diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.getActive())); + } + } } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; 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 a296fc3..8a4e273 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -27,14 +27,15 @@ criteria.addOrder(Order.desc("inTime")); List pgInPgStatusList = criteria.list(); - if (pgInPgStatusList != null) + + if (pgInPgStatusList != null&&pgInPgStatusList.size()!=0) return pgInPgStatusList.get(0); else return null; } public int getInPgNumByName(PgInPgPerson pgInPgPerson) { - String hql = "select count(*) from PgInPgStatus pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); + String hql = "select count(*) from Pg_InPg_Status pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); Object object = this.getSession().createSQLQuery(hql).uniqueResult(); diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; 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 a296fc3..8a4e273 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -27,14 +27,15 @@ criteria.addOrder(Order.desc("inTime")); List pgInPgStatusList = criteria.list(); - if (pgInPgStatusList != null) + + if (pgInPgStatusList != null&&pgInPgStatusList.size()!=0) return pgInPgStatusList.get(0); else return null; } public int getInPgNumByName(PgInPgPerson pgInPgPerson) { - String hql = "select count(*) from PgInPgStatus pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); + String hql = "select count(*) from Pg_InPg_Status pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); Object object = this.getSession().createSQLQuery(hql).uniqueResult(); 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 cca3d1c..8fc0ff9 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,7 +4,6 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; -import com.casic.PgInterface.patroler.domain.PgMaintainDoc; import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; @@ -24,17 +23,6 @@ public class PgMaintainManager extends HibernateEntityDao{ public List getPgMaintainList() { - /*Criteria criteria=createCriteria(PgMaintain.class); - criteria.add(Restrictions.eq("active", 1)); - criteria.addOrder(Order.desc("id")); - - List pgMaintainList=criteria.list(); - List pgMaintainDtoList=new ArrayList(); - for(PgMaintain pgMaintain:pgMaintainList) - { - pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); - } - return pgMaintainDtoList;*/ String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; @@ -44,13 +32,13 @@ for (int i = 0; i < objects.size() ; i++) { PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); - pgMaintainDocDto.setId(objects.get(i)[0].toString()); - pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); - pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); - pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); - pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); - pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); - pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDto.setId(String.valueOf(objects.get(i)[0])); + pgMaintainDocDto.setMainTainer(String.valueOf(objects.get(i)[1])); + pgMaintainDocDto.setList_name(String.valueOf(objects.get(i)[2])); + pgMaintainDocDto.setDescribe(String.valueOf(objects.get(i)[3])); + pgMaintainDocDto.setBeginTime(String.valueOf(objects.get(i)[4])); + pgMaintainDocDto.setTimeLimt(String.valueOf(objects.get(i)[5])); + pgMaintainDocDto.setFile_name(String.valueOf(objects.get(i)[6])); pgMaintainDocDtoList.add(pgMaintainDocDto); } return pgMaintainDocDtoList; diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; 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 a296fc3..8a4e273 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -27,14 +27,15 @@ criteria.addOrder(Order.desc("inTime")); List pgInPgStatusList = criteria.list(); - if (pgInPgStatusList != null) + + if (pgInPgStatusList != null&&pgInPgStatusList.size()!=0) return pgInPgStatusList.get(0); else return null; } public int getInPgNumByName(PgInPgPerson pgInPgPerson) { - String hql = "select count(*) from PgInPgStatus pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); + String hql = "select count(*) from Pg_InPg_Status pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); Object object = this.getSession().createSQLQuery(hql).uniqueResult(); 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 cca3d1c..8fc0ff9 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,7 +4,6 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; -import com.casic.PgInterface.patroler.domain.PgMaintainDoc; import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; @@ -24,17 +23,6 @@ public class PgMaintainManager extends HibernateEntityDao{ public List getPgMaintainList() { - /*Criteria criteria=createCriteria(PgMaintain.class); - criteria.add(Restrictions.eq("active", 1)); - criteria.addOrder(Order.desc("id")); - - List pgMaintainList=criteria.list(); - List pgMaintainDtoList=new ArrayList(); - for(PgMaintain pgMaintain:pgMaintainList) - { - pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); - } - return pgMaintainDtoList;*/ String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; @@ -44,13 +32,13 @@ for (int i = 0; i < objects.size() ; i++) { PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); - pgMaintainDocDto.setId(objects.get(i)[0].toString()); - pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); - pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); - pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); - pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); - pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); - pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDto.setId(String.valueOf(objects.get(i)[0])); + pgMaintainDocDto.setMainTainer(String.valueOf(objects.get(i)[1])); + pgMaintainDocDto.setList_name(String.valueOf(objects.get(i)[2])); + pgMaintainDocDto.setDescribe(String.valueOf(objects.get(i)[3])); + pgMaintainDocDto.setBeginTime(String.valueOf(objects.get(i)[4])); + pgMaintainDocDto.setTimeLimt(String.valueOf(objects.get(i)[5])); + pgMaintainDocDto.setFile_name(String.valueOf(objects.get(i)[6])); pgMaintainDocDtoList.add(pgMaintainDocDto); } return pgMaintainDocDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java new file mode 100644 index 0000000..d4cc10f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintainType; +import com.casic.PgInterface.patroler.dto.PgMaintainTypeDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Service +public class PgMaintainTypeManager extends HibernateEntityDao { + + public List getMaintainType(){ + String sql="select distinct type from PG_MAINTAIN_TYPE"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public List getMaintainTypeModel(String type){ + String sql="select model,type from PG_MAINTAIN_TYPE where type = '"+type+"'"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public PgMaintainType getMaintainTypeByMode(String model) + { + Criteria criteria = createCriteria(PgMaintainType.class); + criteria.add(Restrictions.eq("model", model)); + + List pgMaintainTypeList = criteria.list(); + + if(pgMaintainTypeList.size()!=0) + return pgMaintainTypeList.get(0); + else + return null; + } + +} diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; 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 a296fc3..8a4e273 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -27,14 +27,15 @@ criteria.addOrder(Order.desc("inTime")); List pgInPgStatusList = criteria.list(); - if (pgInPgStatusList != null) + + if (pgInPgStatusList != null&&pgInPgStatusList.size()!=0) return pgInPgStatusList.get(0); else return null; } public int getInPgNumByName(PgInPgPerson pgInPgPerson) { - String hql = "select count(*) from PgInPgStatus pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); + String hql = "select count(*) from Pg_InPg_Status pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); Object object = this.getSession().createSQLQuery(hql).uniqueResult(); 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 cca3d1c..8fc0ff9 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,7 +4,6 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; -import com.casic.PgInterface.patroler.domain.PgMaintainDoc; import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; @@ -24,17 +23,6 @@ public class PgMaintainManager extends HibernateEntityDao{ public List getPgMaintainList() { - /*Criteria criteria=createCriteria(PgMaintain.class); - criteria.add(Restrictions.eq("active", 1)); - criteria.addOrder(Order.desc("id")); - - List pgMaintainList=criteria.list(); - List pgMaintainDtoList=new ArrayList(); - for(PgMaintain pgMaintain:pgMaintainList) - { - pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); - } - return pgMaintainDtoList;*/ String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; @@ -44,13 +32,13 @@ for (int i = 0; i < objects.size() ; i++) { PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); - pgMaintainDocDto.setId(objects.get(i)[0].toString()); - pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); - pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); - pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); - pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); - pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); - pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDto.setId(String.valueOf(objects.get(i)[0])); + pgMaintainDocDto.setMainTainer(String.valueOf(objects.get(i)[1])); + pgMaintainDocDto.setList_name(String.valueOf(objects.get(i)[2])); + pgMaintainDocDto.setDescribe(String.valueOf(objects.get(i)[3])); + pgMaintainDocDto.setBeginTime(String.valueOf(objects.get(i)[4])); + pgMaintainDocDto.setTimeLimt(String.valueOf(objects.get(i)[5])); + pgMaintainDocDto.setFile_name(String.valueOf(objects.get(i)[6])); pgMaintainDocDtoList.add(pgMaintainDocDto); } return pgMaintainDocDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java new file mode 100644 index 0000000..d4cc10f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintainType; +import com.casic.PgInterface.patroler.dto.PgMaintainTypeDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Service +public class PgMaintainTypeManager extends HibernateEntityDao { + + public List getMaintainType(){ + String sql="select distinct type from PG_MAINTAIN_TYPE"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public List getMaintainTypeModel(String type){ + String sql="select model,type from PG_MAINTAIN_TYPE where type = '"+type+"'"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public PgMaintainType getMaintainTypeByMode(String model) + { + Criteria criteria = createCriteria(PgMaintainType.class); + criteria.add(Restrictions.eq("model", model)); + + List pgMaintainTypeList = criteria.list(); + + if(pgMaintainTypeList.size()!=0) + return pgMaintainTypeList.get(0); + else + return null; + } + +} diff --git a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java index bd4857d..0ec26aa 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java @@ -3,7 +3,6 @@ import com.casic.PgInterface.devTable.domain.PgAlarmType; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; - import javax.persistence.*; import java.io.Serializable; diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; 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 a296fc3..8a4e273 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -27,14 +27,15 @@ criteria.addOrder(Order.desc("inTime")); List pgInPgStatusList = criteria.list(); - if (pgInPgStatusList != null) + + if (pgInPgStatusList != null&&pgInPgStatusList.size()!=0) return pgInPgStatusList.get(0); else return null; } public int getInPgNumByName(PgInPgPerson pgInPgPerson) { - String hql = "select count(*) from PgInPgStatus pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); + String hql = "select count(*) from Pg_InPg_Status pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); Object object = this.getSession().createSQLQuery(hql).uniqueResult(); 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 cca3d1c..8fc0ff9 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,7 +4,6 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; -import com.casic.PgInterface.patroler.domain.PgMaintainDoc; import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; @@ -24,17 +23,6 @@ public class PgMaintainManager extends HibernateEntityDao{ public List getPgMaintainList() { - /*Criteria criteria=createCriteria(PgMaintain.class); - criteria.add(Restrictions.eq("active", 1)); - criteria.addOrder(Order.desc("id")); - - List pgMaintainList=criteria.list(); - List pgMaintainDtoList=new ArrayList(); - for(PgMaintain pgMaintain:pgMaintainList) - { - pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); - } - return pgMaintainDtoList;*/ String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; @@ -44,13 +32,13 @@ for (int i = 0; i < objects.size() ; i++) { PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); - pgMaintainDocDto.setId(objects.get(i)[0].toString()); - pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); - pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); - pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); - pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); - pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); - pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDto.setId(String.valueOf(objects.get(i)[0])); + pgMaintainDocDto.setMainTainer(String.valueOf(objects.get(i)[1])); + pgMaintainDocDto.setList_name(String.valueOf(objects.get(i)[2])); + pgMaintainDocDto.setDescribe(String.valueOf(objects.get(i)[3])); + pgMaintainDocDto.setBeginTime(String.valueOf(objects.get(i)[4])); + pgMaintainDocDto.setTimeLimt(String.valueOf(objects.get(i)[5])); + pgMaintainDocDto.setFile_name(String.valueOf(objects.get(i)[6])); pgMaintainDocDtoList.add(pgMaintainDocDto); } return pgMaintainDocDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java new file mode 100644 index 0000000..d4cc10f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintainType; +import com.casic.PgInterface.patroler.dto.PgMaintainTypeDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Service +public class PgMaintainTypeManager extends HibernateEntityDao { + + public List getMaintainType(){ + String sql="select distinct type from PG_MAINTAIN_TYPE"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public List getMaintainTypeModel(String type){ + String sql="select model,type from PG_MAINTAIN_TYPE where type = '"+type+"'"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public PgMaintainType getMaintainTypeByMode(String model) + { + Criteria criteria = createCriteria(PgMaintainType.class); + criteria.add(Restrictions.eq("model", model)); + + List pgMaintainTypeList = criteria.list(); + + if(pgMaintainTypeList.size()!=0) + return pgMaintainTypeList.get(0); + else + return null; + } + +} diff --git a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java index bd4857d..0ec26aa 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java @@ -3,7 +3,6 @@ import com.casic.PgInterface.devTable.domain.PgAlarmType; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; - import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java index ce7a713..0ec81ac 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java @@ -16,6 +16,7 @@ import sun.misc.BASE64Decoder; import javax.servlet.http.HttpServletRequest; +import javax.swing.*; import java.io.*; import java.util.ArrayList; import java.util.List; @@ -42,7 +43,7 @@ try { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String strDirPath = request.getSession().getServletContext().getRealPath(""); - + ImageIcon iv=new ImageIcon(""); FileOutputStream fos = null; String image_toDir = strDirPath + "\\"+fileType;//存储路径 String imageName = ""; diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; 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 a296fc3..8a4e273 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -27,14 +27,15 @@ criteria.addOrder(Order.desc("inTime")); List pgInPgStatusList = criteria.list(); - if (pgInPgStatusList != null) + + if (pgInPgStatusList != null&&pgInPgStatusList.size()!=0) return pgInPgStatusList.get(0); else return null; } public int getInPgNumByName(PgInPgPerson pgInPgPerson) { - String hql = "select count(*) from PgInPgStatus pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); + String hql = "select count(*) from Pg_InPg_Status pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); Object object = this.getSession().createSQLQuery(hql).uniqueResult(); 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 cca3d1c..8fc0ff9 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,7 +4,6 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; -import com.casic.PgInterface.patroler.domain.PgMaintainDoc; import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; @@ -24,17 +23,6 @@ public class PgMaintainManager extends HibernateEntityDao{ public List getPgMaintainList() { - /*Criteria criteria=createCriteria(PgMaintain.class); - criteria.add(Restrictions.eq("active", 1)); - criteria.addOrder(Order.desc("id")); - - List pgMaintainList=criteria.list(); - List pgMaintainDtoList=new ArrayList(); - for(PgMaintain pgMaintain:pgMaintainList) - { - pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); - } - return pgMaintainDtoList;*/ String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; @@ -44,13 +32,13 @@ for (int i = 0; i < objects.size() ; i++) { PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); - pgMaintainDocDto.setId(objects.get(i)[0].toString()); - pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); - pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); - pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); - pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); - pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); - pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDto.setId(String.valueOf(objects.get(i)[0])); + pgMaintainDocDto.setMainTainer(String.valueOf(objects.get(i)[1])); + pgMaintainDocDto.setList_name(String.valueOf(objects.get(i)[2])); + pgMaintainDocDto.setDescribe(String.valueOf(objects.get(i)[3])); + pgMaintainDocDto.setBeginTime(String.valueOf(objects.get(i)[4])); + pgMaintainDocDto.setTimeLimt(String.valueOf(objects.get(i)[5])); + pgMaintainDocDto.setFile_name(String.valueOf(objects.get(i)[6])); pgMaintainDocDtoList.add(pgMaintainDocDto); } return pgMaintainDocDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java new file mode 100644 index 0000000..d4cc10f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintainType; +import com.casic.PgInterface.patroler.dto.PgMaintainTypeDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Service +public class PgMaintainTypeManager extends HibernateEntityDao { + + public List getMaintainType(){ + String sql="select distinct type from PG_MAINTAIN_TYPE"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public List getMaintainTypeModel(String type){ + String sql="select model,type from PG_MAINTAIN_TYPE where type = '"+type+"'"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public PgMaintainType getMaintainTypeByMode(String model) + { + Criteria criteria = createCriteria(PgMaintainType.class); + criteria.add(Restrictions.eq("model", model)); + + List pgMaintainTypeList = criteria.list(); + + if(pgMaintainTypeList.size()!=0) + return pgMaintainTypeList.get(0); + else + return null; + } + +} diff --git a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java index bd4857d..0ec26aa 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java @@ -3,7 +3,6 @@ import com.casic.PgInterface.devTable.domain.PgAlarmType; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; - import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java index ce7a713..0ec81ac 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java @@ -16,6 +16,7 @@ import sun.misc.BASE64Decoder; import javax.servlet.http.HttpServletRequest; +import javax.swing.*; import java.io.*; import java.util.ArrayList; import java.util.List; @@ -42,7 +43,7 @@ try { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String strDirPath = request.getSession().getServletContext().getRealPath(""); - + ImageIcon iv=new ImageIcon(""); FileOutputStream fos = null; String image_toDir = strDirPath + "\\"+fileType;//存储路径 String imageName = ""; diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java index f252247..c6b9e87 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -195,5 +195,4 @@ return resultMap; } - -} +} \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; 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 a296fc3..8a4e273 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -27,14 +27,15 @@ criteria.addOrder(Order.desc("inTime")); List pgInPgStatusList = criteria.list(); - if (pgInPgStatusList != null) + + if (pgInPgStatusList != null&&pgInPgStatusList.size()!=0) return pgInPgStatusList.get(0); else return null; } public int getInPgNumByName(PgInPgPerson pgInPgPerson) { - String hql = "select count(*) from PgInPgStatus pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); + String hql = "select count(*) from Pg_InPg_Status pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); Object object = this.getSession().createSQLQuery(hql).uniqueResult(); 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 cca3d1c..8fc0ff9 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,7 +4,6 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; -import com.casic.PgInterface.patroler.domain.PgMaintainDoc; import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; @@ -24,17 +23,6 @@ public class PgMaintainManager extends HibernateEntityDao{ public List getPgMaintainList() { - /*Criteria criteria=createCriteria(PgMaintain.class); - criteria.add(Restrictions.eq("active", 1)); - criteria.addOrder(Order.desc("id")); - - List pgMaintainList=criteria.list(); - List pgMaintainDtoList=new ArrayList(); - for(PgMaintain pgMaintain:pgMaintainList) - { - pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); - } - return pgMaintainDtoList;*/ String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; @@ -44,13 +32,13 @@ for (int i = 0; i < objects.size() ; i++) { PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); - pgMaintainDocDto.setId(objects.get(i)[0].toString()); - pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); - pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); - pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); - pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); - pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); - pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDto.setId(String.valueOf(objects.get(i)[0])); + pgMaintainDocDto.setMainTainer(String.valueOf(objects.get(i)[1])); + pgMaintainDocDto.setList_name(String.valueOf(objects.get(i)[2])); + pgMaintainDocDto.setDescribe(String.valueOf(objects.get(i)[3])); + pgMaintainDocDto.setBeginTime(String.valueOf(objects.get(i)[4])); + pgMaintainDocDto.setTimeLimt(String.valueOf(objects.get(i)[5])); + pgMaintainDocDto.setFile_name(String.valueOf(objects.get(i)[6])); pgMaintainDocDtoList.add(pgMaintainDocDto); } return pgMaintainDocDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java new file mode 100644 index 0000000..d4cc10f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintainType; +import com.casic.PgInterface.patroler.dto.PgMaintainTypeDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Service +public class PgMaintainTypeManager extends HibernateEntityDao { + + public List getMaintainType(){ + String sql="select distinct type from PG_MAINTAIN_TYPE"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public List getMaintainTypeModel(String type){ + String sql="select model,type from PG_MAINTAIN_TYPE where type = '"+type+"'"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public PgMaintainType getMaintainTypeByMode(String model) + { + Criteria criteria = createCriteria(PgMaintainType.class); + criteria.add(Restrictions.eq("model", model)); + + List pgMaintainTypeList = criteria.list(); + + if(pgMaintainTypeList.size()!=0) + return pgMaintainTypeList.get(0); + else + return null; + } + +} diff --git a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java index bd4857d..0ec26aa 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java @@ -3,7 +3,6 @@ import com.casic.PgInterface.devTable.domain.PgAlarmType; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; - import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java index ce7a713..0ec81ac 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java @@ -16,6 +16,7 @@ import sun.misc.BASE64Decoder; import javax.servlet.http.HttpServletRequest; +import javax.swing.*; import java.io.*; import java.util.ArrayList; import java.util.List; @@ -42,7 +43,7 @@ try { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String strDirPath = request.getSession().getServletContext().getRealPath(""); - + ImageIcon iv=new ImageIcon(""); FileOutputStream fos = null; String image_toDir = strDirPath + "\\"+fileType;//存储路径 String imageName = ""; diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java index f252247..c6b9e87 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -195,5 +195,4 @@ return resultMap; } - -} +} \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java index 932f2e2..5b5c73f 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java @@ -80,40 +80,48 @@ @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, @FormParam("parName")String parName) - throws Exception{ + throws Exception { Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; + String result = ""; + String msg = ""; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { - PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType); - PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + PgConstructionType pgConstructionType = pgConstructionTypeManager.getConstructionTypeByType(constructionType); + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + if (pgConstructionType.equals(null)) { + result = "false"; + msg = "保存失败,不存在施工类型"; + } else if (pgPartition.equals(null)) { + result = "false"; + msg = "保存失败,不存在施工区域"; + } else { + PgConstruction pgConstruction = new PgConstruction(); + pgConstruction.setCs_name(cs_name); + pgConstruction.setCs_detail(cs_detail); + pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); + pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); + pgConstruction.setCs_charge(cs_charge); + pgConstruction.setCs_phone(cs_phone); + pgConstruction.setCs_type(cs_type); - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_detail(cs_detail); - pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); - pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); - pgConstruction.setCs_charge(cs_charge); - pgConstruction.setCs_phone(cs_phone); - pgConstruction.setCs_type(cs_type); - pgConstruction.setPgPartitionId(pgPartition); - pgConstruction.setPgConstructionTypeId(pgConstructionType); - pgConstruction.setActive(1); + pgConstruction.setPgPartitionId(pgPartition); - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; + pgConstruction.setPgConstructionTypeId(pgConstructionType); + pgConstruction.setActive(1); - }catch (Exception e){ + logger.info("保存成功"); + pgConstructionManager.save(pgConstruction); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { result = "false"; msg = "保存失败"; e.printStackTrace(); } - resultMap.put("success",result); - resultMap.put("msg",msg); + resultMap.put("success", result); + resultMap.put("msg", msg); return resultMap; } @@ -356,4 +364,36 @@ return resultMap; } + /* + * 获取维护信息 + */ + @POST + @Path("getConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map getConstruction() throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + List pgConstructionDtoList=new ArrayList(); + + try{ + pgConstructionDtoList=pgConstructionManager.getPgConstructionList(); + if(pgConstructionDtoList==null||pgConstructionDtoList.size()==0) + msg="不存在施工记录"; + else + msg="施工信息获取成功"; + } + catch(Exception e) + { + e.printStackTrace(); + msg="施工信息获取失败"; + result="false"; + } + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); + + return resultMap; + } + + } diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; 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 a296fc3..8a4e273 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -27,14 +27,15 @@ criteria.addOrder(Order.desc("inTime")); List pgInPgStatusList = criteria.list(); - if (pgInPgStatusList != null) + + if (pgInPgStatusList != null&&pgInPgStatusList.size()!=0) return pgInPgStatusList.get(0); else return null; } public int getInPgNumByName(PgInPgPerson pgInPgPerson) { - String hql = "select count(*) from PgInPgStatus pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); + String hql = "select count(*) from Pg_InPg_Status pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); Object object = this.getSession().createSQLQuery(hql).uniqueResult(); 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 cca3d1c..8fc0ff9 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,7 +4,6 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; -import com.casic.PgInterface.patroler.domain.PgMaintainDoc; import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; @@ -24,17 +23,6 @@ public class PgMaintainManager extends HibernateEntityDao{ public List getPgMaintainList() { - /*Criteria criteria=createCriteria(PgMaintain.class); - criteria.add(Restrictions.eq("active", 1)); - criteria.addOrder(Order.desc("id")); - - List pgMaintainList=criteria.list(); - List pgMaintainDtoList=new ArrayList(); - for(PgMaintain pgMaintain:pgMaintainList) - { - pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); - } - return pgMaintainDtoList;*/ String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; @@ -44,13 +32,13 @@ for (int i = 0; i < objects.size() ; i++) { PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); - pgMaintainDocDto.setId(objects.get(i)[0].toString()); - pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); - pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); - pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); - pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); - pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); - pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDto.setId(String.valueOf(objects.get(i)[0])); + pgMaintainDocDto.setMainTainer(String.valueOf(objects.get(i)[1])); + pgMaintainDocDto.setList_name(String.valueOf(objects.get(i)[2])); + pgMaintainDocDto.setDescribe(String.valueOf(objects.get(i)[3])); + pgMaintainDocDto.setBeginTime(String.valueOf(objects.get(i)[4])); + pgMaintainDocDto.setTimeLimt(String.valueOf(objects.get(i)[5])); + pgMaintainDocDto.setFile_name(String.valueOf(objects.get(i)[6])); pgMaintainDocDtoList.add(pgMaintainDocDto); } return pgMaintainDocDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java new file mode 100644 index 0000000..d4cc10f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintainType; +import com.casic.PgInterface.patroler.dto.PgMaintainTypeDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Service +public class PgMaintainTypeManager extends HibernateEntityDao { + + public List getMaintainType(){ + String sql="select distinct type from PG_MAINTAIN_TYPE"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public List getMaintainTypeModel(String type){ + String sql="select model,type from PG_MAINTAIN_TYPE where type = '"+type+"'"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public PgMaintainType getMaintainTypeByMode(String model) + { + Criteria criteria = createCriteria(PgMaintainType.class); + criteria.add(Restrictions.eq("model", model)); + + List pgMaintainTypeList = criteria.list(); + + if(pgMaintainTypeList.size()!=0) + return pgMaintainTypeList.get(0); + else + return null; + } + +} diff --git a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java index bd4857d..0ec26aa 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java @@ -3,7 +3,6 @@ import com.casic.PgInterface.devTable.domain.PgAlarmType; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; - import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java index ce7a713..0ec81ac 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java @@ -16,6 +16,7 @@ import sun.misc.BASE64Decoder; import javax.servlet.http.HttpServletRequest; +import javax.swing.*; import java.io.*; import java.util.ArrayList; import java.util.List; @@ -42,7 +43,7 @@ try { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String strDirPath = request.getSession().getServletContext().getRealPath(""); - + ImageIcon iv=new ImageIcon(""); FileOutputStream fos = null; String image_toDir = strDirPath + "\\"+fileType;//存储路径 String imageName = ""; diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java index f252247..c6b9e87 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -195,5 +195,4 @@ return resultMap; } - -} +} \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java index 932f2e2..5b5c73f 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java @@ -80,40 +80,48 @@ @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, @FormParam("parName")String parName) - throws Exception{ + throws Exception { Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; + String result = ""; + String msg = ""; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { - PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType); - PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + PgConstructionType pgConstructionType = pgConstructionTypeManager.getConstructionTypeByType(constructionType); + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + if (pgConstructionType.equals(null)) { + result = "false"; + msg = "保存失败,不存在施工类型"; + } else if (pgPartition.equals(null)) { + result = "false"; + msg = "保存失败,不存在施工区域"; + } else { + PgConstruction pgConstruction = new PgConstruction(); + pgConstruction.setCs_name(cs_name); + pgConstruction.setCs_detail(cs_detail); + pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); + pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); + pgConstruction.setCs_charge(cs_charge); + pgConstruction.setCs_phone(cs_phone); + pgConstruction.setCs_type(cs_type); - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_detail(cs_detail); - pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); - pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); - pgConstruction.setCs_charge(cs_charge); - pgConstruction.setCs_phone(cs_phone); - pgConstruction.setCs_type(cs_type); - pgConstruction.setPgPartitionId(pgPartition); - pgConstruction.setPgConstructionTypeId(pgConstructionType); - pgConstruction.setActive(1); + pgConstruction.setPgPartitionId(pgPartition); - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; + pgConstruction.setPgConstructionTypeId(pgConstructionType); + pgConstruction.setActive(1); - }catch (Exception e){ + logger.info("保存成功"); + pgConstructionManager.save(pgConstruction); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { result = "false"; msg = "保存失败"; e.printStackTrace(); } - resultMap.put("success",result); - resultMap.put("msg",msg); + resultMap.put("success", result); + resultMap.put("msg", msg); return resultMap; } @@ -356,4 +364,36 @@ return resultMap; } + /* + * 获取维护信息 + */ + @POST + @Path("getConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map getConstruction() throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + List pgConstructionDtoList=new ArrayList(); + + try{ + pgConstructionDtoList=pgConstructionManager.getPgConstructionList(); + if(pgConstructionDtoList==null||pgConstructionDtoList.size()==0) + msg="不存在施工记录"; + else + msg="施工信息获取成功"; + } + catch(Exception e) + { + e.printStackTrace(); + msg="施工信息获取失败"; + result="false"; + } + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); + + return resultMap; + } + + } diff --git "a/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index c85f677..f64ac25 100644 --- "a/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; 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 a296fc3..8a4e273 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -27,14 +27,15 @@ criteria.addOrder(Order.desc("inTime")); List pgInPgStatusList = criteria.list(); - if (pgInPgStatusList != null) + + if (pgInPgStatusList != null&&pgInPgStatusList.size()!=0) return pgInPgStatusList.get(0); else return null; } public int getInPgNumByName(PgInPgPerson pgInPgPerson) { - String hql = "select count(*) from PgInPgStatus pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); + String hql = "select count(*) from Pg_InPg_Status pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); Object object = this.getSession().createSQLQuery(hql).uniqueResult(); 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 cca3d1c..8fc0ff9 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,7 +4,6 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; -import com.casic.PgInterface.patroler.domain.PgMaintainDoc; import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; @@ -24,17 +23,6 @@ public class PgMaintainManager extends HibernateEntityDao{ public List getPgMaintainList() { - /*Criteria criteria=createCriteria(PgMaintain.class); - criteria.add(Restrictions.eq("active", 1)); - criteria.addOrder(Order.desc("id")); - - List pgMaintainList=criteria.list(); - List pgMaintainDtoList=new ArrayList(); - for(PgMaintain pgMaintain:pgMaintainList) - { - pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); - } - return pgMaintainDtoList;*/ String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; @@ -44,13 +32,13 @@ for (int i = 0; i < objects.size() ; i++) { PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); - pgMaintainDocDto.setId(objects.get(i)[0].toString()); - pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); - pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); - pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); - pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); - pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); - pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDto.setId(String.valueOf(objects.get(i)[0])); + pgMaintainDocDto.setMainTainer(String.valueOf(objects.get(i)[1])); + pgMaintainDocDto.setList_name(String.valueOf(objects.get(i)[2])); + pgMaintainDocDto.setDescribe(String.valueOf(objects.get(i)[3])); + pgMaintainDocDto.setBeginTime(String.valueOf(objects.get(i)[4])); + pgMaintainDocDto.setTimeLimt(String.valueOf(objects.get(i)[5])); + pgMaintainDocDto.setFile_name(String.valueOf(objects.get(i)[6])); pgMaintainDocDtoList.add(pgMaintainDocDto); } return pgMaintainDocDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java new file mode 100644 index 0000000..d4cc10f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintainType; +import com.casic.PgInterface.patroler.dto.PgMaintainTypeDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Service +public class PgMaintainTypeManager extends HibernateEntityDao { + + public List getMaintainType(){ + String sql="select distinct type from PG_MAINTAIN_TYPE"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public List getMaintainTypeModel(String type){ + String sql="select model,type from PG_MAINTAIN_TYPE where type = '"+type+"'"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public PgMaintainType getMaintainTypeByMode(String model) + { + Criteria criteria = createCriteria(PgMaintainType.class); + criteria.add(Restrictions.eq("model", model)); + + List pgMaintainTypeList = criteria.list(); + + if(pgMaintainTypeList.size()!=0) + return pgMaintainTypeList.get(0); + else + return null; + } + +} diff --git a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java index bd4857d..0ec26aa 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java @@ -3,7 +3,6 @@ import com.casic.PgInterface.devTable.domain.PgAlarmType; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; - import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java index ce7a713..0ec81ac 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java @@ -16,6 +16,7 @@ import sun.misc.BASE64Decoder; import javax.servlet.http.HttpServletRequest; +import javax.swing.*; import java.io.*; import java.util.ArrayList; import java.util.List; @@ -42,7 +43,7 @@ try { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String strDirPath = request.getSession().getServletContext().getRealPath(""); - + ImageIcon iv=new ImageIcon(""); FileOutputStream fos = null; String image_toDir = strDirPath + "\\"+fileType;//存储路径 String imageName = ""; diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java index f252247..c6b9e87 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -195,5 +195,4 @@ return resultMap; } - -} +} \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java index 932f2e2..5b5c73f 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java @@ -80,40 +80,48 @@ @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, @FormParam("parName")String parName) - throws Exception{ + throws Exception { Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; + String result = ""; + String msg = ""; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { - PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType); - PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + PgConstructionType pgConstructionType = pgConstructionTypeManager.getConstructionTypeByType(constructionType); + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + if (pgConstructionType.equals(null)) { + result = "false"; + msg = "保存失败,不存在施工类型"; + } else if (pgPartition.equals(null)) { + result = "false"; + msg = "保存失败,不存在施工区域"; + } else { + PgConstruction pgConstruction = new PgConstruction(); + pgConstruction.setCs_name(cs_name); + pgConstruction.setCs_detail(cs_detail); + pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); + pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); + pgConstruction.setCs_charge(cs_charge); + pgConstruction.setCs_phone(cs_phone); + pgConstruction.setCs_type(cs_type); - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_detail(cs_detail); - pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); - pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); - pgConstruction.setCs_charge(cs_charge); - pgConstruction.setCs_phone(cs_phone); - pgConstruction.setCs_type(cs_type); - pgConstruction.setPgPartitionId(pgPartition); - pgConstruction.setPgConstructionTypeId(pgConstructionType); - pgConstruction.setActive(1); + pgConstruction.setPgPartitionId(pgPartition); - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; + pgConstruction.setPgConstructionTypeId(pgConstructionType); + pgConstruction.setActive(1); - }catch (Exception e){ + logger.info("保存成功"); + pgConstructionManager.save(pgConstruction); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { result = "false"; msg = "保存失败"; e.printStackTrace(); } - resultMap.put("success",result); - resultMap.put("msg",msg); + resultMap.put("success", result); + resultMap.put("msg", msg); return resultMap; } @@ -356,4 +364,36 @@ return resultMap; } + /* + * 获取维护信息 + */ + @POST + @Path("getConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map getConstruction() throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + List pgConstructionDtoList=new ArrayList(); + + try{ + pgConstructionDtoList=pgConstructionManager.getPgConstructionList(); + if(pgConstructionDtoList==null||pgConstructionDtoList.size()==0) + msg="不存在施工记录"; + else + msg="施工信息获取成功"; + } + catch(Exception e) + { + e.printStackTrace(); + msg="施工信息获取失败"; + result="false"; + } + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); + + return resultMap; + } + + } diff --git "a/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index c85f677..f64ac25 100644 --- "a/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index 386a71d..ed9be64 100644 --- "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; 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 a296fc3..8a4e273 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -27,14 +27,15 @@ criteria.addOrder(Order.desc("inTime")); List pgInPgStatusList = criteria.list(); - if (pgInPgStatusList != null) + + if (pgInPgStatusList != null&&pgInPgStatusList.size()!=0) return pgInPgStatusList.get(0); else return null; } public int getInPgNumByName(PgInPgPerson pgInPgPerson) { - String hql = "select count(*) from PgInPgStatus pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); + String hql = "select count(*) from Pg_InPg_Status pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); Object object = this.getSession().createSQLQuery(hql).uniqueResult(); 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 cca3d1c..8fc0ff9 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,7 +4,6 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; -import com.casic.PgInterface.patroler.domain.PgMaintainDoc; import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; @@ -24,17 +23,6 @@ public class PgMaintainManager extends HibernateEntityDao{ public List getPgMaintainList() { - /*Criteria criteria=createCriteria(PgMaintain.class); - criteria.add(Restrictions.eq("active", 1)); - criteria.addOrder(Order.desc("id")); - - List pgMaintainList=criteria.list(); - List pgMaintainDtoList=new ArrayList(); - for(PgMaintain pgMaintain:pgMaintainList) - { - pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); - } - return pgMaintainDtoList;*/ String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; @@ -44,13 +32,13 @@ for (int i = 0; i < objects.size() ; i++) { PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); - pgMaintainDocDto.setId(objects.get(i)[0].toString()); - pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); - pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); - pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); - pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); - pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); - pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDto.setId(String.valueOf(objects.get(i)[0])); + pgMaintainDocDto.setMainTainer(String.valueOf(objects.get(i)[1])); + pgMaintainDocDto.setList_name(String.valueOf(objects.get(i)[2])); + pgMaintainDocDto.setDescribe(String.valueOf(objects.get(i)[3])); + pgMaintainDocDto.setBeginTime(String.valueOf(objects.get(i)[4])); + pgMaintainDocDto.setTimeLimt(String.valueOf(objects.get(i)[5])); + pgMaintainDocDto.setFile_name(String.valueOf(objects.get(i)[6])); pgMaintainDocDtoList.add(pgMaintainDocDto); } return pgMaintainDocDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java new file mode 100644 index 0000000..d4cc10f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintainType; +import com.casic.PgInterface.patroler.dto.PgMaintainTypeDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Service +public class PgMaintainTypeManager extends HibernateEntityDao { + + public List getMaintainType(){ + String sql="select distinct type from PG_MAINTAIN_TYPE"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public List getMaintainTypeModel(String type){ + String sql="select model,type from PG_MAINTAIN_TYPE where type = '"+type+"'"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public PgMaintainType getMaintainTypeByMode(String model) + { + Criteria criteria = createCriteria(PgMaintainType.class); + criteria.add(Restrictions.eq("model", model)); + + List pgMaintainTypeList = criteria.list(); + + if(pgMaintainTypeList.size()!=0) + return pgMaintainTypeList.get(0); + else + return null; + } + +} diff --git a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java index bd4857d..0ec26aa 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java @@ -3,7 +3,6 @@ import com.casic.PgInterface.devTable.domain.PgAlarmType; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; - import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java index ce7a713..0ec81ac 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java @@ -16,6 +16,7 @@ import sun.misc.BASE64Decoder; import javax.servlet.http.HttpServletRequest; +import javax.swing.*; import java.io.*; import java.util.ArrayList; import java.util.List; @@ -42,7 +43,7 @@ try { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String strDirPath = request.getSession().getServletContext().getRealPath(""); - + ImageIcon iv=new ImageIcon(""); FileOutputStream fos = null; String image_toDir = strDirPath + "\\"+fileType;//存储路径 String imageName = ""; diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java index f252247..c6b9e87 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -195,5 +195,4 @@ return resultMap; } - -} +} \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java index 932f2e2..5b5c73f 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java @@ -80,40 +80,48 @@ @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, @FormParam("parName")String parName) - throws Exception{ + throws Exception { Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; + String result = ""; + String msg = ""; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { - PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType); - PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + PgConstructionType pgConstructionType = pgConstructionTypeManager.getConstructionTypeByType(constructionType); + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + if (pgConstructionType.equals(null)) { + result = "false"; + msg = "保存失败,不存在施工类型"; + } else if (pgPartition.equals(null)) { + result = "false"; + msg = "保存失败,不存在施工区域"; + } else { + PgConstruction pgConstruction = new PgConstruction(); + pgConstruction.setCs_name(cs_name); + pgConstruction.setCs_detail(cs_detail); + pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); + pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); + pgConstruction.setCs_charge(cs_charge); + pgConstruction.setCs_phone(cs_phone); + pgConstruction.setCs_type(cs_type); - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_detail(cs_detail); - pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); - pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); - pgConstruction.setCs_charge(cs_charge); - pgConstruction.setCs_phone(cs_phone); - pgConstruction.setCs_type(cs_type); - pgConstruction.setPgPartitionId(pgPartition); - pgConstruction.setPgConstructionTypeId(pgConstructionType); - pgConstruction.setActive(1); + pgConstruction.setPgPartitionId(pgPartition); - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; + pgConstruction.setPgConstructionTypeId(pgConstructionType); + pgConstruction.setActive(1); - }catch (Exception e){ + logger.info("保存成功"); + pgConstructionManager.save(pgConstruction); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { result = "false"; msg = "保存失败"; e.printStackTrace(); } - resultMap.put("success",result); - resultMap.put("msg",msg); + resultMap.put("success", result); + resultMap.put("msg", msg); return resultMap; } @@ -356,4 +364,36 @@ return resultMap; } + /* + * 获取维护信息 + */ + @POST + @Path("getConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map getConstruction() throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + List pgConstructionDtoList=new ArrayList(); + + try{ + pgConstructionDtoList=pgConstructionManager.getPgConstructionList(); + if(pgConstructionDtoList==null||pgConstructionDtoList.size()==0) + msg="不存在施工记录"; + else + msg="施工信息获取成功"; + } + catch(Exception e) + { + e.printStackTrace(); + msg="施工信息获取失败"; + result="false"; + } + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); + + return resultMap; + } + + } diff --git "a/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index c85f677..f64ac25 100644 --- "a/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index 386a71d..ed9be64 100644 --- "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ diff --git "a/\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 4bd0b78..92f3b61 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 diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 61a7a58..864bcb2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,23 +2,28 @@ + + + - - - - - - - - + + + + + + + + + + + + + - - - @@ -44,36 +49,32 @@ - - + + - - + + - - - + + + + + - + - - - - - - - - - - - - - + + + + + + + @@ -96,26 +97,6 @@ @@ -209,7 +210,7 @@ @@ -240,20 +241,7 @@ - - - - - - - - - - + @@ -345,40 +333,6 @@ - - - - - - - - - - - - - - - @@ -410,7 +364,37 @@ - + + + + + + + + + + + + + + + + @@ -444,129 +428,22 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -605,6 +482,7 @@ + - @@ -1330,7 +1220,7 @@ - + @@ -1342,45 +1232,45 @@ - + - - + - + - + - + - + + - + - + - + - + - + @@ -1400,8 +1290,8 @@ - + @@ -1420,7 +1310,6 @@ - @@ -1445,11 +1334,12 @@ - - @@ -1457,428 +1347,421 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - - + + - + - - - - - - - - - + + - + - - + + - + - - - + + - + - - - + + + + + - + - - - + + - + - - - - - - - - - - - - - - - - - + + - - + + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + + - - + + - + - - - - - - - - - - + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1939,6 +1822,7 @@ 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 a928236..bd235ad 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -13,7 +13,7 @@ * Created by zxh on 2018/3/23. */ @Entity -@Table(name = "PG_CONSTRUCTION") +@Table(name = "CS_TYPE") @SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) public class PgConstruction implements Serializable{ 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 9cda025..318f707 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -20,6 +20,7 @@ private String parName;//施工区域 private String ConstructionType;//项目状态 private String active;//状态位 + private String doc_name;//施工文档 public String getId() { return id; @@ -105,26 +106,37 @@ ConstructionType = constructionType; } - public PgConstructionDto(PgConstruction pgConstruction) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - this.setId(String.valueOf(pgConstruction.getId())); - this.setCs_name(pgConstruction.getCs_name()); - this.setCs_detail(pgConstruction.getCs_detail()); - if (pgConstruction.getCs_beginTime() != null) - this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); - else - this.setCs_beginTime(""); - if (pgConstruction.getCs_endTime() != null) - this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); - else - this.setCs_endTime(""); - this.setCs_charge(pgConstruction.getCs_charge()); - this.setCs_phone(pgConstruction.getCs_phone()); - this.setCs_type(pgConstruction.getCs_type()); - this.setParName(pgConstruction.getPgPartitionId().getParName()); - this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); - this.setActive(String.valueOf(pgConstruction.getActive())); + public String getDoc_name() { + return doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } + + public PgConstructionDto(PgConstruction pgConstruction) { + + if (pgConstruction == null) { + } else { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_detail(pgConstruction.getCs_detail()); + if (pgConstruction.getCs_beginTime() != null) + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + else + this.setCs_beginTime(""); + if (pgConstruction.getCs_endTime() != null) + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + else + this.setCs_endTime(""); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setParName(pgConstruction.getPgPartitionId().getParName()); + this.setConstructionType(pgConstruction.getPgConstructionTypeId().getTypeName()); + this.setActive(String.valueOf(pgConstruction.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 d7099a2..165d328 100644 --- a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -8,7 +8,6 @@ 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.dto.PgAlarmTjDto; import com.casic.PgInterface.devTable.manager.PgPartitionManager; import org.hibernate.Criteria; import org.hibernate.criterion.Order; @@ -139,20 +138,24 @@ public List getStatisticByPartitionOrType(String statisticType) { List pgConstructTjDtoList = new ArrayList(); - String str=statisticType.equals(0)?"cs_type":"pgPartitionId"; + String str=statisticType.equals("0")?"CS_TYPE":"PAPARTITION_ID"; try { - String hql="select count(*), pgConstruction." + str + " from PgConstruction pgConstruction "+ + String hql="select count(*), pgConstruction." + str + " from Pg_Construction pgConstruction "+ "group by pgConstruction." + str; - List objects=this.getSession().createQuery(hql).list(); + List objects=this.getSession().createSQLQuery(hql).list(); for(int i=0;i getPgConstructionList() { + String sql = "SELECT t.ID,t.CS_NAME,t.CS_DETAIL,t.CS_BEGINTIME,t.CS_ENDTIME,t.CS_CHARGE,t.CS_PHONE,t.CS_TYPE,t.ACTIVE, " + + "(SELECT m.PARNAME FROM PG_PARTITION m WHERE m.ID = t.PAPARTITION_ID) AS PARNAME, " + + "(SELECT n.TYPENAME FROM PG_CONSTRUCTION_TYPE n WHERE n.ID = t.PGCONSTRUCTIONTYPE_ID) AS TYPENAME" + + " FROM PG_CONSTRUCTION t WHERE ACTIVE = 1"; + + List pgConstructionDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + if(objects.size()==0) return null; + for (int i = 0; i < objects.size() ; i++) { + PgConstructionDto pgConstructionDto = new PgConstructionDto(null); + pgConstructionDto.setId(String.valueOf(objects.get(i)[0])); + pgConstructionDto.setCs_name(String.valueOf(objects.get(i)[1])); + pgConstructionDto.setCs_detail(String.valueOf(objects.get(i)[2])); + pgConstructionDto.setCs_beginTime(String.valueOf(objects.get(i)[3])); + pgConstructionDto.setCs_endTime(String.valueOf(objects.get(i)[4])); + pgConstructionDto.setCs_charge(String.valueOf(objects.get(i)[5])); + pgConstructionDto.setCs_phone(String.valueOf(objects.get(i)[6])); + pgConstructionDto.setCs_type(String.valueOf(objects.get(i)[7])); + pgConstructionDto.setActive(String.valueOf(objects.get(i)[8])); + pgConstructionDto.setParName(String.valueOf(objects.get(i)[9])); + pgConstructionDto.setConstructionType(String.valueOf(objects.get(i)[9])); + pgConstructionDtoList.add(pgConstructionDto); + } + return pgConstructionDtoList; + } + } diff --git a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java index 24c5b6c..59bee6c 100644 --- a/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java +++ b/src/main/java/com/casic/PgInterface/devTable/manager/PgPartitionManager.java @@ -19,7 +19,7 @@ public class PgPartitionManager extends HibernateEntityDao { public PgPartition getPartitionByParName(String parName) { - Criteria criteria = getSession().createCriteria(PipeGallery.class); + Criteria criteria = getSession().createCriteria(PgPartition.class); criteria.add(Restrictions.eq("parName", parName)); criteria.add(Restrictions.eq("active",1)); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java index 4e962d5..2edddc8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintain.java @@ -1,8 +1,12 @@ package com.casic.PgInterface.patroler.domain; +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 yxw on 2018/3/28. @@ -18,6 +22,8 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private int active;//状态位 + private List pgMaintainDocList;//施工文档 + private PgMaintainType pgMaintainType;//维护类别 @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_ID") @@ -73,4 +79,24 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgmaintain_id") + public List getPgMaintainDocList() { + return pgMaintainDocList; + } + + public void setPgMaintainDocList(List pgMaintainDocList) { + this.pgMaintainDocList = pgMaintainDocList; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "MAINTAINTYPEID") + public PgMaintainType getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(PgMaintainType pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java new file mode 100644 index 0000000..f7c03b7 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainType.java @@ -0,0 +1,66 @@ +package com.casic.PgInterface.patroler.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Entity +@Table(name = "PG_MAINTAIN_TYPE") +@SequenceGenerator(name = "SEQ_PG_MAINTAIN_TYPE_ID", sequenceName = "SEQ_PG_MAINTAIN_TYPE_ID",allocationSize=1,initialValue=1) +public class PgMaintainType implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String type; + private String model; + private int active; + private List pgMaintainTypeList; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAIN_TYPE_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "TYPE") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgMaintainType") + public List getPgMaintainTypeList() { + return pgMaintainTypeList; + } + + public void setPgMaintainTypeList(List pgMaintainTypeList) { + this.pgMaintainTypeList = pgMaintainTypeList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 7f7180b..8639bba 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,11 +1,9 @@ package com.casic.PgInterface.patroler.domain; -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 yxw on 2018/3/28. @@ -20,7 +18,7 @@ private Date beginTime; private String timeLimt; private String describe; - + private List pgPatrolDocList; private int active; @Id @@ -78,4 +76,13 @@ public void setActive(int active) { this.active = active; } + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgpatrol_id") + public List getPgPatrolDocList() { + return pgPatrolDocList; + } + + public void setPgPatrolDocList(List pgPatrolDocList) { + this.pgPatrolDocList = pgPatrolDocList; + } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java index 5863460..4b95be8 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgInPgInfoDto.java @@ -90,7 +90,7 @@ this.setPhoneNumber(pgInPgPerson.getPhoneNumber()); this.setIsInPg(String.valueOf(pgInPgPerson.getIsInPg())); this.setPersonType(pgInPgPerson.getPersonType()); - if (pgInPgStatus.getInTime() != null) + if (pgInPgStatus!=null&&pgInPgStatus.getInTime() != null) this.setLastInTime(sdf.format(pgInPgStatus.getInTime())); else this.setLastInTime(""); diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java index c1c1c68..e4de792 100644 --- a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDto.java @@ -16,6 +16,7 @@ private String timeLimt;//计划工期 private String describe;//任务描述 private String active;//状态位 + private String pgMaintainType;//维护类别 public String getId() { return id; @@ -65,6 +66,14 @@ this.active = active; } + public String getPgMaintainType() { + return pgMaintainType; + } + + public void setPgMaintainType(String pgMaintainType) { + this.pgMaintainType = pgMaintainType; + } + public PgMaintainDto(PgMaintain pgMaintain) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -76,6 +85,7 @@ this.setTimeLimt(pgMaintain.getTimeLimt()); this.setDescribe(pgMaintain.getDescribe()); this.setActive(String.valueOf(pgMaintain.getActive())); + this.setPgMaintainType(pgMaintain.getPgMaintainType().getType()+pgMaintain.getPgMaintainType().getModel()); } } diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java new file mode 100644 index 0000000..5804d37 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainTypeDto.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainType; + +import java.io.Serializable; + +/** + * Created by yxw on 2018/8/21. + */ +public class PgMaintainTypeDto implements Serializable { + private long id; + private String type; + private String model; + private String active; + + public PgMaintainTypeDto (PgMaintainType pgMaintainType) + { + if(pgMaintainType.equals(null)) return; + else { + this.setId(pgMaintainType.getId()); + this.setType(pgMaintainType.getType()); + this.setModel(pgMaintainType.getModel()); + this.setActive(String.valueOf(pgMaintainType.getActive())); + } + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java index 417a378..9952085 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgPersonManager.java @@ -79,7 +79,7 @@ break; case 2://周 dateType = "iw"; - break; + break; case 3://日 dateType="yyyy-mm-dd"; break; 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 a296fc3..8a4e273 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgInPgStatusManager.java @@ -27,14 +27,15 @@ criteria.addOrder(Order.desc("inTime")); List pgInPgStatusList = criteria.list(); - if (pgInPgStatusList != null) + + if (pgInPgStatusList != null&&pgInPgStatusList.size()!=0) return pgInPgStatusList.get(0); else return null; } public int getInPgNumByName(PgInPgPerson pgInPgPerson) { - String hql = "select count(*) from PgInPgStatus pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); + String hql = "select count(*) from Pg_InPg_Status pgInPgStatus where pgInPgStatus.pgInPgPersonId = " + pgInPgPerson.getId(); Object object = this.getSession().createSQLQuery(hql).uniqueResult(); 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 cca3d1c..8fc0ff9 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,7 +4,6 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; -import com.casic.PgInterface.patroler.domain.PgMaintainDoc; import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; @@ -24,17 +23,6 @@ public class PgMaintainManager extends HibernateEntityDao{ public List getPgMaintainList() { - /*Criteria criteria=createCriteria(PgMaintain.class); - criteria.add(Restrictions.eq("active", 1)); - criteria.addOrder(Order.desc("id")); - - List pgMaintainList=criteria.list(); - List pgMaintainDtoList=new ArrayList(); - for(PgMaintain pgMaintain:pgMaintainList) - { - pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); - } - return pgMaintainDtoList;*/ String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; @@ -44,13 +32,13 @@ for (int i = 0; i < objects.size() ; i++) { PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); - pgMaintainDocDto.setId(objects.get(i)[0].toString()); - pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); - pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); - pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); - pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); - pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); - pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDto.setId(String.valueOf(objects.get(i)[0])); + pgMaintainDocDto.setMainTainer(String.valueOf(objects.get(i)[1])); + pgMaintainDocDto.setList_name(String.valueOf(objects.get(i)[2])); + pgMaintainDocDto.setDescribe(String.valueOf(objects.get(i)[3])); + pgMaintainDocDto.setBeginTime(String.valueOf(objects.get(i)[4])); + pgMaintainDocDto.setTimeLimt(String.valueOf(objects.get(i)[5])); + pgMaintainDocDto.setFile_name(String.valueOf(objects.get(i)[6])); pgMaintainDocDtoList.add(pgMaintainDocDto); } return pgMaintainDocDtoList; diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java new file mode 100644 index 0000000..d4cc10f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainTypeManager.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintainType; +import com.casic.PgInterface.patroler.dto.PgMaintainTypeDto; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by yxw on 2018/8/21. + */ +@Service +public class PgMaintainTypeManager extends HibernateEntityDao { + + public List getMaintainType(){ + String sql="select distinct type from PG_MAINTAIN_TYPE"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public List getMaintainTypeModel(String type){ + String sql="select model,type from PG_MAINTAIN_TYPE where type = '"+type+"'"; + + List pgMaintainTypeList=(List)this.getSession().createSQLQuery(sql).list(); + List pgMaintainTypeDtoList=new ArrayList(); + for(PgMaintainType pgMaintainType : pgMaintainTypeList) + { + pgMaintainTypeDtoList.add(new PgMaintainTypeDto(pgMaintainType)); + } + + return pgMaintainTypeDtoList; + } + + public PgMaintainType getMaintainTypeByMode(String model) + { + Criteria criteria = createCriteria(PgMaintainType.class); + criteria.add(Restrictions.eq("model", model)); + + List pgMaintainTypeList = criteria.list(); + + if(pgMaintainTypeList.size()!=0) + return pgMaintainTypeList.get(0); + else + return null; + } + +} diff --git a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java index bd4857d..0ec26aa 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/domain/PgReservePlan.java @@ -3,7 +3,6 @@ import com.casic.PgInterface.devTable.domain.PgAlarmType; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; - import javax.persistence.*; import java.io.Serializable; diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java index ce7a713..0ec81ac 100644 --- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java +++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java @@ -16,6 +16,7 @@ import sun.misc.BASE64Decoder; import javax.servlet.http.HttpServletRequest; +import javax.swing.*; import java.io.*; import java.util.ArrayList; import java.util.List; @@ -42,7 +43,7 @@ try { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String strDirPath = request.getSession().getServletContext().getRealPath(""); - + ImageIcon iv=new ImageIcon(""); FileOutputStream fos = null; String image_toDir = strDirPath + "\\"+fileType;//存储路径 String imageName = ""; diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java index f252247..c6b9e87 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmRs.java @@ -195,5 +195,4 @@ return resultMap; } - -} +} \ No newline at end of file diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java index 932f2e2..5b5c73f 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java @@ -80,40 +80,48 @@ @FormParam("cs_phone")String cs_phone, @FormParam("cs_type")String cs_type, @FormParam("parName")String parName) - throws Exception{ + throws Exception { Map resultMap = new HashMap(); - String result = "" ; - String msg = "" ; + String result = ""; + String msg = ""; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { - PgConstructionType pgConstructionType=pgConstructionTypeManager.getConstructionTypeByType(constructionType); - PgPartition pgPartition=pgPartitionManager.getPartitionByParName(parName); + PgConstructionType pgConstructionType = pgConstructionTypeManager.getConstructionTypeByType(constructionType); + PgPartition pgPartition = pgPartitionManager.getPartitionByParName(parName); + if (pgConstructionType.equals(null)) { + result = "false"; + msg = "保存失败,不存在施工类型"; + } else if (pgPartition.equals(null)) { + result = "false"; + msg = "保存失败,不存在施工区域"; + } else { + PgConstruction pgConstruction = new PgConstruction(); + pgConstruction.setCs_name(cs_name); + pgConstruction.setCs_detail(cs_detail); + pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); + pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); + pgConstruction.setCs_charge(cs_charge); + pgConstruction.setCs_phone(cs_phone); + pgConstruction.setCs_type(cs_type); - PgConstruction pgConstruction = new PgConstruction(); - pgConstruction.setCs_name(cs_name); - pgConstruction.setCs_detail(cs_detail); - pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); - pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); - pgConstruction.setCs_charge(cs_charge); - pgConstruction.setCs_phone(cs_phone); - pgConstruction.setCs_type(cs_type); - pgConstruction.setPgPartitionId(pgPartition); - pgConstruction.setPgConstructionTypeId(pgConstructionType); - pgConstruction.setActive(1); + pgConstruction.setPgPartitionId(pgPartition); - logger.info("保存成功"); - pgConstructionManager.save(pgConstruction); - result = "true"; - msg = "保存成功"; + pgConstruction.setPgConstructionTypeId(pgConstructionType); + pgConstruction.setActive(1); - }catch (Exception e){ + logger.info("保存成功"); + pgConstructionManager.save(pgConstruction); + result = "true"; + msg = "保存成功"; + } + } catch (Exception e) { result = "false"; msg = "保存失败"; e.printStackTrace(); } - resultMap.put("success",result); - resultMap.put("msg",msg); + resultMap.put("success", result); + resultMap.put("msg", msg); return resultMap; } @@ -356,4 +364,36 @@ return resultMap; } + /* + * 获取维护信息 + */ + @POST + @Path("getConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map getConstruction() throws Exception { + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + List pgConstructionDtoList=new ArrayList(); + + try{ + pgConstructionDtoList=pgConstructionManager.getPgConstructionList(); + if(pgConstructionDtoList==null||pgConstructionDtoList.size()==0) + msg="不存在施工记录"; + else + msg="施工信息获取成功"; + } + catch(Exception e) + { + e.printStackTrace(); + msg="施工信息获取失败"; + result="false"; + } + resultMap.put("msg",msg); + resultMap.put("result",pgConstructionDtoList); + + return resultMap; + } + + } diff --git "a/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index c85f677..f64ac25 100644 --- "a/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/~$\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index 386a71d..ed9be64 100644 --- "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ diff --git "a/\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 4bd0b78..92f3b61 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 diff --git "a/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index 0ccb673..6a96541 100644 --- "a/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ