diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java new file mode 100644 index 0000000..dd81cfb --- /dev/null +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.devTable.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Created by yxw on 2017/10/30. + */ +@Service +public class PgAlarmManager extends HibernateEntityDao { + + private PgAlarmTypeManager pgAlarmTypeManager; + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + //获取当前报警消息列表 + public List getAllAlarm() { + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList = criteria.list(); + List pgAlarmDtoList = new ArrayList(); + for (PgAlarm pgAlarm : pgAlarmList) { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + + public List getAlarmByTypeAndTime(String alarmType,String startTime,String endTime) + { + try { + Criteria criteria = createCriteria(PgAlarm.class); + if (StringUtils.isNotBlank(alarmType)) { + criteria.add(Restrictions.eq("alarmTypeId", pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType))); + } + + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("alarmDate", DateUtils.sdf_day.parse(startTime))); + } + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("alarmDate", calendar.getTime())); + } + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList=criteria.list(); + List pgAlarmDtoList=new ArrayList(); + for(PgAlarm pgAlarm : pgAlarmList) + { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java new file mode 100644 index 0000000..dd81cfb --- /dev/null +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.devTable.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Created by yxw on 2017/10/30. + */ +@Service +public class PgAlarmManager extends HibernateEntityDao { + + private PgAlarmTypeManager pgAlarmTypeManager; + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + //获取当前报警消息列表 + public List getAllAlarm() { + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList = criteria.list(); + List pgAlarmDtoList = new ArrayList(); + for (PgAlarm pgAlarm : pgAlarmList) { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + + public List getAlarmByTypeAndTime(String alarmType,String startTime,String endTime) + { + try { + Criteria criteria = createCriteria(PgAlarm.class); + if (StringUtils.isNotBlank(alarmType)) { + criteria.add(Restrictions.eq("alarmTypeId", pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType))); + } + + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("alarmDate", DateUtils.sdf_day.parse(startTime))); + } + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("alarmDate", calendar.getTime())); + } + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList=criteria.list(); + List pgAlarmDtoList=new ArrayList(); + for(PgAlarm pgAlarm : pgAlarmList) + { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java new file mode 100644 index 0000000..c7b2961 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -0,0 +1,198 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import com.casic.PgInterface.devTable.manager.PgAlarmManager; +import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.patroler.manager.PgUserManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by yxw on 2017/11/4. + */ +@Component +@Path("pgAlarm") +public class PgAlarmRs { + + private static Logger logger = LoggerFactory.getLogger(PgAlarmRs.class); + + private PgAlarmTypeManager pgAlarmTypeManager; + + private PgAlarmManager pgAlarmManager; + + private PgUserManager pgPatrolerManager; + + private PgDeviceManager pgDeviceManager; + + @Resource + public void setPgAlarmManager(PgAlarmManager pgAlarmManager) { + this.pgAlarmManager = pgAlarmManager; + } + + @Resource + public void setPgPatrolerManager(PgUserManager pgPatrolerManager) { + this.pgPatrolerManager = pgPatrolerManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + /** + * 获取报警信息 + */ + @POST + @Path("getAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmList() throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAllAlarm(); + if (pgAlarmDtoList.size() == 0) + msg = "没有报警信息"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + return resultMap; + } + + /** + * 消除报警信息 + */ + @POST + @Path("clearAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map clearAlarmList(@FormParam("id") String id) throws Exception { + + Map resultMap = new HashMap(); + String msg = ""; + String result = "false"; + + try { + PgAlarm pgAlarm = new PgAlarm(); + pgAlarm = pgAlarmManager.get(Long.valueOf(id)); + if (pgAlarm == null) { + msg = "不存在该报警信息"; + result = "false"; + } else { + pgAlarm.setActive(0); + pgAlarmManager.save(pgAlarm); + msg = "报警信息清除成功"; + result = "true"; + } + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息清除失败"; + result = "false"; + } + resultMap.put("msg", msg); + resultMap.put("result", result); + return resultMap; + } + + /** + * 新增报警 + */ + @POST + @Path("addAlarm") + @Produces(MediaType.APPLICATION_JSON) + public Map addAlarm(@FormParam("alarmType") String alarmType, + @FormParam("alarmValue") String alarmValue, + @FormParam("alarmDate") String alarmDate, + @FormParam("description") String description, + @FormParam("devCode") String devCode, + @FormParam("userName") String userName) throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + PgAlarm pgAlarm = new PgAlarm(); + if (!pgPatrolerManager.userNameIsExits(userName)) { + result = "false"; + msg = "不存在该用户!"; + } else { + pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); + pgAlarm.setAlarmValue(alarmValue); + pgAlarm.setAlarmDate(sdf.parse(alarmDate)); + pgAlarm.setDescription(description); + pgAlarm.setUserId(pgPatrolerManager.getPatrolerByuserName(userName)); + pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode)); + pgAlarm.setActive(1); + + logger.info("成功保存"); + pgAlarmManager.save(pgAlarm); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + /* + * 根据报警类型和时间查询报警记录 + */ + @POST + @Path("getAlarmByTypeOrTime") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmByTypeOrTime(@FormParam("alarmType") String alarmType, + @FormParam("startTime") String startTime, + @FormParam("endTime") String endTime) throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAlarmByTypeAndTime(alarmType, startTime, endTime); + if (pgAlarmDtoList == null || pgAlarmDtoList.size() == 0) + msg = "报警信息不存在"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + + return resultMap; + } + +} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java new file mode 100644 index 0000000..dd81cfb --- /dev/null +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.devTable.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Created by yxw on 2017/10/30. + */ +@Service +public class PgAlarmManager extends HibernateEntityDao { + + private PgAlarmTypeManager pgAlarmTypeManager; + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + //获取当前报警消息列表 + public List getAllAlarm() { + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList = criteria.list(); + List pgAlarmDtoList = new ArrayList(); + for (PgAlarm pgAlarm : pgAlarmList) { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + + public List getAlarmByTypeAndTime(String alarmType,String startTime,String endTime) + { + try { + Criteria criteria = createCriteria(PgAlarm.class); + if (StringUtils.isNotBlank(alarmType)) { + criteria.add(Restrictions.eq("alarmTypeId", pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType))); + } + + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("alarmDate", DateUtils.sdf_day.parse(startTime))); + } + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("alarmDate", calendar.getTime())); + } + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList=criteria.list(); + List pgAlarmDtoList=new ArrayList(); + for(PgAlarm pgAlarm : pgAlarmList) + { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java new file mode 100644 index 0000000..c7b2961 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -0,0 +1,198 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import com.casic.PgInterface.devTable.manager.PgAlarmManager; +import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.patroler.manager.PgUserManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by yxw on 2017/11/4. + */ +@Component +@Path("pgAlarm") +public class PgAlarmRs { + + private static Logger logger = LoggerFactory.getLogger(PgAlarmRs.class); + + private PgAlarmTypeManager pgAlarmTypeManager; + + private PgAlarmManager pgAlarmManager; + + private PgUserManager pgPatrolerManager; + + private PgDeviceManager pgDeviceManager; + + @Resource + public void setPgAlarmManager(PgAlarmManager pgAlarmManager) { + this.pgAlarmManager = pgAlarmManager; + } + + @Resource + public void setPgPatrolerManager(PgUserManager pgPatrolerManager) { + this.pgPatrolerManager = pgPatrolerManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + /** + * 获取报警信息 + */ + @POST + @Path("getAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmList() throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAllAlarm(); + if (pgAlarmDtoList.size() == 0) + msg = "没有报警信息"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + return resultMap; + } + + /** + * 消除报警信息 + */ + @POST + @Path("clearAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map clearAlarmList(@FormParam("id") String id) throws Exception { + + Map resultMap = new HashMap(); + String msg = ""; + String result = "false"; + + try { + PgAlarm pgAlarm = new PgAlarm(); + pgAlarm = pgAlarmManager.get(Long.valueOf(id)); + if (pgAlarm == null) { + msg = "不存在该报警信息"; + result = "false"; + } else { + pgAlarm.setActive(0); + pgAlarmManager.save(pgAlarm); + msg = "报警信息清除成功"; + result = "true"; + } + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息清除失败"; + result = "false"; + } + resultMap.put("msg", msg); + resultMap.put("result", result); + return resultMap; + } + + /** + * 新增报警 + */ + @POST + @Path("addAlarm") + @Produces(MediaType.APPLICATION_JSON) + public Map addAlarm(@FormParam("alarmType") String alarmType, + @FormParam("alarmValue") String alarmValue, + @FormParam("alarmDate") String alarmDate, + @FormParam("description") String description, + @FormParam("devCode") String devCode, + @FormParam("userName") String userName) throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + PgAlarm pgAlarm = new PgAlarm(); + if (!pgPatrolerManager.userNameIsExits(userName)) { + result = "false"; + msg = "不存在该用户!"; + } else { + pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); + pgAlarm.setAlarmValue(alarmValue); + pgAlarm.setAlarmDate(sdf.parse(alarmDate)); + pgAlarm.setDescription(description); + pgAlarm.setUserId(pgPatrolerManager.getPatrolerByuserName(userName)); + pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode)); + pgAlarm.setActive(1); + + logger.info("成功保存"); + pgAlarmManager.save(pgAlarm); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + /* + * 根据报警类型和时间查询报警记录 + */ + @POST + @Path("getAlarmByTypeOrTime") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmByTypeOrTime(@FormParam("alarmType") String alarmType, + @FormParam("startTime") String startTime, + @FormParam("endTime") String endTime) throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAlarmByTypeAndTime(alarmType, startTime, endTime); + if (pgAlarmDtoList == null || pgAlarmDtoList.size() == 0) + msg = "报警信息不存在"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + + return resultMap; + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java deleted file mode 100644 index eb07aee..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ /dev/null @@ -1,439 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.manager.PgConstructionManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import javax.ws.rs.FormParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/27. - */ - -@Component -@Path("pgConstruction") -public class PgConstructionRs { - - private static Logger logger = LoggerFactory.getLogger(PgConstructionRs.class); - - private PgConstructionManager pgConstructionManager; - - @Resource - public void setPgConstructionManager(PgConstructionManager pgConstructionManager) - { - this.pgConstructionManager = pgConstructionManager; - } - - /* - 新建工程 - */ - @POST - @Path("addConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; - - }catch (Exception e){ - result = "false"; - msg = "保存失败"; - e.printStackTrace(); - } - resultMap.put("success",result); - resultMap.put("msg",msg); - return resultMap; - } - - /* - 施工信息编辑 - */ - @POST - @Path("editConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map editConstruction(@FormParam("id")String id, - @FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - try { - if (id.equals("")) - { - result = "false"; - msg = "请输入ID"; - }else { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "编辑成功"; - } - - }catch (Exception e){ - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - - } - - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("delConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map delConstruction(@FormParam("id")String id) - throws Exception{ - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - try { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - if (pgConstruction == null) - { - result = "false"; - msg = "不存在该施工信息"; - }else - { - pgConstruction.setActive(0); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "成功删除信息"; - } - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "删除失败"; - } - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("queryConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map queryConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_type")String cs_type - ) - throws Exception{ - - Map resultMap = new HashMap(); - List pgConstructionDtoList = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String msg = ""; - - try { - pgConstructionDtoList = pgConstructionManager.getConstructByVague(cs_name, cs_position, cs_type, cs_beginTime, cs_endTime); - if (pgConstructionDtoList != null) - { - msg = "获取数据成功"; - }else - { - msg = "没有满足条件的数据"; - } - }catch (Exception e){ - e.printStackTrace(); - } - - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); - return resultMap; - } - - @POST - @Path("constructTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按天在建工程/完工程统计*/ - @POST - @Path("buildingTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按周在建工程/完工程统计*/ - @POST - @Path("buildingTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按月在建工程/完工程统计*/ - @POST - @Path("buildingTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按类型统计*/ - @POST - @Path("constructTjByType") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByType(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按区域统计*/ - @POST - @Path("constructTjByRegion") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByRegion(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByRegion(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } -} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java new file mode 100644 index 0000000..dd81cfb --- /dev/null +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.devTable.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Created by yxw on 2017/10/30. + */ +@Service +public class PgAlarmManager extends HibernateEntityDao { + + private PgAlarmTypeManager pgAlarmTypeManager; + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + //获取当前报警消息列表 + public List getAllAlarm() { + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList = criteria.list(); + List pgAlarmDtoList = new ArrayList(); + for (PgAlarm pgAlarm : pgAlarmList) { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + + public List getAlarmByTypeAndTime(String alarmType,String startTime,String endTime) + { + try { + Criteria criteria = createCriteria(PgAlarm.class); + if (StringUtils.isNotBlank(alarmType)) { + criteria.add(Restrictions.eq("alarmTypeId", pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType))); + } + + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("alarmDate", DateUtils.sdf_day.parse(startTime))); + } + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("alarmDate", calendar.getTime())); + } + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList=criteria.list(); + List pgAlarmDtoList=new ArrayList(); + for(PgAlarm pgAlarm : pgAlarmList) + { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java new file mode 100644 index 0000000..c7b2961 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -0,0 +1,198 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import com.casic.PgInterface.devTable.manager.PgAlarmManager; +import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.patroler.manager.PgUserManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by yxw on 2017/11/4. + */ +@Component +@Path("pgAlarm") +public class PgAlarmRs { + + private static Logger logger = LoggerFactory.getLogger(PgAlarmRs.class); + + private PgAlarmTypeManager pgAlarmTypeManager; + + private PgAlarmManager pgAlarmManager; + + private PgUserManager pgPatrolerManager; + + private PgDeviceManager pgDeviceManager; + + @Resource + public void setPgAlarmManager(PgAlarmManager pgAlarmManager) { + this.pgAlarmManager = pgAlarmManager; + } + + @Resource + public void setPgPatrolerManager(PgUserManager pgPatrolerManager) { + this.pgPatrolerManager = pgPatrolerManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + /** + * 获取报警信息 + */ + @POST + @Path("getAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmList() throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAllAlarm(); + if (pgAlarmDtoList.size() == 0) + msg = "没有报警信息"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + return resultMap; + } + + /** + * 消除报警信息 + */ + @POST + @Path("clearAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map clearAlarmList(@FormParam("id") String id) throws Exception { + + Map resultMap = new HashMap(); + String msg = ""; + String result = "false"; + + try { + PgAlarm pgAlarm = new PgAlarm(); + pgAlarm = pgAlarmManager.get(Long.valueOf(id)); + if (pgAlarm == null) { + msg = "不存在该报警信息"; + result = "false"; + } else { + pgAlarm.setActive(0); + pgAlarmManager.save(pgAlarm); + msg = "报警信息清除成功"; + result = "true"; + } + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息清除失败"; + result = "false"; + } + resultMap.put("msg", msg); + resultMap.put("result", result); + return resultMap; + } + + /** + * 新增报警 + */ + @POST + @Path("addAlarm") + @Produces(MediaType.APPLICATION_JSON) + public Map addAlarm(@FormParam("alarmType") String alarmType, + @FormParam("alarmValue") String alarmValue, + @FormParam("alarmDate") String alarmDate, + @FormParam("description") String description, + @FormParam("devCode") String devCode, + @FormParam("userName") String userName) throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + PgAlarm pgAlarm = new PgAlarm(); + if (!pgPatrolerManager.userNameIsExits(userName)) { + result = "false"; + msg = "不存在该用户!"; + } else { + pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); + pgAlarm.setAlarmValue(alarmValue); + pgAlarm.setAlarmDate(sdf.parse(alarmDate)); + pgAlarm.setDescription(description); + pgAlarm.setUserId(pgPatrolerManager.getPatrolerByuserName(userName)); + pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode)); + pgAlarm.setActive(1); + + logger.info("成功保存"); + pgAlarmManager.save(pgAlarm); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + /* + * 根据报警类型和时间查询报警记录 + */ + @POST + @Path("getAlarmByTypeOrTime") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmByTypeOrTime(@FormParam("alarmType") String alarmType, + @FormParam("startTime") String startTime, + @FormParam("endTime") String endTime) throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAlarmByTypeAndTime(alarmType, startTime, endTime); + if (pgAlarmDtoList == null || pgAlarmDtoList.size() == 0) + msg = "报警信息不存在"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + + return resultMap; + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java deleted file mode 100644 index eb07aee..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ /dev/null @@ -1,439 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.manager.PgConstructionManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import javax.ws.rs.FormParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/27. - */ - -@Component -@Path("pgConstruction") -public class PgConstructionRs { - - private static Logger logger = LoggerFactory.getLogger(PgConstructionRs.class); - - private PgConstructionManager pgConstructionManager; - - @Resource - public void setPgConstructionManager(PgConstructionManager pgConstructionManager) - { - this.pgConstructionManager = pgConstructionManager; - } - - /* - 新建工程 - */ - @POST - @Path("addConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; - - }catch (Exception e){ - result = "false"; - msg = "保存失败"; - e.printStackTrace(); - } - resultMap.put("success",result); - resultMap.put("msg",msg); - return resultMap; - } - - /* - 施工信息编辑 - */ - @POST - @Path("editConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map editConstruction(@FormParam("id")String id, - @FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - try { - if (id.equals("")) - { - result = "false"; - msg = "请输入ID"; - }else { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "编辑成功"; - } - - }catch (Exception e){ - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - - } - - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("delConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map delConstruction(@FormParam("id")String id) - throws Exception{ - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - try { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - if (pgConstruction == null) - { - result = "false"; - msg = "不存在该施工信息"; - }else - { - pgConstruction.setActive(0); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "成功删除信息"; - } - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "删除失败"; - } - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("queryConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map queryConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_type")String cs_type - ) - throws Exception{ - - Map resultMap = new HashMap(); - List pgConstructionDtoList = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String msg = ""; - - try { - pgConstructionDtoList = pgConstructionManager.getConstructByVague(cs_name, cs_position, cs_type, cs_beginTime, cs_endTime); - if (pgConstructionDtoList != null) - { - msg = "获取数据成功"; - }else - { - msg = "没有满足条件的数据"; - } - }catch (Exception e){ - e.printStackTrace(); - } - - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); - return resultMap; - } - - @POST - @Path("constructTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按天在建工程/完工程统计*/ - @POST - @Path("buildingTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按周在建工程/完工程统计*/ - @POST - @Path("buildingTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按月在建工程/完工程统计*/ - @POST - @Path("buildingTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按类型统计*/ - @POST - @Path("constructTjByType") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByType(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按区域统计*/ - @POST - @Path("constructTjByRegion") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByRegion(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByRegion(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java deleted file mode 100644 index b3f303e..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.construction.manager.PgCsDocumentManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -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.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/28. - */ -@Component -@Path("pgCsDocument") -public class PgCsDocumentRs { - - private static Logger logger = LoggerFactory.getLogger(pgStatisticRs.class); - - private PgCsDocumentManager pgCsDocumentManager; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - @Resource - public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { - this.pgCsDocumentManager = pgCsDocumentManager; - } - - /* - 新增&上传 - */ - @POST - @Path("addConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstructDoc( - @FormParam("doc_name") String doc_name, - @FormParam("cs_name") String cs_name, - @FormParam("cs_type") String cs_type, - @FormParam("cs_time") String cs_time, - @FormParam("construct_doc") String fileBuffer)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) - pgCsDocument.setConstruct_doc(""); - else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); - } - - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - - pgCsDocument.setActive(1); - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "保存成功"; - logger.info("保存成功"); - - } catch (Exception ex) { - result = "false"; - msg = "保存失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } - - //编辑施工文档 - @RequestMapping("editConstructDoc") - @ResponseBody - public Map editReservePlan(@FormParam("id") String id, - @RequestParam(value = "doc_name",required = true) String doc_name, - @FormParam("cs_name") String cs_name, - @RequestParam(value = "cs_type",required =false) String cs_type, - @RequestParam(value ="cs_time",required =false) String cs_time) throws Exception { - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - try { - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if (pgCsDocument == null) { - result = "false"; - msg = "不存在该预案信息"; - } else { - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - pgCsDocument.setActive(1); - - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "编辑成功"; - } - } catch (Exception e) { - - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - } - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - //删除预案文档 - @RequestMapping("delConstructDoc") - @ResponseBody - public Map deleteReservePlan(@FormParam("id") String id)throws Exception{ - Map resultMap = new HashMap(); - String msg=""; - String result=""; - - try{ - - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if(pgCsDocument==null) - { - result="false"; - msg="不存在该预案信息"; - } - else{ - pgCsDocument.setActive(0); - pgCsDocumentManager.save(pgCsDocument); - result="true"; - msg="删除成功"; - } - } - catch(Exception e) - { - e.printStackTrace(); - msg="预案删除失败"; - result="false"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - - } - - /* - 按工程名称、工程类别、施工时间查询 - */ - @RequestMapping("queryConstructDoc") - @ResponseBody - public Map queryConstructDoc(@FormParam("cs_name")String cs_name, - @FormParam("cs_type")String cs_type, - @FormParam("cs_time")String cs_time) - throws Exception{ - - Map resultMap = new HashMap(); - List pgCsDocumentDtoList = new ArrayList(); - - String msg=""; - String result=""; - - try { - pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); - if (pgCsDocumentDtoList != null) - { - result = "true"; - msg = "获取数据成功"; - }else - { - result = "false"; - msg = "没有满足条件的数据"; - } - - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "获取失败"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - @POST - @Path("downLoadConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map downLoadConstructDoc( - @FormParam("cs_type")String cs_type, - @FormParam("doc_name") String doc_name)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (doc_name != null) { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type)); - - result = "true"; - msg = "下载成功"; - logger.info("下载成功"); - } - else - { - result = "false"; - msg = "文件名不能为空"; - logger.info("文件名不能为空"); - } - - } catch (Exception ex) { - result = "false"; - msg = "下载失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } -} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java new file mode 100644 index 0000000..dd81cfb --- /dev/null +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.devTable.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Created by yxw on 2017/10/30. + */ +@Service +public class PgAlarmManager extends HibernateEntityDao { + + private PgAlarmTypeManager pgAlarmTypeManager; + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + //获取当前报警消息列表 + public List getAllAlarm() { + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList = criteria.list(); + List pgAlarmDtoList = new ArrayList(); + for (PgAlarm pgAlarm : pgAlarmList) { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + + public List getAlarmByTypeAndTime(String alarmType,String startTime,String endTime) + { + try { + Criteria criteria = createCriteria(PgAlarm.class); + if (StringUtils.isNotBlank(alarmType)) { + criteria.add(Restrictions.eq("alarmTypeId", pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType))); + } + + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("alarmDate", DateUtils.sdf_day.parse(startTime))); + } + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("alarmDate", calendar.getTime())); + } + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList=criteria.list(); + List pgAlarmDtoList=new ArrayList(); + for(PgAlarm pgAlarm : pgAlarmList) + { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java new file mode 100644 index 0000000..c7b2961 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -0,0 +1,198 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import com.casic.PgInterface.devTable.manager.PgAlarmManager; +import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.patroler.manager.PgUserManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by yxw on 2017/11/4. + */ +@Component +@Path("pgAlarm") +public class PgAlarmRs { + + private static Logger logger = LoggerFactory.getLogger(PgAlarmRs.class); + + private PgAlarmTypeManager pgAlarmTypeManager; + + private PgAlarmManager pgAlarmManager; + + private PgUserManager pgPatrolerManager; + + private PgDeviceManager pgDeviceManager; + + @Resource + public void setPgAlarmManager(PgAlarmManager pgAlarmManager) { + this.pgAlarmManager = pgAlarmManager; + } + + @Resource + public void setPgPatrolerManager(PgUserManager pgPatrolerManager) { + this.pgPatrolerManager = pgPatrolerManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + /** + * 获取报警信息 + */ + @POST + @Path("getAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmList() throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAllAlarm(); + if (pgAlarmDtoList.size() == 0) + msg = "没有报警信息"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + return resultMap; + } + + /** + * 消除报警信息 + */ + @POST + @Path("clearAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map clearAlarmList(@FormParam("id") String id) throws Exception { + + Map resultMap = new HashMap(); + String msg = ""; + String result = "false"; + + try { + PgAlarm pgAlarm = new PgAlarm(); + pgAlarm = pgAlarmManager.get(Long.valueOf(id)); + if (pgAlarm == null) { + msg = "不存在该报警信息"; + result = "false"; + } else { + pgAlarm.setActive(0); + pgAlarmManager.save(pgAlarm); + msg = "报警信息清除成功"; + result = "true"; + } + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息清除失败"; + result = "false"; + } + resultMap.put("msg", msg); + resultMap.put("result", result); + return resultMap; + } + + /** + * 新增报警 + */ + @POST + @Path("addAlarm") + @Produces(MediaType.APPLICATION_JSON) + public Map addAlarm(@FormParam("alarmType") String alarmType, + @FormParam("alarmValue") String alarmValue, + @FormParam("alarmDate") String alarmDate, + @FormParam("description") String description, + @FormParam("devCode") String devCode, + @FormParam("userName") String userName) throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + PgAlarm pgAlarm = new PgAlarm(); + if (!pgPatrolerManager.userNameIsExits(userName)) { + result = "false"; + msg = "不存在该用户!"; + } else { + pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); + pgAlarm.setAlarmValue(alarmValue); + pgAlarm.setAlarmDate(sdf.parse(alarmDate)); + pgAlarm.setDescription(description); + pgAlarm.setUserId(pgPatrolerManager.getPatrolerByuserName(userName)); + pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode)); + pgAlarm.setActive(1); + + logger.info("成功保存"); + pgAlarmManager.save(pgAlarm); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + /* + * 根据报警类型和时间查询报警记录 + */ + @POST + @Path("getAlarmByTypeOrTime") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmByTypeOrTime(@FormParam("alarmType") String alarmType, + @FormParam("startTime") String startTime, + @FormParam("endTime") String endTime) throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAlarmByTypeAndTime(alarmType, startTime, endTime); + if (pgAlarmDtoList == null || pgAlarmDtoList.size() == 0) + msg = "报警信息不存在"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + + return resultMap; + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java deleted file mode 100644 index eb07aee..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ /dev/null @@ -1,439 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.manager.PgConstructionManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import javax.ws.rs.FormParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/27. - */ - -@Component -@Path("pgConstruction") -public class PgConstructionRs { - - private static Logger logger = LoggerFactory.getLogger(PgConstructionRs.class); - - private PgConstructionManager pgConstructionManager; - - @Resource - public void setPgConstructionManager(PgConstructionManager pgConstructionManager) - { - this.pgConstructionManager = pgConstructionManager; - } - - /* - 新建工程 - */ - @POST - @Path("addConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; - - }catch (Exception e){ - result = "false"; - msg = "保存失败"; - e.printStackTrace(); - } - resultMap.put("success",result); - resultMap.put("msg",msg); - return resultMap; - } - - /* - 施工信息编辑 - */ - @POST - @Path("editConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map editConstruction(@FormParam("id")String id, - @FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - try { - if (id.equals("")) - { - result = "false"; - msg = "请输入ID"; - }else { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "编辑成功"; - } - - }catch (Exception e){ - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - - } - - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("delConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map delConstruction(@FormParam("id")String id) - throws Exception{ - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - try { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - if (pgConstruction == null) - { - result = "false"; - msg = "不存在该施工信息"; - }else - { - pgConstruction.setActive(0); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "成功删除信息"; - } - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "删除失败"; - } - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("queryConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map queryConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_type")String cs_type - ) - throws Exception{ - - Map resultMap = new HashMap(); - List pgConstructionDtoList = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String msg = ""; - - try { - pgConstructionDtoList = pgConstructionManager.getConstructByVague(cs_name, cs_position, cs_type, cs_beginTime, cs_endTime); - if (pgConstructionDtoList != null) - { - msg = "获取数据成功"; - }else - { - msg = "没有满足条件的数据"; - } - }catch (Exception e){ - e.printStackTrace(); - } - - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); - return resultMap; - } - - @POST - @Path("constructTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按天在建工程/完工程统计*/ - @POST - @Path("buildingTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按周在建工程/完工程统计*/ - @POST - @Path("buildingTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按月在建工程/完工程统计*/ - @POST - @Path("buildingTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按类型统计*/ - @POST - @Path("constructTjByType") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByType(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按区域统计*/ - @POST - @Path("constructTjByRegion") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByRegion(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByRegion(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java deleted file mode 100644 index b3f303e..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.construction.manager.PgCsDocumentManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -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.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/28. - */ -@Component -@Path("pgCsDocument") -public class PgCsDocumentRs { - - private static Logger logger = LoggerFactory.getLogger(pgStatisticRs.class); - - private PgCsDocumentManager pgCsDocumentManager; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - @Resource - public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { - this.pgCsDocumentManager = pgCsDocumentManager; - } - - /* - 新增&上传 - */ - @POST - @Path("addConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstructDoc( - @FormParam("doc_name") String doc_name, - @FormParam("cs_name") String cs_name, - @FormParam("cs_type") String cs_type, - @FormParam("cs_time") String cs_time, - @FormParam("construct_doc") String fileBuffer)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) - pgCsDocument.setConstruct_doc(""); - else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); - } - - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - - pgCsDocument.setActive(1); - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "保存成功"; - logger.info("保存成功"); - - } catch (Exception ex) { - result = "false"; - msg = "保存失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } - - //编辑施工文档 - @RequestMapping("editConstructDoc") - @ResponseBody - public Map editReservePlan(@FormParam("id") String id, - @RequestParam(value = "doc_name",required = true) String doc_name, - @FormParam("cs_name") String cs_name, - @RequestParam(value = "cs_type",required =false) String cs_type, - @RequestParam(value ="cs_time",required =false) String cs_time) throws Exception { - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - try { - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if (pgCsDocument == null) { - result = "false"; - msg = "不存在该预案信息"; - } else { - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - pgCsDocument.setActive(1); - - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "编辑成功"; - } - } catch (Exception e) { - - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - } - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - //删除预案文档 - @RequestMapping("delConstructDoc") - @ResponseBody - public Map deleteReservePlan(@FormParam("id") String id)throws Exception{ - Map resultMap = new HashMap(); - String msg=""; - String result=""; - - try{ - - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if(pgCsDocument==null) - { - result="false"; - msg="不存在该预案信息"; - } - else{ - pgCsDocument.setActive(0); - pgCsDocumentManager.save(pgCsDocument); - result="true"; - msg="删除成功"; - } - } - catch(Exception e) - { - e.printStackTrace(); - msg="预案删除失败"; - result="false"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - - } - - /* - 按工程名称、工程类别、施工时间查询 - */ - @RequestMapping("queryConstructDoc") - @ResponseBody - public Map queryConstructDoc(@FormParam("cs_name")String cs_name, - @FormParam("cs_type")String cs_type, - @FormParam("cs_time")String cs_time) - throws Exception{ - - Map resultMap = new HashMap(); - List pgCsDocumentDtoList = new ArrayList(); - - String msg=""; - String result=""; - - try { - pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); - if (pgCsDocumentDtoList != null) - { - result = "true"; - msg = "获取数据成功"; - }else - { - result = "false"; - msg = "没有满足条件的数据"; - } - - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "获取失败"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - @POST - @Path("downLoadConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map downLoadConstructDoc( - @FormParam("cs_type")String cs_type, - @FormParam("doc_name") String doc_name)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (doc_name != null) { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type)); - - result = "true"; - msg = "下载成功"; - logger.info("下载成功"); - } - else - { - result = "false"; - msg = "文件名不能为空"; - logger.info("文件名不能为空"); - } - - } catch (Exception ex) { - result = "false"; - msg = "下载失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java index 42914cf..f67760b 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java @@ -206,7 +206,7 @@ /** * 根据时间统计入廊人员次数 */ -/* + /* @POST @Path("getInPgPersonByTime") @Produces(MediaType.APPLICATION_JSON) @@ -230,5 +230,5 @@ resultMap.put("result", pgInPgPersonDtoList); return resultMap; } -*/ + */ } diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java new file mode 100644 index 0000000..dd81cfb --- /dev/null +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.devTable.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Created by yxw on 2017/10/30. + */ +@Service +public class PgAlarmManager extends HibernateEntityDao { + + private PgAlarmTypeManager pgAlarmTypeManager; + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + //获取当前报警消息列表 + public List getAllAlarm() { + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList = criteria.list(); + List pgAlarmDtoList = new ArrayList(); + for (PgAlarm pgAlarm : pgAlarmList) { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + + public List getAlarmByTypeAndTime(String alarmType,String startTime,String endTime) + { + try { + Criteria criteria = createCriteria(PgAlarm.class); + if (StringUtils.isNotBlank(alarmType)) { + criteria.add(Restrictions.eq("alarmTypeId", pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType))); + } + + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("alarmDate", DateUtils.sdf_day.parse(startTime))); + } + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("alarmDate", calendar.getTime())); + } + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList=criteria.list(); + List pgAlarmDtoList=new ArrayList(); + for(PgAlarm pgAlarm : pgAlarmList) + { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java new file mode 100644 index 0000000..c7b2961 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -0,0 +1,198 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import com.casic.PgInterface.devTable.manager.PgAlarmManager; +import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.patroler.manager.PgUserManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by yxw on 2017/11/4. + */ +@Component +@Path("pgAlarm") +public class PgAlarmRs { + + private static Logger logger = LoggerFactory.getLogger(PgAlarmRs.class); + + private PgAlarmTypeManager pgAlarmTypeManager; + + private PgAlarmManager pgAlarmManager; + + private PgUserManager pgPatrolerManager; + + private PgDeviceManager pgDeviceManager; + + @Resource + public void setPgAlarmManager(PgAlarmManager pgAlarmManager) { + this.pgAlarmManager = pgAlarmManager; + } + + @Resource + public void setPgPatrolerManager(PgUserManager pgPatrolerManager) { + this.pgPatrolerManager = pgPatrolerManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + /** + * 获取报警信息 + */ + @POST + @Path("getAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmList() throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAllAlarm(); + if (pgAlarmDtoList.size() == 0) + msg = "没有报警信息"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + return resultMap; + } + + /** + * 消除报警信息 + */ + @POST + @Path("clearAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map clearAlarmList(@FormParam("id") String id) throws Exception { + + Map resultMap = new HashMap(); + String msg = ""; + String result = "false"; + + try { + PgAlarm pgAlarm = new PgAlarm(); + pgAlarm = pgAlarmManager.get(Long.valueOf(id)); + if (pgAlarm == null) { + msg = "不存在该报警信息"; + result = "false"; + } else { + pgAlarm.setActive(0); + pgAlarmManager.save(pgAlarm); + msg = "报警信息清除成功"; + result = "true"; + } + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息清除失败"; + result = "false"; + } + resultMap.put("msg", msg); + resultMap.put("result", result); + return resultMap; + } + + /** + * 新增报警 + */ + @POST + @Path("addAlarm") + @Produces(MediaType.APPLICATION_JSON) + public Map addAlarm(@FormParam("alarmType") String alarmType, + @FormParam("alarmValue") String alarmValue, + @FormParam("alarmDate") String alarmDate, + @FormParam("description") String description, + @FormParam("devCode") String devCode, + @FormParam("userName") String userName) throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + PgAlarm pgAlarm = new PgAlarm(); + if (!pgPatrolerManager.userNameIsExits(userName)) { + result = "false"; + msg = "不存在该用户!"; + } else { + pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); + pgAlarm.setAlarmValue(alarmValue); + pgAlarm.setAlarmDate(sdf.parse(alarmDate)); + pgAlarm.setDescription(description); + pgAlarm.setUserId(pgPatrolerManager.getPatrolerByuserName(userName)); + pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode)); + pgAlarm.setActive(1); + + logger.info("成功保存"); + pgAlarmManager.save(pgAlarm); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + /* + * 根据报警类型和时间查询报警记录 + */ + @POST + @Path("getAlarmByTypeOrTime") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmByTypeOrTime(@FormParam("alarmType") String alarmType, + @FormParam("startTime") String startTime, + @FormParam("endTime") String endTime) throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAlarmByTypeAndTime(alarmType, startTime, endTime); + if (pgAlarmDtoList == null || pgAlarmDtoList.size() == 0) + msg = "报警信息不存在"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + + return resultMap; + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java deleted file mode 100644 index eb07aee..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ /dev/null @@ -1,439 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.manager.PgConstructionManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import javax.ws.rs.FormParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/27. - */ - -@Component -@Path("pgConstruction") -public class PgConstructionRs { - - private static Logger logger = LoggerFactory.getLogger(PgConstructionRs.class); - - private PgConstructionManager pgConstructionManager; - - @Resource - public void setPgConstructionManager(PgConstructionManager pgConstructionManager) - { - this.pgConstructionManager = pgConstructionManager; - } - - /* - 新建工程 - */ - @POST - @Path("addConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; - - }catch (Exception e){ - result = "false"; - msg = "保存失败"; - e.printStackTrace(); - } - resultMap.put("success",result); - resultMap.put("msg",msg); - return resultMap; - } - - /* - 施工信息编辑 - */ - @POST - @Path("editConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map editConstruction(@FormParam("id")String id, - @FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - try { - if (id.equals("")) - { - result = "false"; - msg = "请输入ID"; - }else { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "编辑成功"; - } - - }catch (Exception e){ - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - - } - - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("delConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map delConstruction(@FormParam("id")String id) - throws Exception{ - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - try { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - if (pgConstruction == null) - { - result = "false"; - msg = "不存在该施工信息"; - }else - { - pgConstruction.setActive(0); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "成功删除信息"; - } - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "删除失败"; - } - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("queryConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map queryConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_type")String cs_type - ) - throws Exception{ - - Map resultMap = new HashMap(); - List pgConstructionDtoList = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String msg = ""; - - try { - pgConstructionDtoList = pgConstructionManager.getConstructByVague(cs_name, cs_position, cs_type, cs_beginTime, cs_endTime); - if (pgConstructionDtoList != null) - { - msg = "获取数据成功"; - }else - { - msg = "没有满足条件的数据"; - } - }catch (Exception e){ - e.printStackTrace(); - } - - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); - return resultMap; - } - - @POST - @Path("constructTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按天在建工程/完工程统计*/ - @POST - @Path("buildingTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按周在建工程/完工程统计*/ - @POST - @Path("buildingTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按月在建工程/完工程统计*/ - @POST - @Path("buildingTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按类型统计*/ - @POST - @Path("constructTjByType") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByType(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按区域统计*/ - @POST - @Path("constructTjByRegion") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByRegion(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByRegion(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java deleted file mode 100644 index b3f303e..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.construction.manager.PgCsDocumentManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -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.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/28. - */ -@Component -@Path("pgCsDocument") -public class PgCsDocumentRs { - - private static Logger logger = LoggerFactory.getLogger(pgStatisticRs.class); - - private PgCsDocumentManager pgCsDocumentManager; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - @Resource - public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { - this.pgCsDocumentManager = pgCsDocumentManager; - } - - /* - 新增&上传 - */ - @POST - @Path("addConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstructDoc( - @FormParam("doc_name") String doc_name, - @FormParam("cs_name") String cs_name, - @FormParam("cs_type") String cs_type, - @FormParam("cs_time") String cs_time, - @FormParam("construct_doc") String fileBuffer)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) - pgCsDocument.setConstruct_doc(""); - else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); - } - - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - - pgCsDocument.setActive(1); - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "保存成功"; - logger.info("保存成功"); - - } catch (Exception ex) { - result = "false"; - msg = "保存失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } - - //编辑施工文档 - @RequestMapping("editConstructDoc") - @ResponseBody - public Map editReservePlan(@FormParam("id") String id, - @RequestParam(value = "doc_name",required = true) String doc_name, - @FormParam("cs_name") String cs_name, - @RequestParam(value = "cs_type",required =false) String cs_type, - @RequestParam(value ="cs_time",required =false) String cs_time) throws Exception { - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - try { - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if (pgCsDocument == null) { - result = "false"; - msg = "不存在该预案信息"; - } else { - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - pgCsDocument.setActive(1); - - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "编辑成功"; - } - } catch (Exception e) { - - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - } - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - //删除预案文档 - @RequestMapping("delConstructDoc") - @ResponseBody - public Map deleteReservePlan(@FormParam("id") String id)throws Exception{ - Map resultMap = new HashMap(); - String msg=""; - String result=""; - - try{ - - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if(pgCsDocument==null) - { - result="false"; - msg="不存在该预案信息"; - } - else{ - pgCsDocument.setActive(0); - pgCsDocumentManager.save(pgCsDocument); - result="true"; - msg="删除成功"; - } - } - catch(Exception e) - { - e.printStackTrace(); - msg="预案删除失败"; - result="false"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - - } - - /* - 按工程名称、工程类别、施工时间查询 - */ - @RequestMapping("queryConstructDoc") - @ResponseBody - public Map queryConstructDoc(@FormParam("cs_name")String cs_name, - @FormParam("cs_type")String cs_type, - @FormParam("cs_time")String cs_time) - throws Exception{ - - Map resultMap = new HashMap(); - List pgCsDocumentDtoList = new ArrayList(); - - String msg=""; - String result=""; - - try { - pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); - if (pgCsDocumentDtoList != null) - { - result = "true"; - msg = "获取数据成功"; - }else - { - result = "false"; - msg = "没有满足条件的数据"; - } - - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "获取失败"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - @POST - @Path("downLoadConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map downLoadConstructDoc( - @FormParam("cs_type")String cs_type, - @FormParam("doc_name") String doc_name)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (doc_name != null) { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type)); - - result = "true"; - msg = "下载成功"; - logger.info("下载成功"); - } - else - { - result = "false"; - msg = "文件名不能为空"; - logger.info("文件名不能为空"); - } - - } catch (Exception ex) { - result = "false"; - msg = "下载失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java index 42914cf..f67760b 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java @@ -206,7 +206,7 @@ /** * 根据时间统计入廊人员次数 */ -/* + /* @POST @Path("getInPgPersonByTime") @Produces(MediaType.APPLICATION_JSON) @@ -230,5 +230,5 @@ resultMap.put("result", pgInPgPersonDtoList); return resultMap; } -*/ + */ } diff --git a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java index 1a9138a..27b1482 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java +++ b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java @@ -115,12 +115,11 @@ pgReservePlan.setResUnit(resUnit); pgReservePlan.setPgAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); pgReservePlan.setActive(1); - pgReservePlanManager.save(pgReservePlan); result = "true"; msg = "保存成功"; logger.info("保存成功"); - +// pgReservePlanManager.save(pgReservePlan); } catch (Exception ex) { result = "false"; msg = "保存失败"; diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java new file mode 100644 index 0000000..dd81cfb --- /dev/null +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.devTable.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Created by yxw on 2017/10/30. + */ +@Service +public class PgAlarmManager extends HibernateEntityDao { + + private PgAlarmTypeManager pgAlarmTypeManager; + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + //获取当前报警消息列表 + public List getAllAlarm() { + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList = criteria.list(); + List pgAlarmDtoList = new ArrayList(); + for (PgAlarm pgAlarm : pgAlarmList) { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + + public List getAlarmByTypeAndTime(String alarmType,String startTime,String endTime) + { + try { + Criteria criteria = createCriteria(PgAlarm.class); + if (StringUtils.isNotBlank(alarmType)) { + criteria.add(Restrictions.eq("alarmTypeId", pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType))); + } + + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("alarmDate", DateUtils.sdf_day.parse(startTime))); + } + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("alarmDate", calendar.getTime())); + } + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList=criteria.list(); + List pgAlarmDtoList=new ArrayList(); + for(PgAlarm pgAlarm : pgAlarmList) + { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java new file mode 100644 index 0000000..c7b2961 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -0,0 +1,198 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import com.casic.PgInterface.devTable.manager.PgAlarmManager; +import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.patroler.manager.PgUserManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by yxw on 2017/11/4. + */ +@Component +@Path("pgAlarm") +public class PgAlarmRs { + + private static Logger logger = LoggerFactory.getLogger(PgAlarmRs.class); + + private PgAlarmTypeManager pgAlarmTypeManager; + + private PgAlarmManager pgAlarmManager; + + private PgUserManager pgPatrolerManager; + + private PgDeviceManager pgDeviceManager; + + @Resource + public void setPgAlarmManager(PgAlarmManager pgAlarmManager) { + this.pgAlarmManager = pgAlarmManager; + } + + @Resource + public void setPgPatrolerManager(PgUserManager pgPatrolerManager) { + this.pgPatrolerManager = pgPatrolerManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + /** + * 获取报警信息 + */ + @POST + @Path("getAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmList() throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAllAlarm(); + if (pgAlarmDtoList.size() == 0) + msg = "没有报警信息"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + return resultMap; + } + + /** + * 消除报警信息 + */ + @POST + @Path("clearAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map clearAlarmList(@FormParam("id") String id) throws Exception { + + Map resultMap = new HashMap(); + String msg = ""; + String result = "false"; + + try { + PgAlarm pgAlarm = new PgAlarm(); + pgAlarm = pgAlarmManager.get(Long.valueOf(id)); + if (pgAlarm == null) { + msg = "不存在该报警信息"; + result = "false"; + } else { + pgAlarm.setActive(0); + pgAlarmManager.save(pgAlarm); + msg = "报警信息清除成功"; + result = "true"; + } + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息清除失败"; + result = "false"; + } + resultMap.put("msg", msg); + resultMap.put("result", result); + return resultMap; + } + + /** + * 新增报警 + */ + @POST + @Path("addAlarm") + @Produces(MediaType.APPLICATION_JSON) + public Map addAlarm(@FormParam("alarmType") String alarmType, + @FormParam("alarmValue") String alarmValue, + @FormParam("alarmDate") String alarmDate, + @FormParam("description") String description, + @FormParam("devCode") String devCode, + @FormParam("userName") String userName) throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + PgAlarm pgAlarm = new PgAlarm(); + if (!pgPatrolerManager.userNameIsExits(userName)) { + result = "false"; + msg = "不存在该用户!"; + } else { + pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); + pgAlarm.setAlarmValue(alarmValue); + pgAlarm.setAlarmDate(sdf.parse(alarmDate)); + pgAlarm.setDescription(description); + pgAlarm.setUserId(pgPatrolerManager.getPatrolerByuserName(userName)); + pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode)); + pgAlarm.setActive(1); + + logger.info("成功保存"); + pgAlarmManager.save(pgAlarm); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + /* + * 根据报警类型和时间查询报警记录 + */ + @POST + @Path("getAlarmByTypeOrTime") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmByTypeOrTime(@FormParam("alarmType") String alarmType, + @FormParam("startTime") String startTime, + @FormParam("endTime") String endTime) throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAlarmByTypeAndTime(alarmType, startTime, endTime); + if (pgAlarmDtoList == null || pgAlarmDtoList.size() == 0) + msg = "报警信息不存在"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + + return resultMap; + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java deleted file mode 100644 index eb07aee..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ /dev/null @@ -1,439 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.manager.PgConstructionManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import javax.ws.rs.FormParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/27. - */ - -@Component -@Path("pgConstruction") -public class PgConstructionRs { - - private static Logger logger = LoggerFactory.getLogger(PgConstructionRs.class); - - private PgConstructionManager pgConstructionManager; - - @Resource - public void setPgConstructionManager(PgConstructionManager pgConstructionManager) - { - this.pgConstructionManager = pgConstructionManager; - } - - /* - 新建工程 - */ - @POST - @Path("addConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; - - }catch (Exception e){ - result = "false"; - msg = "保存失败"; - e.printStackTrace(); - } - resultMap.put("success",result); - resultMap.put("msg",msg); - return resultMap; - } - - /* - 施工信息编辑 - */ - @POST - @Path("editConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map editConstruction(@FormParam("id")String id, - @FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - try { - if (id.equals("")) - { - result = "false"; - msg = "请输入ID"; - }else { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "编辑成功"; - } - - }catch (Exception e){ - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - - } - - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("delConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map delConstruction(@FormParam("id")String id) - throws Exception{ - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - try { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - if (pgConstruction == null) - { - result = "false"; - msg = "不存在该施工信息"; - }else - { - pgConstruction.setActive(0); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "成功删除信息"; - } - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "删除失败"; - } - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("queryConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map queryConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_type")String cs_type - ) - throws Exception{ - - Map resultMap = new HashMap(); - List pgConstructionDtoList = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String msg = ""; - - try { - pgConstructionDtoList = pgConstructionManager.getConstructByVague(cs_name, cs_position, cs_type, cs_beginTime, cs_endTime); - if (pgConstructionDtoList != null) - { - msg = "获取数据成功"; - }else - { - msg = "没有满足条件的数据"; - } - }catch (Exception e){ - e.printStackTrace(); - } - - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); - return resultMap; - } - - @POST - @Path("constructTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按天在建工程/完工程统计*/ - @POST - @Path("buildingTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按周在建工程/完工程统计*/ - @POST - @Path("buildingTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按月在建工程/完工程统计*/ - @POST - @Path("buildingTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按类型统计*/ - @POST - @Path("constructTjByType") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByType(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按区域统计*/ - @POST - @Path("constructTjByRegion") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByRegion(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByRegion(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java deleted file mode 100644 index b3f303e..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.construction.manager.PgCsDocumentManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -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.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/28. - */ -@Component -@Path("pgCsDocument") -public class PgCsDocumentRs { - - private static Logger logger = LoggerFactory.getLogger(pgStatisticRs.class); - - private PgCsDocumentManager pgCsDocumentManager; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - @Resource - public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { - this.pgCsDocumentManager = pgCsDocumentManager; - } - - /* - 新增&上传 - */ - @POST - @Path("addConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstructDoc( - @FormParam("doc_name") String doc_name, - @FormParam("cs_name") String cs_name, - @FormParam("cs_type") String cs_type, - @FormParam("cs_time") String cs_time, - @FormParam("construct_doc") String fileBuffer)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) - pgCsDocument.setConstruct_doc(""); - else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); - } - - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - - pgCsDocument.setActive(1); - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "保存成功"; - logger.info("保存成功"); - - } catch (Exception ex) { - result = "false"; - msg = "保存失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } - - //编辑施工文档 - @RequestMapping("editConstructDoc") - @ResponseBody - public Map editReservePlan(@FormParam("id") String id, - @RequestParam(value = "doc_name",required = true) String doc_name, - @FormParam("cs_name") String cs_name, - @RequestParam(value = "cs_type",required =false) String cs_type, - @RequestParam(value ="cs_time",required =false) String cs_time) throws Exception { - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - try { - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if (pgCsDocument == null) { - result = "false"; - msg = "不存在该预案信息"; - } else { - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - pgCsDocument.setActive(1); - - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "编辑成功"; - } - } catch (Exception e) { - - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - } - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - //删除预案文档 - @RequestMapping("delConstructDoc") - @ResponseBody - public Map deleteReservePlan(@FormParam("id") String id)throws Exception{ - Map resultMap = new HashMap(); - String msg=""; - String result=""; - - try{ - - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if(pgCsDocument==null) - { - result="false"; - msg="不存在该预案信息"; - } - else{ - pgCsDocument.setActive(0); - pgCsDocumentManager.save(pgCsDocument); - result="true"; - msg="删除成功"; - } - } - catch(Exception e) - { - e.printStackTrace(); - msg="预案删除失败"; - result="false"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - - } - - /* - 按工程名称、工程类别、施工时间查询 - */ - @RequestMapping("queryConstructDoc") - @ResponseBody - public Map queryConstructDoc(@FormParam("cs_name")String cs_name, - @FormParam("cs_type")String cs_type, - @FormParam("cs_time")String cs_time) - throws Exception{ - - Map resultMap = new HashMap(); - List pgCsDocumentDtoList = new ArrayList(); - - String msg=""; - String result=""; - - try { - pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); - if (pgCsDocumentDtoList != null) - { - result = "true"; - msg = "获取数据成功"; - }else - { - result = "false"; - msg = "没有满足条件的数据"; - } - - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "获取失败"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - @POST - @Path("downLoadConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map downLoadConstructDoc( - @FormParam("cs_type")String cs_type, - @FormParam("doc_name") String doc_name)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (doc_name != null) { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type)); - - result = "true"; - msg = "下载成功"; - logger.info("下载成功"); - } - else - { - result = "false"; - msg = "文件名不能为空"; - logger.info("文件名不能为空"); - } - - } catch (Exception ex) { - result = "false"; - msg = "下载失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java index 42914cf..f67760b 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java @@ -206,7 +206,7 @@ /** * 根据时间统计入廊人员次数 */ -/* + /* @POST @Path("getInPgPersonByTime") @Produces(MediaType.APPLICATION_JSON) @@ -230,5 +230,5 @@ resultMap.put("result", pgInPgPersonDtoList); return resultMap; } -*/ + */ } diff --git a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java index 1a9138a..27b1482 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java +++ b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java @@ -115,12 +115,11 @@ pgReservePlan.setResUnit(resUnit); pgReservePlan.setPgAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); pgReservePlan.setActive(1); - pgReservePlanManager.save(pgReservePlan); result = "true"; msg = "保存成功"; logger.info("保存成功"); - +// pgReservePlanManager.save(pgReservePlan); } catch (Exception ex) { result = "false"; msg = "保存失败"; diff --git a/src/main/java/com/casic/PgInterface/rs/test.java b/src/main/java/com/casic/PgInterface/rs/test.java deleted file mode 100644 index 1bb1ae8..0000000 --- a/src/main/java/com/casic/PgInterface/rs/test.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.casic.PgInterface.rs; - -import java.net.HttpURLConnection; -import java.net.URL; -import java.io.BufferedOutputStream; -import java.io.BufferedInputStream; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.File; - -/** - * Created by Administrator on 2018/4/2. - */ -public class test { - public static File saveUrlAs(String url, String filePath, String method) { - //System.out.println("fileName---->"+filePath); - //创建不同的文件夹目录 - File file = new File(filePath); - //判断文件夹是否存在 - if (!file.exists()) { - //如果文件夹不存在,则创建新的的文件夹 - file.mkdirs(); - } - FileOutputStream fileOut = null; - HttpURLConnection conn = null; - InputStream inputStream = null; - try{ - // 建立链接 - URL httpUrl = new URL(url); - conn = (HttpURLConnection) httpUrl.openConnection(); - //以Post方式提交表单,默认get方式 - conn.setRequestMethod(method); - conn.setDoInput(true); - conn.setDoOutput(true); - // post方式不能使用缓存 - conn.setUseCaches(false); - //连接指定的资源 - conn.connect(); - //获取网络输入流 - inputStream = conn.getInputStream(); - BufferedInputStream bis = new BufferedInputStream(inputStream); - //判断文件的保存路径后面是否以/结尾 - if (!filePath.endsWith("/")) { - - filePath += "/"; - - - } - //写入到文件(注意文件保存路径的后面一定要加上文件的名称) - fileOut = new FileOutputStream(filePath + "123.png"); - BufferedOutputStream bos = new BufferedOutputStream(fileOut); - - byte[] buf = new byte[4096]; - int length = bis.read(buf); - //保存文件 - while (length != -1) { - bos.write(buf, 0, length); - length = bis.read(buf); - - } - bos.close(); - bis.close(); - conn.disconnect(); - - } - - catch( - Exception e - ) - - { - e.printStackTrace(); - System.out.println("抛出异常!!"); - - } - - return file; - -} - -} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java new file mode 100644 index 0000000..dd81cfb --- /dev/null +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.devTable.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Created by yxw on 2017/10/30. + */ +@Service +public class PgAlarmManager extends HibernateEntityDao { + + private PgAlarmTypeManager pgAlarmTypeManager; + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + //获取当前报警消息列表 + public List getAllAlarm() { + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList = criteria.list(); + List pgAlarmDtoList = new ArrayList(); + for (PgAlarm pgAlarm : pgAlarmList) { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + + public List getAlarmByTypeAndTime(String alarmType,String startTime,String endTime) + { + try { + Criteria criteria = createCriteria(PgAlarm.class); + if (StringUtils.isNotBlank(alarmType)) { + criteria.add(Restrictions.eq("alarmTypeId", pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType))); + } + + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("alarmDate", DateUtils.sdf_day.parse(startTime))); + } + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("alarmDate", calendar.getTime())); + } + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList=criteria.list(); + List pgAlarmDtoList=new ArrayList(); + for(PgAlarm pgAlarm : pgAlarmList) + { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java new file mode 100644 index 0000000..c7b2961 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -0,0 +1,198 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import com.casic.PgInterface.devTable.manager.PgAlarmManager; +import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.patroler.manager.PgUserManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by yxw on 2017/11/4. + */ +@Component +@Path("pgAlarm") +public class PgAlarmRs { + + private static Logger logger = LoggerFactory.getLogger(PgAlarmRs.class); + + private PgAlarmTypeManager pgAlarmTypeManager; + + private PgAlarmManager pgAlarmManager; + + private PgUserManager pgPatrolerManager; + + private PgDeviceManager pgDeviceManager; + + @Resource + public void setPgAlarmManager(PgAlarmManager pgAlarmManager) { + this.pgAlarmManager = pgAlarmManager; + } + + @Resource + public void setPgPatrolerManager(PgUserManager pgPatrolerManager) { + this.pgPatrolerManager = pgPatrolerManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + /** + * 获取报警信息 + */ + @POST + @Path("getAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmList() throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAllAlarm(); + if (pgAlarmDtoList.size() == 0) + msg = "没有报警信息"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + return resultMap; + } + + /** + * 消除报警信息 + */ + @POST + @Path("clearAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map clearAlarmList(@FormParam("id") String id) throws Exception { + + Map resultMap = new HashMap(); + String msg = ""; + String result = "false"; + + try { + PgAlarm pgAlarm = new PgAlarm(); + pgAlarm = pgAlarmManager.get(Long.valueOf(id)); + if (pgAlarm == null) { + msg = "不存在该报警信息"; + result = "false"; + } else { + pgAlarm.setActive(0); + pgAlarmManager.save(pgAlarm); + msg = "报警信息清除成功"; + result = "true"; + } + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息清除失败"; + result = "false"; + } + resultMap.put("msg", msg); + resultMap.put("result", result); + return resultMap; + } + + /** + * 新增报警 + */ + @POST + @Path("addAlarm") + @Produces(MediaType.APPLICATION_JSON) + public Map addAlarm(@FormParam("alarmType") String alarmType, + @FormParam("alarmValue") String alarmValue, + @FormParam("alarmDate") String alarmDate, + @FormParam("description") String description, + @FormParam("devCode") String devCode, + @FormParam("userName") String userName) throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + PgAlarm pgAlarm = new PgAlarm(); + if (!pgPatrolerManager.userNameIsExits(userName)) { + result = "false"; + msg = "不存在该用户!"; + } else { + pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); + pgAlarm.setAlarmValue(alarmValue); + pgAlarm.setAlarmDate(sdf.parse(alarmDate)); + pgAlarm.setDescription(description); + pgAlarm.setUserId(pgPatrolerManager.getPatrolerByuserName(userName)); + pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode)); + pgAlarm.setActive(1); + + logger.info("成功保存"); + pgAlarmManager.save(pgAlarm); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + /* + * 根据报警类型和时间查询报警记录 + */ + @POST + @Path("getAlarmByTypeOrTime") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmByTypeOrTime(@FormParam("alarmType") String alarmType, + @FormParam("startTime") String startTime, + @FormParam("endTime") String endTime) throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAlarmByTypeAndTime(alarmType, startTime, endTime); + if (pgAlarmDtoList == null || pgAlarmDtoList.size() == 0) + msg = "报警信息不存在"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + + return resultMap; + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java deleted file mode 100644 index eb07aee..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ /dev/null @@ -1,439 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.manager.PgConstructionManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import javax.ws.rs.FormParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/27. - */ - -@Component -@Path("pgConstruction") -public class PgConstructionRs { - - private static Logger logger = LoggerFactory.getLogger(PgConstructionRs.class); - - private PgConstructionManager pgConstructionManager; - - @Resource - public void setPgConstructionManager(PgConstructionManager pgConstructionManager) - { - this.pgConstructionManager = pgConstructionManager; - } - - /* - 新建工程 - */ - @POST - @Path("addConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; - - }catch (Exception e){ - result = "false"; - msg = "保存失败"; - e.printStackTrace(); - } - resultMap.put("success",result); - resultMap.put("msg",msg); - return resultMap; - } - - /* - 施工信息编辑 - */ - @POST - @Path("editConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map editConstruction(@FormParam("id")String id, - @FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - try { - if (id.equals("")) - { - result = "false"; - msg = "请输入ID"; - }else { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "编辑成功"; - } - - }catch (Exception e){ - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - - } - - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("delConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map delConstruction(@FormParam("id")String id) - throws Exception{ - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - try { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - if (pgConstruction == null) - { - result = "false"; - msg = "不存在该施工信息"; - }else - { - pgConstruction.setActive(0); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "成功删除信息"; - } - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "删除失败"; - } - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("queryConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map queryConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_type")String cs_type - ) - throws Exception{ - - Map resultMap = new HashMap(); - List pgConstructionDtoList = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String msg = ""; - - try { - pgConstructionDtoList = pgConstructionManager.getConstructByVague(cs_name, cs_position, cs_type, cs_beginTime, cs_endTime); - if (pgConstructionDtoList != null) - { - msg = "获取数据成功"; - }else - { - msg = "没有满足条件的数据"; - } - }catch (Exception e){ - e.printStackTrace(); - } - - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); - return resultMap; - } - - @POST - @Path("constructTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按天在建工程/完工程统计*/ - @POST - @Path("buildingTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按周在建工程/完工程统计*/ - @POST - @Path("buildingTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按月在建工程/完工程统计*/ - @POST - @Path("buildingTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按类型统计*/ - @POST - @Path("constructTjByType") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByType(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按区域统计*/ - @POST - @Path("constructTjByRegion") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByRegion(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByRegion(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java deleted file mode 100644 index b3f303e..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.construction.manager.PgCsDocumentManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -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.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/28. - */ -@Component -@Path("pgCsDocument") -public class PgCsDocumentRs { - - private static Logger logger = LoggerFactory.getLogger(pgStatisticRs.class); - - private PgCsDocumentManager pgCsDocumentManager; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - @Resource - public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { - this.pgCsDocumentManager = pgCsDocumentManager; - } - - /* - 新增&上传 - */ - @POST - @Path("addConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstructDoc( - @FormParam("doc_name") String doc_name, - @FormParam("cs_name") String cs_name, - @FormParam("cs_type") String cs_type, - @FormParam("cs_time") String cs_time, - @FormParam("construct_doc") String fileBuffer)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) - pgCsDocument.setConstruct_doc(""); - else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); - } - - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - - pgCsDocument.setActive(1); - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "保存成功"; - logger.info("保存成功"); - - } catch (Exception ex) { - result = "false"; - msg = "保存失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } - - //编辑施工文档 - @RequestMapping("editConstructDoc") - @ResponseBody - public Map editReservePlan(@FormParam("id") String id, - @RequestParam(value = "doc_name",required = true) String doc_name, - @FormParam("cs_name") String cs_name, - @RequestParam(value = "cs_type",required =false) String cs_type, - @RequestParam(value ="cs_time",required =false) String cs_time) throws Exception { - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - try { - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if (pgCsDocument == null) { - result = "false"; - msg = "不存在该预案信息"; - } else { - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - pgCsDocument.setActive(1); - - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "编辑成功"; - } - } catch (Exception e) { - - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - } - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - //删除预案文档 - @RequestMapping("delConstructDoc") - @ResponseBody - public Map deleteReservePlan(@FormParam("id") String id)throws Exception{ - Map resultMap = new HashMap(); - String msg=""; - String result=""; - - try{ - - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if(pgCsDocument==null) - { - result="false"; - msg="不存在该预案信息"; - } - else{ - pgCsDocument.setActive(0); - pgCsDocumentManager.save(pgCsDocument); - result="true"; - msg="删除成功"; - } - } - catch(Exception e) - { - e.printStackTrace(); - msg="预案删除失败"; - result="false"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - - } - - /* - 按工程名称、工程类别、施工时间查询 - */ - @RequestMapping("queryConstructDoc") - @ResponseBody - public Map queryConstructDoc(@FormParam("cs_name")String cs_name, - @FormParam("cs_type")String cs_type, - @FormParam("cs_time")String cs_time) - throws Exception{ - - Map resultMap = new HashMap(); - List pgCsDocumentDtoList = new ArrayList(); - - String msg=""; - String result=""; - - try { - pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); - if (pgCsDocumentDtoList != null) - { - result = "true"; - msg = "获取数据成功"; - }else - { - result = "false"; - msg = "没有满足条件的数据"; - } - - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "获取失败"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - @POST - @Path("downLoadConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map downLoadConstructDoc( - @FormParam("cs_type")String cs_type, - @FormParam("doc_name") String doc_name)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (doc_name != null) { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type)); - - result = "true"; - msg = "下载成功"; - logger.info("下载成功"); - } - else - { - result = "false"; - msg = "文件名不能为空"; - logger.info("文件名不能为空"); - } - - } catch (Exception ex) { - result = "false"; - msg = "下载失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java index 42914cf..f67760b 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java @@ -206,7 +206,7 @@ /** * 根据时间统计入廊人员次数 */ -/* + /* @POST @Path("getInPgPersonByTime") @Produces(MediaType.APPLICATION_JSON) @@ -230,5 +230,5 @@ resultMap.put("result", pgInPgPersonDtoList); return resultMap; } -*/ + */ } diff --git a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java index 1a9138a..27b1482 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java +++ b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java @@ -115,12 +115,11 @@ pgReservePlan.setResUnit(resUnit); pgReservePlan.setPgAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); pgReservePlan.setActive(1); - pgReservePlanManager.save(pgReservePlan); result = "true"; msg = "保存成功"; logger.info("保存成功"); - +// pgReservePlanManager.save(pgReservePlan); } catch (Exception ex) { result = "false"; msg = "保存失败"; diff --git a/src/main/java/com/casic/PgInterface/rs/test.java b/src/main/java/com/casic/PgInterface/rs/test.java deleted file mode 100644 index 1bb1ae8..0000000 --- a/src/main/java/com/casic/PgInterface/rs/test.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.casic.PgInterface.rs; - -import java.net.HttpURLConnection; -import java.net.URL; -import java.io.BufferedOutputStream; -import java.io.BufferedInputStream; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.File; - -/** - * Created by Administrator on 2018/4/2. - */ -public class test { - public static File saveUrlAs(String url, String filePath, String method) { - //System.out.println("fileName---->"+filePath); - //创建不同的文件夹目录 - File file = new File(filePath); - //判断文件夹是否存在 - if (!file.exists()) { - //如果文件夹不存在,则创建新的的文件夹 - file.mkdirs(); - } - FileOutputStream fileOut = null; - HttpURLConnection conn = null; - InputStream inputStream = null; - try{ - // 建立链接 - URL httpUrl = new URL(url); - conn = (HttpURLConnection) httpUrl.openConnection(); - //以Post方式提交表单,默认get方式 - conn.setRequestMethod(method); - conn.setDoInput(true); - conn.setDoOutput(true); - // post方式不能使用缓存 - conn.setUseCaches(false); - //连接指定的资源 - conn.connect(); - //获取网络输入流 - inputStream = conn.getInputStream(); - BufferedInputStream bis = new BufferedInputStream(inputStream); - //判断文件的保存路径后面是否以/结尾 - if (!filePath.endsWith("/")) { - - filePath += "/"; - - - } - //写入到文件(注意文件保存路径的后面一定要加上文件的名称) - fileOut = new FileOutputStream(filePath + "123.png"); - BufferedOutputStream bos = new BufferedOutputStream(fileOut); - - byte[] buf = new byte[4096]; - int length = bis.read(buf); - //保存文件 - while (length != -1) { - bos.write(buf, 0, length); - length = bis.read(buf); - - } - bos.close(); - bis.close(); - conn.disconnect(); - - } - - catch( - Exception e - ) - - { - e.printStackTrace(); - System.out.println("抛出异常!!"); - - } - - return file; - -} - -} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 714f72d..5f21060 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -41,7 +41,7 @@ hibernate.show_sql=true hibernate.format_sql=true hibernate.generate_statistics=true -hibernate.hbm2ddl.auto=update +#hibernate.hbm2ddl.auto=create # ============================================================================ diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java new file mode 100644 index 0000000..dd81cfb --- /dev/null +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.devTable.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Created by yxw on 2017/10/30. + */ +@Service +public class PgAlarmManager extends HibernateEntityDao { + + private PgAlarmTypeManager pgAlarmTypeManager; + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + //获取当前报警消息列表 + public List getAllAlarm() { + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList = criteria.list(); + List pgAlarmDtoList = new ArrayList(); + for (PgAlarm pgAlarm : pgAlarmList) { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + + public List getAlarmByTypeAndTime(String alarmType,String startTime,String endTime) + { + try { + Criteria criteria = createCriteria(PgAlarm.class); + if (StringUtils.isNotBlank(alarmType)) { + criteria.add(Restrictions.eq("alarmTypeId", pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType))); + } + + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("alarmDate", DateUtils.sdf_day.parse(startTime))); + } + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("alarmDate", calendar.getTime())); + } + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList=criteria.list(); + List pgAlarmDtoList=new ArrayList(); + for(PgAlarm pgAlarm : pgAlarmList) + { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java new file mode 100644 index 0000000..c7b2961 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -0,0 +1,198 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import com.casic.PgInterface.devTable.manager.PgAlarmManager; +import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.patroler.manager.PgUserManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by yxw on 2017/11/4. + */ +@Component +@Path("pgAlarm") +public class PgAlarmRs { + + private static Logger logger = LoggerFactory.getLogger(PgAlarmRs.class); + + private PgAlarmTypeManager pgAlarmTypeManager; + + private PgAlarmManager pgAlarmManager; + + private PgUserManager pgPatrolerManager; + + private PgDeviceManager pgDeviceManager; + + @Resource + public void setPgAlarmManager(PgAlarmManager pgAlarmManager) { + this.pgAlarmManager = pgAlarmManager; + } + + @Resource + public void setPgPatrolerManager(PgUserManager pgPatrolerManager) { + this.pgPatrolerManager = pgPatrolerManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + /** + * 获取报警信息 + */ + @POST + @Path("getAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmList() throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAllAlarm(); + if (pgAlarmDtoList.size() == 0) + msg = "没有报警信息"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + return resultMap; + } + + /** + * 消除报警信息 + */ + @POST + @Path("clearAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map clearAlarmList(@FormParam("id") String id) throws Exception { + + Map resultMap = new HashMap(); + String msg = ""; + String result = "false"; + + try { + PgAlarm pgAlarm = new PgAlarm(); + pgAlarm = pgAlarmManager.get(Long.valueOf(id)); + if (pgAlarm == null) { + msg = "不存在该报警信息"; + result = "false"; + } else { + pgAlarm.setActive(0); + pgAlarmManager.save(pgAlarm); + msg = "报警信息清除成功"; + result = "true"; + } + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息清除失败"; + result = "false"; + } + resultMap.put("msg", msg); + resultMap.put("result", result); + return resultMap; + } + + /** + * 新增报警 + */ + @POST + @Path("addAlarm") + @Produces(MediaType.APPLICATION_JSON) + public Map addAlarm(@FormParam("alarmType") String alarmType, + @FormParam("alarmValue") String alarmValue, + @FormParam("alarmDate") String alarmDate, + @FormParam("description") String description, + @FormParam("devCode") String devCode, + @FormParam("userName") String userName) throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + PgAlarm pgAlarm = new PgAlarm(); + if (!pgPatrolerManager.userNameIsExits(userName)) { + result = "false"; + msg = "不存在该用户!"; + } else { + pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); + pgAlarm.setAlarmValue(alarmValue); + pgAlarm.setAlarmDate(sdf.parse(alarmDate)); + pgAlarm.setDescription(description); + pgAlarm.setUserId(pgPatrolerManager.getPatrolerByuserName(userName)); + pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode)); + pgAlarm.setActive(1); + + logger.info("成功保存"); + pgAlarmManager.save(pgAlarm); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + /* + * 根据报警类型和时间查询报警记录 + */ + @POST + @Path("getAlarmByTypeOrTime") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmByTypeOrTime(@FormParam("alarmType") String alarmType, + @FormParam("startTime") String startTime, + @FormParam("endTime") String endTime) throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAlarmByTypeAndTime(alarmType, startTime, endTime); + if (pgAlarmDtoList == null || pgAlarmDtoList.size() == 0) + msg = "报警信息不存在"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + + return resultMap; + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java deleted file mode 100644 index eb07aee..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ /dev/null @@ -1,439 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.manager.PgConstructionManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import javax.ws.rs.FormParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/27. - */ - -@Component -@Path("pgConstruction") -public class PgConstructionRs { - - private static Logger logger = LoggerFactory.getLogger(PgConstructionRs.class); - - private PgConstructionManager pgConstructionManager; - - @Resource - public void setPgConstructionManager(PgConstructionManager pgConstructionManager) - { - this.pgConstructionManager = pgConstructionManager; - } - - /* - 新建工程 - */ - @POST - @Path("addConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; - - }catch (Exception e){ - result = "false"; - msg = "保存失败"; - e.printStackTrace(); - } - resultMap.put("success",result); - resultMap.put("msg",msg); - return resultMap; - } - - /* - 施工信息编辑 - */ - @POST - @Path("editConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map editConstruction(@FormParam("id")String id, - @FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - try { - if (id.equals("")) - { - result = "false"; - msg = "请输入ID"; - }else { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "编辑成功"; - } - - }catch (Exception e){ - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - - } - - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("delConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map delConstruction(@FormParam("id")String id) - throws Exception{ - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - try { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - if (pgConstruction == null) - { - result = "false"; - msg = "不存在该施工信息"; - }else - { - pgConstruction.setActive(0); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "成功删除信息"; - } - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "删除失败"; - } - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("queryConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map queryConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_type")String cs_type - ) - throws Exception{ - - Map resultMap = new HashMap(); - List pgConstructionDtoList = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String msg = ""; - - try { - pgConstructionDtoList = pgConstructionManager.getConstructByVague(cs_name, cs_position, cs_type, cs_beginTime, cs_endTime); - if (pgConstructionDtoList != null) - { - msg = "获取数据成功"; - }else - { - msg = "没有满足条件的数据"; - } - }catch (Exception e){ - e.printStackTrace(); - } - - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); - return resultMap; - } - - @POST - @Path("constructTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按天在建工程/完工程统计*/ - @POST - @Path("buildingTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按周在建工程/完工程统计*/ - @POST - @Path("buildingTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按月在建工程/完工程统计*/ - @POST - @Path("buildingTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按类型统计*/ - @POST - @Path("constructTjByType") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByType(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按区域统计*/ - @POST - @Path("constructTjByRegion") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByRegion(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByRegion(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java deleted file mode 100644 index b3f303e..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.construction.manager.PgCsDocumentManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -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.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/28. - */ -@Component -@Path("pgCsDocument") -public class PgCsDocumentRs { - - private static Logger logger = LoggerFactory.getLogger(pgStatisticRs.class); - - private PgCsDocumentManager pgCsDocumentManager; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - @Resource - public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { - this.pgCsDocumentManager = pgCsDocumentManager; - } - - /* - 新增&上传 - */ - @POST - @Path("addConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstructDoc( - @FormParam("doc_name") String doc_name, - @FormParam("cs_name") String cs_name, - @FormParam("cs_type") String cs_type, - @FormParam("cs_time") String cs_time, - @FormParam("construct_doc") String fileBuffer)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) - pgCsDocument.setConstruct_doc(""); - else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); - } - - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - - pgCsDocument.setActive(1); - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "保存成功"; - logger.info("保存成功"); - - } catch (Exception ex) { - result = "false"; - msg = "保存失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } - - //编辑施工文档 - @RequestMapping("editConstructDoc") - @ResponseBody - public Map editReservePlan(@FormParam("id") String id, - @RequestParam(value = "doc_name",required = true) String doc_name, - @FormParam("cs_name") String cs_name, - @RequestParam(value = "cs_type",required =false) String cs_type, - @RequestParam(value ="cs_time",required =false) String cs_time) throws Exception { - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - try { - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if (pgCsDocument == null) { - result = "false"; - msg = "不存在该预案信息"; - } else { - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - pgCsDocument.setActive(1); - - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "编辑成功"; - } - } catch (Exception e) { - - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - } - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - //删除预案文档 - @RequestMapping("delConstructDoc") - @ResponseBody - public Map deleteReservePlan(@FormParam("id") String id)throws Exception{ - Map resultMap = new HashMap(); - String msg=""; - String result=""; - - try{ - - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if(pgCsDocument==null) - { - result="false"; - msg="不存在该预案信息"; - } - else{ - pgCsDocument.setActive(0); - pgCsDocumentManager.save(pgCsDocument); - result="true"; - msg="删除成功"; - } - } - catch(Exception e) - { - e.printStackTrace(); - msg="预案删除失败"; - result="false"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - - } - - /* - 按工程名称、工程类别、施工时间查询 - */ - @RequestMapping("queryConstructDoc") - @ResponseBody - public Map queryConstructDoc(@FormParam("cs_name")String cs_name, - @FormParam("cs_type")String cs_type, - @FormParam("cs_time")String cs_time) - throws Exception{ - - Map resultMap = new HashMap(); - List pgCsDocumentDtoList = new ArrayList(); - - String msg=""; - String result=""; - - try { - pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); - if (pgCsDocumentDtoList != null) - { - result = "true"; - msg = "获取数据成功"; - }else - { - result = "false"; - msg = "没有满足条件的数据"; - } - - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "获取失败"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - @POST - @Path("downLoadConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map downLoadConstructDoc( - @FormParam("cs_type")String cs_type, - @FormParam("doc_name") String doc_name)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (doc_name != null) { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type)); - - result = "true"; - msg = "下载成功"; - logger.info("下载成功"); - } - else - { - result = "false"; - msg = "文件名不能为空"; - logger.info("文件名不能为空"); - } - - } catch (Exception ex) { - result = "false"; - msg = "下载失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java index 42914cf..f67760b 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java @@ -206,7 +206,7 @@ /** * 根据时间统计入廊人员次数 */ -/* + /* @POST @Path("getInPgPersonByTime") @Produces(MediaType.APPLICATION_JSON) @@ -230,5 +230,5 @@ resultMap.put("result", pgInPgPersonDtoList); return resultMap; } -*/ + */ } diff --git a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java index 1a9138a..27b1482 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java +++ b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java @@ -115,12 +115,11 @@ pgReservePlan.setResUnit(resUnit); pgReservePlan.setPgAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); pgReservePlan.setActive(1); - pgReservePlanManager.save(pgReservePlan); result = "true"; msg = "保存成功"; logger.info("保存成功"); - +// pgReservePlanManager.save(pgReservePlan); } catch (Exception ex) { result = "false"; msg = "保存失败"; diff --git a/src/main/java/com/casic/PgInterface/rs/test.java b/src/main/java/com/casic/PgInterface/rs/test.java deleted file mode 100644 index 1bb1ae8..0000000 --- a/src/main/java/com/casic/PgInterface/rs/test.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.casic.PgInterface.rs; - -import java.net.HttpURLConnection; -import java.net.URL; -import java.io.BufferedOutputStream; -import java.io.BufferedInputStream; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.File; - -/** - * Created by Administrator on 2018/4/2. - */ -public class test { - public static File saveUrlAs(String url, String filePath, String method) { - //System.out.println("fileName---->"+filePath); - //创建不同的文件夹目录 - File file = new File(filePath); - //判断文件夹是否存在 - if (!file.exists()) { - //如果文件夹不存在,则创建新的的文件夹 - file.mkdirs(); - } - FileOutputStream fileOut = null; - HttpURLConnection conn = null; - InputStream inputStream = null; - try{ - // 建立链接 - URL httpUrl = new URL(url); - conn = (HttpURLConnection) httpUrl.openConnection(); - //以Post方式提交表单,默认get方式 - conn.setRequestMethod(method); - conn.setDoInput(true); - conn.setDoOutput(true); - // post方式不能使用缓存 - conn.setUseCaches(false); - //连接指定的资源 - conn.connect(); - //获取网络输入流 - inputStream = conn.getInputStream(); - BufferedInputStream bis = new BufferedInputStream(inputStream); - //判断文件的保存路径后面是否以/结尾 - if (!filePath.endsWith("/")) { - - filePath += "/"; - - - } - //写入到文件(注意文件保存路径的后面一定要加上文件的名称) - fileOut = new FileOutputStream(filePath + "123.png"); - BufferedOutputStream bos = new BufferedOutputStream(fileOut); - - byte[] buf = new byte[4096]; - int length = bis.read(buf); - //保存文件 - while (length != -1) { - bos.write(buf, 0, length); - length = bis.read(buf); - - } - bos.close(); - bis.close(); - conn.disconnect(); - - } - - catch( - Exception e - ) - - { - e.printStackTrace(); - System.out.println("抛出异常!!"); - - } - - return file; - -} - -} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 714f72d..5f21060 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -41,7 +41,7 @@ hibernate.show_sql=true hibernate.format_sql=true hibernate.generate_statistics=true -hibernate.hbm2ddl.auto=update +#hibernate.hbm2ddl.auto=create # ============================================================================ diff --git "a/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" new file mode 100644 index 0000000..e69de29 --- /dev/null +++ "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java new file mode 100644 index 0000000..dd81cfb --- /dev/null +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.devTable.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Created by yxw on 2017/10/30. + */ +@Service +public class PgAlarmManager extends HibernateEntityDao { + + private PgAlarmTypeManager pgAlarmTypeManager; + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + //获取当前报警消息列表 + public List getAllAlarm() { + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList = criteria.list(); + List pgAlarmDtoList = new ArrayList(); + for (PgAlarm pgAlarm : pgAlarmList) { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + + public List getAlarmByTypeAndTime(String alarmType,String startTime,String endTime) + { + try { + Criteria criteria = createCriteria(PgAlarm.class); + if (StringUtils.isNotBlank(alarmType)) { + criteria.add(Restrictions.eq("alarmTypeId", pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType))); + } + + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("alarmDate", DateUtils.sdf_day.parse(startTime))); + } + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("alarmDate", calendar.getTime())); + } + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList=criteria.list(); + List pgAlarmDtoList=new ArrayList(); + for(PgAlarm pgAlarm : pgAlarmList) + { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java new file mode 100644 index 0000000..c7b2961 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -0,0 +1,198 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import com.casic.PgInterface.devTable.manager.PgAlarmManager; +import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.patroler.manager.PgUserManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by yxw on 2017/11/4. + */ +@Component +@Path("pgAlarm") +public class PgAlarmRs { + + private static Logger logger = LoggerFactory.getLogger(PgAlarmRs.class); + + private PgAlarmTypeManager pgAlarmTypeManager; + + private PgAlarmManager pgAlarmManager; + + private PgUserManager pgPatrolerManager; + + private PgDeviceManager pgDeviceManager; + + @Resource + public void setPgAlarmManager(PgAlarmManager pgAlarmManager) { + this.pgAlarmManager = pgAlarmManager; + } + + @Resource + public void setPgPatrolerManager(PgUserManager pgPatrolerManager) { + this.pgPatrolerManager = pgPatrolerManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + /** + * 获取报警信息 + */ + @POST + @Path("getAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmList() throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAllAlarm(); + if (pgAlarmDtoList.size() == 0) + msg = "没有报警信息"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + return resultMap; + } + + /** + * 消除报警信息 + */ + @POST + @Path("clearAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map clearAlarmList(@FormParam("id") String id) throws Exception { + + Map resultMap = new HashMap(); + String msg = ""; + String result = "false"; + + try { + PgAlarm pgAlarm = new PgAlarm(); + pgAlarm = pgAlarmManager.get(Long.valueOf(id)); + if (pgAlarm == null) { + msg = "不存在该报警信息"; + result = "false"; + } else { + pgAlarm.setActive(0); + pgAlarmManager.save(pgAlarm); + msg = "报警信息清除成功"; + result = "true"; + } + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息清除失败"; + result = "false"; + } + resultMap.put("msg", msg); + resultMap.put("result", result); + return resultMap; + } + + /** + * 新增报警 + */ + @POST + @Path("addAlarm") + @Produces(MediaType.APPLICATION_JSON) + public Map addAlarm(@FormParam("alarmType") String alarmType, + @FormParam("alarmValue") String alarmValue, + @FormParam("alarmDate") String alarmDate, + @FormParam("description") String description, + @FormParam("devCode") String devCode, + @FormParam("userName") String userName) throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + PgAlarm pgAlarm = new PgAlarm(); + if (!pgPatrolerManager.userNameIsExits(userName)) { + result = "false"; + msg = "不存在该用户!"; + } else { + pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); + pgAlarm.setAlarmValue(alarmValue); + pgAlarm.setAlarmDate(sdf.parse(alarmDate)); + pgAlarm.setDescription(description); + pgAlarm.setUserId(pgPatrolerManager.getPatrolerByuserName(userName)); + pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode)); + pgAlarm.setActive(1); + + logger.info("成功保存"); + pgAlarmManager.save(pgAlarm); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + /* + * 根据报警类型和时间查询报警记录 + */ + @POST + @Path("getAlarmByTypeOrTime") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmByTypeOrTime(@FormParam("alarmType") String alarmType, + @FormParam("startTime") String startTime, + @FormParam("endTime") String endTime) throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAlarmByTypeAndTime(alarmType, startTime, endTime); + if (pgAlarmDtoList == null || pgAlarmDtoList.size() == 0) + msg = "报警信息不存在"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + + return resultMap; + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java deleted file mode 100644 index eb07aee..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ /dev/null @@ -1,439 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.manager.PgConstructionManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import javax.ws.rs.FormParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/27. - */ - -@Component -@Path("pgConstruction") -public class PgConstructionRs { - - private static Logger logger = LoggerFactory.getLogger(PgConstructionRs.class); - - private PgConstructionManager pgConstructionManager; - - @Resource - public void setPgConstructionManager(PgConstructionManager pgConstructionManager) - { - this.pgConstructionManager = pgConstructionManager; - } - - /* - 新建工程 - */ - @POST - @Path("addConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; - - }catch (Exception e){ - result = "false"; - msg = "保存失败"; - e.printStackTrace(); - } - resultMap.put("success",result); - resultMap.put("msg",msg); - return resultMap; - } - - /* - 施工信息编辑 - */ - @POST - @Path("editConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map editConstruction(@FormParam("id")String id, - @FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - try { - if (id.equals("")) - { - result = "false"; - msg = "请输入ID"; - }else { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "编辑成功"; - } - - }catch (Exception e){ - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - - } - - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("delConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map delConstruction(@FormParam("id")String id) - throws Exception{ - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - try { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - if (pgConstruction == null) - { - result = "false"; - msg = "不存在该施工信息"; - }else - { - pgConstruction.setActive(0); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "成功删除信息"; - } - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "删除失败"; - } - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("queryConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map queryConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_type")String cs_type - ) - throws Exception{ - - Map resultMap = new HashMap(); - List pgConstructionDtoList = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String msg = ""; - - try { - pgConstructionDtoList = pgConstructionManager.getConstructByVague(cs_name, cs_position, cs_type, cs_beginTime, cs_endTime); - if (pgConstructionDtoList != null) - { - msg = "获取数据成功"; - }else - { - msg = "没有满足条件的数据"; - } - }catch (Exception e){ - e.printStackTrace(); - } - - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); - return resultMap; - } - - @POST - @Path("constructTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按天在建工程/完工程统计*/ - @POST - @Path("buildingTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按周在建工程/完工程统计*/ - @POST - @Path("buildingTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按月在建工程/完工程统计*/ - @POST - @Path("buildingTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按类型统计*/ - @POST - @Path("constructTjByType") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByType(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按区域统计*/ - @POST - @Path("constructTjByRegion") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByRegion(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByRegion(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java deleted file mode 100644 index b3f303e..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.construction.manager.PgCsDocumentManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -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.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/28. - */ -@Component -@Path("pgCsDocument") -public class PgCsDocumentRs { - - private static Logger logger = LoggerFactory.getLogger(pgStatisticRs.class); - - private PgCsDocumentManager pgCsDocumentManager; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - @Resource - public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { - this.pgCsDocumentManager = pgCsDocumentManager; - } - - /* - 新增&上传 - */ - @POST - @Path("addConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstructDoc( - @FormParam("doc_name") String doc_name, - @FormParam("cs_name") String cs_name, - @FormParam("cs_type") String cs_type, - @FormParam("cs_time") String cs_time, - @FormParam("construct_doc") String fileBuffer)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) - pgCsDocument.setConstruct_doc(""); - else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); - } - - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - - pgCsDocument.setActive(1); - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "保存成功"; - logger.info("保存成功"); - - } catch (Exception ex) { - result = "false"; - msg = "保存失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } - - //编辑施工文档 - @RequestMapping("editConstructDoc") - @ResponseBody - public Map editReservePlan(@FormParam("id") String id, - @RequestParam(value = "doc_name",required = true) String doc_name, - @FormParam("cs_name") String cs_name, - @RequestParam(value = "cs_type",required =false) String cs_type, - @RequestParam(value ="cs_time",required =false) String cs_time) throws Exception { - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - try { - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if (pgCsDocument == null) { - result = "false"; - msg = "不存在该预案信息"; - } else { - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - pgCsDocument.setActive(1); - - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "编辑成功"; - } - } catch (Exception e) { - - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - } - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - //删除预案文档 - @RequestMapping("delConstructDoc") - @ResponseBody - public Map deleteReservePlan(@FormParam("id") String id)throws Exception{ - Map resultMap = new HashMap(); - String msg=""; - String result=""; - - try{ - - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if(pgCsDocument==null) - { - result="false"; - msg="不存在该预案信息"; - } - else{ - pgCsDocument.setActive(0); - pgCsDocumentManager.save(pgCsDocument); - result="true"; - msg="删除成功"; - } - } - catch(Exception e) - { - e.printStackTrace(); - msg="预案删除失败"; - result="false"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - - } - - /* - 按工程名称、工程类别、施工时间查询 - */ - @RequestMapping("queryConstructDoc") - @ResponseBody - public Map queryConstructDoc(@FormParam("cs_name")String cs_name, - @FormParam("cs_type")String cs_type, - @FormParam("cs_time")String cs_time) - throws Exception{ - - Map resultMap = new HashMap(); - List pgCsDocumentDtoList = new ArrayList(); - - String msg=""; - String result=""; - - try { - pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); - if (pgCsDocumentDtoList != null) - { - result = "true"; - msg = "获取数据成功"; - }else - { - result = "false"; - msg = "没有满足条件的数据"; - } - - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "获取失败"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - @POST - @Path("downLoadConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map downLoadConstructDoc( - @FormParam("cs_type")String cs_type, - @FormParam("doc_name") String doc_name)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (doc_name != null) { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type)); - - result = "true"; - msg = "下载成功"; - logger.info("下载成功"); - } - else - { - result = "false"; - msg = "文件名不能为空"; - logger.info("文件名不能为空"); - } - - } catch (Exception ex) { - result = "false"; - msg = "下载失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java index 42914cf..f67760b 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java @@ -206,7 +206,7 @@ /** * 根据时间统计入廊人员次数 */ -/* + /* @POST @Path("getInPgPersonByTime") @Produces(MediaType.APPLICATION_JSON) @@ -230,5 +230,5 @@ resultMap.put("result", pgInPgPersonDtoList); return resultMap; } -*/ + */ } diff --git a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java index 1a9138a..27b1482 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java +++ b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java @@ -115,12 +115,11 @@ pgReservePlan.setResUnit(resUnit); pgReservePlan.setPgAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); pgReservePlan.setActive(1); - pgReservePlanManager.save(pgReservePlan); result = "true"; msg = "保存成功"; logger.info("保存成功"); - +// pgReservePlanManager.save(pgReservePlan); } catch (Exception ex) { result = "false"; msg = "保存失败"; diff --git a/src/main/java/com/casic/PgInterface/rs/test.java b/src/main/java/com/casic/PgInterface/rs/test.java deleted file mode 100644 index 1bb1ae8..0000000 --- a/src/main/java/com/casic/PgInterface/rs/test.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.casic.PgInterface.rs; - -import java.net.HttpURLConnection; -import java.net.URL; -import java.io.BufferedOutputStream; -import java.io.BufferedInputStream; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.File; - -/** - * Created by Administrator on 2018/4/2. - */ -public class test { - public static File saveUrlAs(String url, String filePath, String method) { - //System.out.println("fileName---->"+filePath); - //创建不同的文件夹目录 - File file = new File(filePath); - //判断文件夹是否存在 - if (!file.exists()) { - //如果文件夹不存在,则创建新的的文件夹 - file.mkdirs(); - } - FileOutputStream fileOut = null; - HttpURLConnection conn = null; - InputStream inputStream = null; - try{ - // 建立链接 - URL httpUrl = new URL(url); - conn = (HttpURLConnection) httpUrl.openConnection(); - //以Post方式提交表单,默认get方式 - conn.setRequestMethod(method); - conn.setDoInput(true); - conn.setDoOutput(true); - // post方式不能使用缓存 - conn.setUseCaches(false); - //连接指定的资源 - conn.connect(); - //获取网络输入流 - inputStream = conn.getInputStream(); - BufferedInputStream bis = new BufferedInputStream(inputStream); - //判断文件的保存路径后面是否以/结尾 - if (!filePath.endsWith("/")) { - - filePath += "/"; - - - } - //写入到文件(注意文件保存路径的后面一定要加上文件的名称) - fileOut = new FileOutputStream(filePath + "123.png"); - BufferedOutputStream bos = new BufferedOutputStream(fileOut); - - byte[] buf = new byte[4096]; - int length = bis.read(buf); - //保存文件 - while (length != -1) { - bos.write(buf, 0, length); - length = bis.read(buf); - - } - bos.close(); - bis.close(); - conn.disconnect(); - - } - - catch( - Exception e - ) - - { - e.printStackTrace(); - System.out.println("抛出异常!!"); - - } - - return file; - -} - -} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 714f72d..5f21060 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -41,7 +41,7 @@ hibernate.show_sql=true hibernate.format_sql=true hibernate.generate_statistics=true -hibernate.hbm2ddl.auto=update +#hibernate.hbm2ddl.auto=create # ============================================================================ diff --git "a/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" new file mode 100644 index 0000000..e69de29 --- /dev/null +++ "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index 2de346f..e69de29 100644 --- "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7f2148b..7a84550 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - E:/out/PgInterface/artifacts/PgInterface + $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface diff --git a/.idea/misc.xml b/.idea/misc.xml index 45651d5..85d63f2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -12,7 +12,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e403cd9..be2235d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,28 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -30,12 +49,30 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + @@ -107,8 +144,8 @@ @@ -203,6 +240,20 @@ + + + + + + + + + + @@ -346,6 +397,10 @@ @@ -376,10 +431,6 @@ - - @@ -483,18 +534,34 @@ - - - - + + + + + + + + + + @@ -919,7 +986,8 @@ - + + 1510219102698 @@ -1009,11 +1077,15 @@ 1522719993330 1522719993330 - - @@ -1048,29 +1120,29 @@ + - - + - + @@ -1111,7 +1183,8 @@ - @@ -1131,20 +1204,6 @@ - - - - - - - - - - - - - - @@ -1392,7 +1451,6 @@ - @@ -1444,16 +1502,6 @@ - - - - - - - - - - @@ -1484,22 +1532,68 @@ + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -1510,19 +1604,13 @@ - + - - - - - - - - - - - + + + + + diff --git a/PgInterface.iml b/PgInterface.iml index a322876..5d58f83 100644 --- a/PgInterface.iml +++ b/PgInterface.iml @@ -11,6 +11,9 @@ + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java deleted file mode 100644 index 8b57e41..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/23. - */ -@Entity -@Table(name = "PG_CONSTRUCTION") -@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) -public class PgConstruction implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String cs_name; - private String cs_position; - private String cs_status; - private String cs_detail; - private Date cs_beginTime; - private Date cs_endTime; - private String cs_charge; - private String cs_phone; - private String cs_type; - private String cs_region; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_POSITION") - public String getCs_position(){ return cs_position; } - - public void setCs_position(String cs_position){ this.cs_position = cs_position; } - - @Column(name = "CS_STATUS") - public String getCs_status(){ return cs_status; } - - public void setCs_status(String cs_status){ this.cs_status = cs_status; } - - @Column(name = "CS_DETAIL") - public String getCs_detail(){ return cs_detail; } - - public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } - - @Column(name = "CS_BEGINTIME") - public Date getCs_beginTime(){ return cs_beginTime; } - - public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } - - @Column(name = "CS_ENDTIME") - public Date getCs_endTime(){ return cs_endTime; } - - public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } - - @Column(name = "CS_CHARGE") - public String getCs_charge(){ return cs_charge; } - - public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } - - @Column(name = "CS_PHONE") - public String getCs_phone(){ return cs_phone; } - - public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } - - public void setCs_region(String cs_region){ this.cs_region = cs_region; } - - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java deleted file mode 100644 index 13579ab..0000000 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.casic.PgInterface.construction.domain; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; - -/** - * Created by zxh on 2018/3/28. - */ - -@Entity -@Table(name = "PG_CSDOCUMENT") -@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) -public class PgCsDocument implements Serializable{ - - private static final long serialVersionUID = 1L; - private long id; - private String doc_name; - private String cs_name; - private String cs_type; - private Date cs_time; - private String construct_doc; - private int active; - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } - - public void setId(long id){ this.id = id; } - - @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - @Column(name = "CS_NAME") - public String getCs_name(){ return cs_name; } - - public void setCs_name(String cs_name){ this.cs_name = cs_name; } - - @Column(name = "CS_TYPE") - public String getCs_type(){ return cs_type; } - - public void setCs_type(String cs_type){ this.cs_type = cs_type; } - - @Column(name = "CS_TIME") - public Date getCs_time(){ return cs_time; } - - public void setCs_time(Date cs_time){ this.cs_time = cs_time; } - @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - @Column(name = "ACTIVE") - public int getActive(){ return active; } - - public void setActive(int active){ this.active = active; } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java deleted file mode 100644 index 98a49f6..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import java.io.Serializable; - -/** - * Created by Administrator on 2018/3/30. - */ -public class PgConstructTjDto implements Serializable { - - private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 - - public String getConstructNum(){ return constructNum; } - - public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - - public String getCompleteNum(){ return completeNum; } - - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} - - public String getUnderwayNum(){ return underwayNum; } - - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} - - public String getConstructTypeNum(){ return constructTypeNum; } - - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} - - public String getConstructRegionNum(){ return constructRegionNum; } - - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java deleted file mode 100644 index a092f0e..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgConstruction; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -/** - * Created by zxh on 2018/3/23. - */ -public class PgConstructionDto implements Serializable{ - - private String id; - private String cs_name;//项目名称 - private String cs_position;//施工位置 - private String cs_status;//项目状态 - private String cs_detail;//施工内容 - private String cs_beginTime;//施工开始时间 - private String cs_endTime;//施工结束时间 - private String cs_charge;//施工负责人 - private String cs_phone;//联系方式 - private String cs_type;//工程类别 - private String cs_region;//施工区域 - private String active;//状态位 - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_position() { - return cs_position; - } - - public void setCs_position(String cs_position) { - this.cs_position = cs_position; - } - - public String getCs_status() { - return cs_status; - } - - public void setCs_status(String cs_status) { - this.cs_status = cs_status; - } - - public String getCs_detail() { - return cs_detail; - } - - public void setCs_detail(String cs_detail) { - this.cs_detail = cs_detail; - } - - public String getCs_beginTime() { - return cs_beginTime; - } - - public void setCs_beginTime(String cs_beginTime) { - this.cs_beginTime = cs_beginTime; - } - - public String getCs_endTime() { - return cs_endTime; - } - - public void setCs_endTime(String cs_endTime) { - this.cs_endTime = cs_endTime; - } - - public String getCs_charge() { - return cs_charge; - } - - public void setCs_charge(String cs_charge) { - this.cs_charge = cs_charge; - } - - public String getCs_phone() { - return cs_phone; - } - - public void setCs_phone(String cs_phone) { - this.cs_phone = cs_phone; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_region() { - return cs_region; - } - - public void setCs_region(String cs_region) { - this.cs_region = cs_region; - } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgConstructionDto(PgConstruction pgConstruction) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_position(pgConstruction.getCs_position()); - this.setCs_status(pgConstruction.getCs_status()); - this.setCs_detail(pgConstruction.getCs_detail()); - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setCs_region(pgConstruction.getCs_region()); - this.setActive(String.valueOf(pgConstruction.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java deleted file mode 100644 index 598380f..0000000 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.casic.PgInterface.construction.dto; - -import com.casic.PgInterface.construction.domain.PgCsDocument; - -import java.io.Serializable; -import java.text.SimpleDateFormat; - -/** - * Created by zxh on 2018/3/28. - */ -public class PgCsDocumentDto implements Serializable{ - - private String id; - private String doc_name;//文档名称 - private String cs_name;//项目名称 - private String cs_type;//工程类别 - private String cs_time;//施工时间 - private String construct_doc;//施工文档 - private String active;//状态位 - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDoc_name(){ return doc_name; } - - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } - - public String getCs_name() { - return cs_name; - } - - public void setCs_name(String cs_name) { - this.cs_name = cs_name; - } - - public String getCs_type() { - return cs_type; - } - - public void setCs_type(String cs_type) { - this.cs_type = cs_type; - } - - public String getCs_time() { - return cs_time; - } - - public void setCs_time(String cs_time) { - this.cs_time = cs_time; - } - - public String getConstruct_doc(){ return construct_doc; } - - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } - - public String getActive(){ return active; } - - public void setActive(String active){ this.active = active; } - - public PgCsDocumentDto (PgCsDocument pgCsDocument) - { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgCsDocument.getId())); - this.setDoc_name(pgCsDocument.getDoc_name()); - this.setCs_name(pgCsDocument.getCs_name()); - this.setCs_type(pgCsDocument.getCs_type()); - this.setCs_time(sdf.format(pgCsDocument.getCs_time())); - this.setConstruct_doc(pgCsDocument.getConstruct_doc()); - this.setActive(String.valueOf(pgCsDocument.getActive())); - - } -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java deleted file mode 100644 index 1fdac02..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.core.util.DateUtils; -import com.casic.PgInterface.core.util.StringUtils; -import org.hibernate.Criteria; -import org.hibernate.criterion.Restrictions; -import org.springframework.stereotype.Service; -import org.hibernate.Query; - -import java.util.Calendar; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by zxh on 2018/3/23. - */ -@Service -public class PgConstructionManager extends HibernateEntityDao{ - - Calendar calendar_now = Calendar.getInstance(); - int year = calendar_now.get(Calendar.YEAR); - int month = calendar_now.get(Calendar.MONTH)+1; - int day = calendar_now.get(Calendar.DAY_OF_MONTH); - String date_now = String.valueOf(year + "-" + month + "-" + day); - - - - - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { - - List pgConstructionDtoList = new ArrayList(); - - try { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.like("cs_name", cs_name)); - criteria.add(Restrictions.like("cs_type", cs_type)); - criteria.add(Restrictions.like("cs_position", cs_position)); - criteria.add(Restrictions.eq("active", 1)); - - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); - } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); - } - - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ - e.printStackTrace(); - return null; - } - return pgConstructionDtoList; - } - - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); - - criteria.add(Restrictions.eq("active", 1)); - - List pgConstructionList = criteria.list(); - - if (pgConstructionList != null && pgConstructionList.size() > 0) - return pgConstructionList.get(0); - else - return null; - } - - /*统计当天施工数*/ - public List getAllConstructByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计本周施工数*/ - public List getAllConstructByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - /*统计本月施工数*/ - public List getAllConstructByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String sql = ""; - - sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; - - Query query = this.getSession().createSQLQuery(sql); - - int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*统计当天在建工/完工程数*/ - - public List getBuildingByDay(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按周统计*/ - - public List getBuildingByWeek(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getBuildingByMon(String queryDate) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String buildingSql = ""; - String completeSql = ""; - Query buildingQuery, completeQuery; - - /*在建*/ - buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; - /*完工*/ - completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; - - buildingQuery = this.getSession().createSQLQuery(buildingSql); - completeQuery = this.getSession().createSQLQuery(completeSql); - - int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); - int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); - - pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); - pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - /*按类型统计*/ - - public List getConstructTjByType(String cs_type) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - - public List getConstructTjByRegion(String cs_region) throws Exception { - - List pgConstructionDtoList = new ArrayList(); - - PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); - - String Sql = ""; - - Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; - - - Query query = this.getSession().createSQLQuery(Sql); - - int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); - - pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); - - pgConstructionDtoList.add(pgConstructTjDto); - - return pgConstructionDtoList; - } - -} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java deleted file mode 100644 index 12f3042..0000000 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.casic.PgInterface.construction.manager; - -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.core.hibernate.HibernateEntityDao; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.core.util.DateUtils; - -import com.sun.xml.internal.ws.client.ResponseContextReceiver; -import org.hibernate.Criteria; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import com.sun.org.apache.xml.internal.security.utils.Base64; -import org.springframework.stereotype.Service; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartFile; -import sun.misc.BASE64Decoder; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - - -/** - * Created by zxh on 2018/3/28. - */ -@Service -public class PgCsDocumentManager extends HibernateEntityDao{ - - public String saveFiles(List files,String fileType){ - String [] fileNames = new String[files.size()]; - String [] fileBuffers = new String[files.size()]; - try { - for (int i = 0; i < files.size(); i++) { - fileNames[i] = files.get(i).getOriginalFilename(); - byte[] fis = files.get(i).getBytes(); - fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); - } - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - for (int i = 0; i < fileBuffers.length; i++) { - if (fileBuffers[i] != null && fileNames[i] != null) { - imageName += fileType+"/"+fileNames[i] + ","; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileNames[i]); - fos = new FileOutputStream(imageFile);//保存图片 - fos.write(buffer); - fos.flush(); - fos.close(); - } - } - return imageName.substring(0,imageName.length()-1); - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - - public String saveFiles(String fileBuffer, String fileName, String fileType){ - - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\"+fileType;//存储路径 - String imageName = ""; - imageName += fileType+"/"+fileName; - byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - File imageFile = new File(destDir, fileName); - fos = new FileOutputStream(imageFile);//保存文件 - fos.write(buffer); - fos.flush(); - fos.close(); - return imageName; - } - catch(Exception ex) - { - ex.printStackTrace(); - return ""; - } - } - - /*下载*/ - public String downFile(String fileName, String fileType){ - try { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String strDirPath = request.getSession().getServletContext().getRealPath(""); - - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("active", 1)); - List pgCsDocumentList = criteria.list(); - - if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) - return null; - - FileOutputStream fos = null; - String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; - - File destDir = new File(image_toDir); - if (!destDir.exists()) - destDir.mkdirs(); - - byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); - fos.write(buffer); - fos.flush(); - fos.close(); - - return image_toDir; - } - catch (Exception e) - { - e.printStackTrace(); - return ""; - } - } - - /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { - - List pgCsDocumentDtoList = new ArrayList(); - - try { - Criteria criteria = createCriteria(PgCsDocument.class); - criteria.addOrder(Order.desc("id")); - criteria.add(Restrictions.eq("cs_name", cs_name)); - criteria.add(Restrictions.eq("cs_type", cs_type)); - - if (StringUtils.isNotBlank(cs_time)) { - criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); - } - List pgCsDocumentList=criteria.list(); - - for (PgCsDocument pgCsDocument : pgCsDocumentList) { - pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); - } - } - catch(Exception ex) - { - return null; - } - - return pgCsDocumentDtoList; - } -/* -*根据工程名称查找 -*/ - public PgCsDocument getDocByCsName(String cs_name) { - Criteria criteria=createCriteria(PgCsDocument.class); - criteria.add(Restrictions.eq("cs_name",cs_name)); - - List pgCsDocumentList=criteria.list(); - if(pgCsDocumentList.size()==0) - return null; - else - return pgCsDocumentList.get(0); - } -} diff --git a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java index 5c7d969..975c11b 100644 --- a/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java +++ b/src/main/java/com/casic/PgInterface/devTable/dto/PgAlarmDto.java @@ -112,7 +112,7 @@ this.setAlarmDevName(pgAlarm.getAlarmDevId().getAssetName()); this.setAlarmLocation(pgAlarm.getAlarmDevId().getPosition()); this.setUserName(pgAlarm.getUserId().getUserName()); - + this.setPhoneNumber(pgAlarm.getUserId().getPhoneNumber()); this.setActive(String.valueOf(pgAlarm.getActive())); } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java new file mode 100644 index 0000000..dd81cfb --- /dev/null +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgAlarmManager.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.devTable.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Created by yxw on 2017/10/30. + */ +@Service +public class PgAlarmManager extends HibernateEntityDao { + + private PgAlarmTypeManager pgAlarmTypeManager; + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + //获取当前报警消息列表 + public List getAllAlarm() { + Criteria criteria = createCriteria(PgAlarm.class); + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList = criteria.list(); + List pgAlarmDtoList = new ArrayList(); + for (PgAlarm pgAlarm : pgAlarmList) { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + + public List getAlarmByTypeAndTime(String alarmType,String startTime,String endTime) + { + try { + Criteria criteria = createCriteria(PgAlarm.class); + if (StringUtils.isNotBlank(alarmType)) { + criteria.add(Restrictions.eq("alarmTypeId", pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType))); + } + + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("alarmDate", DateUtils.sdf_day.parse(startTime))); + } + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("alarmDate", calendar.getTime())); + } + criteria.add(Restrictions.eq("active", 1)); + criteria.addOrder(Order.desc("id")); + + List pgAlarmList=criteria.list(); + List pgAlarmDtoList=new ArrayList(); + for(PgAlarm pgAlarm : pgAlarmList) + { + pgAlarmDtoList.add(new PgAlarmDto(pgAlarm)); + } + + return pgAlarmDtoList; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java new file mode 100644 index 0000000..c7b2961 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -0,0 +1,198 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.devTable.domain.PgAlarm; +import com.casic.PgInterface.devTable.dto.PgAlarmDto; +import com.casic.PgInterface.devTable.manager.PgAlarmManager; +import com.casic.PgInterface.devTable.manager.PgAlarmTypeManager; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.patroler.manager.PgUserManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by yxw on 2017/11/4. + */ +@Component +@Path("pgAlarm") +public class PgAlarmRs { + + private static Logger logger = LoggerFactory.getLogger(PgAlarmRs.class); + + private PgAlarmTypeManager pgAlarmTypeManager; + + private PgAlarmManager pgAlarmManager; + + private PgUserManager pgPatrolerManager; + + private PgDeviceManager pgDeviceManager; + + @Resource + public void setPgAlarmManager(PgAlarmManager pgAlarmManager) { + this.pgAlarmManager = pgAlarmManager; + } + + @Resource + public void setPgPatrolerManager(PgUserManager pgPatrolerManager) { + this.pgPatrolerManager = pgPatrolerManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + + @Resource + public void setPgAlarmTypeManager(PgAlarmTypeManager pgAlarmTypeManager) { + this.pgAlarmTypeManager = pgAlarmTypeManager; + } + + /** + * 获取报警信息 + */ + @POST + @Path("getAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmList() throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAllAlarm(); + if (pgAlarmDtoList.size() == 0) + msg = "没有报警信息"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + return resultMap; + } + + /** + * 消除报警信息 + */ + @POST + @Path("clearAlarmInfo") + @Produces(MediaType.APPLICATION_JSON) + public Map clearAlarmList(@FormParam("id") String id) throws Exception { + + Map resultMap = new HashMap(); + String msg = ""; + String result = "false"; + + try { + PgAlarm pgAlarm = new PgAlarm(); + pgAlarm = pgAlarmManager.get(Long.valueOf(id)); + if (pgAlarm == null) { + msg = "不存在该报警信息"; + result = "false"; + } else { + pgAlarm.setActive(0); + pgAlarmManager.save(pgAlarm); + msg = "报警信息清除成功"; + result = "true"; + } + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息清除失败"; + result = "false"; + } + resultMap.put("msg", msg); + resultMap.put("result", result); + return resultMap; + } + + /** + * 新增报警 + */ + @POST + @Path("addAlarm") + @Produces(MediaType.APPLICATION_JSON) + public Map addAlarm(@FormParam("alarmType") String alarmType, + @FormParam("alarmValue") String alarmValue, + @FormParam("alarmDate") String alarmDate, + @FormParam("description") String description, + @FormParam("devCode") String devCode, + @FormParam("userName") String userName) throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + PgAlarm pgAlarm = new PgAlarm(); + if (!pgPatrolerManager.userNameIsExits(userName)) { + result = "false"; + msg = "不存在该用户!"; + } else { + pgAlarm.setAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); + pgAlarm.setAlarmValue(alarmValue); + pgAlarm.setAlarmDate(sdf.parse(alarmDate)); + pgAlarm.setDescription(description); + pgAlarm.setUserId(pgPatrolerManager.getPatrolerByuserName(userName)); + pgAlarm.setAlarmDevId(pgDeviceManager.getDeviceBydevCode(devCode)); + pgAlarm.setActive(1); + + logger.info("成功保存"); + pgAlarmManager.save(pgAlarm); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + /* + * 根据报警类型和时间查询报警记录 + */ + @POST + @Path("getAlarmByTypeOrTime") + @Produces(MediaType.APPLICATION_JSON) + public Map getAlarmByTypeOrTime(@FormParam("alarmType") String alarmType, + @FormParam("startTime") String startTime, + @FormParam("endTime") String endTime) throws Exception { + Map resultMap = new HashMap(); + String msg = ""; + + List pgAlarmDtoList = new ArrayList(); + try { + pgAlarmDtoList = pgAlarmManager.getAlarmByTypeAndTime(alarmType, startTime, endTime); + if (pgAlarmDtoList == null || pgAlarmDtoList.size() == 0) + msg = "报警信息不存在"; + else + msg = "报警信息获取成功"; + } catch (Exception e) { + e.printStackTrace(); + msg = "报警信息获取失败"; + } + + resultMap.put("msg", msg); + resultMap.put("result", pgAlarmDtoList); + + return resultMap; + } + +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java deleted file mode 100644 index eb07aee..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ /dev/null @@ -1,439 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.construction.domain.PgConstruction; -import com.casic.PgInterface.construction.dto.PgConstructTjDto; -import com.casic.PgInterface.construction.dto.PgConstructionDto; -import com.casic.PgInterface.construction.manager.PgConstructionManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import javax.ws.rs.FormParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/27. - */ - -@Component -@Path("pgConstruction") -public class PgConstructionRs { - - private static Logger logger = LoggerFactory.getLogger(PgConstructionRs.class); - - private PgConstructionManager pgConstructionManager; - - @Resource - public void setPgConstructionManager(PgConstructionManager pgConstructionManager) - { - this.pgConstructionManager = pgConstructionManager; - } - - /* - 新建工程 - */ - @POST - @Path("addConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - try { - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; - - }catch (Exception e){ - result = "false"; - msg = "保存失败"; - e.printStackTrace(); - } - resultMap.put("success",result); - resultMap.put("msg",msg); - return resultMap; - } - - /* - 施工信息编辑 - */ - @POST - @Path("editConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map editConstruction(@FormParam("id")String id, - @FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_status")String cs_status, - @FormParam("cs_detail")String cs_detail, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_charge")String cs_charge, - @FormParam("cs_phone")String cs_phone, - @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) - throws Exception{ - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - try { - if (id.equals("")) - { - result = "false"; - msg = "请输入ID"; - }else { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_position(cs_position); - pgConstruction.setCs_status(cs_status); - 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.setCs_region(cs_region); - pgConstruction.setActive(1); - - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "编辑成功"; - } - - }catch (Exception e){ - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - - } - - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("delConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map delConstruction(@FormParam("id")String id) - throws Exception{ - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - try { - PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); - if (pgConstruction == null) - { - result = "false"; - msg = "不存在该施工信息"; - }else - { - pgConstruction.setActive(0); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "成功删除信息"; - } - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "删除失败"; - } - resultMap.put("result", result); - resultMap.put("msg", msg); - return resultMap; - } - - @POST - @Path("queryConstruction") - @Produces(MediaType.APPLICATION_JSON) - public Map queryConstruction(@FormParam("cs_name")String cs_name, - @FormParam("cs_position")String cs_position, - @FormParam("cs_beginTime")String cs_beginTime, - @FormParam("cs_endTime")String cs_endTime, - @FormParam("cs_type")String cs_type - ) - throws Exception{ - - Map resultMap = new HashMap(); - List pgConstructionDtoList = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - String msg = ""; - - try { - pgConstructionDtoList = pgConstructionManager.getConstructByVague(cs_name, cs_position, cs_type, cs_beginTime, cs_endTime); - if (pgConstructionDtoList != null) - { - msg = "获取数据成功"; - }else - { - msg = "没有满足条件的数据"; - } - }catch (Exception e){ - e.printStackTrace(); - } - - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); - return resultMap; - } - - @POST - @Path("constructTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - @POST - @Path("constructTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按天在建工程/完工程统计*/ - @POST - @Path("buildingTjByDay") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByDay(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按周在建工程/完工程统计*/ - @POST - @Path("buildingTjByWeek") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByWeek(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按月在建工程/完工程统计*/ - @POST - @Path("buildingTjByMon") - @Produces(MediaType.APPLICATION_JSON) - public Map buildingTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getBuildingByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按类型统计*/ - @POST - @Path("constructTjByType") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByType(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } - - /*按区域统计*/ - @POST - @Path("constructTjByRegion") - @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByRegion(@FormParam("cs_beginTime") String cs_beginTime)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByRegion(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) - { - e.printStackTrace(); - msg = "获取失败"; - } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java deleted file mode 100644 index b3f303e..0000000 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.casic.PgInterface.rs; - -import com.casic.PgInterface.core.util.StringUtils; -import com.casic.PgInterface.construction.domain.PgCsDocument; -import com.casic.PgInterface.construction.dto.PgCsDocumentDto; -import com.casic.PgInterface.construction.manager.PgCsDocumentManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -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.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by zxh on 2018/3/28. - */ -@Component -@Path("pgCsDocument") -public class PgCsDocumentRs { - - private static Logger logger = LoggerFactory.getLogger(pgStatisticRs.class); - - private PgCsDocumentManager pgCsDocumentManager; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - @Resource - public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { - this.pgCsDocumentManager = pgCsDocumentManager; - } - - /* - 新增&上传 - */ - @POST - @Path("addConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map addConstructDoc( - @FormParam("doc_name") String doc_name, - @FormParam("cs_name") String cs_name, - @FormParam("cs_type") String cs_type, - @FormParam("cs_time") String cs_time, - @FormParam("construct_doc") String fileBuffer)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) - pgCsDocument.setConstruct_doc(""); - else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); - } - - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - - pgCsDocument.setActive(1); - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "保存成功"; - logger.info("保存成功"); - - } catch (Exception ex) { - result = "false"; - msg = "保存失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } - - //编辑施工文档 - @RequestMapping("editConstructDoc") - @ResponseBody - public Map editReservePlan(@FormParam("id") String id, - @RequestParam(value = "doc_name",required = true) String doc_name, - @FormParam("cs_name") String cs_name, - @RequestParam(value = "cs_type",required =false) String cs_type, - @RequestParam(value ="cs_time",required =false) String cs_time) throws Exception { - - Map resultMap = new HashMap(); - String result = ""; - String msg = ""; - - try { - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if (pgCsDocument == null) { - result = "false"; - msg = "不存在该预案信息"; - } else { - pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - pgCsDocument.setActive(1); - - pgCsDocumentManager.save(pgCsDocument); - - result = "true"; - msg = "编辑成功"; - } - } catch (Exception e) { - - result = "false"; - msg = "编辑失败"; - e.printStackTrace(); - } - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - //删除预案文档 - @RequestMapping("delConstructDoc") - @ResponseBody - public Map deleteReservePlan(@FormParam("id") String id)throws Exception{ - Map resultMap = new HashMap(); - String msg=""; - String result=""; - - try{ - - PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); - if(pgCsDocument==null) - { - result="false"; - msg="不存在该预案信息"; - } - else{ - pgCsDocument.setActive(0); - pgCsDocumentManager.save(pgCsDocument); - result="true"; - msg="删除成功"; - } - } - catch(Exception e) - { - e.printStackTrace(); - msg="预案删除失败"; - result="false"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - - } - - /* - 按工程名称、工程类别、施工时间查询 - */ - @RequestMapping("queryConstructDoc") - @ResponseBody - public Map queryConstructDoc(@FormParam("cs_name")String cs_name, - @FormParam("cs_type")String cs_type, - @FormParam("cs_time")String cs_time) - throws Exception{ - - Map resultMap = new HashMap(); - List pgCsDocumentDtoList = new ArrayList(); - - String msg=""; - String result=""; - - try { - pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); - if (pgCsDocumentDtoList != null) - { - result = "true"; - msg = "获取数据成功"; - }else - { - result = "false"; - msg = "没有满足条件的数据"; - } - - }catch (Exception e){ - e.printStackTrace(); - result = "false"; - msg = "获取失败"; - } - - resultMap.put("msg",msg); - resultMap.put("result",result); - return resultMap; - } - - @POST - @Path("downLoadConstructDoc") - @Produces(MediaType.APPLICATION_JSON) - public Map downLoadConstructDoc( - @FormParam("cs_type")String cs_type, - @FormParam("doc_name") String doc_name)throws Exception { - Map resultMap = new HashMap(); - PgCsDocument pgCsDocument = new PgCsDocument(); - - String result = ""; - String msg = ""; - - try { - if (doc_name != null) { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type)); - - result = "true"; - msg = "下载成功"; - logger.info("下载成功"); - } - else - { - result = "false"; - msg = "文件名不能为空"; - logger.info("文件名不能为空"); - } - - } catch (Exception ex) { - result = "false"; - msg = "下载失败"; - ex.printStackTrace(); - } - - resultMap.put("success", result); - resultMap.put("msg", msg); - return resultMap; - } -} diff --git a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java index 42914cf..f67760b 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgInPgPersonRs.java @@ -206,7 +206,7 @@ /** * 根据时间统计入廊人员次数 */ -/* + /* @POST @Path("getInPgPersonByTime") @Produces(MediaType.APPLICATION_JSON) @@ -230,5 +230,5 @@ resultMap.put("result", pgInPgPersonDtoList); return resultMap; } -*/ + */ } diff --git a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java index 1a9138a..27b1482 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgReserveController.java +++ b/src/main/java/com/casic/PgInterface/rs/PgReserveController.java @@ -115,12 +115,11 @@ pgReservePlan.setResUnit(resUnit); pgReservePlan.setPgAlarmTypeId(pgAlarmTypeManager.getAlarmTypeByAlarmType(alarmType)); pgReservePlan.setActive(1); - pgReservePlanManager.save(pgReservePlan); result = "true"; msg = "保存成功"; logger.info("保存成功"); - +// pgReservePlanManager.save(pgReservePlan); } catch (Exception ex) { result = "false"; msg = "保存失败"; diff --git a/src/main/java/com/casic/PgInterface/rs/test.java b/src/main/java/com/casic/PgInterface/rs/test.java deleted file mode 100644 index 1bb1ae8..0000000 --- a/src/main/java/com/casic/PgInterface/rs/test.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.casic.PgInterface.rs; - -import java.net.HttpURLConnection; -import java.net.URL; -import java.io.BufferedOutputStream; -import java.io.BufferedInputStream; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.File; - -/** - * Created by Administrator on 2018/4/2. - */ -public class test { - public static File saveUrlAs(String url, String filePath, String method) { - //System.out.println("fileName---->"+filePath); - //创建不同的文件夹目录 - File file = new File(filePath); - //判断文件夹是否存在 - if (!file.exists()) { - //如果文件夹不存在,则创建新的的文件夹 - file.mkdirs(); - } - FileOutputStream fileOut = null; - HttpURLConnection conn = null; - InputStream inputStream = null; - try{ - // 建立链接 - URL httpUrl = new URL(url); - conn = (HttpURLConnection) httpUrl.openConnection(); - //以Post方式提交表单,默认get方式 - conn.setRequestMethod(method); - conn.setDoInput(true); - conn.setDoOutput(true); - // post方式不能使用缓存 - conn.setUseCaches(false); - //连接指定的资源 - conn.connect(); - //获取网络输入流 - inputStream = conn.getInputStream(); - BufferedInputStream bis = new BufferedInputStream(inputStream); - //判断文件的保存路径后面是否以/结尾 - if (!filePath.endsWith("/")) { - - filePath += "/"; - - - } - //写入到文件(注意文件保存路径的后面一定要加上文件的名称) - fileOut = new FileOutputStream(filePath + "123.png"); - BufferedOutputStream bos = new BufferedOutputStream(fileOut); - - byte[] buf = new byte[4096]; - int length = bis.read(buf); - //保存文件 - while (length != -1) { - bos.write(buf, 0, length); - length = bis.read(buf); - - } - bos.close(); - bis.close(); - conn.disconnect(); - - } - - catch( - Exception e - ) - - { - e.printStackTrace(); - System.out.println("抛出异常!!"); - - } - - return file; - -} - -} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 714f72d..5f21060 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -41,7 +41,7 @@ hibernate.show_sql=true hibernate.format_sql=true hibernate.generate_statistics=true -hibernate.hbm2ddl.auto=update +#hibernate.hbm2ddl.auto=create # ============================================================================ diff --git "a/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" new file mode 100644 index 0000000..e69de29 --- /dev/null +++ "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index 2de346f..e69de29 100644 --- "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ diff --git a/~WRL1033.tmp b/~WRL1033.tmp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/~WRL1033.tmp