diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java new file mode 100644 index 0000000..8b57e41 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.construction.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/23. + */ +@Entity +@Table(name = "PG_CONSTRUCTION") +@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) +public class PgConstruction implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String cs_name; + private String cs_position; + private String cs_status; + private String cs_detail; + private Date cs_beginTime; + private Date cs_endTime; + private String cs_charge; + private String cs_phone; + private String cs_type; + private String cs_region; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_POSITION") + public String getCs_position(){ return cs_position; } + + public void setCs_position(String cs_position){ this.cs_position = cs_position; } + + @Column(name = "CS_STATUS") + public String getCs_status(){ return cs_status; } + + public void setCs_status(String cs_status){ this.cs_status = cs_status; } + + @Column(name = "CS_DETAIL") + public String getCs_detail(){ return cs_detail; } + + public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } + + @Column(name = "CS_BEGINTIME") + public Date getCs_beginTime(){ return cs_beginTime; } + + public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } + + @Column(name = "CS_ENDTIME") + public Date getCs_endTime(){ return cs_endTime; } + + public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } + + @Column(name = "CS_CHARGE") + public String getCs_charge(){ return cs_charge; } + + public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } + + @Column(name = "CS_PHONE") + public String getCs_phone(){ return cs_phone; } + + public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_REGION") + public String getCs_region(){ return cs_region; } + + public void setCs_region(String cs_region){ this.cs_region = cs_region; } + + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java new file mode 100644 index 0000000..8b57e41 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.construction.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/23. + */ +@Entity +@Table(name = "PG_CONSTRUCTION") +@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) +public class PgConstruction implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String cs_name; + private String cs_position; + private String cs_status; + private String cs_detail; + private Date cs_beginTime; + private Date cs_endTime; + private String cs_charge; + private String cs_phone; + private String cs_type; + private String cs_region; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_POSITION") + public String getCs_position(){ return cs_position; } + + public void setCs_position(String cs_position){ this.cs_position = cs_position; } + + @Column(name = "CS_STATUS") + public String getCs_status(){ return cs_status; } + + public void setCs_status(String cs_status){ this.cs_status = cs_status; } + + @Column(name = "CS_DETAIL") + public String getCs_detail(){ return cs_detail; } + + public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } + + @Column(name = "CS_BEGINTIME") + public Date getCs_beginTime(){ return cs_beginTime; } + + public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } + + @Column(name = "CS_ENDTIME") + public Date getCs_endTime(){ return cs_endTime; } + + public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } + + @Column(name = "CS_CHARGE") + public String getCs_charge(){ return cs_charge; } + + public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } + + @Column(name = "CS_PHONE") + public String getCs_phone(){ return cs_phone; } + + public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_REGION") + public String getCs_region(){ return cs_region; } + + public void setCs_region(String cs_region){ this.cs_region = cs_region; } + + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java new file mode 100644 index 0000000..13579ab --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.construction.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/28. + */ + +@Entity +@Table(name = "PG_CSDOCUMENT") +@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) +public class PgCsDocument implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String doc_name; + private String cs_name; + private String cs_type; + private Date cs_time; + private String construct_doc; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "DOC_NAME") + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_TIME") + public Date getCs_time(){ return cs_time; } + + public void setCs_time(Date cs_time){ this.cs_time = cs_time; } + @Column(name = "CONSTRUCT_DOC") + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java new file mode 100644 index 0000000..8b57e41 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.construction.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/23. + */ +@Entity +@Table(name = "PG_CONSTRUCTION") +@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) +public class PgConstruction implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String cs_name; + private String cs_position; + private String cs_status; + private String cs_detail; + private Date cs_beginTime; + private Date cs_endTime; + private String cs_charge; + private String cs_phone; + private String cs_type; + private String cs_region; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_POSITION") + public String getCs_position(){ return cs_position; } + + public void setCs_position(String cs_position){ this.cs_position = cs_position; } + + @Column(name = "CS_STATUS") + public String getCs_status(){ return cs_status; } + + public void setCs_status(String cs_status){ this.cs_status = cs_status; } + + @Column(name = "CS_DETAIL") + public String getCs_detail(){ return cs_detail; } + + public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } + + @Column(name = "CS_BEGINTIME") + public Date getCs_beginTime(){ return cs_beginTime; } + + public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } + + @Column(name = "CS_ENDTIME") + public Date getCs_endTime(){ return cs_endTime; } + + public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } + + @Column(name = "CS_CHARGE") + public String getCs_charge(){ return cs_charge; } + + public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } + + @Column(name = "CS_PHONE") + public String getCs_phone(){ return cs_phone; } + + public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_REGION") + public String getCs_region(){ return cs_region; } + + public void setCs_region(String cs_region){ this.cs_region = cs_region; } + + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java new file mode 100644 index 0000000..13579ab --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.construction.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/28. + */ + +@Entity +@Table(name = "PG_CSDOCUMENT") +@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) +public class PgCsDocument implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String doc_name; + private String cs_name; + private String cs_type; + private Date cs_time; + private String construct_doc; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "DOC_NAME") + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_TIME") + public Date getCs_time(){ return cs_time; } + + public void setCs_time(Date cs_time){ this.cs_time = cs_time; } + @Column(name = "CONSTRUCT_DOC") + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java new file mode 100644 index 0000000..98a49f6 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -0,0 +1,35 @@ +package com.casic.PgInterface.construction.dto; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/3/30. + */ +public class PgConstructTjDto implements Serializable { + + private String constructNum;//施工数量 + private String completeNum;//完工数量 + private String underwayNum;//施工中数量 + private String constructTypeNum;//施工类型统计 + private String constructRegionNum;//施工区域统计 + + public String getConstructNum(){ return constructNum; } + + public void setConstructNum(String constructNum){ this.constructNum = constructNum;} + + public String getCompleteNum(){ return completeNum; } + + public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + + public String getUnderwayNum(){ return underwayNum; } + + public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + + public String getConstructTypeNum(){ return constructTypeNum; } + + public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + + public String getConstructRegionNum(){ return constructRegionNum; } + + public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java new file mode 100644 index 0000000..8b57e41 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.construction.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/23. + */ +@Entity +@Table(name = "PG_CONSTRUCTION") +@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) +public class PgConstruction implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String cs_name; + private String cs_position; + private String cs_status; + private String cs_detail; + private Date cs_beginTime; + private Date cs_endTime; + private String cs_charge; + private String cs_phone; + private String cs_type; + private String cs_region; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_POSITION") + public String getCs_position(){ return cs_position; } + + public void setCs_position(String cs_position){ this.cs_position = cs_position; } + + @Column(name = "CS_STATUS") + public String getCs_status(){ return cs_status; } + + public void setCs_status(String cs_status){ this.cs_status = cs_status; } + + @Column(name = "CS_DETAIL") + public String getCs_detail(){ return cs_detail; } + + public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } + + @Column(name = "CS_BEGINTIME") + public Date getCs_beginTime(){ return cs_beginTime; } + + public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } + + @Column(name = "CS_ENDTIME") + public Date getCs_endTime(){ return cs_endTime; } + + public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } + + @Column(name = "CS_CHARGE") + public String getCs_charge(){ return cs_charge; } + + public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } + + @Column(name = "CS_PHONE") + public String getCs_phone(){ return cs_phone; } + + public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_REGION") + public String getCs_region(){ return cs_region; } + + public void setCs_region(String cs_region){ this.cs_region = cs_region; } + + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java new file mode 100644 index 0000000..13579ab --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.construction.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/28. + */ + +@Entity +@Table(name = "PG_CSDOCUMENT") +@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) +public class PgCsDocument implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String doc_name; + private String cs_name; + private String cs_type; + private Date cs_time; + private String construct_doc; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "DOC_NAME") + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_TIME") + public Date getCs_time(){ return cs_time; } + + public void setCs_time(Date cs_time){ this.cs_time = cs_time; } + @Column(name = "CONSTRUCT_DOC") + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java new file mode 100644 index 0000000..98a49f6 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -0,0 +1,35 @@ +package com.casic.PgInterface.construction.dto; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/3/30. + */ +public class PgConstructTjDto implements Serializable { + + private String constructNum;//施工数量 + private String completeNum;//完工数量 + private String underwayNum;//施工中数量 + private String constructTypeNum;//施工类型统计 + private String constructRegionNum;//施工区域统计 + + public String getConstructNum(){ return constructNum; } + + public void setConstructNum(String constructNum){ this.constructNum = constructNum;} + + public String getCompleteNum(){ return completeNum; } + + public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + + public String getUnderwayNum(){ return underwayNum; } + + public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + + public String getConstructTypeNum(){ return constructTypeNum; } + + public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + + public String getConstructRegionNum(){ return constructRegionNum; } + + public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java new file mode 100644 index 0000000..a092f0e --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -0,0 +1,135 @@ +package com.casic.PgInterface.construction.dto; + +import com.casic.PgInterface.construction.domain.PgConstruction; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +/** + * Created by zxh on 2018/3/23. + */ +public class PgConstructionDto implements Serializable{ + + private String id; + private String cs_name;//项目名称 + private String cs_position;//施工位置 + private String cs_status;//项目状态 + private String cs_detail;//施工内容 + private String cs_beginTime;//施工开始时间 + private String cs_endTime;//施工结束时间 + private String cs_charge;//施工负责人 + private String cs_phone;//联系方式 + private String cs_type;//工程类别 + private String cs_region;//施工区域 + private String active;//状态位 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCs_name() { + return cs_name; + } + + public void setCs_name(String cs_name) { + this.cs_name = cs_name; + } + + public String getCs_position() { + return cs_position; + } + + public void setCs_position(String cs_position) { + this.cs_position = cs_position; + } + + public String getCs_status() { + return cs_status; + } + + public void setCs_status(String cs_status) { + this.cs_status = cs_status; + } + + public String getCs_detail() { + return cs_detail; + } + + public void setCs_detail(String cs_detail) { + this.cs_detail = cs_detail; + } + + public String getCs_beginTime() { + return cs_beginTime; + } + + public void setCs_beginTime(String cs_beginTime) { + this.cs_beginTime = cs_beginTime; + } + + public String getCs_endTime() { + return cs_endTime; + } + + public void setCs_endTime(String cs_endTime) { + this.cs_endTime = cs_endTime; + } + + public String getCs_charge() { + return cs_charge; + } + + public void setCs_charge(String cs_charge) { + this.cs_charge = cs_charge; + } + + public String getCs_phone() { + return cs_phone; + } + + public void setCs_phone(String cs_phone) { + this.cs_phone = cs_phone; + } + + public String getCs_type() { + return cs_type; + } + + public void setCs_type(String cs_type) { + this.cs_type = cs_type; + } + + public String getCs_region() { + return cs_region; + } + + public void setCs_region(String cs_region) { + this.cs_region = cs_region; + } + + public String getActive(){ return active; } + + public void setActive(String active){ this.active = active; } + + public PgConstructionDto(PgConstruction pgConstruction) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_position(pgConstruction.getCs_position()); + this.setCs_status(pgConstruction.getCs_status()); + this.setCs_detail(pgConstruction.getCs_detail()); + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setCs_region(pgConstruction.getCs_region()); + this.setActive(String.valueOf(pgConstruction.getActive())); + + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java new file mode 100644 index 0000000..8b57e41 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.construction.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/23. + */ +@Entity +@Table(name = "PG_CONSTRUCTION") +@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) +public class PgConstruction implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String cs_name; + private String cs_position; + private String cs_status; + private String cs_detail; + private Date cs_beginTime; + private Date cs_endTime; + private String cs_charge; + private String cs_phone; + private String cs_type; + private String cs_region; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_POSITION") + public String getCs_position(){ return cs_position; } + + public void setCs_position(String cs_position){ this.cs_position = cs_position; } + + @Column(name = "CS_STATUS") + public String getCs_status(){ return cs_status; } + + public void setCs_status(String cs_status){ this.cs_status = cs_status; } + + @Column(name = "CS_DETAIL") + public String getCs_detail(){ return cs_detail; } + + public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } + + @Column(name = "CS_BEGINTIME") + public Date getCs_beginTime(){ return cs_beginTime; } + + public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } + + @Column(name = "CS_ENDTIME") + public Date getCs_endTime(){ return cs_endTime; } + + public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } + + @Column(name = "CS_CHARGE") + public String getCs_charge(){ return cs_charge; } + + public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } + + @Column(name = "CS_PHONE") + public String getCs_phone(){ return cs_phone; } + + public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_REGION") + public String getCs_region(){ return cs_region; } + + public void setCs_region(String cs_region){ this.cs_region = cs_region; } + + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java new file mode 100644 index 0000000..13579ab --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.construction.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/28. + */ + +@Entity +@Table(name = "PG_CSDOCUMENT") +@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) +public class PgCsDocument implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String doc_name; + private String cs_name; + private String cs_type; + private Date cs_time; + private String construct_doc; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "DOC_NAME") + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_TIME") + public Date getCs_time(){ return cs_time; } + + public void setCs_time(Date cs_time){ this.cs_time = cs_time; } + @Column(name = "CONSTRUCT_DOC") + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java new file mode 100644 index 0000000..98a49f6 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -0,0 +1,35 @@ +package com.casic.PgInterface.construction.dto; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/3/30. + */ +public class PgConstructTjDto implements Serializable { + + private String constructNum;//施工数量 + private String completeNum;//完工数量 + private String underwayNum;//施工中数量 + private String constructTypeNum;//施工类型统计 + private String constructRegionNum;//施工区域统计 + + public String getConstructNum(){ return constructNum; } + + public void setConstructNum(String constructNum){ this.constructNum = constructNum;} + + public String getCompleteNum(){ return completeNum; } + + public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + + public String getUnderwayNum(){ return underwayNum; } + + public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + + public String getConstructTypeNum(){ return constructTypeNum; } + + public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + + public String getConstructRegionNum(){ return constructRegionNum; } + + public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java new file mode 100644 index 0000000..a092f0e --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -0,0 +1,135 @@ +package com.casic.PgInterface.construction.dto; + +import com.casic.PgInterface.construction.domain.PgConstruction; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +/** + * Created by zxh on 2018/3/23. + */ +public class PgConstructionDto implements Serializable{ + + private String id; + private String cs_name;//项目名称 + private String cs_position;//施工位置 + private String cs_status;//项目状态 + private String cs_detail;//施工内容 + private String cs_beginTime;//施工开始时间 + private String cs_endTime;//施工结束时间 + private String cs_charge;//施工负责人 + private String cs_phone;//联系方式 + private String cs_type;//工程类别 + private String cs_region;//施工区域 + private String active;//状态位 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCs_name() { + return cs_name; + } + + public void setCs_name(String cs_name) { + this.cs_name = cs_name; + } + + public String getCs_position() { + return cs_position; + } + + public void setCs_position(String cs_position) { + this.cs_position = cs_position; + } + + public String getCs_status() { + return cs_status; + } + + public void setCs_status(String cs_status) { + this.cs_status = cs_status; + } + + public String getCs_detail() { + return cs_detail; + } + + public void setCs_detail(String cs_detail) { + this.cs_detail = cs_detail; + } + + public String getCs_beginTime() { + return cs_beginTime; + } + + public void setCs_beginTime(String cs_beginTime) { + this.cs_beginTime = cs_beginTime; + } + + public String getCs_endTime() { + return cs_endTime; + } + + public void setCs_endTime(String cs_endTime) { + this.cs_endTime = cs_endTime; + } + + public String getCs_charge() { + return cs_charge; + } + + public void setCs_charge(String cs_charge) { + this.cs_charge = cs_charge; + } + + public String getCs_phone() { + return cs_phone; + } + + public void setCs_phone(String cs_phone) { + this.cs_phone = cs_phone; + } + + public String getCs_type() { + return cs_type; + } + + public void setCs_type(String cs_type) { + this.cs_type = cs_type; + } + + public String getCs_region() { + return cs_region; + } + + public void setCs_region(String cs_region) { + this.cs_region = cs_region; + } + + public String getActive(){ return active; } + + public void setActive(String active){ this.active = active; } + + public PgConstructionDto(PgConstruction pgConstruction) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_position(pgConstruction.getCs_position()); + this.setCs_status(pgConstruction.getCs_status()); + this.setCs_detail(pgConstruction.getCs_detail()); + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setCs_region(pgConstruction.getCs_region()); + this.setActive(String.valueOf(pgConstruction.getActive())); + + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java new file mode 100644 index 0000000..598380f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -0,0 +1,79 @@ +package com.casic.PgInterface.construction.dto; + +import com.casic.PgInterface.construction.domain.PgCsDocument; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by zxh on 2018/3/28. + */ +public class PgCsDocumentDto implements Serializable{ + + private String id; + private String doc_name;//文档名称 + private String cs_name;//项目名称 + private String cs_type;//工程类别 + private String cs_time;//施工时间 + private String construct_doc;//施工文档 + private String active;//状态位 + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + public String getCs_name() { + return cs_name; + } + + public void setCs_name(String cs_name) { + this.cs_name = cs_name; + } + + public String getCs_type() { + return cs_type; + } + + public void setCs_type(String cs_type) { + this.cs_type = cs_type; + } + + public String getCs_time() { + return cs_time; + } + + public void setCs_time(String cs_time) { + this.cs_time = cs_time; + } + + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + + public String getActive(){ return active; } + + public void setActive(String active){ this.active = active; } + + public PgCsDocumentDto (PgCsDocument pgCsDocument) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgCsDocument.getId())); + this.setDoc_name(pgCsDocument.getDoc_name()); + this.setCs_name(pgCsDocument.getCs_name()); + this.setCs_type(pgCsDocument.getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getCs_time())); + this.setConstruct_doc(pgCsDocument.getConstruct_doc()); + this.setActive(String.valueOf(pgCsDocument.getActive())); + + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java new file mode 100644 index 0000000..8b57e41 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.construction.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/23. + */ +@Entity +@Table(name = "PG_CONSTRUCTION") +@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) +public class PgConstruction implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String cs_name; + private String cs_position; + private String cs_status; + private String cs_detail; + private Date cs_beginTime; + private Date cs_endTime; + private String cs_charge; + private String cs_phone; + private String cs_type; + private String cs_region; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_POSITION") + public String getCs_position(){ return cs_position; } + + public void setCs_position(String cs_position){ this.cs_position = cs_position; } + + @Column(name = "CS_STATUS") + public String getCs_status(){ return cs_status; } + + public void setCs_status(String cs_status){ this.cs_status = cs_status; } + + @Column(name = "CS_DETAIL") + public String getCs_detail(){ return cs_detail; } + + public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } + + @Column(name = "CS_BEGINTIME") + public Date getCs_beginTime(){ return cs_beginTime; } + + public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } + + @Column(name = "CS_ENDTIME") + public Date getCs_endTime(){ return cs_endTime; } + + public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } + + @Column(name = "CS_CHARGE") + public String getCs_charge(){ return cs_charge; } + + public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } + + @Column(name = "CS_PHONE") + public String getCs_phone(){ return cs_phone; } + + public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_REGION") + public String getCs_region(){ return cs_region; } + + public void setCs_region(String cs_region){ this.cs_region = cs_region; } + + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java new file mode 100644 index 0000000..13579ab --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.construction.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/28. + */ + +@Entity +@Table(name = "PG_CSDOCUMENT") +@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) +public class PgCsDocument implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String doc_name; + private String cs_name; + private String cs_type; + private Date cs_time; + private String construct_doc; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "DOC_NAME") + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_TIME") + public Date getCs_time(){ return cs_time; } + + public void setCs_time(Date cs_time){ this.cs_time = cs_time; } + @Column(name = "CONSTRUCT_DOC") + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java new file mode 100644 index 0000000..98a49f6 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -0,0 +1,35 @@ +package com.casic.PgInterface.construction.dto; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/3/30. + */ +public class PgConstructTjDto implements Serializable { + + private String constructNum;//施工数量 + private String completeNum;//完工数量 + private String underwayNum;//施工中数量 + private String constructTypeNum;//施工类型统计 + private String constructRegionNum;//施工区域统计 + + public String getConstructNum(){ return constructNum; } + + public void setConstructNum(String constructNum){ this.constructNum = constructNum;} + + public String getCompleteNum(){ return completeNum; } + + public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + + public String getUnderwayNum(){ return underwayNum; } + + public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + + public String getConstructTypeNum(){ return constructTypeNum; } + + public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + + public String getConstructRegionNum(){ return constructRegionNum; } + + public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java new file mode 100644 index 0000000..a092f0e --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -0,0 +1,135 @@ +package com.casic.PgInterface.construction.dto; + +import com.casic.PgInterface.construction.domain.PgConstruction; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +/** + * Created by zxh on 2018/3/23. + */ +public class PgConstructionDto implements Serializable{ + + private String id; + private String cs_name;//项目名称 + private String cs_position;//施工位置 + private String cs_status;//项目状态 + private String cs_detail;//施工内容 + private String cs_beginTime;//施工开始时间 + private String cs_endTime;//施工结束时间 + private String cs_charge;//施工负责人 + private String cs_phone;//联系方式 + private String cs_type;//工程类别 + private String cs_region;//施工区域 + private String active;//状态位 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCs_name() { + return cs_name; + } + + public void setCs_name(String cs_name) { + this.cs_name = cs_name; + } + + public String getCs_position() { + return cs_position; + } + + public void setCs_position(String cs_position) { + this.cs_position = cs_position; + } + + public String getCs_status() { + return cs_status; + } + + public void setCs_status(String cs_status) { + this.cs_status = cs_status; + } + + public String getCs_detail() { + return cs_detail; + } + + public void setCs_detail(String cs_detail) { + this.cs_detail = cs_detail; + } + + public String getCs_beginTime() { + return cs_beginTime; + } + + public void setCs_beginTime(String cs_beginTime) { + this.cs_beginTime = cs_beginTime; + } + + public String getCs_endTime() { + return cs_endTime; + } + + public void setCs_endTime(String cs_endTime) { + this.cs_endTime = cs_endTime; + } + + public String getCs_charge() { + return cs_charge; + } + + public void setCs_charge(String cs_charge) { + this.cs_charge = cs_charge; + } + + public String getCs_phone() { + return cs_phone; + } + + public void setCs_phone(String cs_phone) { + this.cs_phone = cs_phone; + } + + public String getCs_type() { + return cs_type; + } + + public void setCs_type(String cs_type) { + this.cs_type = cs_type; + } + + public String getCs_region() { + return cs_region; + } + + public void setCs_region(String cs_region) { + this.cs_region = cs_region; + } + + public String getActive(){ return active; } + + public void setActive(String active){ this.active = active; } + + public PgConstructionDto(PgConstruction pgConstruction) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_position(pgConstruction.getCs_position()); + this.setCs_status(pgConstruction.getCs_status()); + this.setCs_detail(pgConstruction.getCs_detail()); + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setCs_region(pgConstruction.getCs_region()); + this.setActive(String.valueOf(pgConstruction.getActive())); + + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java new file mode 100644 index 0000000..598380f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -0,0 +1,79 @@ +package com.casic.PgInterface.construction.dto; + +import com.casic.PgInterface.construction.domain.PgCsDocument; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by zxh on 2018/3/28. + */ +public class PgCsDocumentDto implements Serializable{ + + private String id; + private String doc_name;//文档名称 + private String cs_name;//项目名称 + private String cs_type;//工程类别 + private String cs_time;//施工时间 + private String construct_doc;//施工文档 + private String active;//状态位 + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + public String getCs_name() { + return cs_name; + } + + public void setCs_name(String cs_name) { + this.cs_name = cs_name; + } + + public String getCs_type() { + return cs_type; + } + + public void setCs_type(String cs_type) { + this.cs_type = cs_type; + } + + public String getCs_time() { + return cs_time; + } + + public void setCs_time(String cs_time) { + this.cs_time = cs_time; + } + + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + + public String getActive(){ return active; } + + public void setActive(String active){ this.active = active; } + + public PgCsDocumentDto (PgCsDocument pgCsDocument) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgCsDocument.getId())); + this.setDoc_name(pgCsDocument.getDoc_name()); + this.setCs_name(pgCsDocument.getCs_name()); + this.setCs_type(pgCsDocument.getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getCs_time())); + this.setConstruct_doc(pgCsDocument.getConstruct_doc()); + this.setActive(String.valueOf(pgCsDocument.getActive())); + + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java new file mode 100644 index 0000000..1fdac02 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -0,0 +1,280 @@ +package com.casic.PgInterface.construction.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.dto.PgConstructionDto; +import com.casic.PgInterface.construction.dto.PgConstructTjDto; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; +import org.hibernate.Query; + +import java.util.Calendar; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by zxh on 2018/3/23. + */ +@Service +public class PgConstructionManager extends HibernateEntityDao{ + + Calendar calendar_now = Calendar.getInstance(); + int year = calendar_now.get(Calendar.YEAR); + int month = calendar_now.get(Calendar.MONTH)+1; + int day = calendar_now.get(Calendar.DAY_OF_MONTH); + String date_now = String.valueOf(year + "-" + month + "-" + day); + + + + + public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + + List pgConstructionDtoList = new ArrayList(); + + try { + Criteria criteria = getSession().createCriteria(PgConstruction.class); + criteria.add(Restrictions.like("cs_name", cs_name)); + criteria.add(Restrictions.like("cs_type", cs_type)); + criteria.add(Restrictions.like("cs_position", cs_position)); + criteria.add(Restrictions.eq("active", 1)); + + if (StringUtils.isNotBlank(cs_beginTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + } + if (StringUtils.isNotBlank(cs_endTime)) { + criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + } + + List pgConstructionList = criteria.list(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + + }catch (Exception e){ + e.printStackTrace(); + return null; + } + return pgConstructionDtoList; + } + + public PgConstructionManager getPartitionByCsName(String cs_name) { + Criteria criteria = getSession().createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", cs_name)); + + criteria.add(Restrictions.eq("active", 1)); + + List pgConstructionList = criteria.list(); + + if (pgConstructionList != null && pgConstructionList.size() > 0) + return pgConstructionList.get(0); + else + return null; + } + + /*统计当天施工数*/ + public List getAllConstructByDay(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*统计本周施工数*/ + public List getAllConstructByWeek(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + /*统计本月施工数*/ + public List getAllConstructByMon(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*统计当天在建工/完工程数*/ + + public List getBuildingByDay(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*按周统计*/ + + public List getBuildingByWeek(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + public List getBuildingByMon(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*按类型统计*/ + + public List getConstructTjByType(String cs_type) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String Sql = ""; + + Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; + + + Query query = this.getSession().createSQLQuery(Sql); + + int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + public List getConstructTjByRegion(String cs_region) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String Sql = ""; + + Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; + + + Query query = this.getSession().createSQLQuery(Sql); + + int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java new file mode 100644 index 0000000..8b57e41 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.construction.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/23. + */ +@Entity +@Table(name = "PG_CONSTRUCTION") +@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) +public class PgConstruction implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String cs_name; + private String cs_position; + private String cs_status; + private String cs_detail; + private Date cs_beginTime; + private Date cs_endTime; + private String cs_charge; + private String cs_phone; + private String cs_type; + private String cs_region; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_POSITION") + public String getCs_position(){ return cs_position; } + + public void setCs_position(String cs_position){ this.cs_position = cs_position; } + + @Column(name = "CS_STATUS") + public String getCs_status(){ return cs_status; } + + public void setCs_status(String cs_status){ this.cs_status = cs_status; } + + @Column(name = "CS_DETAIL") + public String getCs_detail(){ return cs_detail; } + + public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } + + @Column(name = "CS_BEGINTIME") + public Date getCs_beginTime(){ return cs_beginTime; } + + public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } + + @Column(name = "CS_ENDTIME") + public Date getCs_endTime(){ return cs_endTime; } + + public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } + + @Column(name = "CS_CHARGE") + public String getCs_charge(){ return cs_charge; } + + public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } + + @Column(name = "CS_PHONE") + public String getCs_phone(){ return cs_phone; } + + public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_REGION") + public String getCs_region(){ return cs_region; } + + public void setCs_region(String cs_region){ this.cs_region = cs_region; } + + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java new file mode 100644 index 0000000..13579ab --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.construction.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/28. + */ + +@Entity +@Table(name = "PG_CSDOCUMENT") +@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) +public class PgCsDocument implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String doc_name; + private String cs_name; + private String cs_type; + private Date cs_time; + private String construct_doc; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "DOC_NAME") + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_TIME") + public Date getCs_time(){ return cs_time; } + + public void setCs_time(Date cs_time){ this.cs_time = cs_time; } + @Column(name = "CONSTRUCT_DOC") + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java new file mode 100644 index 0000000..98a49f6 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -0,0 +1,35 @@ +package com.casic.PgInterface.construction.dto; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/3/30. + */ +public class PgConstructTjDto implements Serializable { + + private String constructNum;//施工数量 + private String completeNum;//完工数量 + private String underwayNum;//施工中数量 + private String constructTypeNum;//施工类型统计 + private String constructRegionNum;//施工区域统计 + + public String getConstructNum(){ return constructNum; } + + public void setConstructNum(String constructNum){ this.constructNum = constructNum;} + + public String getCompleteNum(){ return completeNum; } + + public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + + public String getUnderwayNum(){ return underwayNum; } + + public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + + public String getConstructTypeNum(){ return constructTypeNum; } + + public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + + public String getConstructRegionNum(){ return constructRegionNum; } + + public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java new file mode 100644 index 0000000..a092f0e --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -0,0 +1,135 @@ +package com.casic.PgInterface.construction.dto; + +import com.casic.PgInterface.construction.domain.PgConstruction; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +/** + * Created by zxh on 2018/3/23. + */ +public class PgConstructionDto implements Serializable{ + + private String id; + private String cs_name;//项目名称 + private String cs_position;//施工位置 + private String cs_status;//项目状态 + private String cs_detail;//施工内容 + private String cs_beginTime;//施工开始时间 + private String cs_endTime;//施工结束时间 + private String cs_charge;//施工负责人 + private String cs_phone;//联系方式 + private String cs_type;//工程类别 + private String cs_region;//施工区域 + private String active;//状态位 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCs_name() { + return cs_name; + } + + public void setCs_name(String cs_name) { + this.cs_name = cs_name; + } + + public String getCs_position() { + return cs_position; + } + + public void setCs_position(String cs_position) { + this.cs_position = cs_position; + } + + public String getCs_status() { + return cs_status; + } + + public void setCs_status(String cs_status) { + this.cs_status = cs_status; + } + + public String getCs_detail() { + return cs_detail; + } + + public void setCs_detail(String cs_detail) { + this.cs_detail = cs_detail; + } + + public String getCs_beginTime() { + return cs_beginTime; + } + + public void setCs_beginTime(String cs_beginTime) { + this.cs_beginTime = cs_beginTime; + } + + public String getCs_endTime() { + return cs_endTime; + } + + public void setCs_endTime(String cs_endTime) { + this.cs_endTime = cs_endTime; + } + + public String getCs_charge() { + return cs_charge; + } + + public void setCs_charge(String cs_charge) { + this.cs_charge = cs_charge; + } + + public String getCs_phone() { + return cs_phone; + } + + public void setCs_phone(String cs_phone) { + this.cs_phone = cs_phone; + } + + public String getCs_type() { + return cs_type; + } + + public void setCs_type(String cs_type) { + this.cs_type = cs_type; + } + + public String getCs_region() { + return cs_region; + } + + public void setCs_region(String cs_region) { + this.cs_region = cs_region; + } + + public String getActive(){ return active; } + + public void setActive(String active){ this.active = active; } + + public PgConstructionDto(PgConstruction pgConstruction) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_position(pgConstruction.getCs_position()); + this.setCs_status(pgConstruction.getCs_status()); + this.setCs_detail(pgConstruction.getCs_detail()); + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setCs_region(pgConstruction.getCs_region()); + this.setActive(String.valueOf(pgConstruction.getActive())); + + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java new file mode 100644 index 0000000..598380f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -0,0 +1,79 @@ +package com.casic.PgInterface.construction.dto; + +import com.casic.PgInterface.construction.domain.PgCsDocument; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by zxh on 2018/3/28. + */ +public class PgCsDocumentDto implements Serializable{ + + private String id; + private String doc_name;//文档名称 + private String cs_name;//项目名称 + private String cs_type;//工程类别 + private String cs_time;//施工时间 + private String construct_doc;//施工文档 + private String active;//状态位 + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + public String getCs_name() { + return cs_name; + } + + public void setCs_name(String cs_name) { + this.cs_name = cs_name; + } + + public String getCs_type() { + return cs_type; + } + + public void setCs_type(String cs_type) { + this.cs_type = cs_type; + } + + public String getCs_time() { + return cs_time; + } + + public void setCs_time(String cs_time) { + this.cs_time = cs_time; + } + + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + + public String getActive(){ return active; } + + public void setActive(String active){ this.active = active; } + + public PgCsDocumentDto (PgCsDocument pgCsDocument) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgCsDocument.getId())); + this.setDoc_name(pgCsDocument.getDoc_name()); + this.setCs_name(pgCsDocument.getCs_name()); + this.setCs_type(pgCsDocument.getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getCs_time())); + this.setConstruct_doc(pgCsDocument.getConstruct_doc()); + this.setActive(String.valueOf(pgCsDocument.getActive())); + + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java new file mode 100644 index 0000000..1fdac02 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -0,0 +1,280 @@ +package com.casic.PgInterface.construction.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.dto.PgConstructionDto; +import com.casic.PgInterface.construction.dto.PgConstructTjDto; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; +import org.hibernate.Query; + +import java.util.Calendar; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by zxh on 2018/3/23. + */ +@Service +public class PgConstructionManager extends HibernateEntityDao{ + + Calendar calendar_now = Calendar.getInstance(); + int year = calendar_now.get(Calendar.YEAR); + int month = calendar_now.get(Calendar.MONTH)+1; + int day = calendar_now.get(Calendar.DAY_OF_MONTH); + String date_now = String.valueOf(year + "-" + month + "-" + day); + + + + + public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + + List pgConstructionDtoList = new ArrayList(); + + try { + Criteria criteria = getSession().createCriteria(PgConstruction.class); + criteria.add(Restrictions.like("cs_name", cs_name)); + criteria.add(Restrictions.like("cs_type", cs_type)); + criteria.add(Restrictions.like("cs_position", cs_position)); + criteria.add(Restrictions.eq("active", 1)); + + if (StringUtils.isNotBlank(cs_beginTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + } + if (StringUtils.isNotBlank(cs_endTime)) { + criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + } + + List pgConstructionList = criteria.list(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + + }catch (Exception e){ + e.printStackTrace(); + return null; + } + return pgConstructionDtoList; + } + + public PgConstructionManager getPartitionByCsName(String cs_name) { + Criteria criteria = getSession().createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", cs_name)); + + criteria.add(Restrictions.eq("active", 1)); + + List pgConstructionList = criteria.list(); + + if (pgConstructionList != null && pgConstructionList.size() > 0) + return pgConstructionList.get(0); + else + return null; + } + + /*统计当天施工数*/ + public List getAllConstructByDay(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*统计本周施工数*/ + public List getAllConstructByWeek(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + /*统计本月施工数*/ + public List getAllConstructByMon(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*统计当天在建工/完工程数*/ + + public List getBuildingByDay(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*按周统计*/ + + public List getBuildingByWeek(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + public List getBuildingByMon(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*按类型统计*/ + + public List getConstructTjByType(String cs_type) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String Sql = ""; + + Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; + + + Query query = this.getSession().createSQLQuery(Sql); + + int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + public List getConstructTjByRegion(String cs_region) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String Sql = ""; + + Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; + + + Query query = this.getSession().createSQLQuery(Sql); + + int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java new file mode 100644 index 0000000..12f3042 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java @@ -0,0 +1,176 @@ +package com.casic.PgInterface.construction.manager; + +import com.casic.PgInterface.construction.dto.PgCsDocumentDto; +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.construction.domain.PgCsDocument; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.core.util.DateUtils; + +import com.sun.xml.internal.ws.client.ResponseContextReceiver; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import com.sun.org.apache.xml.internal.security.utils.Base64; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.multipart.MultipartFile; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; + + +/** + * Created by zxh on 2018/3/28. + */ +@Service +public class PgCsDocumentManager extends HibernateEntityDao{ + + public String saveFiles(List files,String fileType){ + String [] fileNames = new String[files.size()]; + String [] fileBuffers = new String[files.size()]; + try { + for (int i = 0; i < files.size(); i++) { + fileNames[i] = files.get(i).getOriginalFilename(); + byte[] fis = files.get(i).getBytes(); + fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); + } + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+fileType;//存储路径 + String imageName = ""; + for (int i = 0; i < fileBuffers.length; i++) { + if (fileBuffers[i] != null && fileNames[i] != null) { + imageName += fileType+"/"+fileNames[i] + ","; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, fileNames[i]); + fos = new FileOutputStream(imageFile);//保存图片 + fos.write(buffer); + fos.flush(); + fos.close(); + } + } + return imageName.substring(0,imageName.length()-1); + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + + public String saveFiles(String fileBuffer, String fileName, String fileType){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+fileType;//存储路径 + String imageName = ""; + imageName += fileType+"/"+fileName; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, fileName); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + /*下载*/ + public String downFile(String fileName, String fileType){ + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + Criteria criteria = createCriteria(PgCsDocument.class); + criteria.add(Restrictions.eq("active", 1)); + List pgCsDocumentList = criteria.list(); + + if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) + return null; + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; + + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + + byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); + fos.write(buffer); + fos.flush(); + fos.close(); + + return image_toDir; + } + catch (Exception e) + { + e.printStackTrace(); + return ""; + } + } + + /*查询*/ + public List getAllDocData(String cs_name ,String cs_type,String cs_time) { + + List pgCsDocumentDtoList = new ArrayList(); + + try { + Criteria criteria = createCriteria(PgCsDocument.class); + criteria.addOrder(Order.desc("id")); + criteria.add(Restrictions.eq("cs_name", cs_name)); + criteria.add(Restrictions.eq("cs_type", cs_type)); + + if (StringUtils.isNotBlank(cs_time)) { + criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); + } + List pgCsDocumentList=criteria.list(); + + for (PgCsDocument pgCsDocument : pgCsDocumentList) { + pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); + } + } + catch(Exception ex) + { + return null; + } + + return pgCsDocumentDtoList; + } +/* +*根据工程名称查找 +*/ + public PgCsDocument getDocByCsName(String cs_name) { + Criteria criteria=createCriteria(PgCsDocument.class); + criteria.add(Restrictions.eq("cs_name",cs_name)); + + List pgCsDocumentList=criteria.list(); + if(pgCsDocumentList.size()==0) + return null; + else + return pgCsDocumentList.get(0); + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java new file mode 100644 index 0000000..8b57e41 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.construction.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/23. + */ +@Entity +@Table(name = "PG_CONSTRUCTION") +@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) +public class PgConstruction implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String cs_name; + private String cs_position; + private String cs_status; + private String cs_detail; + private Date cs_beginTime; + private Date cs_endTime; + private String cs_charge; + private String cs_phone; + private String cs_type; + private String cs_region; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_POSITION") + public String getCs_position(){ return cs_position; } + + public void setCs_position(String cs_position){ this.cs_position = cs_position; } + + @Column(name = "CS_STATUS") + public String getCs_status(){ return cs_status; } + + public void setCs_status(String cs_status){ this.cs_status = cs_status; } + + @Column(name = "CS_DETAIL") + public String getCs_detail(){ return cs_detail; } + + public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } + + @Column(name = "CS_BEGINTIME") + public Date getCs_beginTime(){ return cs_beginTime; } + + public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } + + @Column(name = "CS_ENDTIME") + public Date getCs_endTime(){ return cs_endTime; } + + public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } + + @Column(name = "CS_CHARGE") + public String getCs_charge(){ return cs_charge; } + + public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } + + @Column(name = "CS_PHONE") + public String getCs_phone(){ return cs_phone; } + + public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_REGION") + public String getCs_region(){ return cs_region; } + + public void setCs_region(String cs_region){ this.cs_region = cs_region; } + + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java new file mode 100644 index 0000000..13579ab --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.construction.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/28. + */ + +@Entity +@Table(name = "PG_CSDOCUMENT") +@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) +public class PgCsDocument implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String doc_name; + private String cs_name; + private String cs_type; + private Date cs_time; + private String construct_doc; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "DOC_NAME") + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_TIME") + public Date getCs_time(){ return cs_time; } + + public void setCs_time(Date cs_time){ this.cs_time = cs_time; } + @Column(name = "CONSTRUCT_DOC") + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java new file mode 100644 index 0000000..98a49f6 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -0,0 +1,35 @@ +package com.casic.PgInterface.construction.dto; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/3/30. + */ +public class PgConstructTjDto implements Serializable { + + private String constructNum;//施工数量 + private String completeNum;//完工数量 + private String underwayNum;//施工中数量 + private String constructTypeNum;//施工类型统计 + private String constructRegionNum;//施工区域统计 + + public String getConstructNum(){ return constructNum; } + + public void setConstructNum(String constructNum){ this.constructNum = constructNum;} + + public String getCompleteNum(){ return completeNum; } + + public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + + public String getUnderwayNum(){ return underwayNum; } + + public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + + public String getConstructTypeNum(){ return constructTypeNum; } + + public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + + public String getConstructRegionNum(){ return constructRegionNum; } + + public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java new file mode 100644 index 0000000..a092f0e --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -0,0 +1,135 @@ +package com.casic.PgInterface.construction.dto; + +import com.casic.PgInterface.construction.domain.PgConstruction; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +/** + * Created by zxh on 2018/3/23. + */ +public class PgConstructionDto implements Serializable{ + + private String id; + private String cs_name;//项目名称 + private String cs_position;//施工位置 + private String cs_status;//项目状态 + private String cs_detail;//施工内容 + private String cs_beginTime;//施工开始时间 + private String cs_endTime;//施工结束时间 + private String cs_charge;//施工负责人 + private String cs_phone;//联系方式 + private String cs_type;//工程类别 + private String cs_region;//施工区域 + private String active;//状态位 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCs_name() { + return cs_name; + } + + public void setCs_name(String cs_name) { + this.cs_name = cs_name; + } + + public String getCs_position() { + return cs_position; + } + + public void setCs_position(String cs_position) { + this.cs_position = cs_position; + } + + public String getCs_status() { + return cs_status; + } + + public void setCs_status(String cs_status) { + this.cs_status = cs_status; + } + + public String getCs_detail() { + return cs_detail; + } + + public void setCs_detail(String cs_detail) { + this.cs_detail = cs_detail; + } + + public String getCs_beginTime() { + return cs_beginTime; + } + + public void setCs_beginTime(String cs_beginTime) { + this.cs_beginTime = cs_beginTime; + } + + public String getCs_endTime() { + return cs_endTime; + } + + public void setCs_endTime(String cs_endTime) { + this.cs_endTime = cs_endTime; + } + + public String getCs_charge() { + return cs_charge; + } + + public void setCs_charge(String cs_charge) { + this.cs_charge = cs_charge; + } + + public String getCs_phone() { + return cs_phone; + } + + public void setCs_phone(String cs_phone) { + this.cs_phone = cs_phone; + } + + public String getCs_type() { + return cs_type; + } + + public void setCs_type(String cs_type) { + this.cs_type = cs_type; + } + + public String getCs_region() { + return cs_region; + } + + public void setCs_region(String cs_region) { + this.cs_region = cs_region; + } + + public String getActive(){ return active; } + + public void setActive(String active){ this.active = active; } + + public PgConstructionDto(PgConstruction pgConstruction) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_position(pgConstruction.getCs_position()); + this.setCs_status(pgConstruction.getCs_status()); + this.setCs_detail(pgConstruction.getCs_detail()); + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setCs_region(pgConstruction.getCs_region()); + this.setActive(String.valueOf(pgConstruction.getActive())); + + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java new file mode 100644 index 0000000..598380f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -0,0 +1,79 @@ +package com.casic.PgInterface.construction.dto; + +import com.casic.PgInterface.construction.domain.PgCsDocument; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by zxh on 2018/3/28. + */ +public class PgCsDocumentDto implements Serializable{ + + private String id; + private String doc_name;//文档名称 + private String cs_name;//项目名称 + private String cs_type;//工程类别 + private String cs_time;//施工时间 + private String construct_doc;//施工文档 + private String active;//状态位 + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + public String getCs_name() { + return cs_name; + } + + public void setCs_name(String cs_name) { + this.cs_name = cs_name; + } + + public String getCs_type() { + return cs_type; + } + + public void setCs_type(String cs_type) { + this.cs_type = cs_type; + } + + public String getCs_time() { + return cs_time; + } + + public void setCs_time(String cs_time) { + this.cs_time = cs_time; + } + + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + + public String getActive(){ return active; } + + public void setActive(String active){ this.active = active; } + + public PgCsDocumentDto (PgCsDocument pgCsDocument) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgCsDocument.getId())); + this.setDoc_name(pgCsDocument.getDoc_name()); + this.setCs_name(pgCsDocument.getCs_name()); + this.setCs_type(pgCsDocument.getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getCs_time())); + this.setConstruct_doc(pgCsDocument.getConstruct_doc()); + this.setActive(String.valueOf(pgCsDocument.getActive())); + + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java new file mode 100644 index 0000000..1fdac02 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -0,0 +1,280 @@ +package com.casic.PgInterface.construction.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.dto.PgConstructionDto; +import com.casic.PgInterface.construction.dto.PgConstructTjDto; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; +import org.hibernate.Query; + +import java.util.Calendar; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by zxh on 2018/3/23. + */ +@Service +public class PgConstructionManager extends HibernateEntityDao{ + + Calendar calendar_now = Calendar.getInstance(); + int year = calendar_now.get(Calendar.YEAR); + int month = calendar_now.get(Calendar.MONTH)+1; + int day = calendar_now.get(Calendar.DAY_OF_MONTH); + String date_now = String.valueOf(year + "-" + month + "-" + day); + + + + + public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + + List pgConstructionDtoList = new ArrayList(); + + try { + Criteria criteria = getSession().createCriteria(PgConstruction.class); + criteria.add(Restrictions.like("cs_name", cs_name)); + criteria.add(Restrictions.like("cs_type", cs_type)); + criteria.add(Restrictions.like("cs_position", cs_position)); + criteria.add(Restrictions.eq("active", 1)); + + if (StringUtils.isNotBlank(cs_beginTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + } + if (StringUtils.isNotBlank(cs_endTime)) { + criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + } + + List pgConstructionList = criteria.list(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + + }catch (Exception e){ + e.printStackTrace(); + return null; + } + return pgConstructionDtoList; + } + + public PgConstructionManager getPartitionByCsName(String cs_name) { + Criteria criteria = getSession().createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", cs_name)); + + criteria.add(Restrictions.eq("active", 1)); + + List pgConstructionList = criteria.list(); + + if (pgConstructionList != null && pgConstructionList.size() > 0) + return pgConstructionList.get(0); + else + return null; + } + + /*统计当天施工数*/ + public List getAllConstructByDay(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*统计本周施工数*/ + public List getAllConstructByWeek(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + /*统计本月施工数*/ + public List getAllConstructByMon(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*统计当天在建工/完工程数*/ + + public List getBuildingByDay(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*按周统计*/ + + public List getBuildingByWeek(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + public List getBuildingByMon(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*按类型统计*/ + + public List getConstructTjByType(String cs_type) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String Sql = ""; + + Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; + + + Query query = this.getSession().createSQLQuery(Sql); + + int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + public List getConstructTjByRegion(String cs_region) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String Sql = ""; + + Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; + + + Query query = this.getSession().createSQLQuery(Sql); + + int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java new file mode 100644 index 0000000..12f3042 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java @@ -0,0 +1,176 @@ +package com.casic.PgInterface.construction.manager; + +import com.casic.PgInterface.construction.dto.PgCsDocumentDto; +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.construction.domain.PgCsDocument; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.core.util.DateUtils; + +import com.sun.xml.internal.ws.client.ResponseContextReceiver; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import com.sun.org.apache.xml.internal.security.utils.Base64; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.multipart.MultipartFile; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; + + +/** + * Created by zxh on 2018/3/28. + */ +@Service +public class PgCsDocumentManager extends HibernateEntityDao{ + + public String saveFiles(List files,String fileType){ + String [] fileNames = new String[files.size()]; + String [] fileBuffers = new String[files.size()]; + try { + for (int i = 0; i < files.size(); i++) { + fileNames[i] = files.get(i).getOriginalFilename(); + byte[] fis = files.get(i).getBytes(); + fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); + } + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+fileType;//存储路径 + String imageName = ""; + for (int i = 0; i < fileBuffers.length; i++) { + if (fileBuffers[i] != null && fileNames[i] != null) { + imageName += fileType+"/"+fileNames[i] + ","; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, fileNames[i]); + fos = new FileOutputStream(imageFile);//保存图片 + fos.write(buffer); + fos.flush(); + fos.close(); + } + } + return imageName.substring(0,imageName.length()-1); + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + + public String saveFiles(String fileBuffer, String fileName, String fileType){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+fileType;//存储路径 + String imageName = ""; + imageName += fileType+"/"+fileName; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, fileName); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + /*下载*/ + public String downFile(String fileName, String fileType){ + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + Criteria criteria = createCriteria(PgCsDocument.class); + criteria.add(Restrictions.eq("active", 1)); + List pgCsDocumentList = criteria.list(); + + if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) + return null; + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; + + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + + byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); + fos.write(buffer); + fos.flush(); + fos.close(); + + return image_toDir; + } + catch (Exception e) + { + e.printStackTrace(); + return ""; + } + } + + /*查询*/ + public List getAllDocData(String cs_name ,String cs_type,String cs_time) { + + List pgCsDocumentDtoList = new ArrayList(); + + try { + Criteria criteria = createCriteria(PgCsDocument.class); + criteria.addOrder(Order.desc("id")); + criteria.add(Restrictions.eq("cs_name", cs_name)); + criteria.add(Restrictions.eq("cs_type", cs_type)); + + if (StringUtils.isNotBlank(cs_time)) { + criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); + } + List pgCsDocumentList=criteria.list(); + + for (PgCsDocument pgCsDocument : pgCsDocumentList) { + pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); + } + } + catch(Exception ex) + { + return null; + } + + return pgCsDocumentDtoList; + } +/* +*根据工程名称查找 +*/ + public PgCsDocument getDocByCsName(String cs_name) { + Criteria criteria=createCriteria(PgCsDocument.class); + criteria.add(Restrictions.eq("cs_name",cs_name)); + + List pgCsDocumentList=criteria.list(); + if(pgCsDocumentList.size()==0) + return null; + else + return pgCsDocumentList.get(0); + } +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java new file mode 100644 index 0000000..11f0525 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java @@ -0,0 +1,439 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.dto.PgConstructTjDto; +import com.casic.PgInterface.construction.dto.PgConstructionDto; +import com.casic.PgInterface.construction.manager.PgConstructionManager; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by zxh on 2018/3/27. + */ + +@Component +@Path("pgConstruction") +public class PgConstructionRs { + + private static Logger logger = LoggerFactory.getLogger(PgConstructionRs.class); + + private PgConstructionManager pgConstructionManager; + + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) + { + this.pgConstructionManager = pgConstructionManager; + } + + /* + 新建工程 + */ + @POST + @Path("addConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map addConstruction(@FormParam("cs_name")String cs_name, + @FormParam("cs_position")String cs_position, + @FormParam("cs_status")String cs_status, + @FormParam("cs_detail")String cs_detail, + @FormParam("cs_beginTime")String cs_beginTime, + @FormParam("cs_endTime")String cs_endTime, + @FormParam("cs_charge")String cs_charge, + @FormParam("cs_phone")String cs_phone, + @FormParam("cs_type")String cs_type, + @FormParam("cs_region")String cs_region) + throws Exception{ + Map resultMap = new HashMap(); + String result = "" ; + String msg = "" ; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + try { + PgConstruction pgConstruction = new PgConstruction(); + pgConstruction.setCs_name(cs_name); + pgConstruction.setCs_position(cs_position); + pgConstruction.setCs_status(cs_status); + pgConstruction.setCs_detail(cs_detail); + pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); + pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); + pgConstruction.setCs_charge(cs_charge); + pgConstruction.setCs_phone(cs_phone); + pgConstruction.setCs_type(cs_type); + pgConstruction.setCs_region(cs_region); + pgConstruction.setActive(1); + + logger.info("保存成功"); + pgConstructionManager.save(pgConstruction); + result = "true"; + msg = "保存成功"; + + }catch (Exception e){ + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + resultMap.put("success",result); + resultMap.put("msg",msg); + return resultMap; + } + + /* + 施工信息编辑 + */ + @POST + @Path("editConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map editConstruction(@FormParam("id")String id, + @FormParam("cs_name")String cs_name, + @FormParam("cs_position")String cs_position, + @FormParam("cs_status")String cs_status, + @FormParam("cs_detail")String cs_detail, + @FormParam("cs_beginTime")String cs_beginTime, + @FormParam("cs_endTime")String cs_endTime, + @FormParam("cs_charge")String cs_charge, + @FormParam("cs_phone")String cs_phone, + @FormParam("cs_type")String cs_type, + @FormParam("cs_region")String cs_region) + throws Exception{ + + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + try { + if (id.equals("")) + { + result = "false"; + msg = "请输入ID"; + }else { + PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); + pgConstruction.setCs_name(cs_name); + pgConstruction.setCs_position(cs_position); + pgConstruction.setCs_status(cs_status); + pgConstruction.setCs_detail(cs_detail); + pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); + pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); + pgConstruction.setCs_charge(cs_charge); + pgConstruction.setCs_phone(cs_phone); + pgConstruction.setCs_type(cs_type); + pgConstruction.setCs_region(cs_region); + pgConstruction.setActive(1); + + pgConstructionManager.save(pgConstruction); + result = "true"; + msg = "编辑成功"; + } + + }catch (Exception e){ + result = "false"; + msg = "编辑失败"; + e.printStackTrace(); + + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + @POST + @Path("delConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map delConstruction(@FormParam("id")String id) + throws Exception{ + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + try { + PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); + if (pgConstruction == null) + { + result = "false"; + msg = "不存在该施工信息"; + }else + { + pgConstruction.setActive(0); + pgConstructionManager.save(pgConstruction); + result = "true"; + msg = "成功删除信息"; + } + }catch (Exception e){ + e.printStackTrace(); + result = "false"; + msg = "删除失败"; + } + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + @POST + @Path("queryConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map queryConstruction(@FormParam("cs_name")String cs_name, + @FormParam("cs_position")String cs_position, + @FormParam("cs_beginTime")String cs_beginTime, + @FormParam("cs_endTime")String cs_endTime, + @FormParam("cs_type")String cs_type + ) + throws Exception{ + + Map resultMap = new HashMap(); + List pgConstructionDtoList = new ArrayList(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + String msg = ""; + + try { + pgConstructionDtoList = pgConstructionManager.getConstructByVague(cs_name, cs_position, cs_type, cs_beginTime, cs_endTime); + if (pgConstructionDtoList != null) + { + msg = "获取数据成功"; + }else + { + msg = "没有满足条件的数据"; + } + }catch (Exception e){ + e.printStackTrace(); + } + + resultMap.put("msg", msg); + resultMap.put("result", pgConstructionDtoList); + return resultMap; + } + + @POST + @Path("constructTjByDay") + @Produces(MediaType.APPLICATION_JSON) + public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + @POST + @Path("constructTjByWeek") + @Produces(MediaType.APPLICATION_JSON) + public Map constructTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getAllConstructByWeek(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + @POST + @Path("constructTjByMon") + @Produces(MediaType.APPLICATION_JSON) + public Map constructTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + /*按天在建工程/完工程统计*/ + @POST + @Path("buildingTjByDay") + @Produces(MediaType.APPLICATION_JSON) + public Map buildingTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getBuildingByDay(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + /*按周在建工程/完工程统计*/ + @POST + @Path("buildingTjByWeek") + @Produces(MediaType.APPLICATION_JSON) + public Map buildingTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getBuildingByWeek(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + /*按月在建工程/完工程统计*/ + @POST + @Path("buildingTjByMon") + @Produces(MediaType.APPLICATION_JSON) + public Map buildingTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getBuildingByMon(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + /*按类型统计*/ + @POST + @Path("constructTjByType") + @Produces(MediaType.APPLICATION_JSON) + public Map constructTjByType(@FormParam("cs_type") String cs_type)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_type); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + /*按区域统计*/ + @POST + @Path("constructTjByRegion") + @Produces(MediaType.APPLICATION_JSON) + public Map constructTjByRegion(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getConstructTjByRegion(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java new file mode 100644 index 0000000..8b57e41 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.construction.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/23. + */ +@Entity +@Table(name = "PG_CONSTRUCTION") +@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1) +public class PgConstruction implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String cs_name; + private String cs_position; + private String cs_status; + private String cs_detail; + private Date cs_beginTime; + private Date cs_endTime; + private String cs_charge; + private String cs_phone; + private String cs_type; + private String cs_region; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CONSTRUCTION_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_POSITION") + public String getCs_position(){ return cs_position; } + + public void setCs_position(String cs_position){ this.cs_position = cs_position; } + + @Column(name = "CS_STATUS") + public String getCs_status(){ return cs_status; } + + public void setCs_status(String cs_status){ this.cs_status = cs_status; } + + @Column(name = "CS_DETAIL") + public String getCs_detail(){ return cs_detail; } + + public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; } + + @Column(name = "CS_BEGINTIME") + public Date getCs_beginTime(){ return cs_beginTime; } + + public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; } + + @Column(name = "CS_ENDTIME") + public Date getCs_endTime(){ return cs_endTime; } + + public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; } + + @Column(name = "CS_CHARGE") + public String getCs_charge(){ return cs_charge; } + + public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; } + + @Column(name = "CS_PHONE") + public String getCs_phone(){ return cs_phone; } + + public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_REGION") + public String getCs_region(){ return cs_region; } + + public void setCs_region(String cs_region){ this.cs_region = cs_region; } + + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java new file mode 100644 index 0000000..13579ab --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -0,0 +1,58 @@ +package com.casic.PgInterface.construction.domain; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** + * Created by zxh on 2018/3/28. + */ + +@Entity +@Table(name = "PG_CSDOCUMENT") +@SequenceGenerator(name = "SEQ_PG_CSDOCUMENT_ID", sequenceName = "SEQ_PG_CSDOCUMENT_ID", allocationSize = 1, initialValue = 1) +public class PgCsDocument implements Serializable{ + + private static final long serialVersionUID = 1L; + private long id; + private String doc_name; + private String cs_name; + private String cs_type; + private Date cs_time; + private String construct_doc; + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") + public long getId(){ return id; } + + public void setId(long id){ this.id = id; } + + @Column(name = "DOC_NAME") + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + @Column(name = "CS_NAME") + public String getCs_name(){ return cs_name; } + + public void setCs_name(String cs_name){ this.cs_name = cs_name; } + + @Column(name = "CS_TYPE") + public String getCs_type(){ return cs_type; } + + public void setCs_type(String cs_type){ this.cs_type = cs_type; } + + @Column(name = "CS_TIME") + public Date getCs_time(){ return cs_time; } + + public void setCs_time(Date cs_time){ this.cs_time = cs_time; } + @Column(name = "CONSTRUCT_DOC") + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + @Column(name = "ACTIVE") + public int getActive(){ return active; } + + public void setActive(int active){ this.active = active; } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java new file mode 100644 index 0000000..98a49f6 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructTjDto.java @@ -0,0 +1,35 @@ +package com.casic.PgInterface.construction.dto; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/3/30. + */ +public class PgConstructTjDto implements Serializable { + + private String constructNum;//施工数量 + private String completeNum;//完工数量 + private String underwayNum;//施工中数量 + private String constructTypeNum;//施工类型统计 + private String constructRegionNum;//施工区域统计 + + public String getConstructNum(){ return constructNum; } + + public void setConstructNum(String constructNum){ this.constructNum = constructNum;} + + public String getCompleteNum(){ return completeNum; } + + public void setCompleteNum(String completeNum){ this.completeNum = completeNum;} + + public String getUnderwayNum(){ return underwayNum; } + + public void setUnderwayNum(String underwayNum){ this.underwayNum = underwayNum;} + + public String getConstructTypeNum(){ return constructTypeNum; } + + public void setConstructTypeNum(String constructTypeNum){ this.constructTypeNum = constructTypeNum;} + + public String getConstructRegionNum(){ return constructRegionNum; } + + public void setConstructRegionNum(String constructRegionNum){ this.constructRegionNum = constructRegionNum;} +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java new file mode 100644 index 0000000..a092f0e --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgConstructionDto.java @@ -0,0 +1,135 @@ +package com.casic.PgInterface.construction.dto; + +import com.casic.PgInterface.construction.domain.PgConstruction; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +/** + * Created by zxh on 2018/3/23. + */ +public class PgConstructionDto implements Serializable{ + + private String id; + private String cs_name;//项目名称 + private String cs_position;//施工位置 + private String cs_status;//项目状态 + private String cs_detail;//施工内容 + private String cs_beginTime;//施工开始时间 + private String cs_endTime;//施工结束时间 + private String cs_charge;//施工负责人 + private String cs_phone;//联系方式 + private String cs_type;//工程类别 + private String cs_region;//施工区域 + private String active;//状态位 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCs_name() { + return cs_name; + } + + public void setCs_name(String cs_name) { + this.cs_name = cs_name; + } + + public String getCs_position() { + return cs_position; + } + + public void setCs_position(String cs_position) { + this.cs_position = cs_position; + } + + public String getCs_status() { + return cs_status; + } + + public void setCs_status(String cs_status) { + this.cs_status = cs_status; + } + + public String getCs_detail() { + return cs_detail; + } + + public void setCs_detail(String cs_detail) { + this.cs_detail = cs_detail; + } + + public String getCs_beginTime() { + return cs_beginTime; + } + + public void setCs_beginTime(String cs_beginTime) { + this.cs_beginTime = cs_beginTime; + } + + public String getCs_endTime() { + return cs_endTime; + } + + public void setCs_endTime(String cs_endTime) { + this.cs_endTime = cs_endTime; + } + + public String getCs_charge() { + return cs_charge; + } + + public void setCs_charge(String cs_charge) { + this.cs_charge = cs_charge; + } + + public String getCs_phone() { + return cs_phone; + } + + public void setCs_phone(String cs_phone) { + this.cs_phone = cs_phone; + } + + public String getCs_type() { + return cs_type; + } + + public void setCs_type(String cs_type) { + this.cs_type = cs_type; + } + + public String getCs_region() { + return cs_region; + } + + public void setCs_region(String cs_region) { + this.cs_region = cs_region; + } + + public String getActive(){ return active; } + + public void setActive(String active){ this.active = active; } + + public PgConstructionDto(PgConstruction pgConstruction) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgConstruction.getId())); + this.setCs_name(pgConstruction.getCs_name()); + this.setCs_position(pgConstruction.getCs_position()); + this.setCs_status(pgConstruction.getCs_status()); + this.setCs_detail(pgConstruction.getCs_detail()); + this.setCs_beginTime(sdf.format(pgConstruction.getCs_beginTime())); + this.setCs_endTime(sdf.format(pgConstruction.getCs_endTime())); + this.setCs_charge(pgConstruction.getCs_charge()); + this.setCs_phone(pgConstruction.getCs_phone()); + this.setCs_type(pgConstruction.getCs_type()); + this.setCs_region(pgConstruction.getCs_region()); + this.setActive(String.valueOf(pgConstruction.getActive())); + + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java new file mode 100644 index 0000000..598380f --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -0,0 +1,79 @@ +package com.casic.PgInterface.construction.dto; + +import com.casic.PgInterface.construction.domain.PgCsDocument; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by zxh on 2018/3/28. + */ +public class PgCsDocumentDto implements Serializable{ + + private String id; + private String doc_name;//文档名称 + private String cs_name;//项目名称 + private String cs_type;//工程类别 + private String cs_time;//施工时间 + private String construct_doc;//施工文档 + private String active;//状态位 + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDoc_name(){ return doc_name; } + + public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + + public String getCs_name() { + return cs_name; + } + + public void setCs_name(String cs_name) { + this.cs_name = cs_name; + } + + public String getCs_type() { + return cs_type; + } + + public void setCs_type(String cs_type) { + this.cs_type = cs_type; + } + + public String getCs_time() { + return cs_time; + } + + public void setCs_time(String cs_time) { + this.cs_time = cs_time; + } + + public String getConstruct_doc(){ return construct_doc; } + + public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + + public String getActive(){ return active; } + + public void setActive(String active){ this.active = active; } + + public PgCsDocumentDto (PgCsDocument pgCsDocument) + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + this.setId(String.valueOf(pgCsDocument.getId())); + this.setDoc_name(pgCsDocument.getDoc_name()); + this.setCs_name(pgCsDocument.getCs_name()); + this.setCs_type(pgCsDocument.getCs_type()); + this.setCs_time(sdf.format(pgCsDocument.getCs_time())); + this.setConstruct_doc(pgCsDocument.getConstruct_doc()); + this.setActive(String.valueOf(pgCsDocument.getActive())); + + } +} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java new file mode 100644 index 0000000..1fdac02 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgConstructionManager.java @@ -0,0 +1,280 @@ +package com.casic.PgInterface.construction.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.dto.PgConstructionDto; +import com.casic.PgInterface.construction.dto.PgConstructTjDto; +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.core.util.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Service; +import org.hibernate.Query; + +import java.util.Calendar; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by zxh on 2018/3/23. + */ +@Service +public class PgConstructionManager extends HibernateEntityDao{ + + Calendar calendar_now = Calendar.getInstance(); + int year = calendar_now.get(Calendar.YEAR); + int month = calendar_now.get(Calendar.MONTH)+1; + int day = calendar_now.get(Calendar.DAY_OF_MONTH); + String date_now = String.valueOf(year + "-" + month + "-" + day); + + + + + public List getConstructByVague(String cs_name, String cs_type, String cs_position, String cs_beginTime, String cs_endTime) { + + List pgConstructionDtoList = new ArrayList(); + + try { + Criteria criteria = getSession().createCriteria(PgConstruction.class); + criteria.add(Restrictions.like("cs_name", cs_name)); + criteria.add(Restrictions.like("cs_type", cs_type)); + criteria.add(Restrictions.like("cs_position", cs_position)); + criteria.add(Restrictions.eq("active", 1)); + + if (StringUtils.isNotBlank(cs_beginTime)) { + criteria.add(Restrictions.ge("cs_beginTime", DateUtils.sdf4.parse(cs_beginTime))); + } + if (StringUtils.isNotBlank(cs_endTime)) { + criteria.add(Restrictions.le("cs_endTime", DateUtils.sdf4.parse(cs_endTime))); + } + + List pgConstructionList = criteria.list(); + + for (PgConstruction pgConstruction : pgConstructionList) { + pgConstructionDtoList.add(new PgConstructionDto(pgConstruction)); + } + + }catch (Exception e){ + e.printStackTrace(); + return null; + } + return pgConstructionDtoList; + } + + public PgConstructionManager getPartitionByCsName(String cs_name) { + Criteria criteria = getSession().createCriteria(PgConstruction.class); + criteria.add(Restrictions.eq("cs_name", cs_name)); + + criteria.add(Restrictions.eq("active", 1)); + + List pgConstructionList = criteria.list(); + + if (pgConstructionList != null && pgConstructionList.size() > 0) + return pgConstructionList.get(0); + else + return null; + } + + /*统计当天施工数*/ + public List getAllConstructByDay(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*统计本周施工数*/ + public List getAllConstructByWeek(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + /*统计本月施工数*/ + public List getAllConstructByMon(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String sql = ""; + + sql ="SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.ACTIVE = 1"; + + Query query = this.getSession().createSQLQuery(sql); + + int numCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*统计当天在建工/完工程数*/ + + public List getBuildingByDay(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'DD') = TO_CHAR('"+queryDate+"','DD') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*按周统计*/ + + public List getBuildingByWeek(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'IW') = TO_CHAR('"+queryDate+"','IW') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + public List getBuildingByMon(String queryDate) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String buildingSql = ""; + String completeSql = ""; + Query buildingQuery, completeQuery; + + /*在建*/ + buildingSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '施工' AND T.ACTIVE = 1"; + /*完工*/ + completeSql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE TO_CHAR(T.CS_BEGINTIME,'MM') = TO_CHAR('"+queryDate+"','MM') AND T.CS_STATUS = '完工' AND T.ACTIVE = 1"; + + buildingQuery = this.getSession().createSQLQuery(buildingSql); + completeQuery = this.getSession().createSQLQuery(completeSql); + + int buildingCount = Integer.valueOf(String.valueOf(buildingQuery.uniqueResult())); + int completeCount = Integer.valueOf(String.valueOf(completeQuery.uniqueResult())); + + pgConstructTjDto.setUnderwayNum(String.valueOf(buildingQuery.uniqueResult())); + pgConstructTjDto.setCompleteNum(String.valueOf(completeQuery.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + /*按类型统计*/ + + public List getConstructTjByType(String cs_type) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String Sql = ""; + + Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_TYPE = '"+ cs_type +"' AND T.ACTIVE = 1"; + + + Query query = this.getSession().createSQLQuery(Sql); + + int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructTypeNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + + public List getConstructTjByRegion(String cs_region) throws Exception { + + List pgConstructionDtoList = new ArrayList(); + + PgConstructTjDto pgConstructTjDto = new PgConstructTjDto(); + + String Sql = ""; + + Sql = "SELECT COUNT(*) FROM PG_CONSTRUCTION T WHERE T.CS_REGION = '"+ cs_region +"' AND T.ACTIVE = 1"; + + + Query query = this.getSession().createSQLQuery(Sql); + + int buildingCount = Integer.valueOf(String.valueOf(query.uniqueResult())); + + pgConstructTjDto.setConstructRegionNum(String.valueOf(query.uniqueResult())); + + pgConstructionDtoList.add(pgConstructTjDto); + + return pgConstructionDtoList; + } + +} diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java new file mode 100644 index 0000000..12f3042 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java @@ -0,0 +1,176 @@ +package com.casic.PgInterface.construction.manager; + +import com.casic.PgInterface.construction.dto.PgCsDocumentDto; +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.construction.domain.PgCsDocument; +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.core.util.DateUtils; + +import com.sun.xml.internal.ws.client.ResponseContextReceiver; +import org.hibernate.Criteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import com.sun.org.apache.xml.internal.security.utils.Base64; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.multipart.MultipartFile; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; + + +/** + * Created by zxh on 2018/3/28. + */ +@Service +public class PgCsDocumentManager extends HibernateEntityDao{ + + public String saveFiles(List files,String fileType){ + String [] fileNames = new String[files.size()]; + String [] fileBuffers = new String[files.size()]; + try { + for (int i = 0; i < files.size(); i++) { + fileNames[i] = files.get(i).getOriginalFilename(); + byte[] fis = files.get(i).getBytes(); + fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH)); + } + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+fileType;//存储路径 + String imageName = ""; + for (int i = 0; i < fileBuffers.length; i++) { + if (fileBuffers[i] != null && fileNames[i] != null) { + imageName += fileType+"/"+fileNames[i] + ","; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, fileNames[i]); + fos = new FileOutputStream(imageFile);//保存图片 + fos.write(buffer); + fos.flush(); + fos.close(); + } + } + return imageName.substring(0,imageName.length()-1); + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + + public String saveFiles(String fileBuffer, String fileName, String fileType){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+fileType;//存储路径 + String imageName = ""; + imageName += fileType+"/"+fileName; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, fileName); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + /*下载*/ + public String downFile(String fileName, String fileType){ + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + Criteria criteria = createCriteria(PgCsDocument.class); + criteria.add(Restrictions.eq("active", 1)); + List pgCsDocumentList = criteria.list(); + + if (pgCsDocumentList == null || pgCsDocumentList.size() == 0) + return null; + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\" + fileType + "/" + fileName; + + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + + byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir); + fos.write(buffer); + fos.flush(); + fos.close(); + + return image_toDir; + } + catch (Exception e) + { + e.printStackTrace(); + return ""; + } + } + + /*查询*/ + public List getAllDocData(String cs_name ,String cs_type,String cs_time) { + + List pgCsDocumentDtoList = new ArrayList(); + + try { + Criteria criteria = createCriteria(PgCsDocument.class); + criteria.addOrder(Order.desc("id")); + criteria.add(Restrictions.eq("cs_name", cs_name)); + criteria.add(Restrictions.eq("cs_type", cs_type)); + + if (StringUtils.isNotBlank(cs_time)) { + criteria.add(Restrictions.like("cs_time", DateUtils.sdf4.parse(cs_time))); + } + List pgCsDocumentList=criteria.list(); + + for (PgCsDocument pgCsDocument : pgCsDocumentList) { + pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument)); + } + } + catch(Exception ex) + { + return null; + } + + return pgCsDocumentDtoList; + } +/* +*根据工程名称查找 +*/ + public PgCsDocument getDocByCsName(String cs_name) { + Criteria criteria=createCriteria(PgCsDocument.class); + criteria.add(Restrictions.eq("cs_name",cs_name)); + + List pgCsDocumentList=criteria.list(); + if(pgCsDocumentList.size()==0) + return null; + else + return pgCsDocumentList.get(0); + } +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java new file mode 100644 index 0000000..11f0525 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgConstructionRs.java @@ -0,0 +1,439 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.construction.domain.PgConstruction; +import com.casic.PgInterface.construction.dto.PgConstructTjDto; +import com.casic.PgInterface.construction.dto.PgConstructionDto; +import com.casic.PgInterface.construction.manager.PgConstructionManager; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by zxh on 2018/3/27. + */ + +@Component +@Path("pgConstruction") +public class PgConstructionRs { + + private static Logger logger = LoggerFactory.getLogger(PgConstructionRs.class); + + private PgConstructionManager pgConstructionManager; + + @Resource + public void setPgConstructionManager(PgConstructionManager pgConstructionManager) + { + this.pgConstructionManager = pgConstructionManager; + } + + /* + 新建工程 + */ + @POST + @Path("addConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map addConstruction(@FormParam("cs_name")String cs_name, + @FormParam("cs_position")String cs_position, + @FormParam("cs_status")String cs_status, + @FormParam("cs_detail")String cs_detail, + @FormParam("cs_beginTime")String cs_beginTime, + @FormParam("cs_endTime")String cs_endTime, + @FormParam("cs_charge")String cs_charge, + @FormParam("cs_phone")String cs_phone, + @FormParam("cs_type")String cs_type, + @FormParam("cs_region")String cs_region) + throws Exception{ + Map resultMap = new HashMap(); + String result = "" ; + String msg = "" ; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + try { + PgConstruction pgConstruction = new PgConstruction(); + pgConstruction.setCs_name(cs_name); + pgConstruction.setCs_position(cs_position); + pgConstruction.setCs_status(cs_status); + pgConstruction.setCs_detail(cs_detail); + pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); + pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); + pgConstruction.setCs_charge(cs_charge); + pgConstruction.setCs_phone(cs_phone); + pgConstruction.setCs_type(cs_type); + pgConstruction.setCs_region(cs_region); + pgConstruction.setActive(1); + + logger.info("保存成功"); + pgConstructionManager.save(pgConstruction); + result = "true"; + msg = "保存成功"; + + }catch (Exception e){ + result = "false"; + msg = "保存失败"; + e.printStackTrace(); + } + resultMap.put("success",result); + resultMap.put("msg",msg); + return resultMap; + } + + /* + 施工信息编辑 + */ + @POST + @Path("editConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map editConstruction(@FormParam("id")String id, + @FormParam("cs_name")String cs_name, + @FormParam("cs_position")String cs_position, + @FormParam("cs_status")String cs_status, + @FormParam("cs_detail")String cs_detail, + @FormParam("cs_beginTime")String cs_beginTime, + @FormParam("cs_endTime")String cs_endTime, + @FormParam("cs_charge")String cs_charge, + @FormParam("cs_phone")String cs_phone, + @FormParam("cs_type")String cs_type, + @FormParam("cs_region")String cs_region) + throws Exception{ + + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + try { + if (id.equals("")) + { + result = "false"; + msg = "请输入ID"; + }else { + PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); + pgConstruction.setCs_name(cs_name); + pgConstruction.setCs_position(cs_position); + pgConstruction.setCs_status(cs_status); + pgConstruction.setCs_detail(cs_detail); + pgConstruction.setCs_beginTime(sdf.parse(cs_beginTime)); + pgConstruction.setCs_endTime(sdf.parse(cs_endTime)); + pgConstruction.setCs_charge(cs_charge); + pgConstruction.setCs_phone(cs_phone); + pgConstruction.setCs_type(cs_type); + pgConstruction.setCs_region(cs_region); + pgConstruction.setActive(1); + + pgConstructionManager.save(pgConstruction); + result = "true"; + msg = "编辑成功"; + } + + }catch (Exception e){ + result = "false"; + msg = "编辑失败"; + e.printStackTrace(); + + } + + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + @POST + @Path("delConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map delConstruction(@FormParam("id")String id) + throws Exception{ + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + try { + PgConstruction pgConstruction = pgConstructionManager.get(Long.valueOf(id)); + if (pgConstruction == null) + { + result = "false"; + msg = "不存在该施工信息"; + }else + { + pgConstruction.setActive(0); + pgConstructionManager.save(pgConstruction); + result = "true"; + msg = "成功删除信息"; + } + }catch (Exception e){ + e.printStackTrace(); + result = "false"; + msg = "删除失败"; + } + resultMap.put("result", result); + resultMap.put("msg", msg); + return resultMap; + } + + @POST + @Path("queryConstruction") + @Produces(MediaType.APPLICATION_JSON) + public Map queryConstruction(@FormParam("cs_name")String cs_name, + @FormParam("cs_position")String cs_position, + @FormParam("cs_beginTime")String cs_beginTime, + @FormParam("cs_endTime")String cs_endTime, + @FormParam("cs_type")String cs_type + ) + throws Exception{ + + Map resultMap = new HashMap(); + List pgConstructionDtoList = new ArrayList(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + String msg = ""; + + try { + pgConstructionDtoList = pgConstructionManager.getConstructByVague(cs_name, cs_position, cs_type, cs_beginTime, cs_endTime); + if (pgConstructionDtoList != null) + { + msg = "获取数据成功"; + }else + { + msg = "没有满足条件的数据"; + } + }catch (Exception e){ + e.printStackTrace(); + } + + resultMap.put("msg", msg); + resultMap.put("result", pgConstructionDtoList); + return resultMap; + } + + @POST + @Path("constructTjByDay") + @Produces(MediaType.APPLICATION_JSON) + public Map constructTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getAllConstructByDay(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + @POST + @Path("constructTjByWeek") + @Produces(MediaType.APPLICATION_JSON) + public Map constructTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getAllConstructByWeek(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + @POST + @Path("constructTjByMon") + @Produces(MediaType.APPLICATION_JSON) + public Map constructTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getAllConstructByMon(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + /*按天在建工程/完工程统计*/ + @POST + @Path("buildingTjByDay") + @Produces(MediaType.APPLICATION_JSON) + public Map buildingTjByDay(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getBuildingByDay(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + /*按周在建工程/完工程统计*/ + @POST + @Path("buildingTjByWeek") + @Produces(MediaType.APPLICATION_JSON) + public Map buildingTjByWeek(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getBuildingByWeek(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + /*按月在建工程/完工程统计*/ + @POST + @Path("buildingTjByMon") + @Produces(MediaType.APPLICATION_JSON) + public Map buildingTjByMon(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getBuildingByMon(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + /*按类型统计*/ + @POST + @Path("constructTjByType") + @Produces(MediaType.APPLICATION_JSON) + public Map constructTjByType(@FormParam("cs_type") String cs_type)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getConstructTjByType(cs_type); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } + + /*按区域统计*/ + @POST + @Path("constructTjByRegion") + @Produces(MediaType.APPLICATION_JSON) + public Map constructTjByRegion(@FormParam("cs_beginTime") String cs_beginTime)throws Exception + { + Map resultMap = new HashMap(); + List pgConstructTjDtoList = new ArrayList(); + String msg = ""; + try { + pgConstructTjDtoList = pgConstructionManager.getConstructTjByRegion(cs_beginTime); + if (pgConstructTjDtoList != null) + { + msg = "获取成功"; + }else{ + msg = "没有符合条件的数据"; + } + + }catch(Exception e) + { + e.printStackTrace(); + msg = "获取失败"; + } + resultMap.put("msg", msg); + resultMap.put("result", pgConstructTjDtoList); + return resultMap; + } +} diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java new file mode 100644 index 0000000..b3f303e --- /dev/null +++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java @@ -0,0 +1,245 @@ +package com.casic.PgInterface.rs; + +import com.casic.PgInterface.core.util.StringUtils; +import com.casic.PgInterface.construction.domain.PgCsDocument; +import com.casic.PgInterface.construction.dto.PgCsDocumentDto; +import com.casic.PgInterface.construction.manager.PgCsDocumentManager; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.ws.rs.FormParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by zxh on 2018/3/28. + */ +@Component +@Path("pgCsDocument") +public class PgCsDocumentRs { + + private static Logger logger = LoggerFactory.getLogger(pgStatisticRs.class); + + private PgCsDocumentManager pgCsDocumentManager; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + @Resource + public void setPgCsDocumentManager(PgCsDocumentManager pgCsDocumentManager) { + this.pgCsDocumentManager = pgCsDocumentManager; + } + + /* + 新增&上传 + */ + @POST + @Path("addConstructDoc") + @Produces(MediaType.APPLICATION_JSON) + public Map addConstructDoc( + @FormParam("doc_name") String doc_name, + @FormParam("cs_name") String cs_name, + @FormParam("cs_type") String cs_type, + @FormParam("cs_time") String cs_time, + @FormParam("construct_doc") String fileBuffer)throws Exception { + Map resultMap = new HashMap(); + PgCsDocument pgCsDocument = new PgCsDocument(); + + String result = ""; + String msg = ""; + + try { + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) + pgCsDocument.setConstruct_doc(""); + else { + pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); + } + + pgCsDocument.setDoc_name(doc_name); + pgCsDocument.setCs_name(cs_name); + pgCsDocument.setCs_type(cs_type); + pgCsDocument.setCs_time(sdf.parse(cs_time)); + + pgCsDocument.setActive(1); + pgCsDocumentManager.save(pgCsDocument); + + result = "true"; + msg = "保存成功"; + logger.info("保存成功"); + + } catch (Exception ex) { + result = "false"; + msg = "保存失败"; + ex.printStackTrace(); + } + + resultMap.put("success", result); + resultMap.put("msg", msg); + return resultMap; + } + + //编辑施工文档 + @RequestMapping("editConstructDoc") + @ResponseBody + public Map editReservePlan(@FormParam("id") String id, + @RequestParam(value = "doc_name",required = true) String doc_name, + @FormParam("cs_name") String cs_name, + @RequestParam(value = "cs_type",required =false) String cs_type, + @RequestParam(value ="cs_time",required =false) String cs_time) throws Exception { + + Map resultMap = new HashMap(); + String result = ""; + String msg = ""; + + try { + PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); + if (pgCsDocument == null) { + result = "false"; + msg = "不存在该预案信息"; + } else { + pgCsDocument.setDoc_name(doc_name); + pgCsDocument.setCs_name(cs_name); + pgCsDocument.setCs_type(cs_type); + pgCsDocument.setCs_time(sdf.parse(cs_time)); + pgCsDocument.setActive(1); + + pgCsDocumentManager.save(pgCsDocument); + + result = "true"; + msg = "编辑成功"; + } + } catch (Exception e) { + + result = "false"; + msg = "编辑失败"; + e.printStackTrace(); + } + resultMap.put("msg",msg); + resultMap.put("result",result); + return resultMap; + } + + //删除预案文档 + @RequestMapping("delConstructDoc") + @ResponseBody + public Map deleteReservePlan(@FormParam("id") String id)throws Exception{ + Map resultMap = new HashMap(); + String msg=""; + String result=""; + + try{ + + PgCsDocument pgCsDocument = pgCsDocumentManager.get(Long.valueOf(id)); + if(pgCsDocument==null) + { + result="false"; + msg="不存在该预案信息"; + } + else{ + pgCsDocument.setActive(0); + pgCsDocumentManager.save(pgCsDocument); + result="true"; + msg="删除成功"; + } + } + catch(Exception e) + { + e.printStackTrace(); + msg="预案删除失败"; + result="false"; + } + + resultMap.put("msg",msg); + resultMap.put("result",result); + return resultMap; + + } + + /* + 按工程名称、工程类别、施工时间查询 + */ + @RequestMapping("queryConstructDoc") + @ResponseBody + public Map queryConstructDoc(@FormParam("cs_name")String cs_name, + @FormParam("cs_type")String cs_type, + @FormParam("cs_time")String cs_time) + throws Exception{ + + Map resultMap = new HashMap(); + List pgCsDocumentDtoList = new ArrayList(); + + String msg=""; + String result=""; + + try { + pgCsDocumentDtoList = pgCsDocumentManager.getAllDocData(cs_name, cs_type, cs_time); + if (pgCsDocumentDtoList != null) + { + result = "true"; + msg = "获取数据成功"; + }else + { + result = "false"; + msg = "没有满足条件的数据"; + } + + }catch (Exception e){ + e.printStackTrace(); + result = "false"; + msg = "获取失败"; + } + + resultMap.put("msg",msg); + resultMap.put("result",result); + return resultMap; + } + + @POST + @Path("downLoadConstructDoc") + @Produces(MediaType.APPLICATION_JSON) + public Map downLoadConstructDoc( + @FormParam("cs_type")String cs_type, + @FormParam("doc_name") String doc_name)throws Exception { + Map resultMap = new HashMap(); + PgCsDocument pgCsDocument = new PgCsDocument(); + + String result = ""; + String msg = ""; + + try { + if (doc_name != null) { + pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type)); + + result = "true"; + msg = "下载成功"; + logger.info("下载成功"); + } + else + { + result = "false"; + msg = "文件名不能为空"; + logger.info("文件名不能为空"); + } + + } catch (Exception ex) { + result = "false"; + msg = "下载失败"; + ex.printStackTrace(); + } + + resultMap.put("success", result); + resultMap.put("msg", msg); + return resultMap; + } +}