diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return active; } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return active; } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java index a092f0e..c5ac9f9 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -11,7 +11,6 @@ private String id; private String cs_name;//项目名称 - private String cs_position;//施工位置 private String cs_status;//项目状态 private String cs_detail;//施工内容 private String cs_beginTime;//施工开始时间 @@ -19,7 +18,7 @@ private String cs_charge;//施工负责人 private String cs_phone;//联系方式 private String cs_type;//工程类别 - private String cs_region;//施工区域 + private String parName;//施工区域 private String active;//状态位 public String getId() { @@ -38,14 +37,6 @@ 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; } @@ -102,12 +93,12 @@ this.cs_type = cs_type; } - public String getCs_region() { - return cs_region; + public String getParName() { + return parName; } - public void setCs_region(String cs_region) { - this.cs_region = cs_region; + public void setParName(String parName) { + this.parName = parName; } public String getActive(){ return active; } @@ -120,7 +111,6 @@ 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())); @@ -128,8 +118,7 @@ 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.setParName(pgConstruction.getPgPartitionId().getParName()); this.setActive(String.valueOf(pgConstruction.getActive())); - } } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java index a092f0e..c5ac9f9 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -11,7 +11,6 @@ private String id; private String cs_name;//项目名称 - private String cs_position;//施工位置 private String cs_status;//项目状态 private String cs_detail;//施工内容 private String cs_beginTime;//施工开始时间 @@ -19,7 +18,7 @@ private String cs_charge;//施工负责人 private String cs_phone;//联系方式 private String cs_type;//工程类别 - private String cs_region;//施工区域 + private String parName;//施工区域 private String active;//状态位 public String getId() { @@ -38,14 +37,6 @@ 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; } @@ -102,12 +93,12 @@ this.cs_type = cs_type; } - public String getCs_region() { - return cs_region; + public String getParName() { + return parName; } - public void setCs_region(String cs_region) { - this.cs_region = cs_region; + public void setParName(String parName) { + this.parName = parName; } public String getActive(){ return active; } @@ -120,7 +111,6 @@ 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())); @@ -128,8 +118,7 @@ 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.setParName(pgConstruction.getPgPartitionId().getParName()); 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 index 598380f..e9886fb 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -18,7 +18,6 @@ private String construct_doc;//施工文档 private String active;//状态位 - public String getId() { return id; } @@ -65,13 +64,13 @@ public PgCsDocumentDto (PgCsDocument pgCsDocument) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 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.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); + this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getPgConstructionId().getCs_beginTime())); this.setConstruct_doc(pgCsDocument.getConstruct_doc()); this.setActive(String.valueOf(pgCsDocument.getActive())); diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java index a092f0e..c5ac9f9 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -11,7 +11,6 @@ private String id; private String cs_name;//项目名称 - private String cs_position;//施工位置 private String cs_status;//项目状态 private String cs_detail;//施工内容 private String cs_beginTime;//施工开始时间 @@ -19,7 +18,7 @@ private String cs_charge;//施工负责人 private String cs_phone;//联系方式 private String cs_type;//工程类别 - private String cs_region;//施工区域 + private String parName;//施工区域 private String active;//状态位 public String getId() { @@ -38,14 +37,6 @@ 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; } @@ -102,12 +93,12 @@ this.cs_type = cs_type; } - public String getCs_region() { - return cs_region; + public String getParName() { + return parName; } - public void setCs_region(String cs_region) { - this.cs_region = cs_region; + public void setParName(String parName) { + this.parName = parName; } public String getActive(){ return active; } @@ -120,7 +111,6 @@ 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())); @@ -128,8 +118,7 @@ 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.setParName(pgConstruction.getPgPartitionId().getParName()); 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 index 598380f..e9886fb 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -18,7 +18,6 @@ private String construct_doc;//施工文档 private String active;//状态位 - public String getId() { return id; } @@ -65,13 +64,13 @@ public PgCsDocumentDto (PgCsDocument pgCsDocument) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 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.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); + this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getPgConstructionId().getCs_beginTime())); 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 index 09468a4..5b90c2b 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -1,279 +1,176 @@ 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.construction.dto.PgConstructionDto; +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.PgPartition; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; +import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; -import org.hibernate.Query; -import java.util.Calendar; +import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; /** * Created by zxh on 2018/3/23. */ @Service -public class PgConstructionManager extends HibernateEntityDao{ +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 month = calendar_now.get(Calendar.MONTH) + 1; int day = calendar_now.get(Calendar.DAY_OF_MONTH); String date_now = String.valueOf(year + "-" + month + "-" + day); + private PgPartitionManager pgPartitionManager; + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + public PgConstruction getPgContructionByName(String name) { + Criteria criteria = createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", name)); + criteria.add(Restrictions.eq("active", 1)); - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + List pgConstructionList = criteria.list(); - List pgConstructionDtoList = new ArrayList(); + if (pgConstructionList == null) + return null; + else + return pgConstructionList.get(0); + } + + public List getPgContructionByNameOrType(String cs_name, String cs_type, PgPartition pgPartition, String startTime, String endTime) { 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)); + Criteria criteria = createCriteria(PgConstruction.class); + criteria.addOrder(Order.desc("id")); + if (pgPartition != null) + criteria.add(Restrictions.eq("pgPartitionId", pgPartition)); + if (StringUtils.isNotBlank(cs_name)) + criteria.add(Restrictions.eq("cs_name", cs_name)); + if (StringUtils.isNotBlank(cs_type)) + criteria.add(Restrictions.eq("cs_type", cs_type)); - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf_day.parse(startTime))); } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("cs_beginTime", calendar.getTime())); } + return criteria.list(); - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return null; } + } + + public List getPgContructionDtoByNameOrType(String cs_name, String cs_type, String parName, String startTime, String endTime) { + + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + + List pgConstructionList = getPgContructionByNameOrType(cs_name, cs_type, pgPartition, startTime, endTime); + List pgConstructionDtoList = new ArrayList(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + return pgConstructionDtoList; } - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); + //yyyy-mm-dd + public List getConstructionByTimeAndStatus(String startTime, String endTime, String statisticType, String constructionStatus) { + String sql = ""; + String dateType = ""; + List pgConstructTjDtoList = new ArrayList(); + + int type = Integer.valueOf(statisticType); + switch (type) { + case 0://年 + dateType = "yyyy"; + break; + case 1://月 + dateType = "yyyy-mm"; + break; + case 2://周 + dateType = "iw"; + break; + case 3://日 + dateType = "yyyy-mm-dd"; + break; + default: + break; + } + sql = "select count(*), to_char(t.CS_BEGINTIME, '" + dateType + "') from PG_CONSTRUCTION t where t.CS_BEGINTIME >= " + + "to_date('" + startTime + "', 'yyyy-mm-dd') and t.CS_BEGINTIME <= to_date('" + endTime + "', 'yyyy-mm-dd') " + + "and t.CS_STATUS = '" + constructionStatus + "' group by to_char(t.CS_BEGINTIME, '" + dateType + "')"; + + List objects = this.getSession().createSQLQuery(sql).list(); + for (int i = 0; i < objects.size(); i++) { + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + pgConstructTjDto.setConstructNum(objects.get(i)[0].toString()); + pgConstructTjDto.setConstructionTime(objects.get(i)[1].toString()); + pgConstructTjDto.setConstructStatus(constructionStatus); + + pgConstructTjDtoList.add(pgConstructTjDto); + } + return pgConstructTjDtoList; + } + + public List getStatisticByPartitionOrType(String statisticType) { + List pgConstructTjDtoList = new ArrayList(); + String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + try { + + String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + "group by pgConstruction." + str; + + List objects=this.getSession().createQuery(hql).list(); + for(int i=0;i getConstructionToday() { + List pgConstructionDtoList = new ArrayList(); + Criteria criteria = createCriteria(PgConstruction.class); 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); + List pgConstructionList = criteria.list(); + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } 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/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java index a092f0e..c5ac9f9 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -11,7 +11,6 @@ private String id; private String cs_name;//项目名称 - private String cs_position;//施工位置 private String cs_status;//项目状态 private String cs_detail;//施工内容 private String cs_beginTime;//施工开始时间 @@ -19,7 +18,7 @@ private String cs_charge;//施工负责人 private String cs_phone;//联系方式 private String cs_type;//工程类别 - private String cs_region;//施工区域 + private String parName;//施工区域 private String active;//状态位 public String getId() { @@ -38,14 +37,6 @@ 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; } @@ -102,12 +93,12 @@ this.cs_type = cs_type; } - public String getCs_region() { - return cs_region; + public String getParName() { + return parName; } - public void setCs_region(String cs_region) { - this.cs_region = cs_region; + public void setParName(String parName) { + this.parName = parName; } public String getActive(){ return active; } @@ -120,7 +111,6 @@ 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())); @@ -128,8 +118,7 @@ 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.setParName(pgConstruction.getPgPartitionId().getParName()); 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 index 598380f..e9886fb 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -18,7 +18,6 @@ private String construct_doc;//施工文档 private String active;//状态位 - public String getId() { return id; } @@ -65,13 +64,13 @@ public PgCsDocumentDto (PgCsDocument pgCsDocument) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 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.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); + this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getPgConstructionId().getCs_beginTime())); 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 index 09468a4..5b90c2b 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -1,279 +1,176 @@ 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.construction.dto.PgConstructionDto; +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.PgPartition; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; +import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; -import org.hibernate.Query; -import java.util.Calendar; +import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; /** * Created by zxh on 2018/3/23. */ @Service -public class PgConstructionManager extends HibernateEntityDao{ +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 month = calendar_now.get(Calendar.MONTH) + 1; int day = calendar_now.get(Calendar.DAY_OF_MONTH); String date_now = String.valueOf(year + "-" + month + "-" + day); + private PgPartitionManager pgPartitionManager; + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + public PgConstruction getPgContructionByName(String name) { + Criteria criteria = createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", name)); + criteria.add(Restrictions.eq("active", 1)); - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + List pgConstructionList = criteria.list(); - List pgConstructionDtoList = new ArrayList(); + if (pgConstructionList == null) + return null; + else + return pgConstructionList.get(0); + } + + public List getPgContructionByNameOrType(String cs_name, String cs_type, PgPartition pgPartition, String startTime, String endTime) { 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)); + Criteria criteria = createCriteria(PgConstruction.class); + criteria.addOrder(Order.desc("id")); + if (pgPartition != null) + criteria.add(Restrictions.eq("pgPartitionId", pgPartition)); + if (StringUtils.isNotBlank(cs_name)) + criteria.add(Restrictions.eq("cs_name", cs_name)); + if (StringUtils.isNotBlank(cs_type)) + criteria.add(Restrictions.eq("cs_type", cs_type)); - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf_day.parse(startTime))); } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("cs_beginTime", calendar.getTime())); } + return criteria.list(); - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return null; } + } + + public List getPgContructionDtoByNameOrType(String cs_name, String cs_type, String parName, String startTime, String endTime) { + + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + + List pgConstructionList = getPgContructionByNameOrType(cs_name, cs_type, pgPartition, startTime, endTime); + List pgConstructionDtoList = new ArrayList(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + return pgConstructionDtoList; } - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); + //yyyy-mm-dd + public List getConstructionByTimeAndStatus(String startTime, String endTime, String statisticType, String constructionStatus) { + String sql = ""; + String dateType = ""; + List pgConstructTjDtoList = new ArrayList(); + + int type = Integer.valueOf(statisticType); + switch (type) { + case 0://年 + dateType = "yyyy"; + break; + case 1://月 + dateType = "yyyy-mm"; + break; + case 2://周 + dateType = "iw"; + break; + case 3://日 + dateType = "yyyy-mm-dd"; + break; + default: + break; + } + sql = "select count(*), to_char(t.CS_BEGINTIME, '" + dateType + "') from PG_CONSTRUCTION t where t.CS_BEGINTIME >= " + + "to_date('" + startTime + "', 'yyyy-mm-dd') and t.CS_BEGINTIME <= to_date('" + endTime + "', 'yyyy-mm-dd') " + + "and t.CS_STATUS = '" + constructionStatus + "' group by to_char(t.CS_BEGINTIME, '" + dateType + "')"; + + List objects = this.getSession().createSQLQuery(sql).list(); + for (int i = 0; i < objects.size(); i++) { + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + pgConstructTjDto.setConstructNum(objects.get(i)[0].toString()); + pgConstructTjDto.setConstructionTime(objects.get(i)[1].toString()); + pgConstructTjDto.setConstructStatus(constructionStatus); + + pgConstructTjDtoList.add(pgConstructTjDto); + } + return pgConstructTjDtoList; + } + + public List getStatisticByPartitionOrType(String statisticType) { + List pgConstructTjDtoList = new ArrayList(); + String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + try { + + String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + "group by pgConstruction." + str; + + List objects=this.getSession().createQuery(hql).list(); + for(int i=0;i getConstructionToday() { + List pgConstructionDtoList = new ArrayList(); + Criteria criteria = createCriteria(PgConstruction.class); 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); + List pgConstructionList = criteria.list(); + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } 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 index 12f3042..68d1c49 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java @@ -1,27 +1,22 @@ package com.casic.PgInterface.construction.manager; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.domain.PgCsDocument; 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.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; 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.annotation.Resource; 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; @@ -32,6 +27,13 @@ @Service public class PgCsDocumentManager extends HibernateEntityDao{ + private PgConstructionManager pgConstructionManager; + + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { + this.pgConstructionManager = pgConstructionManager; + } + public String saveFiles(List files,String fileType){ String [] fileNames = new String[files.size()]; String [] fileBuffers = new String[files.size()]; @@ -70,7 +72,6 @@ } } - public String saveFiles(String fileBuffer, String fileName, String fileType){ try { @@ -134,43 +135,32 @@ } /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { + public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) { 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)); + List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name, cs_type, null,startTime, endTime); + if(pgConstructionList==null||pgConstructionList.size()==0) + return null; + else + { + List pgCsDocumentList=new ArrayList(); + for(PgConstruction pgConstruction : pgConstructionList) + { + String hql="select * from PgCsDocument pgCsDocument where pgCsDocument.pgConstructionId = " + pgConstruction; + List pgCsDocuments=this.getSession().createQuery(hql).list(); - 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) - { + for(PgCsDocument pgCsDocument : pgCsDocuments) + { + pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); + } + } + return pgCsDocumentDtoList; + } + } 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/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java index a092f0e..c5ac9f9 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -11,7 +11,6 @@ private String id; private String cs_name;//项目名称 - private String cs_position;//施工位置 private String cs_status;//项目状态 private String cs_detail;//施工内容 private String cs_beginTime;//施工开始时间 @@ -19,7 +18,7 @@ private String cs_charge;//施工负责人 private String cs_phone;//联系方式 private String cs_type;//工程类别 - private String cs_region;//施工区域 + private String parName;//施工区域 private String active;//状态位 public String getId() { @@ -38,14 +37,6 @@ 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; } @@ -102,12 +93,12 @@ this.cs_type = cs_type; } - public String getCs_region() { - return cs_region; + public String getParName() { + return parName; } - public void setCs_region(String cs_region) { - this.cs_region = cs_region; + public void setParName(String parName) { + this.parName = parName; } public String getActive(){ return active; } @@ -120,7 +111,6 @@ 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())); @@ -128,8 +118,7 @@ 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.setParName(pgConstruction.getPgPartitionId().getParName()); 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 index 598380f..e9886fb 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -18,7 +18,6 @@ private String construct_doc;//施工文档 private String active;//状态位 - public String getId() { return id; } @@ -65,13 +64,13 @@ public PgCsDocumentDto (PgCsDocument pgCsDocument) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 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.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); + this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getPgConstructionId().getCs_beginTime())); 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 index 09468a4..5b90c2b 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -1,279 +1,176 @@ 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.construction.dto.PgConstructionDto; +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.PgPartition; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; +import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; -import org.hibernate.Query; -import java.util.Calendar; +import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; /** * Created by zxh on 2018/3/23. */ @Service -public class PgConstructionManager extends HibernateEntityDao{ +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 month = calendar_now.get(Calendar.MONTH) + 1; int day = calendar_now.get(Calendar.DAY_OF_MONTH); String date_now = String.valueOf(year + "-" + month + "-" + day); + private PgPartitionManager pgPartitionManager; + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + public PgConstruction getPgContructionByName(String name) { + Criteria criteria = createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", name)); + criteria.add(Restrictions.eq("active", 1)); - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + List pgConstructionList = criteria.list(); - List pgConstructionDtoList = new ArrayList(); + if (pgConstructionList == null) + return null; + else + return pgConstructionList.get(0); + } + + public List getPgContructionByNameOrType(String cs_name, String cs_type, PgPartition pgPartition, String startTime, String endTime) { 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)); + Criteria criteria = createCriteria(PgConstruction.class); + criteria.addOrder(Order.desc("id")); + if (pgPartition != null) + criteria.add(Restrictions.eq("pgPartitionId", pgPartition)); + if (StringUtils.isNotBlank(cs_name)) + criteria.add(Restrictions.eq("cs_name", cs_name)); + if (StringUtils.isNotBlank(cs_type)) + criteria.add(Restrictions.eq("cs_type", cs_type)); - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf_day.parse(startTime))); } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("cs_beginTime", calendar.getTime())); } + return criteria.list(); - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return null; } + } + + public List getPgContructionDtoByNameOrType(String cs_name, String cs_type, String parName, String startTime, String endTime) { + + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + + List pgConstructionList = getPgContructionByNameOrType(cs_name, cs_type, pgPartition, startTime, endTime); + List pgConstructionDtoList = new ArrayList(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + return pgConstructionDtoList; } - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); + //yyyy-mm-dd + public List getConstructionByTimeAndStatus(String startTime, String endTime, String statisticType, String constructionStatus) { + String sql = ""; + String dateType = ""; + List pgConstructTjDtoList = new ArrayList(); + + int type = Integer.valueOf(statisticType); + switch (type) { + case 0://年 + dateType = "yyyy"; + break; + case 1://月 + dateType = "yyyy-mm"; + break; + case 2://周 + dateType = "iw"; + break; + case 3://日 + dateType = "yyyy-mm-dd"; + break; + default: + break; + } + sql = "select count(*), to_char(t.CS_BEGINTIME, '" + dateType + "') from PG_CONSTRUCTION t where t.CS_BEGINTIME >= " + + "to_date('" + startTime + "', 'yyyy-mm-dd') and t.CS_BEGINTIME <= to_date('" + endTime + "', 'yyyy-mm-dd') " + + "and t.CS_STATUS = '" + constructionStatus + "' group by to_char(t.CS_BEGINTIME, '" + dateType + "')"; + + List objects = this.getSession().createSQLQuery(sql).list(); + for (int i = 0; i < objects.size(); i++) { + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + pgConstructTjDto.setConstructNum(objects.get(i)[0].toString()); + pgConstructTjDto.setConstructionTime(objects.get(i)[1].toString()); + pgConstructTjDto.setConstructStatus(constructionStatus); + + pgConstructTjDtoList.add(pgConstructTjDto); + } + return pgConstructTjDtoList; + } + + public List getStatisticByPartitionOrType(String statisticType) { + List pgConstructTjDtoList = new ArrayList(); + String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + try { + + String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + "group by pgConstruction." + str; + + List objects=this.getSession().createQuery(hql).list(); + for(int i=0;i getConstructionToday() { + List pgConstructionDtoList = new ArrayList(); + Criteria criteria = createCriteria(PgConstruction.class); 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); + List pgConstructionList = criteria.list(); + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } 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 index 12f3042..68d1c49 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java @@ -1,27 +1,22 @@ package com.casic.PgInterface.construction.manager; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.domain.PgCsDocument; 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.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; 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.annotation.Resource; 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; @@ -32,6 +27,13 @@ @Service public class PgCsDocumentManager extends HibernateEntityDao{ + private PgConstructionManager pgConstructionManager; + + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { + this.pgConstructionManager = pgConstructionManager; + } + public String saveFiles(List files,String fileType){ String [] fileNames = new String[files.size()]; String [] fileBuffers = new String[files.size()]; @@ -70,7 +72,6 @@ } } - public String saveFiles(String fileBuffer, String fileName, String fileType){ try { @@ -134,43 +135,32 @@ } /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { + public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) { 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)); + List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name, cs_type, null,startTime, endTime); + if(pgConstructionList==null||pgConstructionList.size()==0) + return null; + else + { + List pgCsDocumentList=new ArrayList(); + for(PgConstruction pgConstruction : pgConstructionList) + { + String hql="select * from PgCsDocument pgCsDocument where pgCsDocument.pgConstructionId = " + pgConstruction; + List pgCsDocuments=this.getSession().createQuery(hql).list(); - 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) - { + for(PgCsDocument pgCsDocument : pgCsDocuments) + { + pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); + } + } + return pgCsDocumentDtoList; + } + } 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/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java index d209733..5545fac 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java @@ -1,5 +1,7 @@ package com.casic.PgInterface.devTable.domain; +import com.casic.PgInterface.construction.domain.PgConstruction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -26,6 +28,7 @@ private String material;//建设材质 private int active;//状态位 private List pipeGalleryList;//管廊仓 + private List pgConstructionList;//施工 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID") @@ -127,5 +130,12 @@ this.pipeGalleryList = pipeGalleryList; } + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId") + public List getPgConstructionList() { + return pgConstructionList; + } + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java index a092f0e..c5ac9f9 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -11,7 +11,6 @@ private String id; private String cs_name;//项目名称 - private String cs_position;//施工位置 private String cs_status;//项目状态 private String cs_detail;//施工内容 private String cs_beginTime;//施工开始时间 @@ -19,7 +18,7 @@ private String cs_charge;//施工负责人 private String cs_phone;//联系方式 private String cs_type;//工程类别 - private String cs_region;//施工区域 + private String parName;//施工区域 private String active;//状态位 public String getId() { @@ -38,14 +37,6 @@ 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; } @@ -102,12 +93,12 @@ this.cs_type = cs_type; } - public String getCs_region() { - return cs_region; + public String getParName() { + return parName; } - public void setCs_region(String cs_region) { - this.cs_region = cs_region; + public void setParName(String parName) { + this.parName = parName; } public String getActive(){ return active; } @@ -120,7 +111,6 @@ 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())); @@ -128,8 +118,7 @@ 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.setParName(pgConstruction.getPgPartitionId().getParName()); 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 index 598380f..e9886fb 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -18,7 +18,6 @@ private String construct_doc;//施工文档 private String active;//状态位 - public String getId() { return id; } @@ -65,13 +64,13 @@ public PgCsDocumentDto (PgCsDocument pgCsDocument) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 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.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); + this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getPgConstructionId().getCs_beginTime())); 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 index 09468a4..5b90c2b 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -1,279 +1,176 @@ 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.construction.dto.PgConstructionDto; +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.PgPartition; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; +import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; -import org.hibernate.Query; -import java.util.Calendar; +import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; /** * Created by zxh on 2018/3/23. */ @Service -public class PgConstructionManager extends HibernateEntityDao{ +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 month = calendar_now.get(Calendar.MONTH) + 1; int day = calendar_now.get(Calendar.DAY_OF_MONTH); String date_now = String.valueOf(year + "-" + month + "-" + day); + private PgPartitionManager pgPartitionManager; + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + public PgConstruction getPgContructionByName(String name) { + Criteria criteria = createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", name)); + criteria.add(Restrictions.eq("active", 1)); - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + List pgConstructionList = criteria.list(); - List pgConstructionDtoList = new ArrayList(); + if (pgConstructionList == null) + return null; + else + return pgConstructionList.get(0); + } + + public List getPgContructionByNameOrType(String cs_name, String cs_type, PgPartition pgPartition, String startTime, String endTime) { 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)); + Criteria criteria = createCriteria(PgConstruction.class); + criteria.addOrder(Order.desc("id")); + if (pgPartition != null) + criteria.add(Restrictions.eq("pgPartitionId", pgPartition)); + if (StringUtils.isNotBlank(cs_name)) + criteria.add(Restrictions.eq("cs_name", cs_name)); + if (StringUtils.isNotBlank(cs_type)) + criteria.add(Restrictions.eq("cs_type", cs_type)); - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf_day.parse(startTime))); } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("cs_beginTime", calendar.getTime())); } + return criteria.list(); - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return null; } + } + + public List getPgContructionDtoByNameOrType(String cs_name, String cs_type, String parName, String startTime, String endTime) { + + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + + List pgConstructionList = getPgContructionByNameOrType(cs_name, cs_type, pgPartition, startTime, endTime); + List pgConstructionDtoList = new ArrayList(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + return pgConstructionDtoList; } - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); + //yyyy-mm-dd + public List getConstructionByTimeAndStatus(String startTime, String endTime, String statisticType, String constructionStatus) { + String sql = ""; + String dateType = ""; + List pgConstructTjDtoList = new ArrayList(); + + int type = Integer.valueOf(statisticType); + switch (type) { + case 0://年 + dateType = "yyyy"; + break; + case 1://月 + dateType = "yyyy-mm"; + break; + case 2://周 + dateType = "iw"; + break; + case 3://日 + dateType = "yyyy-mm-dd"; + break; + default: + break; + } + sql = "select count(*), to_char(t.CS_BEGINTIME, '" + dateType + "') from PG_CONSTRUCTION t where t.CS_BEGINTIME >= " + + "to_date('" + startTime + "', 'yyyy-mm-dd') and t.CS_BEGINTIME <= to_date('" + endTime + "', 'yyyy-mm-dd') " + + "and t.CS_STATUS = '" + constructionStatus + "' group by to_char(t.CS_BEGINTIME, '" + dateType + "')"; + + List objects = this.getSession().createSQLQuery(sql).list(); + for (int i = 0; i < objects.size(); i++) { + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + pgConstructTjDto.setConstructNum(objects.get(i)[0].toString()); + pgConstructTjDto.setConstructionTime(objects.get(i)[1].toString()); + pgConstructTjDto.setConstructStatus(constructionStatus); + + pgConstructTjDtoList.add(pgConstructTjDto); + } + return pgConstructTjDtoList; + } + + public List getStatisticByPartitionOrType(String statisticType) { + List pgConstructTjDtoList = new ArrayList(); + String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + try { + + String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + "group by pgConstruction." + str; + + List objects=this.getSession().createQuery(hql).list(); + for(int i=0;i getConstructionToday() { + List pgConstructionDtoList = new ArrayList(); + Criteria criteria = createCriteria(PgConstruction.class); 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); + List pgConstructionList = criteria.list(); + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } 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 index 12f3042..68d1c49 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java @@ -1,27 +1,22 @@ package com.casic.PgInterface.construction.manager; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.domain.PgCsDocument; 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.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; 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.annotation.Resource; 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; @@ -32,6 +27,13 @@ @Service public class PgCsDocumentManager extends HibernateEntityDao{ + private PgConstructionManager pgConstructionManager; + + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { + this.pgConstructionManager = pgConstructionManager; + } + public String saveFiles(List files,String fileType){ String [] fileNames = new String[files.size()]; String [] fileBuffers = new String[files.size()]; @@ -70,7 +72,6 @@ } } - public String saveFiles(String fileBuffer, String fileName, String fileType){ try { @@ -134,43 +135,32 @@ } /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { + public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) { 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)); + List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name, cs_type, null,startTime, endTime); + if(pgConstructionList==null||pgConstructionList.size()==0) + return null; + else + { + List pgCsDocumentList=new ArrayList(); + for(PgConstruction pgConstruction : pgConstructionList) + { + String hql="select * from PgCsDocument pgCsDocument where pgCsDocument.pgConstructionId = " + pgConstruction; + List pgCsDocuments=this.getSession().createQuery(hql).list(); - 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) - { + for(PgCsDocument pgCsDocument : pgCsDocuments) + { + pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); + } + } + return pgCsDocumentDtoList; + } + } 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/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java index d209733..5545fac 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java @@ -1,5 +1,7 @@ package com.casic.PgInterface.devTable.domain; +import com.casic.PgInterface.construction.domain.PgConstruction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -26,6 +28,7 @@ private String material;//建设材质 private int active;//状态位 private List pipeGalleryList;//管廊仓 + private List pgConstructionList;//施工 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID") @@ -127,5 +130,12 @@ this.pipeGalleryList = pipeGalleryList; } + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId") + public List getPgConstructionList() { + return pgConstructionList; + } + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java index 2f07bee..dabcc7f 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -71,15 +71,16 @@ public List getPgInPersonListByDay() { List pgInPgInfoDtoList = new ArrayList(); - PgInPgInfoDto pgInPgInfoDto = null; + String sql = "select count(*), to_char(t.intime, 'yyyy-mm-dd') from pg_inpg_status t group " + "by to_char(t.intime, 'yyyy-mm-dd')"; List objects = this.getSession().createSQLQuery(sql).list(); for (int i = 0; i < objects.size(); i++) { - pgInPgInfoDto.setInPgNum(String.valueOf(objects.get(i)[0])); - pgInPgInfoDto.setInPgTime(DateUtils.sdf_day.format(objects.get(i)[1])); + PgInPgInfoDto pgInPgInfoDto = new PgInPgInfoDto(); + pgInPgInfoDto.setInPgNum(objects.get(i)[0].toString()); + pgInPgInfoDto.setInPgTime(objects.get(i)[1].toString()); pgInPgInfoDtoList.add(pgInPgInfoDto); } return pgInPgInfoDtoList; diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java index a092f0e..c5ac9f9 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -11,7 +11,6 @@ private String id; private String cs_name;//项目名称 - private String cs_position;//施工位置 private String cs_status;//项目状态 private String cs_detail;//施工内容 private String cs_beginTime;//施工开始时间 @@ -19,7 +18,7 @@ private String cs_charge;//施工负责人 private String cs_phone;//联系方式 private String cs_type;//工程类别 - private String cs_region;//施工区域 + private String parName;//施工区域 private String active;//状态位 public String getId() { @@ -38,14 +37,6 @@ 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; } @@ -102,12 +93,12 @@ this.cs_type = cs_type; } - public String getCs_region() { - return cs_region; + public String getParName() { + return parName; } - public void setCs_region(String cs_region) { - this.cs_region = cs_region; + public void setParName(String parName) { + this.parName = parName; } public String getActive(){ return active; } @@ -120,7 +111,6 @@ 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())); @@ -128,8 +118,7 @@ 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.setParName(pgConstruction.getPgPartitionId().getParName()); 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 index 598380f..e9886fb 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -18,7 +18,6 @@ private String construct_doc;//施工文档 private String active;//状态位 - public String getId() { return id; } @@ -65,13 +64,13 @@ public PgCsDocumentDto (PgCsDocument pgCsDocument) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 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.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); + this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getPgConstructionId().getCs_beginTime())); 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 index 09468a4..5b90c2b 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -1,279 +1,176 @@ 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.construction.dto.PgConstructionDto; +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.PgPartition; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; +import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; -import org.hibernate.Query; -import java.util.Calendar; +import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; /** * Created by zxh on 2018/3/23. */ @Service -public class PgConstructionManager extends HibernateEntityDao{ +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 month = calendar_now.get(Calendar.MONTH) + 1; int day = calendar_now.get(Calendar.DAY_OF_MONTH); String date_now = String.valueOf(year + "-" + month + "-" + day); + private PgPartitionManager pgPartitionManager; + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + public PgConstruction getPgContructionByName(String name) { + Criteria criteria = createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", name)); + criteria.add(Restrictions.eq("active", 1)); - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + List pgConstructionList = criteria.list(); - List pgConstructionDtoList = new ArrayList(); + if (pgConstructionList == null) + return null; + else + return pgConstructionList.get(0); + } + + public List getPgContructionByNameOrType(String cs_name, String cs_type, PgPartition pgPartition, String startTime, String endTime) { 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)); + Criteria criteria = createCriteria(PgConstruction.class); + criteria.addOrder(Order.desc("id")); + if (pgPartition != null) + criteria.add(Restrictions.eq("pgPartitionId", pgPartition)); + if (StringUtils.isNotBlank(cs_name)) + criteria.add(Restrictions.eq("cs_name", cs_name)); + if (StringUtils.isNotBlank(cs_type)) + criteria.add(Restrictions.eq("cs_type", cs_type)); - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf_day.parse(startTime))); } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("cs_beginTime", calendar.getTime())); } + return criteria.list(); - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return null; } + } + + public List getPgContructionDtoByNameOrType(String cs_name, String cs_type, String parName, String startTime, String endTime) { + + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + + List pgConstructionList = getPgContructionByNameOrType(cs_name, cs_type, pgPartition, startTime, endTime); + List pgConstructionDtoList = new ArrayList(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + return pgConstructionDtoList; } - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); + //yyyy-mm-dd + public List getConstructionByTimeAndStatus(String startTime, String endTime, String statisticType, String constructionStatus) { + String sql = ""; + String dateType = ""; + List pgConstructTjDtoList = new ArrayList(); + + int type = Integer.valueOf(statisticType); + switch (type) { + case 0://年 + dateType = "yyyy"; + break; + case 1://月 + dateType = "yyyy-mm"; + break; + case 2://周 + dateType = "iw"; + break; + case 3://日 + dateType = "yyyy-mm-dd"; + break; + default: + break; + } + sql = "select count(*), to_char(t.CS_BEGINTIME, '" + dateType + "') from PG_CONSTRUCTION t where t.CS_BEGINTIME >= " + + "to_date('" + startTime + "', 'yyyy-mm-dd') and t.CS_BEGINTIME <= to_date('" + endTime + "', 'yyyy-mm-dd') " + + "and t.CS_STATUS = '" + constructionStatus + "' group by to_char(t.CS_BEGINTIME, '" + dateType + "')"; + + List objects = this.getSession().createSQLQuery(sql).list(); + for (int i = 0; i < objects.size(); i++) { + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + pgConstructTjDto.setConstructNum(objects.get(i)[0].toString()); + pgConstructTjDto.setConstructionTime(objects.get(i)[1].toString()); + pgConstructTjDto.setConstructStatus(constructionStatus); + + pgConstructTjDtoList.add(pgConstructTjDto); + } + return pgConstructTjDtoList; + } + + public List getStatisticByPartitionOrType(String statisticType) { + List pgConstructTjDtoList = new ArrayList(); + String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + try { + + String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + "group by pgConstruction." + str; + + List objects=this.getSession().createQuery(hql).list(); + for(int i=0;i getConstructionToday() { + List pgConstructionDtoList = new ArrayList(); + Criteria criteria = createCriteria(PgConstruction.class); 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); + List pgConstructionList = criteria.list(); + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } 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 index 12f3042..68d1c49 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java @@ -1,27 +1,22 @@ package com.casic.PgInterface.construction.manager; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.domain.PgCsDocument; 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.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; 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.annotation.Resource; 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; @@ -32,6 +27,13 @@ @Service public class PgCsDocumentManager extends HibernateEntityDao{ + private PgConstructionManager pgConstructionManager; + + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { + this.pgConstructionManager = pgConstructionManager; + } + public String saveFiles(List files,String fileType){ String [] fileNames = new String[files.size()]; String [] fileBuffers = new String[files.size()]; @@ -70,7 +72,6 @@ } } - public String saveFiles(String fileBuffer, String fileName, String fileType){ try { @@ -134,43 +135,32 @@ } /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { + public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) { 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)); + List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name, cs_type, null,startTime, endTime); + if(pgConstructionList==null||pgConstructionList.size()==0) + return null; + else + { + List pgCsDocumentList=new ArrayList(); + for(PgConstruction pgConstruction : pgConstructionList) + { + String hql="select * from PgCsDocument pgCsDocument where pgCsDocument.pgConstructionId = " + pgConstruction; + List pgCsDocuments=this.getSession().createQuery(hql).list(); - 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) - { + for(PgCsDocument pgCsDocument : pgCsDocuments) + { + pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); + } + } + return pgCsDocumentDtoList; + } + } 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/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java index d209733..5545fac 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java @@ -1,5 +1,7 @@ package com.casic.PgInterface.devTable.domain; +import com.casic.PgInterface.construction.domain.PgConstruction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -26,6 +28,7 @@ private String material;//建设材质 private int active;//状态位 private List pipeGalleryList;//管廊仓 + private List pgConstructionList;//施工 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID") @@ -127,5 +130,12 @@ this.pipeGalleryList = pipeGalleryList; } + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId") + public List getPgConstructionList() { + return pgConstructionList; + } + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java index 2f07bee..dabcc7f 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -71,15 +71,16 @@ public List getPgInPersonListByDay() { List pgInPgInfoDtoList = new ArrayList(); - PgInPgInfoDto pgInPgInfoDto = null; + String sql = "select count(*), to_char(t.intime, 'yyyy-mm-dd') from pg_inpg_status t group " + "by to_char(t.intime, 'yyyy-mm-dd')"; List objects = this.getSession().createSQLQuery(sql).list(); for (int i = 0; i < objects.size(); i++) { - pgInPgInfoDto.setInPgNum(String.valueOf(objects.get(i)[0])); - pgInPgInfoDto.setInPgTime(DateUtils.sdf_day.format(objects.get(i)[1])); + PgInPgInfoDto pgInPgInfoDto = new PgInPgInfoDto(); + pgInPgInfoDto.setInPgNum(objects.get(i)[0].toString()); + pgInPgInfoDto.setInPgTime(objects.get(i)[1].toString()); pgInPgInfoDtoList.add(pgInPgInfoDto); } return pgInPgInfoDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index c22aa95..321ebfa 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -93,7 +93,7 @@ default: break; } - sql="select count(*), to_char(t.beginTime, '"+dateType+"') from PG_MAINTAIN t where t.BEGINTIME >= " + + sql="select count(*), to_char(t.BEGINTIME, '"+dateType+"') from PG_MAINTAIN t where t.BEGINTIME >= " + "to_date('"+startTime+"', 'yyyy-mm-dd') and t.BEGINTIME <= to_date('"+endTime+"', 'yyyy-mm-dd') group " + "by to_char(t.BEGINTIME, '"+dateType+"')"; diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java index a092f0e..c5ac9f9 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -11,7 +11,6 @@ private String id; private String cs_name;//项目名称 - private String cs_position;//施工位置 private String cs_status;//项目状态 private String cs_detail;//施工内容 private String cs_beginTime;//施工开始时间 @@ -19,7 +18,7 @@ private String cs_charge;//施工负责人 private String cs_phone;//联系方式 private String cs_type;//工程类别 - private String cs_region;//施工区域 + private String parName;//施工区域 private String active;//状态位 public String getId() { @@ -38,14 +37,6 @@ 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; } @@ -102,12 +93,12 @@ this.cs_type = cs_type; } - public String getCs_region() { - return cs_region; + public String getParName() { + return parName; } - public void setCs_region(String cs_region) { - this.cs_region = cs_region; + public void setParName(String parName) { + this.parName = parName; } public String getActive(){ return active; } @@ -120,7 +111,6 @@ 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())); @@ -128,8 +118,7 @@ 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.setParName(pgConstruction.getPgPartitionId().getParName()); 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 index 598380f..e9886fb 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -18,7 +18,6 @@ private String construct_doc;//施工文档 private String active;//状态位 - public String getId() { return id; } @@ -65,13 +64,13 @@ public PgCsDocumentDto (PgCsDocument pgCsDocument) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 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.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); + this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getPgConstructionId().getCs_beginTime())); 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 index 09468a4..5b90c2b 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -1,279 +1,176 @@ 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.construction.dto.PgConstructionDto; +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.PgPartition; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; +import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; -import org.hibernate.Query; -import java.util.Calendar; +import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; /** * Created by zxh on 2018/3/23. */ @Service -public class PgConstructionManager extends HibernateEntityDao{ +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 month = calendar_now.get(Calendar.MONTH) + 1; int day = calendar_now.get(Calendar.DAY_OF_MONTH); String date_now = String.valueOf(year + "-" + month + "-" + day); + private PgPartitionManager pgPartitionManager; + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + public PgConstruction getPgContructionByName(String name) { + Criteria criteria = createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", name)); + criteria.add(Restrictions.eq("active", 1)); - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + List pgConstructionList = criteria.list(); - List pgConstructionDtoList = new ArrayList(); + if (pgConstructionList == null) + return null; + else + return pgConstructionList.get(0); + } + + public List getPgContructionByNameOrType(String cs_name, String cs_type, PgPartition pgPartition, String startTime, String endTime) { 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)); + Criteria criteria = createCriteria(PgConstruction.class); + criteria.addOrder(Order.desc("id")); + if (pgPartition != null) + criteria.add(Restrictions.eq("pgPartitionId", pgPartition)); + if (StringUtils.isNotBlank(cs_name)) + criteria.add(Restrictions.eq("cs_name", cs_name)); + if (StringUtils.isNotBlank(cs_type)) + criteria.add(Restrictions.eq("cs_type", cs_type)); - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf_day.parse(startTime))); } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("cs_beginTime", calendar.getTime())); } + return criteria.list(); - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return null; } + } + + public List getPgContructionDtoByNameOrType(String cs_name, String cs_type, String parName, String startTime, String endTime) { + + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + + List pgConstructionList = getPgContructionByNameOrType(cs_name, cs_type, pgPartition, startTime, endTime); + List pgConstructionDtoList = new ArrayList(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + return pgConstructionDtoList; } - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); + //yyyy-mm-dd + public List getConstructionByTimeAndStatus(String startTime, String endTime, String statisticType, String constructionStatus) { + String sql = ""; + String dateType = ""; + List pgConstructTjDtoList = new ArrayList(); + + int type = Integer.valueOf(statisticType); + switch (type) { + case 0://年 + dateType = "yyyy"; + break; + case 1://月 + dateType = "yyyy-mm"; + break; + case 2://周 + dateType = "iw"; + break; + case 3://日 + dateType = "yyyy-mm-dd"; + break; + default: + break; + } + sql = "select count(*), to_char(t.CS_BEGINTIME, '" + dateType + "') from PG_CONSTRUCTION t where t.CS_BEGINTIME >= " + + "to_date('" + startTime + "', 'yyyy-mm-dd') and t.CS_BEGINTIME <= to_date('" + endTime + "', 'yyyy-mm-dd') " + + "and t.CS_STATUS = '" + constructionStatus + "' group by to_char(t.CS_BEGINTIME, '" + dateType + "')"; + + List objects = this.getSession().createSQLQuery(sql).list(); + for (int i = 0; i < objects.size(); i++) { + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + pgConstructTjDto.setConstructNum(objects.get(i)[0].toString()); + pgConstructTjDto.setConstructionTime(objects.get(i)[1].toString()); + pgConstructTjDto.setConstructStatus(constructionStatus); + + pgConstructTjDtoList.add(pgConstructTjDto); + } + return pgConstructTjDtoList; + } + + public List getStatisticByPartitionOrType(String statisticType) { + List pgConstructTjDtoList = new ArrayList(); + String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + try { + + String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + "group by pgConstruction." + str; + + List objects=this.getSession().createQuery(hql).list(); + for(int i=0;i getConstructionToday() { + List pgConstructionDtoList = new ArrayList(); + Criteria criteria = createCriteria(PgConstruction.class); 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); + List pgConstructionList = criteria.list(); + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } 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 index 12f3042..68d1c49 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java @@ -1,27 +1,22 @@ package com.casic.PgInterface.construction.manager; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.domain.PgCsDocument; 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.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; 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.annotation.Resource; 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; @@ -32,6 +27,13 @@ @Service public class PgCsDocumentManager extends HibernateEntityDao{ + private PgConstructionManager pgConstructionManager; + + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { + this.pgConstructionManager = pgConstructionManager; + } + public String saveFiles(List files,String fileType){ String [] fileNames = new String[files.size()]; String [] fileBuffers = new String[files.size()]; @@ -70,7 +72,6 @@ } } - public String saveFiles(String fileBuffer, String fileName, String fileType){ try { @@ -134,43 +135,32 @@ } /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { + public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) { 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)); + List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name, cs_type, null,startTime, endTime); + if(pgConstructionList==null||pgConstructionList.size()==0) + return null; + else + { + List pgCsDocumentList=new ArrayList(); + for(PgConstruction pgConstruction : pgConstructionList) + { + String hql="select * from PgCsDocument pgCsDocument where pgCsDocument.pgConstructionId = " + pgConstruction; + List pgCsDocuments=this.getSession().createQuery(hql).list(); - 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) - { + for(PgCsDocument pgCsDocument : pgCsDocuments) + { + pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); + } + } + return pgCsDocumentDtoList; + } + } 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/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java index d209733..5545fac 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java @@ -1,5 +1,7 @@ package com.casic.PgInterface.devTable.domain; +import com.casic.PgInterface.construction.domain.PgConstruction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -26,6 +28,7 @@ private String material;//建设材质 private int active;//状态位 private List pipeGalleryList;//管廊仓 + private List pgConstructionList;//施工 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID") @@ -127,5 +130,12 @@ this.pipeGalleryList = pipeGalleryList; } + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId") + public List getPgConstructionList() { + return pgConstructionList; + } + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java index 2f07bee..dabcc7f 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -71,15 +71,16 @@ public List getPgInPersonListByDay() { List pgInPgInfoDtoList = new ArrayList(); - PgInPgInfoDto pgInPgInfoDto = null; + String sql = "select count(*), to_char(t.intime, 'yyyy-mm-dd') from pg_inpg_status t group " + "by to_char(t.intime, 'yyyy-mm-dd')"; List objects = this.getSession().createSQLQuery(sql).list(); for (int i = 0; i < objects.size(); i++) { - pgInPgInfoDto.setInPgNum(String.valueOf(objects.get(i)[0])); - pgInPgInfoDto.setInPgTime(DateUtils.sdf_day.format(objects.get(i)[1])); + PgInPgInfoDto pgInPgInfoDto = new PgInPgInfoDto(); + pgInPgInfoDto.setInPgNum(objects.get(i)[0].toString()); + pgInPgInfoDto.setInPgTime(objects.get(i)[1].toString()); pgInPgInfoDtoList.add(pgInPgInfoDto); } return pgInPgInfoDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index c22aa95..321ebfa 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -93,7 +93,7 @@ default: break; } - sql="select count(*), to_char(t.beginTime, '"+dateType+"') from PG_MAINTAIN t where t.BEGINTIME >= " + + sql="select count(*), to_char(t.BEGINTIME, '"+dateType+"') from PG_MAINTAIN t where t.BEGINTIME >= " + "to_date('"+startTime+"', 'yyyy-mm-dd') and t.BEGINTIME <= to_date('"+endTime+"', 'yyyy-mm-dd') group " + "by to_char(t.BEGINTIME, '"+dateType+"')"; diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java index 33879a0..6ec29e1 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java @@ -4,7 +4,10 @@ import com.casic.PgInterface.construction.dto.PgConstructTjDto; import com.casic.PgInterface.construction.dto.PgConstructionDto; import com.casic.PgInterface.construction.manager.PgConstructionManager; - +import com.casic.PgInterface.devTable.domain.PgPartition; +import com.casic.PgInterface.devTable.dto.PgDeviceDto; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -33,20 +36,33 @@ private PgConstructionManager pgConstructionManager; + private PgPartitionManager pgPartitionManager; + + private PgDeviceManager pgDeviceManager; + @Resource public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { this.pgConstructionManager = pgConstructionManager; } + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + /* - 新建工程 - */ + *新建工程 + */ @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, @@ -54,16 +70,17 @@ @FormParam("cs_charge")String cs_charge, @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) + @FormParam("parName")String parName) throws Exception{ Map resultMap = new HashMap(); String result = "" ; String msg = "" ; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { + PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + 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)); @@ -71,7 +88,7 @@ pgConstruction.setCs_charge(cs_charge); pgConstruction.setCs_phone(cs_phone); pgConstruction.setCs_type(cs_type); - pgConstruction.setCs_region(cs_region); + pgConstruction.setPgPartitionId(pgPartition); pgConstruction.setActive(1); logger.info("保存成功"); @@ -97,7 +114,6 @@ @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, @@ -105,7 +121,7 @@ @FormParam("cs_charge")String cs_charge, @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) + @FormParam("parName")String parName) throws Exception{ Map resultMap = new HashMap(); @@ -120,9 +136,10 @@ result = "false"; msg = "请输入ID"; }else { + PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + 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)); @@ -130,7 +147,7 @@ pgConstruction.setCs_charge(cs_charge); pgConstruction.setCs_phone(cs_phone); pgConstruction.setCs_type(cs_type); - pgConstruction.setCs_region(cs_region); + pgConstruction.setPgPartitionId(pgPartition); pgConstruction.setActive(1); pgConstructionManager.save(pgConstruction); @@ -150,6 +167,9 @@ return resultMap; } + /* + 删除信息 + */ @POST @Path("delConstruction") @Produces(MediaType.APPLICATION_JSON) @@ -181,256 +201,146 @@ return resultMap; } + /* + 查询 + */ @POST - @Path("queryConstruction") + @Path("searchConstruction") @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(); + public Map searchConstruction(@FormParam("cs_name")String cs_name, + @FormParam("cs_type")String cs_type, + @FormParam("parName")String parName, + @FormParam("startTime")String startTime, + @FormParam("endTime")String endTime)throws Exception{ + Map resultMap=new HashMap(); + String msg=""; + List pgConstructionDtoList=new ArrayList(); + try{ + pgConstructionDtoList=pgConstructionManager.getPgContructionDtoByNameOrType(cs_name,cs_type,parName,startTime,endTime); + msg="信息获取成功"; } + catch(Exception e) + { + e.printStackTrace(); + msg="查询失败"; + } + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); return resultMap; } + /** + * 根据时间统计施工次数 + */ @POST - @Path("constructTjByDay") + @Path("getConstructionByTimeAndStatus") @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception { + public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime, + @FormParam("endTime") String endTime, + @FormParam("statisticType") String statisticType, + @FormParam("constructionStatus") String constructionStatus) throws Exception { Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) { - msg = "获取成功"; - } else { - msg = "没有符合条件的数据"; - } + List pgConstructTjDtoList=new ArrayList(); + try { + pgConstructTjDtoList = pgConstructionManager.getConstructionByTimeAndStatus(startTime, endTime, statisticType, constructionStatus); + if(pgConstructTjDtoList==null) + msg="施工统计信息获取失败"; + else + msg="施工统计信息获取成功"; } catch (Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg = "施工统计信息获取失败"; } resultMap.put("msg", msg); resultMap.put("result", pgConstructTjDtoList); return resultMap; } + /** + * 工程类别统计 + */ @POST - @Path("constructTjByWeek") + @Path("getConstructionByType") @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 = "没有符合条件的数据"; - } + public Map getConstructionByType(@FormParam("statisticType") String statisticType) throws Exception{ + Map resultMap=new HashMap(); + String msg=""; - }catch(Exception e) + List pgConstructTjDtoList=new ArrayList(); + try{ + pgConstructTjDtoList=pgConstructionManager.getStatisticByPartitionOrType(statisticType); + msg="统计信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="统计失败"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + + resultMap.put("msg",msg); + resultMap.put("result",pgConstructTjDtoList); return resultMap; } + /** + * 当天施工 + */ @POST - @Path("constructTjByMon") + @Path("getConstructionToday") @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 = ""; + public Map getConstructionToday() throws Exception{ + Map resultMap=new HashMap(); + String msg=""; + List pgConstructionDtoList=new ArrayList(); try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) + pgConstructionDtoList = pgConstructionManager.getConstructionToday(); + msg = "当天施工信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="获取失败"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); return resultMap; } - /*按天在建工程/完工程统计*/ +/** + * 获取关联设备《摄像机》 + */ @POST - @Path("buildingTjByDay") + @Path("getConstructionDev") @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 = "没有符合条件的数据"; - } + public Map getConstructionDev(@FormParam("id") String id) throws Exception{ + Map resultMap=new HashMap(); + String msg=""; - }catch(Exception e) + List pgDeviceDtoList =new ArrayList(); + try{ + + PgConstruction pgConstruction=pgConstructionManager.get(Long.valueOf(id)); + + pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(pgConstruction.getPgPartitionId().getParName()); + + if(pgDeviceDtoList==null) + msg="信息获取失败"; + else + msg="信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="设备信息获取成功"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + resultMap.put("msg",msg); + resultMap.put("result",pgDeviceDtoList); + 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_type") String cs_type)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_type); - 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/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java index a092f0e..c5ac9f9 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -11,7 +11,6 @@ private String id; private String cs_name;//项目名称 - private String cs_position;//施工位置 private String cs_status;//项目状态 private String cs_detail;//施工内容 private String cs_beginTime;//施工开始时间 @@ -19,7 +18,7 @@ private String cs_charge;//施工负责人 private String cs_phone;//联系方式 private String cs_type;//工程类别 - private String cs_region;//施工区域 + private String parName;//施工区域 private String active;//状态位 public String getId() { @@ -38,14 +37,6 @@ 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; } @@ -102,12 +93,12 @@ this.cs_type = cs_type; } - public String getCs_region() { - return cs_region; + public String getParName() { + return parName; } - public void setCs_region(String cs_region) { - this.cs_region = cs_region; + public void setParName(String parName) { + this.parName = parName; } public String getActive(){ return active; } @@ -120,7 +111,6 @@ 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())); @@ -128,8 +118,7 @@ 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.setParName(pgConstruction.getPgPartitionId().getParName()); 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 index 598380f..e9886fb 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -18,7 +18,6 @@ private String construct_doc;//施工文档 private String active;//状态位 - public String getId() { return id; } @@ -65,13 +64,13 @@ public PgCsDocumentDto (PgCsDocument pgCsDocument) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 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.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); + this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getPgConstructionId().getCs_beginTime())); 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 index 09468a4..5b90c2b 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -1,279 +1,176 @@ 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.construction.dto.PgConstructionDto; +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.PgPartition; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; +import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; -import org.hibernate.Query; -import java.util.Calendar; +import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; /** * Created by zxh on 2018/3/23. */ @Service -public class PgConstructionManager extends HibernateEntityDao{ +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 month = calendar_now.get(Calendar.MONTH) + 1; int day = calendar_now.get(Calendar.DAY_OF_MONTH); String date_now = String.valueOf(year + "-" + month + "-" + day); + private PgPartitionManager pgPartitionManager; + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + public PgConstruction getPgContructionByName(String name) { + Criteria criteria = createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", name)); + criteria.add(Restrictions.eq("active", 1)); - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + List pgConstructionList = criteria.list(); - List pgConstructionDtoList = new ArrayList(); + if (pgConstructionList == null) + return null; + else + return pgConstructionList.get(0); + } + + public List getPgContructionByNameOrType(String cs_name, String cs_type, PgPartition pgPartition, String startTime, String endTime) { 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)); + Criteria criteria = createCriteria(PgConstruction.class); + criteria.addOrder(Order.desc("id")); + if (pgPartition != null) + criteria.add(Restrictions.eq("pgPartitionId", pgPartition)); + if (StringUtils.isNotBlank(cs_name)) + criteria.add(Restrictions.eq("cs_name", cs_name)); + if (StringUtils.isNotBlank(cs_type)) + criteria.add(Restrictions.eq("cs_type", cs_type)); - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf_day.parse(startTime))); } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("cs_beginTime", calendar.getTime())); } + return criteria.list(); - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return null; } + } + + public List getPgContructionDtoByNameOrType(String cs_name, String cs_type, String parName, String startTime, String endTime) { + + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + + List pgConstructionList = getPgContructionByNameOrType(cs_name, cs_type, pgPartition, startTime, endTime); + List pgConstructionDtoList = new ArrayList(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + return pgConstructionDtoList; } - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); + //yyyy-mm-dd + public List getConstructionByTimeAndStatus(String startTime, String endTime, String statisticType, String constructionStatus) { + String sql = ""; + String dateType = ""; + List pgConstructTjDtoList = new ArrayList(); + + int type = Integer.valueOf(statisticType); + switch (type) { + case 0://年 + dateType = "yyyy"; + break; + case 1://月 + dateType = "yyyy-mm"; + break; + case 2://周 + dateType = "iw"; + break; + case 3://日 + dateType = "yyyy-mm-dd"; + break; + default: + break; + } + sql = "select count(*), to_char(t.CS_BEGINTIME, '" + dateType + "') from PG_CONSTRUCTION t where t.CS_BEGINTIME >= " + + "to_date('" + startTime + "', 'yyyy-mm-dd') and t.CS_BEGINTIME <= to_date('" + endTime + "', 'yyyy-mm-dd') " + + "and t.CS_STATUS = '" + constructionStatus + "' group by to_char(t.CS_BEGINTIME, '" + dateType + "')"; + + List objects = this.getSession().createSQLQuery(sql).list(); + for (int i = 0; i < objects.size(); i++) { + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + pgConstructTjDto.setConstructNum(objects.get(i)[0].toString()); + pgConstructTjDto.setConstructionTime(objects.get(i)[1].toString()); + pgConstructTjDto.setConstructStatus(constructionStatus); + + pgConstructTjDtoList.add(pgConstructTjDto); + } + return pgConstructTjDtoList; + } + + public List getStatisticByPartitionOrType(String statisticType) { + List pgConstructTjDtoList = new ArrayList(); + String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + try { + + String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + "group by pgConstruction." + str; + + List objects=this.getSession().createQuery(hql).list(); + for(int i=0;i getConstructionToday() { + List pgConstructionDtoList = new ArrayList(); + Criteria criteria = createCriteria(PgConstruction.class); 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); + List pgConstructionList = criteria.list(); + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } 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 index 12f3042..68d1c49 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java @@ -1,27 +1,22 @@ package com.casic.PgInterface.construction.manager; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.domain.PgCsDocument; 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.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; 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.annotation.Resource; 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; @@ -32,6 +27,13 @@ @Service public class PgCsDocumentManager extends HibernateEntityDao{ + private PgConstructionManager pgConstructionManager; + + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { + this.pgConstructionManager = pgConstructionManager; + } + public String saveFiles(List files,String fileType){ String [] fileNames = new String[files.size()]; String [] fileBuffers = new String[files.size()]; @@ -70,7 +72,6 @@ } } - public String saveFiles(String fileBuffer, String fileName, String fileType){ try { @@ -134,43 +135,32 @@ } /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { + public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) { 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)); + List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name, cs_type, null,startTime, endTime); + if(pgConstructionList==null||pgConstructionList.size()==0) + return null; + else + { + List pgCsDocumentList=new ArrayList(); + for(PgConstruction pgConstruction : pgConstructionList) + { + String hql="select * from PgCsDocument pgCsDocument where pgCsDocument.pgConstructionId = " + pgConstruction; + List pgCsDocuments=this.getSession().createQuery(hql).list(); - 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) - { + for(PgCsDocument pgCsDocument : pgCsDocuments) + { + pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); + } + } + return pgCsDocumentDtoList; + } + } 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/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java index d209733..5545fac 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java @@ -1,5 +1,7 @@ package com.casic.PgInterface.devTable.domain; +import com.casic.PgInterface.construction.domain.PgConstruction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -26,6 +28,7 @@ private String material;//建设材质 private int active;//状态位 private List pipeGalleryList;//管廊仓 + private List pgConstructionList;//施工 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID") @@ -127,5 +130,12 @@ this.pipeGalleryList = pipeGalleryList; } + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId") + public List getPgConstructionList() { + return pgConstructionList; + } + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java index 2f07bee..dabcc7f 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -71,15 +71,16 @@ public List getPgInPersonListByDay() { List pgInPgInfoDtoList = new ArrayList(); - PgInPgInfoDto pgInPgInfoDto = null; + String sql = "select count(*), to_char(t.intime, 'yyyy-mm-dd') from pg_inpg_status t group " + "by to_char(t.intime, 'yyyy-mm-dd')"; List objects = this.getSession().createSQLQuery(sql).list(); for (int i = 0; i < objects.size(); i++) { - pgInPgInfoDto.setInPgNum(String.valueOf(objects.get(i)[0])); - pgInPgInfoDto.setInPgTime(DateUtils.sdf_day.format(objects.get(i)[1])); + PgInPgInfoDto pgInPgInfoDto = new PgInPgInfoDto(); + pgInPgInfoDto.setInPgNum(objects.get(i)[0].toString()); + pgInPgInfoDto.setInPgTime(objects.get(i)[1].toString()); pgInPgInfoDtoList.add(pgInPgInfoDto); } return pgInPgInfoDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index c22aa95..321ebfa 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -93,7 +93,7 @@ default: break; } - sql="select count(*), to_char(t.beginTime, '"+dateType+"') from PG_MAINTAIN t where t.BEGINTIME >= " + + sql="select count(*), to_char(t.BEGINTIME, '"+dateType+"') from PG_MAINTAIN t where t.BEGINTIME >= " + "to_date('"+startTime+"', 'yyyy-mm-dd') and t.BEGINTIME <= to_date('"+endTime+"', 'yyyy-mm-dd') group " + "by to_char(t.BEGINTIME, '"+dateType+"')"; diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java index 33879a0..6ec29e1 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java @@ -4,7 +4,10 @@ import com.casic.PgInterface.construction.dto.PgConstructTjDto; import com.casic.PgInterface.construction.dto.PgConstructionDto; import com.casic.PgInterface.construction.manager.PgConstructionManager; - +import com.casic.PgInterface.devTable.domain.PgPartition; +import com.casic.PgInterface.devTable.dto.PgDeviceDto; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -33,20 +36,33 @@ private PgConstructionManager pgConstructionManager; + private PgPartitionManager pgPartitionManager; + + private PgDeviceManager pgDeviceManager; + @Resource public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { this.pgConstructionManager = pgConstructionManager; } + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + /* - 新建工程 - */ + *新建工程 + */ @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, @@ -54,16 +70,17 @@ @FormParam("cs_charge")String cs_charge, @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) + @FormParam("parName")String parName) throws Exception{ Map resultMap = new HashMap(); String result = "" ; String msg = "" ; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { + PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + 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)); @@ -71,7 +88,7 @@ pgConstruction.setCs_charge(cs_charge); pgConstruction.setCs_phone(cs_phone); pgConstruction.setCs_type(cs_type); - pgConstruction.setCs_region(cs_region); + pgConstruction.setPgPartitionId(pgPartition); pgConstruction.setActive(1); logger.info("保存成功"); @@ -97,7 +114,6 @@ @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, @@ -105,7 +121,7 @@ @FormParam("cs_charge")String cs_charge, @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) + @FormParam("parName")String parName) throws Exception{ Map resultMap = new HashMap(); @@ -120,9 +136,10 @@ result = "false"; msg = "请输入ID"; }else { + PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + 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)); @@ -130,7 +147,7 @@ pgConstruction.setCs_charge(cs_charge); pgConstruction.setCs_phone(cs_phone); pgConstruction.setCs_type(cs_type); - pgConstruction.setCs_region(cs_region); + pgConstruction.setPgPartitionId(pgPartition); pgConstruction.setActive(1); pgConstructionManager.save(pgConstruction); @@ -150,6 +167,9 @@ return resultMap; } + /* + 删除信息 + */ @POST @Path("delConstruction") @Produces(MediaType.APPLICATION_JSON) @@ -181,256 +201,146 @@ return resultMap; } + /* + 查询 + */ @POST - @Path("queryConstruction") + @Path("searchConstruction") @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(); + public Map searchConstruction(@FormParam("cs_name")String cs_name, + @FormParam("cs_type")String cs_type, + @FormParam("parName")String parName, + @FormParam("startTime")String startTime, + @FormParam("endTime")String endTime)throws Exception{ + Map resultMap=new HashMap(); + String msg=""; + List pgConstructionDtoList=new ArrayList(); + try{ + pgConstructionDtoList=pgConstructionManager.getPgContructionDtoByNameOrType(cs_name,cs_type,parName,startTime,endTime); + msg="信息获取成功"; } + catch(Exception e) + { + e.printStackTrace(); + msg="查询失败"; + } + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); return resultMap; } + /** + * 根据时间统计施工次数 + */ @POST - @Path("constructTjByDay") + @Path("getConstructionByTimeAndStatus") @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception { + public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime, + @FormParam("endTime") String endTime, + @FormParam("statisticType") String statisticType, + @FormParam("constructionStatus") String constructionStatus) throws Exception { Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) { - msg = "获取成功"; - } else { - msg = "没有符合条件的数据"; - } + List pgConstructTjDtoList=new ArrayList(); + try { + pgConstructTjDtoList = pgConstructionManager.getConstructionByTimeAndStatus(startTime, endTime, statisticType, constructionStatus); + if(pgConstructTjDtoList==null) + msg="施工统计信息获取失败"; + else + msg="施工统计信息获取成功"; } catch (Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg = "施工统计信息获取失败"; } resultMap.put("msg", msg); resultMap.put("result", pgConstructTjDtoList); return resultMap; } + /** + * 工程类别统计 + */ @POST - @Path("constructTjByWeek") + @Path("getConstructionByType") @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 = "没有符合条件的数据"; - } + public Map getConstructionByType(@FormParam("statisticType") String statisticType) throws Exception{ + Map resultMap=new HashMap(); + String msg=""; - }catch(Exception e) + List pgConstructTjDtoList=new ArrayList(); + try{ + pgConstructTjDtoList=pgConstructionManager.getStatisticByPartitionOrType(statisticType); + msg="统计信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="统计失败"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + + resultMap.put("msg",msg); + resultMap.put("result",pgConstructTjDtoList); return resultMap; } + /** + * 当天施工 + */ @POST - @Path("constructTjByMon") + @Path("getConstructionToday") @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 = ""; + public Map getConstructionToday() throws Exception{ + Map resultMap=new HashMap(); + String msg=""; + List pgConstructionDtoList=new ArrayList(); try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) + pgConstructionDtoList = pgConstructionManager.getConstructionToday(); + msg = "当天施工信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="获取失败"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); return resultMap; } - /*按天在建工程/完工程统计*/ +/** + * 获取关联设备《摄像机》 + */ @POST - @Path("buildingTjByDay") + @Path("getConstructionDev") @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 = "没有符合条件的数据"; - } + public Map getConstructionDev(@FormParam("id") String id) throws Exception{ + Map resultMap=new HashMap(); + String msg=""; - }catch(Exception e) + List pgDeviceDtoList =new ArrayList(); + try{ + + PgConstruction pgConstruction=pgConstructionManager.get(Long.valueOf(id)); + + pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(pgConstruction.getPgPartitionId().getParName()); + + if(pgDeviceDtoList==null) + msg="信息获取失败"; + else + msg="信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="设备信息获取成功"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + resultMap.put("msg",msg); + resultMap.put("result",pgDeviceDtoList); + 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_type") String cs_type)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_type); - 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 index b3f303e..2e08ac5 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java @@ -1,15 +1,15 @@ package com.casic.PgInterface.rs; -import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.construction.domain.PgConstruction; import com.casic.PgInterface.construction.domain.PgCsDocument; import com.casic.PgInterface.construction.dto.PgCsDocumentDto; +import com.casic.PgInterface.construction.manager.PgConstructionManager; import com.casic.PgInterface.construction.manager.PgCsDocumentManager; - +import com.casic.PgInterface.core.util.StringUtils; 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; @@ -36,11 +36,18 @@ private PgCsDocumentManager pgCsDocumentManager; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + private PgConstructionManager pgConstructionManager; + @Resource public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { this.pgCsDocumentManager = pgCsDocumentManager; } + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { + this.pgConstructionManager = pgConstructionManager; + } + /* 新增&上传 */ @@ -49,10 +56,8 @@ @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 { + @FormParam("construct_doc") String fileBuffer, + @FormParam("cs_name") String cs_name)throws Exception { Map resultMap = new HashMap(); PgCsDocument pgCsDocument = new PgCsDocument(); @@ -66,11 +71,9 @@ pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); } + PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - + pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); pgCsDocumentManager.save(pgCsDocument); @@ -93,10 +96,8 @@ @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 { + @FormParam("doc_name") String doc_name, + @FormParam("cs_name") String cs_name) throws Exception { Map resultMap = new HashMap(); String result = ""; @@ -108,10 +109,9 @@ result = "false"; msg = "不存在该预案信息"; } else { + PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); + pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); pgCsDocumentManager.save(pgCsDocument); @@ -173,7 +173,8 @@ @ResponseBody public Map queryConstructDoc(@FormParam("cs_name")String cs_name, @FormParam("cs_type")String cs_type, - @FormParam("cs_time")String cs_time) + @FormParam("startTime")String startTime, + @FormParam("endTime")String endTime) throws Exception{ Map resultMap = new HashMap(); @@ -183,7 +184,7 @@ String result=""; try { - pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); + pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, startTime,endTime); if (pgCsDocumentDtoList != null) { result = "true"; @@ -201,15 +202,15 @@ } resultMap.put("msg",msg); - resultMap.put("result",result); + resultMap.put("result",pgCsDocumentDtoList); return resultMap; } + @POST @Path("downLoadConstructDoc") @Produces(MediaType.APPLICATION_JSON) - public Map downLoadConstructDoc( - @FormParam("cs_type")String cs_type, + 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(); @@ -242,4 +243,5 @@ resultMap.put("msg", msg); return resultMap; } + } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java index a092f0e..c5ac9f9 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -11,7 +11,6 @@ private String id; private String cs_name;//项目名称 - private String cs_position;//施工位置 private String cs_status;//项目状态 private String cs_detail;//施工内容 private String cs_beginTime;//施工开始时间 @@ -19,7 +18,7 @@ private String cs_charge;//施工负责人 private String cs_phone;//联系方式 private String cs_type;//工程类别 - private String cs_region;//施工区域 + private String parName;//施工区域 private String active;//状态位 public String getId() { @@ -38,14 +37,6 @@ 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; } @@ -102,12 +93,12 @@ this.cs_type = cs_type; } - public String getCs_region() { - return cs_region; + public String getParName() { + return parName; } - public void setCs_region(String cs_region) { - this.cs_region = cs_region; + public void setParName(String parName) { + this.parName = parName; } public String getActive(){ return active; } @@ -120,7 +111,6 @@ 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())); @@ -128,8 +118,7 @@ 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.setParName(pgConstruction.getPgPartitionId().getParName()); 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 index 598380f..e9886fb 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -18,7 +18,6 @@ private String construct_doc;//施工文档 private String active;//状态位 - public String getId() { return id; } @@ -65,13 +64,13 @@ public PgCsDocumentDto (PgCsDocument pgCsDocument) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 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.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); + this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getPgConstructionId().getCs_beginTime())); 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 index 09468a4..5b90c2b 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -1,279 +1,176 @@ 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.construction.dto.PgConstructionDto; +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.PgPartition; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; +import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; -import org.hibernate.Query; -import java.util.Calendar; +import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; /** * Created by zxh on 2018/3/23. */ @Service -public class PgConstructionManager extends HibernateEntityDao{ +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 month = calendar_now.get(Calendar.MONTH) + 1; int day = calendar_now.get(Calendar.DAY_OF_MONTH); String date_now = String.valueOf(year + "-" + month + "-" + day); + private PgPartitionManager pgPartitionManager; + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + public PgConstruction getPgContructionByName(String name) { + Criteria criteria = createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", name)); + criteria.add(Restrictions.eq("active", 1)); - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + List pgConstructionList = criteria.list(); - List pgConstructionDtoList = new ArrayList(); + if (pgConstructionList == null) + return null; + else + return pgConstructionList.get(0); + } + + public List getPgContructionByNameOrType(String cs_name, String cs_type, PgPartition pgPartition, String startTime, String endTime) { 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)); + Criteria criteria = createCriteria(PgConstruction.class); + criteria.addOrder(Order.desc("id")); + if (pgPartition != null) + criteria.add(Restrictions.eq("pgPartitionId", pgPartition)); + if (StringUtils.isNotBlank(cs_name)) + criteria.add(Restrictions.eq("cs_name", cs_name)); + if (StringUtils.isNotBlank(cs_type)) + criteria.add(Restrictions.eq("cs_type", cs_type)); - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf_day.parse(startTime))); } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("cs_beginTime", calendar.getTime())); } + return criteria.list(); - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return null; } + } + + public List getPgContructionDtoByNameOrType(String cs_name, String cs_type, String parName, String startTime, String endTime) { + + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + + List pgConstructionList = getPgContructionByNameOrType(cs_name, cs_type, pgPartition, startTime, endTime); + List pgConstructionDtoList = new ArrayList(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + return pgConstructionDtoList; } - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); + //yyyy-mm-dd + public List getConstructionByTimeAndStatus(String startTime, String endTime, String statisticType, String constructionStatus) { + String sql = ""; + String dateType = ""; + List pgConstructTjDtoList = new ArrayList(); + + int type = Integer.valueOf(statisticType); + switch (type) { + case 0://年 + dateType = "yyyy"; + break; + case 1://月 + dateType = "yyyy-mm"; + break; + case 2://周 + dateType = "iw"; + break; + case 3://日 + dateType = "yyyy-mm-dd"; + break; + default: + break; + } + sql = "select count(*), to_char(t.CS_BEGINTIME, '" + dateType + "') from PG_CONSTRUCTION t where t.CS_BEGINTIME >= " + + "to_date('" + startTime + "', 'yyyy-mm-dd') and t.CS_BEGINTIME <= to_date('" + endTime + "', 'yyyy-mm-dd') " + + "and t.CS_STATUS = '" + constructionStatus + "' group by to_char(t.CS_BEGINTIME, '" + dateType + "')"; + + List objects = this.getSession().createSQLQuery(sql).list(); + for (int i = 0; i < objects.size(); i++) { + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + pgConstructTjDto.setConstructNum(objects.get(i)[0].toString()); + pgConstructTjDto.setConstructionTime(objects.get(i)[1].toString()); + pgConstructTjDto.setConstructStatus(constructionStatus); + + pgConstructTjDtoList.add(pgConstructTjDto); + } + return pgConstructTjDtoList; + } + + public List getStatisticByPartitionOrType(String statisticType) { + List pgConstructTjDtoList = new ArrayList(); + String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + try { + + String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + "group by pgConstruction." + str; + + List objects=this.getSession().createQuery(hql).list(); + for(int i=0;i getConstructionToday() { + List pgConstructionDtoList = new ArrayList(); + Criteria criteria = createCriteria(PgConstruction.class); 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); + List pgConstructionList = criteria.list(); + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } 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 index 12f3042..68d1c49 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java @@ -1,27 +1,22 @@ package com.casic.PgInterface.construction.manager; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.domain.PgCsDocument; 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.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; 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.annotation.Resource; 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; @@ -32,6 +27,13 @@ @Service public class PgCsDocumentManager extends HibernateEntityDao{ + private PgConstructionManager pgConstructionManager; + + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { + this.pgConstructionManager = pgConstructionManager; + } + public String saveFiles(List files,String fileType){ String [] fileNames = new String[files.size()]; String [] fileBuffers = new String[files.size()]; @@ -70,7 +72,6 @@ } } - public String saveFiles(String fileBuffer, String fileName, String fileType){ try { @@ -134,43 +135,32 @@ } /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { + public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) { 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)); + List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name, cs_type, null,startTime, endTime); + if(pgConstructionList==null||pgConstructionList.size()==0) + return null; + else + { + List pgCsDocumentList=new ArrayList(); + for(PgConstruction pgConstruction : pgConstructionList) + { + String hql="select * from PgCsDocument pgCsDocument where pgCsDocument.pgConstructionId = " + pgConstruction; + List pgCsDocuments=this.getSession().createQuery(hql).list(); - 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) - { + for(PgCsDocument pgCsDocument : pgCsDocuments) + { + pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); + } + } + return pgCsDocumentDtoList; + } + } 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/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java index d209733..5545fac 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java @@ -1,5 +1,7 @@ package com.casic.PgInterface.devTable.domain; +import com.casic.PgInterface.construction.domain.PgConstruction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -26,6 +28,7 @@ private String material;//建设材质 private int active;//状态位 private List pipeGalleryList;//管廊仓 + private List pgConstructionList;//施工 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID") @@ -127,5 +130,12 @@ this.pipeGalleryList = pipeGalleryList; } + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId") + public List getPgConstructionList() { + return pgConstructionList; + } + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java index 2f07bee..dabcc7f 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -71,15 +71,16 @@ public List getPgInPersonListByDay() { List pgInPgInfoDtoList = new ArrayList(); - PgInPgInfoDto pgInPgInfoDto = null; + String sql = "select count(*), to_char(t.intime, 'yyyy-mm-dd') from pg_inpg_status t group " + "by to_char(t.intime, 'yyyy-mm-dd')"; List objects = this.getSession().createSQLQuery(sql).list(); for (int i = 0; i < objects.size(); i++) { - pgInPgInfoDto.setInPgNum(String.valueOf(objects.get(i)[0])); - pgInPgInfoDto.setInPgTime(DateUtils.sdf_day.format(objects.get(i)[1])); + PgInPgInfoDto pgInPgInfoDto = new PgInPgInfoDto(); + pgInPgInfoDto.setInPgNum(objects.get(i)[0].toString()); + pgInPgInfoDto.setInPgTime(objects.get(i)[1].toString()); pgInPgInfoDtoList.add(pgInPgInfoDto); } return pgInPgInfoDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index c22aa95..321ebfa 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -93,7 +93,7 @@ default: break; } - sql="select count(*), to_char(t.beginTime, '"+dateType+"') from PG_MAINTAIN t where t.BEGINTIME >= " + + sql="select count(*), to_char(t.BEGINTIME, '"+dateType+"') from PG_MAINTAIN t where t.BEGINTIME >= " + "to_date('"+startTime+"', 'yyyy-mm-dd') and t.BEGINTIME <= to_date('"+endTime+"', 'yyyy-mm-dd') group " + "by to_char(t.BEGINTIME, '"+dateType+"')"; diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java index 33879a0..6ec29e1 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java @@ -4,7 +4,10 @@ import com.casic.PgInterface.construction.dto.PgConstructTjDto; import com.casic.PgInterface.construction.dto.PgConstructionDto; import com.casic.PgInterface.construction.manager.PgConstructionManager; - +import com.casic.PgInterface.devTable.domain.PgPartition; +import com.casic.PgInterface.devTable.dto.PgDeviceDto; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -33,20 +36,33 @@ private PgConstructionManager pgConstructionManager; + private PgPartitionManager pgPartitionManager; + + private PgDeviceManager pgDeviceManager; + @Resource public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { this.pgConstructionManager = pgConstructionManager; } + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + /* - 新建工程 - */ + *新建工程 + */ @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, @@ -54,16 +70,17 @@ @FormParam("cs_charge")String cs_charge, @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) + @FormParam("parName")String parName) throws Exception{ Map resultMap = new HashMap(); String result = "" ; String msg = "" ; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { + PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + 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)); @@ -71,7 +88,7 @@ pgConstruction.setCs_charge(cs_charge); pgConstruction.setCs_phone(cs_phone); pgConstruction.setCs_type(cs_type); - pgConstruction.setCs_region(cs_region); + pgConstruction.setPgPartitionId(pgPartition); pgConstruction.setActive(1); logger.info("保存成功"); @@ -97,7 +114,6 @@ @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, @@ -105,7 +121,7 @@ @FormParam("cs_charge")String cs_charge, @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) + @FormParam("parName")String parName) throws Exception{ Map resultMap = new HashMap(); @@ -120,9 +136,10 @@ result = "false"; msg = "请输入ID"; }else { + PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + 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)); @@ -130,7 +147,7 @@ pgConstruction.setCs_charge(cs_charge); pgConstruction.setCs_phone(cs_phone); pgConstruction.setCs_type(cs_type); - pgConstruction.setCs_region(cs_region); + pgConstruction.setPgPartitionId(pgPartition); pgConstruction.setActive(1); pgConstructionManager.save(pgConstruction); @@ -150,6 +167,9 @@ return resultMap; } + /* + 删除信息 + */ @POST @Path("delConstruction") @Produces(MediaType.APPLICATION_JSON) @@ -181,256 +201,146 @@ return resultMap; } + /* + 查询 + */ @POST - @Path("queryConstruction") + @Path("searchConstruction") @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(); + public Map searchConstruction(@FormParam("cs_name")String cs_name, + @FormParam("cs_type")String cs_type, + @FormParam("parName")String parName, + @FormParam("startTime")String startTime, + @FormParam("endTime")String endTime)throws Exception{ + Map resultMap=new HashMap(); + String msg=""; + List pgConstructionDtoList=new ArrayList(); + try{ + pgConstructionDtoList=pgConstructionManager.getPgContructionDtoByNameOrType(cs_name,cs_type,parName,startTime,endTime); + msg="信息获取成功"; } + catch(Exception e) + { + e.printStackTrace(); + msg="查询失败"; + } + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); return resultMap; } + /** + * 根据时间统计施工次数 + */ @POST - @Path("constructTjByDay") + @Path("getConstructionByTimeAndStatus") @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception { + public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime, + @FormParam("endTime") String endTime, + @FormParam("statisticType") String statisticType, + @FormParam("constructionStatus") String constructionStatus) throws Exception { Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) { - msg = "获取成功"; - } else { - msg = "没有符合条件的数据"; - } + List pgConstructTjDtoList=new ArrayList(); + try { + pgConstructTjDtoList = pgConstructionManager.getConstructionByTimeAndStatus(startTime, endTime, statisticType, constructionStatus); + if(pgConstructTjDtoList==null) + msg="施工统计信息获取失败"; + else + msg="施工统计信息获取成功"; } catch (Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg = "施工统计信息获取失败"; } resultMap.put("msg", msg); resultMap.put("result", pgConstructTjDtoList); return resultMap; } + /** + * 工程类别统计 + */ @POST - @Path("constructTjByWeek") + @Path("getConstructionByType") @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 = "没有符合条件的数据"; - } + public Map getConstructionByType(@FormParam("statisticType") String statisticType) throws Exception{ + Map resultMap=new HashMap(); + String msg=""; - }catch(Exception e) + List pgConstructTjDtoList=new ArrayList(); + try{ + pgConstructTjDtoList=pgConstructionManager.getStatisticByPartitionOrType(statisticType); + msg="统计信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="统计失败"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + + resultMap.put("msg",msg); + resultMap.put("result",pgConstructTjDtoList); return resultMap; } + /** + * 当天施工 + */ @POST - @Path("constructTjByMon") + @Path("getConstructionToday") @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 = ""; + public Map getConstructionToday() throws Exception{ + Map resultMap=new HashMap(); + String msg=""; + List pgConstructionDtoList=new ArrayList(); try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) + pgConstructionDtoList = pgConstructionManager.getConstructionToday(); + msg = "当天施工信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="获取失败"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); return resultMap; } - /*按天在建工程/完工程统计*/ +/** + * 获取关联设备《摄像机》 + */ @POST - @Path("buildingTjByDay") + @Path("getConstructionDev") @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 = "没有符合条件的数据"; - } + public Map getConstructionDev(@FormParam("id") String id) throws Exception{ + Map resultMap=new HashMap(); + String msg=""; - }catch(Exception e) + List pgDeviceDtoList =new ArrayList(); + try{ + + PgConstruction pgConstruction=pgConstructionManager.get(Long.valueOf(id)); + + pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(pgConstruction.getPgPartitionId().getParName()); + + if(pgDeviceDtoList==null) + msg="信息获取失败"; + else + msg="信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="设备信息获取成功"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + resultMap.put("msg",msg); + resultMap.put("result",pgDeviceDtoList); + 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_type") String cs_type)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_type); - 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 index b3f303e..2e08ac5 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java @@ -1,15 +1,15 @@ package com.casic.PgInterface.rs; -import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.construction.domain.PgConstruction; import com.casic.PgInterface.construction.domain.PgCsDocument; import com.casic.PgInterface.construction.dto.PgCsDocumentDto; +import com.casic.PgInterface.construction.manager.PgConstructionManager; import com.casic.PgInterface.construction.manager.PgCsDocumentManager; - +import com.casic.PgInterface.core.util.StringUtils; 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; @@ -36,11 +36,18 @@ private PgCsDocumentManager pgCsDocumentManager; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + private PgConstructionManager pgConstructionManager; + @Resource public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { this.pgCsDocumentManager = pgCsDocumentManager; } + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { + this.pgConstructionManager = pgConstructionManager; + } + /* 新增&上传 */ @@ -49,10 +56,8 @@ @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 { + @FormParam("construct_doc") String fileBuffer, + @FormParam("cs_name") String cs_name)throws Exception { Map resultMap = new HashMap(); PgCsDocument pgCsDocument = new PgCsDocument(); @@ -66,11 +71,9 @@ pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); } + PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - + pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); pgCsDocumentManager.save(pgCsDocument); @@ -93,10 +96,8 @@ @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 { + @FormParam("doc_name") String doc_name, + @FormParam("cs_name") String cs_name) throws Exception { Map resultMap = new HashMap(); String result = ""; @@ -108,10 +109,9 @@ result = "false"; msg = "不存在该预案信息"; } else { + PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); + pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); pgCsDocumentManager.save(pgCsDocument); @@ -173,7 +173,8 @@ @ResponseBody public Map queryConstructDoc(@FormParam("cs_name")String cs_name, @FormParam("cs_type")String cs_type, - @FormParam("cs_time")String cs_time) + @FormParam("startTime")String startTime, + @FormParam("endTime")String endTime) throws Exception{ Map resultMap = new HashMap(); @@ -183,7 +184,7 @@ String result=""; try { - pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); + pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, startTime,endTime); if (pgCsDocumentDtoList != null) { result = "true"; @@ -201,15 +202,15 @@ } resultMap.put("msg",msg); - resultMap.put("result",result); + resultMap.put("result",pgCsDocumentDtoList); return resultMap; } + @POST @Path("downLoadConstructDoc") @Produces(MediaType.APPLICATION_JSON) - public Map downLoadConstructDoc( - @FormParam("cs_type")String cs_type, + 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(); @@ -242,4 +243,5 @@ resultMap.put("msg", msg); return resultMap; } + } diff --git a/~WRL1588.tmp b/~WRL1588.tmp new file mode 100644 index 0000000..69a73ca --- /dev/null +++ b/~WRL1588.tmp Binary files differ diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 026f98e..b0a73f0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ - - + + + + + + + + + + + + + + @@ -28,7 +40,77 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -46,13 +128,6 @@ @@ -157,9 +239,9 @@ - @@ -190,6 +272,21 @@ + + + + + + + + + + + @@ -338,6 +435,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -416,21 +573,6 @@ - - - - - - - - - - - @@ -857,7 +999,9 @@ - + + + 1510219102698 @@ -987,11 +1131,15 @@ 1523244710693 1523244710693 - - @@ -1014,7 +1162,7 @@ - + @@ -1033,14 +1181,13 @@ - - + @@ -1049,9 +1196,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1093,11 +1276,12 @@ - - @@ -1105,93 +1289,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1214,18 +1311,10 @@ - - - - - - - - @@ -1233,15 +1322,6 @@ - - - - - - - - - @@ -1249,7 +1329,6 @@ - @@ -1257,9 +1336,6 @@ - - - @@ -1267,17 +1343,6 @@ - - - - - - - - - - - @@ -1285,14 +1350,6 @@ - - - - - - - - @@ -1300,7 +1357,6 @@ - @@ -1308,7 +1364,6 @@ - @@ -1316,15 +1371,6 @@ - - - - - - - - - @@ -1332,36 +1378,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1377,10 +1393,6 @@ - - - - @@ -1388,7 +1400,6 @@ - @@ -1396,7 +1407,6 @@ - @@ -1404,7 +1414,6 @@ - @@ -1412,7 +1421,6 @@ - @@ -1424,53 +1432,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1478,7 +1443,6 @@ - @@ -1486,7 +1450,6 @@ - @@ -1494,7 +1457,6 @@ - @@ -1502,7 +1464,6 @@ - @@ -1510,7 +1471,6 @@ - @@ -1518,7 +1478,6 @@ - @@ -1526,7 +1485,6 @@ - @@ -1534,23 +1492,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java index 8b57e41..658efa9 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -1,11 +1,13 @@ package com.casic.PgInterface.construction.domain; +import com.casic.PgInterface.devTable.domain.PgPartition; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.util.List; /** * Created by zxh on 2018/3/23. @@ -17,17 +19,17 @@ 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; + private String cs_name;//项目名称 + 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 PgPartition pgPartitionId;//施工区域 + private List pgConstructionList;//施工文档 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") @@ -40,11 +42,6 @@ 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; } @@ -80,10 +77,25 @@ public void setCs_type(String cs_type){ this.cs_type = cs_type; } - @Column(name = "CS_REGION") - public String getCs_region(){ return cs_region; } + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PAPARTITION_ID") + public PgPartition getPgPartitionId() { + return pgPartitionId; + } - public void setCs_region(String cs_region){ this.cs_region = cs_region; } + public void setPgPartitionId(PgPartition pgPartitionId) { + this.pgPartitionId = pgPartitionId; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId") + public List getPgConstructionList() { + return pgConstructionList; + } + + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } @Column(name = "ACTIVE") public int getActive(){ return 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 index 13579ab..8bef2b4 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -1,8 +1,10 @@ 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/28. @@ -15,12 +17,10 @@ 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; + private String doc_name;//文档名称 + private String construct_doc;//施工文档 + private PgConstruction pgConstructionId;//项目 + private int active;//状态位 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") @@ -33,24 +33,22 @@ 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; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGCONSTRUCTION_ID") + public PgConstruction getPgConstructionId() { + return pgConstructionId; + } + + public void setPgConstructionId(PgConstruction pgConstructionId) { + this.pgConstructionId = pgConstructionId; + } + @Column(name = "ACTIVE") public int getActive(){ return 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 index 98a49f6..8aea66f 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -8,28 +8,44 @@ public class PgConstructTjDto implements Serializable { private String constructNum;//施工数量 - private String completeNum;//完工数量 - private String underwayNum;//施工中数量 - private String constructTypeNum;//施工类型统计 - private String constructRegionNum;//施工区域统计 + private String constructionTime;//施工时间 + private String constructType;//施工类型 + private String constructStatus;//施工状态 + private String constructPartition;//施工区域 public String getConstructNum(){ return constructNum; } public void setConstructNum(String constructNum){ this.constructNum = constructNum;} - public String getCompleteNum(){ return completeNum; } + public String getConstructionTime() { + return constructionTime; + } - public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + public void setConstructionTime(String constructionTime) { + this.constructionTime = constructionTime; + } - public String getUnderwayNum(){ return underwayNum; } + public String getConstructType() { + return constructType; + } - public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + public void setConstructType(String constructType) { + this.constructType = constructType; + } - public String getConstructTypeNum(){ return constructTypeNum; } + public String getConstructStatus() { + return constructStatus; + } - public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + public void setConstructStatus(String constructStatus) { + this.constructStatus = constructStatus; + } - public String getConstructRegionNum(){ return constructRegionNum; } + public String getConstructPartition() { + return constructPartition; + } - public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} + public void setConstructPartition(String constructPartition) { + this.constructPartition = constructPartition; + } } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java index a092f0e..c5ac9f9 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -11,7 +11,6 @@ private String id; private String cs_name;//项目名称 - private String cs_position;//施工位置 private String cs_status;//项目状态 private String cs_detail;//施工内容 private String cs_beginTime;//施工开始时间 @@ -19,7 +18,7 @@ private String cs_charge;//施工负责人 private String cs_phone;//联系方式 private String cs_type;//工程类别 - private String cs_region;//施工区域 + private String parName;//施工区域 private String active;//状态位 public String getId() { @@ -38,14 +37,6 @@ 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; } @@ -102,12 +93,12 @@ this.cs_type = cs_type; } - public String getCs_region() { - return cs_region; + public String getParName() { + return parName; } - public void setCs_region(String cs_region) { - this.cs_region = cs_region; + public void setParName(String parName) { + this.parName = parName; } public String getActive(){ return active; } @@ -120,7 +111,6 @@ 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())); @@ -128,8 +118,7 @@ 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.setParName(pgConstruction.getPgPartitionId().getParName()); 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 index 598380f..e9886fb 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -18,7 +18,6 @@ private String construct_doc;//施工文档 private String active;//状态位 - public String getId() { return id; } @@ -65,13 +64,13 @@ public PgCsDocumentDto (PgCsDocument pgCsDocument) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 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.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); + this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getPgConstructionId().getCs_beginTime())); 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 index 09468a4..5b90c2b 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -1,279 +1,176 @@ 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.construction.dto.PgConstructionDto; +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.PgPartition; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; +import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; -import org.hibernate.Query; -import java.util.Calendar; +import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; /** * Created by zxh on 2018/3/23. */ @Service -public class PgConstructionManager extends HibernateEntityDao{ +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 month = calendar_now.get(Calendar.MONTH) + 1; int day = calendar_now.get(Calendar.DAY_OF_MONTH); String date_now = String.valueOf(year + "-" + month + "-" + day); + private PgPartitionManager pgPartitionManager; + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + public PgConstruction getPgContructionByName(String name) { + Criteria criteria = createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", name)); + criteria.add(Restrictions.eq("active", 1)); - public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + List pgConstructionList = criteria.list(); - List pgConstructionDtoList = new ArrayList(); + if (pgConstructionList == null) + return null; + else + return pgConstructionList.get(0); + } + + public List getPgContructionByNameOrType(String cs_name, String cs_type, PgPartition pgPartition, String startTime, String endTime) { 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)); + Criteria criteria = createCriteria(PgConstruction.class); + criteria.addOrder(Order.desc("id")); + if (pgPartition != null) + criteria.add(Restrictions.eq("pgPartitionId", pgPartition)); + if (StringUtils.isNotBlank(cs_name)) + criteria.add(Restrictions.eq("cs_name", cs_name)); + if (StringUtils.isNotBlank(cs_type)) + criteria.add(Restrictions.eq("cs_type", cs_type)); - if (StringUtils.isNotBlank(cs_beginTime)) { - criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + if (StringUtils.isNotBlank(startTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf_day.parse(startTime))); } - if (StringUtils.isNotBlank(cs_endTime)) { - criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + if (StringUtils.isNotBlank(endTime)) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.sdf_day.parse(endTime)); + calendar.add(Calendar.DATE, 1); + criteria.add(Restrictions.le("cs_beginTime", calendar.getTime())); } + return criteria.list(); - List pgConstructionList = criteria.list(); - - for (PgConstruction pgConstruction : pgConstructionList) { - pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); - } - - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return null; } + } + + public List getPgContructionDtoByNameOrType(String cs_name, String cs_type, String parName, String startTime, String endTime) { + + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + + List pgConstructionList = getPgContructionByNameOrType(cs_name, cs_type, pgPartition, startTime, endTime); + List pgConstructionDtoList = new ArrayList(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + return pgConstructionDtoList; } - public PgConstructionManager getPartitionByCsName(String cs_name) { - Criteria criteria = getSession().createCriteria(PgConstruction.class); - criteria.add(Restrictions.eq("cs_name", cs_name)); + //yyyy-mm-dd + public List getConstructionByTimeAndStatus(String startTime, String endTime, String statisticType, String constructionStatus) { + String sql = ""; + String dateType = ""; + List pgConstructTjDtoList = new ArrayList(); + + int type = Integer.valueOf(statisticType); + switch (type) { + case 0://年 + dateType = "yyyy"; + break; + case 1://月 + dateType = "yyyy-mm"; + break; + case 2://周 + dateType = "iw"; + break; + case 3://日 + dateType = "yyyy-mm-dd"; + break; + default: + break; + } + sql = "select count(*), to_char(t.CS_BEGINTIME, '" + dateType + "') from PG_CONSTRUCTION t where t.CS_BEGINTIME >= " + + "to_date('" + startTime + "', 'yyyy-mm-dd') and t.CS_BEGINTIME <= to_date('" + endTime + "', 'yyyy-mm-dd') " + + "and t.CS_STATUS = '" + constructionStatus + "' group by to_char(t.CS_BEGINTIME, '" + dateType + "')"; + + List objects = this.getSession().createSQLQuery(sql).list(); + for (int i = 0; i < objects.size(); i++) { + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + pgConstructTjDto.setConstructNum(objects.get(i)[0].toString()); + pgConstructTjDto.setConstructionTime(objects.get(i)[1].toString()); + pgConstructTjDto.setConstructStatus(constructionStatus); + + pgConstructTjDtoList.add(pgConstructTjDto); + } + return pgConstructTjDtoList; + } + + public List getStatisticByPartitionOrType(String statisticType) { + List pgConstructTjDtoList = new ArrayList(); + String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + try { + + String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + "group by pgConstruction." + str; + + List objects=this.getSession().createQuery(hql).list(); + for(int i=0;i getConstructionToday() { + List pgConstructionDtoList = new ArrayList(); + Criteria criteria = createCriteria(PgConstruction.class); 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); + List pgConstructionList = criteria.list(); + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } 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 index 12f3042..68d1c49 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java @@ -1,27 +1,22 @@ package com.casic.PgInterface.construction.manager; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.domain.PgCsDocument; 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.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; 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.annotation.Resource; 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; @@ -32,6 +27,13 @@ @Service public class PgCsDocumentManager extends HibernateEntityDao{ + private PgConstructionManager pgConstructionManager; + + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { + this.pgConstructionManager = pgConstructionManager; + } + public String saveFiles(List files,String fileType){ String [] fileNames = new String[files.size()]; String [] fileBuffers = new String[files.size()]; @@ -70,7 +72,6 @@ } } - public String saveFiles(String fileBuffer, String fileName, String fileType){ try { @@ -134,43 +135,32 @@ } /*查询*/ - public List getAllDocData(String cs_name ,String cs_type,String cs_time) { + public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) { 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)); + List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name, cs_type, null,startTime, endTime); + if(pgConstructionList==null||pgConstructionList.size()==0) + return null; + else + { + List pgCsDocumentList=new ArrayList(); + for(PgConstruction pgConstruction : pgConstructionList) + { + String hql="select * from PgCsDocument pgCsDocument where pgCsDocument.pgConstructionId = " + pgConstruction; + List pgCsDocuments=this.getSession().createQuery(hql).list(); - 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) - { + for(PgCsDocument pgCsDocument : pgCsDocuments) + { + pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); + } + } + return pgCsDocumentDtoList; + } + } 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/domain/PgPartition.java b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java index d209733..5545fac 100644 --- a/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java +++ b/src/main/java/com/casic/PgInterface/devTable/domain/PgPartition.java @@ -1,5 +1,7 @@ package com.casic.PgInterface.devTable.domain; +import com.casic.PgInterface.construction.domain.PgConstruction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -26,6 +28,7 @@ private String material;//建设材质 private int active;//状态位 private List pipeGalleryList;//管廊仓 + private List pgConstructionList;//施工 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PARTITION_ID") @@ -127,5 +130,12 @@ this.pipeGalleryList = pipeGalleryList; } + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgPartitionId") + public List getPgConstructionList() { + return pgConstructionList; + } + public void setPgConstructionList(List pgConstructionList) { + this.pgConstructionList = pgConstructionList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java index 2f07bee..dabcc7f 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -71,15 +71,16 @@ public List getPgInPersonListByDay() { List pgInPgInfoDtoList = new ArrayList(); - PgInPgInfoDto pgInPgInfoDto = null; + String sql = "select count(*), to_char(t.intime, 'yyyy-mm-dd') from pg_inpg_status t group " + "by to_char(t.intime, 'yyyy-mm-dd')"; List objects = this.getSession().createSQLQuery(sql).list(); for (int i = 0; i < objects.size(); i++) { - pgInPgInfoDto.setInPgNum(String.valueOf(objects.get(i)[0])); - pgInPgInfoDto.setInPgTime(DateUtils.sdf_day.format(objects.get(i)[1])); + PgInPgInfoDto pgInPgInfoDto = new PgInPgInfoDto(); + pgInPgInfoDto.setInPgNum(objects.get(i)[0].toString()); + pgInPgInfoDto.setInPgTime(objects.get(i)[1].toString()); pgInPgInfoDtoList.add(pgInPgInfoDto); } return pgInPgInfoDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index c22aa95..321ebfa 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -93,7 +93,7 @@ default: break; } - sql="select count(*), to_char(t.beginTime, '"+dateType+"') from PG_MAINTAIN t where t.BEGINTIME >= " + + sql="select count(*), to_char(t.BEGINTIME, '"+dateType+"') from PG_MAINTAIN t where t.BEGINTIME >= " + "to_date('"+startTime+"', 'yyyy-mm-dd') and t.BEGINTIME <= to_date('"+endTime+"', 'yyyy-mm-dd') group " + "by to_char(t.BEGINTIME, '"+dateType+"')"; diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java index 33879a0..6ec29e1 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java @@ -4,7 +4,10 @@ import com.casic.PgInterface.construction.dto.PgConstructTjDto; import com.casic.PgInterface.construction.dto.PgConstructionDto; import com.casic.PgInterface.construction.manager.PgConstructionManager; - +import com.casic.PgInterface.devTable.domain.PgPartition; +import com.casic.PgInterface.devTable.dto.PgDeviceDto; +import com.casic.PgInterface.devTable.manager.PgDeviceManager; +import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -33,20 +36,33 @@ private PgConstructionManager pgConstructionManager; + private PgPartitionManager pgPartitionManager; + + private PgDeviceManager pgDeviceManager; + @Resource public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { this.pgConstructionManager = pgConstructionManager; } + @Resource + public void setPgPartitionManager(PgPartitionManager pgPartitionManager) { + this.pgPartitionManager = pgPartitionManager; + } + + @Resource + public void setPgDeviceManager(PgDeviceManager pgDeviceManager) { + this.pgDeviceManager = pgDeviceManager; + } + /* - 新建工程 - */ + *新建工程 + */ @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, @@ -54,16 +70,17 @@ @FormParam("cs_charge")String cs_charge, @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) + @FormParam("parName")String parName) throws Exception{ Map resultMap = new HashMap(); String result = "" ; String msg = "" ; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { + PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + 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)); @@ -71,7 +88,7 @@ pgConstruction.setCs_charge(cs_charge); pgConstruction.setCs_phone(cs_phone); pgConstruction.setCs_type(cs_type); - pgConstruction.setCs_region(cs_region); + pgConstruction.setPgPartitionId(pgPartition); pgConstruction.setActive(1); logger.info("保存成功"); @@ -97,7 +114,6 @@ @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, @@ -105,7 +121,7 @@ @FormParam("cs_charge")String cs_charge, @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, - @FormParam("cs_region")String cs_region) + @FormParam("parName")String parName) throws Exception{ Map resultMap = new HashMap(); @@ -120,9 +136,10 @@ result = "false"; msg = "请输入ID"; }else { + PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + 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)); @@ -130,7 +147,7 @@ pgConstruction.setCs_charge(cs_charge); pgConstruction.setCs_phone(cs_phone); pgConstruction.setCs_type(cs_type); - pgConstruction.setCs_region(cs_region); + pgConstruction.setPgPartitionId(pgPartition); pgConstruction.setActive(1); pgConstructionManager.save(pgConstruction); @@ -150,6 +167,9 @@ return resultMap; } + /* + 删除信息 + */ @POST @Path("delConstruction") @Produces(MediaType.APPLICATION_JSON) @@ -181,256 +201,146 @@ return resultMap; } + /* + 查询 + */ @POST - @Path("queryConstruction") + @Path("searchConstruction") @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(); + public Map searchConstruction(@FormParam("cs_name")String cs_name, + @FormParam("cs_type")String cs_type, + @FormParam("parName")String parName, + @FormParam("startTime")String startTime, + @FormParam("endTime")String endTime)throws Exception{ + Map resultMap=new HashMap(); + String msg=""; + List pgConstructionDtoList=new ArrayList(); + try{ + pgConstructionDtoList=pgConstructionManager.getPgContructionDtoByNameOrType(cs_name,cs_type,parName,startTime,endTime); + msg="信息获取成功"; } + catch(Exception e) + { + e.printStackTrace(); + msg="查询失败"; + } + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); - resultMap.put("msg", msg); - resultMap.put("result", pgConstructionDtoList); return resultMap; } + /** + * 根据时间统计施工次数 + */ @POST - @Path("constructTjByDay") + @Path("getConstructionByTimeAndStatus") @Produces(MediaType.APPLICATION_JSON) - public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception { + public Map getConstructionByTimeAndStatus(@FormParam("startTime") String startTime, + @FormParam("endTime") String endTime, + @FormParam("statisticType") String statisticType, + @FormParam("constructionStatus") String constructionStatus) throws Exception { Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); - if (pgConstructTjDtoList != null) { - msg = "获取成功"; - } else { - msg = "没有符合条件的数据"; - } + List pgConstructTjDtoList=new ArrayList(); + try { + pgConstructTjDtoList = pgConstructionManager.getConstructionByTimeAndStatus(startTime, endTime, statisticType, constructionStatus); + if(pgConstructTjDtoList==null) + msg="施工统计信息获取失败"; + else + msg="施工统计信息获取成功"; } catch (Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg = "施工统计信息获取失败"; } resultMap.put("msg", msg); resultMap.put("result", pgConstructTjDtoList); return resultMap; } + /** + * 工程类别统计 + */ @POST - @Path("constructTjByWeek") + @Path("getConstructionByType") @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 = "没有符合条件的数据"; - } + public Map getConstructionByType(@FormParam("statisticType") String statisticType) throws Exception{ + Map resultMap=new HashMap(); + String msg=""; - }catch(Exception e) + List pgConstructTjDtoList=new ArrayList(); + try{ + pgConstructTjDtoList=pgConstructionManager.getStatisticByPartitionOrType(statisticType); + msg="统计信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="统计失败"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + + resultMap.put("msg",msg); + resultMap.put("result",pgConstructTjDtoList); return resultMap; } + /** + * 当天施工 + */ @POST - @Path("constructTjByMon") + @Path("getConstructionToday") @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 = ""; + public Map getConstructionToday() throws Exception{ + Map resultMap=new HashMap(); + String msg=""; + List pgConstructionDtoList=new ArrayList(); try { - pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); - if (pgConstructTjDtoList != null) - { - msg = "获取成功"; - }else{ - msg = "没有符合条件的数据"; - } - - }catch(Exception e) + pgConstructionDtoList = pgConstructionManager.getConstructionToday(); + msg = "当天施工信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="获取失败"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); return resultMap; } - /*按天在建工程/完工程统计*/ +/** + * 获取关联设备《摄像机》 + */ @POST - @Path("buildingTjByDay") + @Path("getConstructionDev") @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 = "没有符合条件的数据"; - } + public Map getConstructionDev(@FormParam("id") String id) throws Exception{ + Map resultMap=new HashMap(); + String msg=""; - }catch(Exception e) + List pgDeviceDtoList =new ArrayList(); + try{ + + PgConstruction pgConstruction=pgConstructionManager.get(Long.valueOf(id)); + + pgDeviceDtoList=pgDeviceManager.getPgDeviceDtoListByPartition(pgConstruction.getPgPartitionId().getParName()); + + if(pgDeviceDtoList==null) + msg="信息获取失败"; + else + msg="信息获取成功"; + } + catch(Exception e) { e.printStackTrace(); - msg = "获取失败"; + msg="设备信息获取成功"; } - resultMap.put("msg", msg); - resultMap.put("result", pgConstructTjDtoList); + resultMap.put("msg",msg); + resultMap.put("result",pgDeviceDtoList); + 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_type") String cs_type)throws Exception - { - Map resultMap = new HashMap(); - List pgConstructTjDtoList = new ArrayList(); - String msg = ""; - try { - pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_type); - 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 index b3f303e..2e08ac5 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java @@ -1,15 +1,15 @@ package com.casic.PgInterface.rs; -import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.construction.domain.PgConstruction; import com.casic.PgInterface.construction.domain.PgCsDocument; import com.casic.PgInterface.construction.dto.PgCsDocumentDto; +import com.casic.PgInterface.construction.manager.PgConstructionManager; import com.casic.PgInterface.construction.manager.PgCsDocumentManager; - +import com.casic.PgInterface.core.util.StringUtils; 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; @@ -36,11 +36,18 @@ private PgCsDocumentManager pgCsDocumentManager; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + private PgConstructionManager pgConstructionManager; + @Resource public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { this.pgCsDocumentManager = pgCsDocumentManager; } + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) { + this.pgConstructionManager = pgConstructionManager; + } + /* 新增&上传 */ @@ -49,10 +56,8 @@ @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 { + @FormParam("construct_doc") String fileBuffer, + @FormParam("cs_name") String cs_name)throws Exception { Map resultMap = new HashMap(); PgCsDocument pgCsDocument = new PgCsDocument(); @@ -66,11 +71,9 @@ pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); } + PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); - + pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); pgCsDocumentManager.save(pgCsDocument); @@ -93,10 +96,8 @@ @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 { + @FormParam("doc_name") String doc_name, + @FormParam("cs_name") String cs_name) throws Exception { Map resultMap = new HashMap(); String result = ""; @@ -108,10 +109,9 @@ result = "false"; msg = "不存在该预案信息"; } else { + PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); pgCsDocument.setDoc_name(doc_name); - pgCsDocument.setCs_name(cs_name); - pgCsDocument.setCs_type(cs_type); - pgCsDocument.setCs_time(sdf.parse(cs_time)); + pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); pgCsDocumentManager.save(pgCsDocument); @@ -173,7 +173,8 @@ @ResponseBody public Map queryConstructDoc(@FormParam("cs_name")String cs_name, @FormParam("cs_type")String cs_type, - @FormParam("cs_time")String cs_time) + @FormParam("startTime")String startTime, + @FormParam("endTime")String endTime) throws Exception{ Map resultMap = new HashMap(); @@ -183,7 +184,7 @@ String result=""; try { - pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); + pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, startTime,endTime); if (pgCsDocumentDtoList != null) { result = "true"; @@ -201,15 +202,15 @@ } resultMap.put("msg",msg); - resultMap.put("result",result); + resultMap.put("result",pgCsDocumentDtoList); return resultMap; } + @POST @Path("downLoadConstructDoc") @Produces(MediaType.APPLICATION_JSON) - public Map downLoadConstructDoc( - @FormParam("cs_type")String cs_type, + 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(); @@ -242,4 +243,5 @@ resultMap.put("msg", msg); return resultMap; } + } diff --git a/~WRL1588.tmp b/~WRL1588.tmp new file mode 100644 index 0000000..69a73ca --- /dev/null +++ b/~WRL1588.tmp Binary files differ diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index 69a73ca..b8dd4cd 100644 --- "a/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ