diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } +} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @Column(name = "ACTIVE") + public int getActive() { + return active; + } + + public void setActive(int active) { + this.active = active; + } + +} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java new file mode 100644 index 0000000..2f101b0 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java @@ -0,0 +1,99 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by Administrator on 2018/4/24. + */ +public class PgPatrolDocDto implements Serializable{ + + private String id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private String patroler; + private String beginTime; + private String timeLimt; + private String describe; + private String active; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + public String getPatroler() { + return patroler; + } + + public void setPatroler(String patroler) { + this.patroler = patroler; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public PgPatrolDocDto() + { + + } + + public PgPatrolDocDto(PgPatrolDoc pgPatrolDoc) + { + this.setId(String.valueOf(pgPatrolDoc.getPgpatrol_id())); + this.setPatroler(pgPatrolDoc.getPgpatrol_id().getPatroler()); + this.setBeginTime(DateUtils.sdf4.format(pgPatrolDoc.getPgpatrol_id().getBeginTime())); + this.setList_name(pgPatrolDoc.getList_name()); + this.setFile_name(pgPatrolDoc.getFile_name()); + + this.setActive(String.valueOf(pgPatrolDoc.getActive())); + } +} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java new file mode 100644 index 0000000..2f101b0 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java @@ -0,0 +1,99 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by Administrator on 2018/4/24. + */ +public class PgPatrolDocDto implements Serializable{ + + private String id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private String patroler; + private String beginTime; + private String timeLimt; + private String describe; + private String active; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + public String getPatroler() { + return patroler; + } + + public void setPatroler(String patroler) { + this.patroler = patroler; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public PgPatrolDocDto() + { + + } + + public PgPatrolDocDto(PgPatrolDoc pgPatrolDoc) + { + this.setId(String.valueOf(pgPatrolDoc.getPgpatrol_id())); + this.setPatroler(pgPatrolDoc.getPgpatrol_id().getPatroler()); + this.setBeginTime(DateUtils.sdf4.format(pgPatrolDoc.getPgpatrol_id().getBeginTime())); + this.setList_name(pgPatrolDoc.getList_name()); + this.setFile_name(pgPatrolDoc.getFile_name()); + + this.setActive(String.valueOf(pgPatrolDoc.getActive())); + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java new file mode 100644 index 0000000..1968a8c --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/27. + */ + +@Service +public class PgMaintainDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + public ResponseEntity downloadFile(PgMaintainDoc pgMaintainDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgMaintainDoc.getList_name() + "\\" + pgMaintainDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getMaintainDocById(PgMaintain pgMaintain) + { + Criteria criteria = createCriteria(PgMaintainDoc.class); + criteria.add(Restrictions.eq("pgmaintain_id", pgMaintain)); + criteria.add(Restrictions.eq("active", 1)); + + List pgMaintainDocList = criteria.list(); + + if (pgMaintainDocList == null) + return null; + else + return pgMaintainDocList; + } +} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java new file mode 100644 index 0000000..2f101b0 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java @@ -0,0 +1,99 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by Administrator on 2018/4/24. + */ +public class PgPatrolDocDto implements Serializable{ + + private String id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private String patroler; + private String beginTime; + private String timeLimt; + private String describe; + private String active; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + public String getPatroler() { + return patroler; + } + + public void setPatroler(String patroler) { + this.patroler = patroler; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public PgPatrolDocDto() + { + + } + + public PgPatrolDocDto(PgPatrolDoc pgPatrolDoc) + { + this.setId(String.valueOf(pgPatrolDoc.getPgpatrol_id())); + this.setPatroler(pgPatrolDoc.getPgpatrol_id().getPatroler()); + this.setBeginTime(DateUtils.sdf4.format(pgPatrolDoc.getPgpatrol_id().getBeginTime())); + this.setList_name(pgPatrolDoc.getList_name()); + this.setFile_name(pgPatrolDoc.getFile_name()); + + this.setActive(String.valueOf(pgPatrolDoc.getActive())); + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java new file mode 100644 index 0000000..1968a8c --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/27. + */ + +@Service +public class PgMaintainDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + public ResponseEntity downloadFile(PgMaintainDoc pgMaintainDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgMaintainDoc.getList_name() + "\\" + pgMaintainDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getMaintainDocById(PgMaintain pgMaintain) + { + Criteria criteria = createCriteria(PgMaintainDoc.class); + criteria.add(Restrictions.eq("pgmaintain_id", pgMaintain)); + criteria.add(Restrictions.eq("active", 1)); + + List pgMaintainDocList = criteria.list(); + + if (pgMaintainDocList == null) + return null; + else + return pgMaintainDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index 321ebfa..cca3d1c 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -21,8 +23,8 @@ @Service public class PgMaintainManager extends HibernateEntityDao{ - public List getPgMaintainList() { - Criteria criteria=createCriteria(PgMaintain.class); + public List getPgMaintainList() { + /*Criteria criteria=createCriteria(PgMaintain.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +34,26 @@ { pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); } - return pgMaintainDtoList; + return pgMaintainDtoList;*/ + String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgMaintainDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); + pgMaintainDocDto.setId(objects.get(i)[0].toString()); + pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); + pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); + pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); + pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); + pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDtoList.add(pgMaintainDocDto); + } + return pgMaintainDocDtoList; } public List getPgMaintainByMaintainerOrTime(String mainTainer,String startTime,String endTime) { diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java new file mode 100644 index 0000000..2f101b0 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java @@ -0,0 +1,99 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by Administrator on 2018/4/24. + */ +public class PgPatrolDocDto implements Serializable{ + + private String id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private String patroler; + private String beginTime; + private String timeLimt; + private String describe; + private String active; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + public String getPatroler() { + return patroler; + } + + public void setPatroler(String patroler) { + this.patroler = patroler; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public PgPatrolDocDto() + { + + } + + public PgPatrolDocDto(PgPatrolDoc pgPatrolDoc) + { + this.setId(String.valueOf(pgPatrolDoc.getPgpatrol_id())); + this.setPatroler(pgPatrolDoc.getPgpatrol_id().getPatroler()); + this.setBeginTime(DateUtils.sdf4.format(pgPatrolDoc.getPgpatrol_id().getBeginTime())); + this.setList_name(pgPatrolDoc.getList_name()); + this.setFile_name(pgPatrolDoc.getFile_name()); + + this.setActive(String.valueOf(pgPatrolDoc.getActive())); + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java new file mode 100644 index 0000000..1968a8c --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/27. + */ + +@Service +public class PgMaintainDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + public ResponseEntity downloadFile(PgMaintainDoc pgMaintainDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgMaintainDoc.getList_name() + "\\" + pgMaintainDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getMaintainDocById(PgMaintain pgMaintain) + { + Criteria criteria = createCriteria(PgMaintainDoc.class); + criteria.add(Restrictions.eq("pgmaintain_id", pgMaintain)); + criteria.add(Restrictions.eq("active", 1)); + + List pgMaintainDocList = criteria.list(); + + if (pgMaintainDocList == null) + return null; + else + return pgMaintainDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index 321ebfa..cca3d1c 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -21,8 +23,8 @@ @Service public class PgMaintainManager extends HibernateEntityDao{ - public List getPgMaintainList() { - Criteria criteria=createCriteria(PgMaintain.class); + public List getPgMaintainList() { + /*Criteria criteria=createCriteria(PgMaintain.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +34,26 @@ { pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); } - return pgMaintainDtoList; + return pgMaintainDtoList;*/ + String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgMaintainDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); + pgMaintainDocDto.setId(objects.get(i)[0].toString()); + pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); + pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); + pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); + pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); + pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDtoList.add(pgMaintainDocDto); + } + return pgMaintainDocDtoList; } public List getPgMaintainByMaintainerOrTime(String mainTainer,String startTime,String endTime) { diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java new file mode 100644 index 0000000..c5ed9b5 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java @@ -0,0 +1,95 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/24. + */ + +@Service +public class PgPatrolDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + + /*下载文件*/ + public ResponseEntity downloadFile(PgPatrolDoc pgPatrolDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgPatrolDoc.getList_name() + "\\" + pgPatrolDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getPgPatrolDocById(PgPatrol pgPatrol) + { + Criteria criteria = createCriteria(PgPatrolDoc.class); + criteria.add(Restrictions.eq("pgpatrol_id", pgPatrol)); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolDocList = criteria.list(); + + if (pgPatrolDocList == null) + return null; + else + return pgPatrolDocList; + } +} diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java new file mode 100644 index 0000000..2f101b0 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java @@ -0,0 +1,99 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by Administrator on 2018/4/24. + */ +public class PgPatrolDocDto implements Serializable{ + + private String id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private String patroler; + private String beginTime; + private String timeLimt; + private String describe; + private String active; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + public String getPatroler() { + return patroler; + } + + public void setPatroler(String patroler) { + this.patroler = patroler; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public PgPatrolDocDto() + { + + } + + public PgPatrolDocDto(PgPatrolDoc pgPatrolDoc) + { + this.setId(String.valueOf(pgPatrolDoc.getPgpatrol_id())); + this.setPatroler(pgPatrolDoc.getPgpatrol_id().getPatroler()); + this.setBeginTime(DateUtils.sdf4.format(pgPatrolDoc.getPgpatrol_id().getBeginTime())); + this.setList_name(pgPatrolDoc.getList_name()); + this.setFile_name(pgPatrolDoc.getFile_name()); + + this.setActive(String.valueOf(pgPatrolDoc.getActive())); + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java new file mode 100644 index 0000000..1968a8c --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/27. + */ + +@Service +public class PgMaintainDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + public ResponseEntity downloadFile(PgMaintainDoc pgMaintainDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgMaintainDoc.getList_name() + "\\" + pgMaintainDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getMaintainDocById(PgMaintain pgMaintain) + { + Criteria criteria = createCriteria(PgMaintainDoc.class); + criteria.add(Restrictions.eq("pgmaintain_id", pgMaintain)); + criteria.add(Restrictions.eq("active", 1)); + + List pgMaintainDocList = criteria.list(); + + if (pgMaintainDocList == null) + return null; + else + return pgMaintainDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index 321ebfa..cca3d1c 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -21,8 +23,8 @@ @Service public class PgMaintainManager extends HibernateEntityDao{ - public List getPgMaintainList() { - Criteria criteria=createCriteria(PgMaintain.class); + public List getPgMaintainList() { + /*Criteria criteria=createCriteria(PgMaintain.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +34,26 @@ { pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); } - return pgMaintainDtoList; + return pgMaintainDtoList;*/ + String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgMaintainDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); + pgMaintainDocDto.setId(objects.get(i)[0].toString()); + pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); + pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); + pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); + pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); + pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDtoList.add(pgMaintainDocDto); + } + return pgMaintainDocDtoList; } public List getPgMaintainByMaintainerOrTime(String mainTainer,String startTime,String endTime) { diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java new file mode 100644 index 0000000..c5ed9b5 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java @@ -0,0 +1,95 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/24. + */ + +@Service +public class PgPatrolDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + + /*下载文件*/ + public ResponseEntity downloadFile(PgPatrolDoc pgPatrolDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgPatrolDoc.getList_name() + "\\" + pgPatrolDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getPgPatrolDocById(PgPatrol pgPatrol) + { + Criteria criteria = createCriteria(PgPatrolDoc.class); + criteria.add(Restrictions.eq("pgpatrol_id", pgPatrol)); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolDocList = criteria.list(); + + if (pgPatrolDocList == null) + return null; + else + return pgPatrolDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java index e587023..6e96782 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import com.casic.PgInterface.patroler.dto.PgPatrolDocDto; import com.casic.PgInterface.patroler.dto.PgPatrolDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -11,6 +13,7 @@ import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; +import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; @@ -21,8 +24,8 @@ @Service public class PgPatrolManager extends HibernateEntityDao { - public List getPgPatrolList() { - Criteria criteria=createCriteria(PgPatrol.class); + public List getPgPatrolList() { + /*Criteria criteria=createCriteria(PgPatrol.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +35,27 @@ { pgPatrolDtoList.add(new PgPatrolDto(pgPatrol)); } - return pgPatrolDtoList; + return pgPatrolDtoList;*/ + + String sql = "SELECT B.ID,B.PATROLER,A.LIST_NAME,B.DESCRIBE,B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_PATROLDOC A LEFT JOIN PG_PATROL B ON B.ID = A.PGPATROL_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgPatrolDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgPatrolDocDto pgPatrolDocDto = new PgPatrolDocDto(); + pgPatrolDocDto.setId(objects.get(i)[0].toString()); + pgPatrolDocDto.setPatroler(objects.get(i)[1].toString()); + pgPatrolDocDto.setList_name(objects.get(i)[2].toString()); + pgPatrolDocDto.setDescribe(objects.get(i)[3].toString()); + pgPatrolDocDto.setBeginTime(objects.get(i)[4].toString()); + pgPatrolDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgPatrolDocDto.setFile_name(objects.get(i)[6].toString()); + pgPatrolDocDtoList.add(pgPatrolDocDto); + } + return pgPatrolDocDtoList; } public List getPgPatrolByPatrolerOrTime(String patroler,String startTime,String endTime) { @@ -110,4 +133,25 @@ return pgPatrolMaintainInfoDtoList; } + public PgPatrol getPgPatrolByPT(String name, String beginTime) { + try { + Criteria criteria = createCriteria(PgPatrol.class); + criteria.add(Restrictions.eq("patroler", name)); + criteria.add(Restrictions.eq("beginTime",DateUtils.sdf4.parse(beginTime))); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolList = criteria.list(); + + if (pgPatrolList == null) + return null; + else + return pgPatrolList.get(0); + + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + + } diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java new file mode 100644 index 0000000..2f101b0 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java @@ -0,0 +1,99 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by Administrator on 2018/4/24. + */ +public class PgPatrolDocDto implements Serializable{ + + private String id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private String patroler; + private String beginTime; + private String timeLimt; + private String describe; + private String active; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + public String getPatroler() { + return patroler; + } + + public void setPatroler(String patroler) { + this.patroler = patroler; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public PgPatrolDocDto() + { + + } + + public PgPatrolDocDto(PgPatrolDoc pgPatrolDoc) + { + this.setId(String.valueOf(pgPatrolDoc.getPgpatrol_id())); + this.setPatroler(pgPatrolDoc.getPgpatrol_id().getPatroler()); + this.setBeginTime(DateUtils.sdf4.format(pgPatrolDoc.getPgpatrol_id().getBeginTime())); + this.setList_name(pgPatrolDoc.getList_name()); + this.setFile_name(pgPatrolDoc.getFile_name()); + + this.setActive(String.valueOf(pgPatrolDoc.getActive())); + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java new file mode 100644 index 0000000..1968a8c --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/27. + */ + +@Service +public class PgMaintainDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + public ResponseEntity downloadFile(PgMaintainDoc pgMaintainDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgMaintainDoc.getList_name() + "\\" + pgMaintainDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getMaintainDocById(PgMaintain pgMaintain) + { + Criteria criteria = createCriteria(PgMaintainDoc.class); + criteria.add(Restrictions.eq("pgmaintain_id", pgMaintain)); + criteria.add(Restrictions.eq("active", 1)); + + List pgMaintainDocList = criteria.list(); + + if (pgMaintainDocList == null) + return null; + else + return pgMaintainDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index 321ebfa..cca3d1c 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -21,8 +23,8 @@ @Service public class PgMaintainManager extends HibernateEntityDao{ - public List getPgMaintainList() { - Criteria criteria=createCriteria(PgMaintain.class); + public List getPgMaintainList() { + /*Criteria criteria=createCriteria(PgMaintain.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +34,26 @@ { pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); } - return pgMaintainDtoList; + return pgMaintainDtoList;*/ + String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgMaintainDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); + pgMaintainDocDto.setId(objects.get(i)[0].toString()); + pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); + pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); + pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); + pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); + pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDtoList.add(pgMaintainDocDto); + } + return pgMaintainDocDtoList; } public List getPgMaintainByMaintainerOrTime(String mainTainer,String startTime,String endTime) { diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java new file mode 100644 index 0000000..c5ed9b5 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java @@ -0,0 +1,95 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/24. + */ + +@Service +public class PgPatrolDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + + /*下载文件*/ + public ResponseEntity downloadFile(PgPatrolDoc pgPatrolDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgPatrolDoc.getList_name() + "\\" + pgPatrolDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getPgPatrolDocById(PgPatrol pgPatrol) + { + Criteria criteria = createCriteria(PgPatrolDoc.class); + criteria.add(Restrictions.eq("pgpatrol_id", pgPatrol)); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolDocList = criteria.list(); + + if (pgPatrolDocList == null) + return null; + else + return pgPatrolDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java index e587023..6e96782 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import com.casic.PgInterface.patroler.dto.PgPatrolDocDto; import com.casic.PgInterface.patroler.dto.PgPatrolDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -11,6 +13,7 @@ import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; +import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; @@ -21,8 +24,8 @@ @Service public class PgPatrolManager extends HibernateEntityDao { - public List getPgPatrolList() { - Criteria criteria=createCriteria(PgPatrol.class); + public List getPgPatrolList() { + /*Criteria criteria=createCriteria(PgPatrol.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +35,27 @@ { pgPatrolDtoList.add(new PgPatrolDto(pgPatrol)); } - return pgPatrolDtoList; + return pgPatrolDtoList;*/ + + String sql = "SELECT B.ID,B.PATROLER,A.LIST_NAME,B.DESCRIBE,B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_PATROLDOC A LEFT JOIN PG_PATROL B ON B.ID = A.PGPATROL_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgPatrolDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgPatrolDocDto pgPatrolDocDto = new PgPatrolDocDto(); + pgPatrolDocDto.setId(objects.get(i)[0].toString()); + pgPatrolDocDto.setPatroler(objects.get(i)[1].toString()); + pgPatrolDocDto.setList_name(objects.get(i)[2].toString()); + pgPatrolDocDto.setDescribe(objects.get(i)[3].toString()); + pgPatrolDocDto.setBeginTime(objects.get(i)[4].toString()); + pgPatrolDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgPatrolDocDto.setFile_name(objects.get(i)[6].toString()); + pgPatrolDocDtoList.add(pgPatrolDocDto); + } + return pgPatrolDocDtoList; } public List getPgPatrolByPatrolerOrTime(String patroler,String startTime,String endTime) { @@ -110,4 +133,25 @@ return pgPatrolMaintainInfoDtoList; } + public PgPatrol getPgPatrolByPT(String name, String beginTime) { + try { + Criteria criteria = createCriteria(PgPatrol.class); + criteria.add(Restrictions.eq("patroler", name)); + criteria.add(Restrictions.eq("beginTime",DateUtils.sdf4.parse(beginTime))); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolList = criteria.list(); + + if (pgPatrolList == null) + return null; + else + return pgPatrolList.get(0); + + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + + } diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java index 103ba36..260b3ec 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java @@ -54,6 +54,7 @@ @Path("addConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map addConstructDoc( + @FormParam("list_name") String list_name, @FormParam("doc_name") String doc_name, @FormParam("construct_doc") String fileBuffer, @FormParam("cs_name") String cs_name)throws Exception { @@ -67,10 +68,11 @@ if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) pgCsDocument.setConstruct_doc(""); else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); + pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, list_name)); } PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); + pgCsDocument.setList_name(list_name); pgCsDocument.setDoc_name(doc_name); pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); @@ -96,6 +98,7 @@ @Path("editConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map editReservePlan(@FormParam("id") String id, + @FormParam("list_name") String List_name, @FormParam("doc_name") String doc_name, @FormParam("cs_name") String cs_name) throws Exception { diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java new file mode 100644 index 0000000..2f101b0 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java @@ -0,0 +1,99 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by Administrator on 2018/4/24. + */ +public class PgPatrolDocDto implements Serializable{ + + private String id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private String patroler; + private String beginTime; + private String timeLimt; + private String describe; + private String active; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + public String getPatroler() { + return patroler; + } + + public void setPatroler(String patroler) { + this.patroler = patroler; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public PgPatrolDocDto() + { + + } + + public PgPatrolDocDto(PgPatrolDoc pgPatrolDoc) + { + this.setId(String.valueOf(pgPatrolDoc.getPgpatrol_id())); + this.setPatroler(pgPatrolDoc.getPgpatrol_id().getPatroler()); + this.setBeginTime(DateUtils.sdf4.format(pgPatrolDoc.getPgpatrol_id().getBeginTime())); + this.setList_name(pgPatrolDoc.getList_name()); + this.setFile_name(pgPatrolDoc.getFile_name()); + + this.setActive(String.valueOf(pgPatrolDoc.getActive())); + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java new file mode 100644 index 0000000..1968a8c --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/27. + */ + +@Service +public class PgMaintainDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + public ResponseEntity downloadFile(PgMaintainDoc pgMaintainDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgMaintainDoc.getList_name() + "\\" + pgMaintainDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getMaintainDocById(PgMaintain pgMaintain) + { + Criteria criteria = createCriteria(PgMaintainDoc.class); + criteria.add(Restrictions.eq("pgmaintain_id", pgMaintain)); + criteria.add(Restrictions.eq("active", 1)); + + List pgMaintainDocList = criteria.list(); + + if (pgMaintainDocList == null) + return null; + else + return pgMaintainDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index 321ebfa..cca3d1c 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -21,8 +23,8 @@ @Service public class PgMaintainManager extends HibernateEntityDao{ - public List getPgMaintainList() { - Criteria criteria=createCriteria(PgMaintain.class); + public List getPgMaintainList() { + /*Criteria criteria=createCriteria(PgMaintain.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +34,26 @@ { pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); } - return pgMaintainDtoList; + return pgMaintainDtoList;*/ + String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgMaintainDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); + pgMaintainDocDto.setId(objects.get(i)[0].toString()); + pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); + pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); + pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); + pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); + pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDtoList.add(pgMaintainDocDto); + } + return pgMaintainDocDtoList; } public List getPgMaintainByMaintainerOrTime(String mainTainer,String startTime,String endTime) { diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java new file mode 100644 index 0000000..c5ed9b5 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java @@ -0,0 +1,95 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/24. + */ + +@Service +public class PgPatrolDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + + /*下载文件*/ + public ResponseEntity downloadFile(PgPatrolDoc pgPatrolDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgPatrolDoc.getList_name() + "\\" + pgPatrolDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getPgPatrolDocById(PgPatrol pgPatrol) + { + Criteria criteria = createCriteria(PgPatrolDoc.class); + criteria.add(Restrictions.eq("pgpatrol_id", pgPatrol)); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolDocList = criteria.list(); + + if (pgPatrolDocList == null) + return null; + else + return pgPatrolDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java index e587023..6e96782 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import com.casic.PgInterface.patroler.dto.PgPatrolDocDto; import com.casic.PgInterface.patroler.dto.PgPatrolDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -11,6 +13,7 @@ import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; +import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; @@ -21,8 +24,8 @@ @Service public class PgPatrolManager extends HibernateEntityDao { - public List getPgPatrolList() { - Criteria criteria=createCriteria(PgPatrol.class); + public List getPgPatrolList() { + /*Criteria criteria=createCriteria(PgPatrol.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +35,27 @@ { pgPatrolDtoList.add(new PgPatrolDto(pgPatrol)); } - return pgPatrolDtoList; + return pgPatrolDtoList;*/ + + String sql = "SELECT B.ID,B.PATROLER,A.LIST_NAME,B.DESCRIBE,B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_PATROLDOC A LEFT JOIN PG_PATROL B ON B.ID = A.PGPATROL_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgPatrolDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgPatrolDocDto pgPatrolDocDto = new PgPatrolDocDto(); + pgPatrolDocDto.setId(objects.get(i)[0].toString()); + pgPatrolDocDto.setPatroler(objects.get(i)[1].toString()); + pgPatrolDocDto.setList_name(objects.get(i)[2].toString()); + pgPatrolDocDto.setDescribe(objects.get(i)[3].toString()); + pgPatrolDocDto.setBeginTime(objects.get(i)[4].toString()); + pgPatrolDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgPatrolDocDto.setFile_name(objects.get(i)[6].toString()); + pgPatrolDocDtoList.add(pgPatrolDocDto); + } + return pgPatrolDocDtoList; } public List getPgPatrolByPatrolerOrTime(String patroler,String startTime,String endTime) { @@ -110,4 +133,25 @@ return pgPatrolMaintainInfoDtoList; } + public PgPatrol getPgPatrolByPT(String name, String beginTime) { + try { + Criteria criteria = createCriteria(PgPatrol.class); + criteria.add(Restrictions.eq("patroler", name)); + criteria.add(Restrictions.eq("beginTime",DateUtils.sdf4.parse(beginTime))); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolList = criteria.list(); + + if (pgPatrolList == null) + return null; + else + return pgPatrolList.get(0); + + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + + } diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java index 103ba36..260b3ec 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java @@ -54,6 +54,7 @@ @Path("addConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map addConstructDoc( + @FormParam("list_name") String list_name, @FormParam("doc_name") String doc_name, @FormParam("construct_doc") String fileBuffer, @FormParam("cs_name") String cs_name)throws Exception { @@ -67,10 +68,11 @@ if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) pgCsDocument.setConstruct_doc(""); else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); + pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, list_name)); } PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); + pgCsDocument.setList_name(list_name); pgCsDocument.setDoc_name(doc_name); pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); @@ -96,6 +98,7 @@ @Path("editConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map editReservePlan(@FormParam("id") String id, + @FormParam("list_name") String List_name, @FormParam("doc_name") String doc_name, @FormParam("cs_name") String cs_name) throws Exception { diff --git a/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java b/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java index 2639058..1f2c0f2 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java @@ -1,9 +1,15 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; +import com.casic.PgInterface.patroler.manager.PgMaintainDocManager; import com.casic.PgInterface.patroler.manager.PgMaintainManager; +import com.casic.PgInterface.patroler.manager.PgPatrolDocManager; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -26,12 +32,19 @@ public class PgMaintainRs { PgMaintainManager pgMaintainManager=new PgMaintainManager(); + PgMaintainDocManager pgMaintainDocManager = new PgMaintainDocManager(); @Resource public void setPgMaintainManager(PgMaintainManager pgMaintainManager) { this.pgMaintainManager = pgMaintainManager; } + @Resource + public void setPgMaintainDocManager(PgMaintainDocManager pgMaintainDocManager) + { + this.pgMaintainDocManager = pgMaintainDocManager; + } + /** * 新增维护记录 */ @@ -41,7 +54,10 @@ public Map addMaintain(@FormParam("mainTainer") String mainTainer, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("maintain_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -49,6 +65,7 @@ String result = ""; String msg = ""; PgMaintain pgMaintain=new PgMaintain(); + PgMaintainDoc pgMaintainDoc = new PgMaintainDoc(); try { pgMaintain.setMainTainer(mainTainer); @@ -58,6 +75,20 @@ pgMaintain.setActive(1); pgMaintainManager.save(pgMaintain); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgMaintainDoc.setFile_path(""); + else { + pgMaintainDoc.setFile_path(pgMaintainDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + pgMaintainDoc.setList_name(list_name); + pgMaintainDoc.setFile_name(file_name); + pgMaintainDoc.setPgmaintain_id(pgMaintain); + pgMaintainDoc.setActive(1); + + pgMaintainDocManager.save(pgMaintainDoc); + result = "true"; msg = "保存成功"; } catch (Exception e) { @@ -80,7 +111,10 @@ @FormParam("mainTainer") String mainTainer, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("maintain_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map resultMap = new HashMap(); @@ -95,6 +129,25 @@ pgMaintain.setDescribe(describe); pgMaintainManager.save(pgMaintain); + + List pgMaintainDocList = pgMaintainDocManager.getMaintainDocById(pgMaintain); + PgMaintainDoc pgMaintainDocument = new PgMaintainDoc(); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgMaintainDocument.setFile_path(""); + else { + pgMaintainDocument.setFile_path(pgMaintainDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + for (PgMaintainDoc pgMaintainDoc : pgMaintainDocList) + { + pgMaintainDoc.setList_name(list_name); + pgMaintainDoc.setFile_name(file_name); + pgMaintainDoc.setActive(1); + pgMaintainDocManager.save(pgMaintainDoc); + } + pgMaintainDocManager.save(pgMaintainDocument); + msg = "维护记录编辑成功"; result = "true"; } catch (Exception e) { @@ -119,11 +172,11 @@ Map resultMap = new HashMap(); String result = ""; String msg = ""; - List pgMaintainDtoList=new ArrayList(); + List pgMaintainDocDtoList=new ArrayList(); try{ - pgMaintainDtoList=pgMaintainManager.getPgMaintainList(); - if(pgMaintainDtoList==null||pgMaintainDtoList.size()==0) + pgMaintainDocDtoList=pgMaintainManager.getPgMaintainList(); + if(pgMaintainDocDtoList==null||pgMaintainDocDtoList.size()==0) msg="不存在维护记录"; else msg="维护获取成功"; @@ -135,7 +188,7 @@ result="false"; } resultMap.put("msg",msg); - resultMap.put("result",pgMaintainDtoList); + resultMap.put("result",pgMaintainDocDtoList); return resultMap; } @@ -171,6 +224,30 @@ return resultMap; } + + @POST + @Path("fileDownload") + @Produces(MediaType.APPLICATION_JSON) + public Map downloadFile(@FormParam("id") String id)throws Exception + { + Map resultMap = new HashMap(); + + String msg = ""; + ResponseEntity path = null; + try{ + PgMaintainDoc pgMaintainDoc = pgMaintainDocManager.get(Long.valueOf(id)); + path = pgMaintainDocManager.downloadFile(pgMaintainDoc); + msg = "下载成功"; + + }catch (Exception e){ + e.printStackTrace(); + msg = "下载失败"; + } + + resultMap.put("result", path); + resultMap.put("msg", msg); + return resultMap; + } /** * 根据时间统计巡检次数 */ diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java new file mode 100644 index 0000000..2f101b0 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java @@ -0,0 +1,99 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by Administrator on 2018/4/24. + */ +public class PgPatrolDocDto implements Serializable{ + + private String id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private String patroler; + private String beginTime; + private String timeLimt; + private String describe; + private String active; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + public String getPatroler() { + return patroler; + } + + public void setPatroler(String patroler) { + this.patroler = patroler; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public PgPatrolDocDto() + { + + } + + public PgPatrolDocDto(PgPatrolDoc pgPatrolDoc) + { + this.setId(String.valueOf(pgPatrolDoc.getPgpatrol_id())); + this.setPatroler(pgPatrolDoc.getPgpatrol_id().getPatroler()); + this.setBeginTime(DateUtils.sdf4.format(pgPatrolDoc.getPgpatrol_id().getBeginTime())); + this.setList_name(pgPatrolDoc.getList_name()); + this.setFile_name(pgPatrolDoc.getFile_name()); + + this.setActive(String.valueOf(pgPatrolDoc.getActive())); + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java new file mode 100644 index 0000000..1968a8c --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/27. + */ + +@Service +public class PgMaintainDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + public ResponseEntity downloadFile(PgMaintainDoc pgMaintainDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgMaintainDoc.getList_name() + "\\" + pgMaintainDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getMaintainDocById(PgMaintain pgMaintain) + { + Criteria criteria = createCriteria(PgMaintainDoc.class); + criteria.add(Restrictions.eq("pgmaintain_id", pgMaintain)); + criteria.add(Restrictions.eq("active", 1)); + + List pgMaintainDocList = criteria.list(); + + if (pgMaintainDocList == null) + return null; + else + return pgMaintainDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index 321ebfa..cca3d1c 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -21,8 +23,8 @@ @Service public class PgMaintainManager extends HibernateEntityDao{ - public List getPgMaintainList() { - Criteria criteria=createCriteria(PgMaintain.class); + public List getPgMaintainList() { + /*Criteria criteria=createCriteria(PgMaintain.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +34,26 @@ { pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); } - return pgMaintainDtoList; + return pgMaintainDtoList;*/ + String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgMaintainDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); + pgMaintainDocDto.setId(objects.get(i)[0].toString()); + pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); + pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); + pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); + pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); + pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDtoList.add(pgMaintainDocDto); + } + return pgMaintainDocDtoList; } public List getPgMaintainByMaintainerOrTime(String mainTainer,String startTime,String endTime) { diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java new file mode 100644 index 0000000..c5ed9b5 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java @@ -0,0 +1,95 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/24. + */ + +@Service +public class PgPatrolDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + + /*下载文件*/ + public ResponseEntity downloadFile(PgPatrolDoc pgPatrolDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgPatrolDoc.getList_name() + "\\" + pgPatrolDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getPgPatrolDocById(PgPatrol pgPatrol) + { + Criteria criteria = createCriteria(PgPatrolDoc.class); + criteria.add(Restrictions.eq("pgpatrol_id", pgPatrol)); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolDocList = criteria.list(); + + if (pgPatrolDocList == null) + return null; + else + return pgPatrolDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java index e587023..6e96782 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import com.casic.PgInterface.patroler.dto.PgPatrolDocDto; import com.casic.PgInterface.patroler.dto.PgPatrolDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -11,6 +13,7 @@ import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; +import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; @@ -21,8 +24,8 @@ @Service public class PgPatrolManager extends HibernateEntityDao { - public List getPgPatrolList() { - Criteria criteria=createCriteria(PgPatrol.class); + public List getPgPatrolList() { + /*Criteria criteria=createCriteria(PgPatrol.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +35,27 @@ { pgPatrolDtoList.add(new PgPatrolDto(pgPatrol)); } - return pgPatrolDtoList; + return pgPatrolDtoList;*/ + + String sql = "SELECT B.ID,B.PATROLER,A.LIST_NAME,B.DESCRIBE,B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_PATROLDOC A LEFT JOIN PG_PATROL B ON B.ID = A.PGPATROL_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgPatrolDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgPatrolDocDto pgPatrolDocDto = new PgPatrolDocDto(); + pgPatrolDocDto.setId(objects.get(i)[0].toString()); + pgPatrolDocDto.setPatroler(objects.get(i)[1].toString()); + pgPatrolDocDto.setList_name(objects.get(i)[2].toString()); + pgPatrolDocDto.setDescribe(objects.get(i)[3].toString()); + pgPatrolDocDto.setBeginTime(objects.get(i)[4].toString()); + pgPatrolDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgPatrolDocDto.setFile_name(objects.get(i)[6].toString()); + pgPatrolDocDtoList.add(pgPatrolDocDto); + } + return pgPatrolDocDtoList; } public List getPgPatrolByPatrolerOrTime(String patroler,String startTime,String endTime) { @@ -110,4 +133,25 @@ return pgPatrolMaintainInfoDtoList; } + public PgPatrol getPgPatrolByPT(String name, String beginTime) { + try { + Criteria criteria = createCriteria(PgPatrol.class); + criteria.add(Restrictions.eq("patroler", name)); + criteria.add(Restrictions.eq("beginTime",DateUtils.sdf4.parse(beginTime))); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolList = criteria.list(); + + if (pgPatrolList == null) + return null; + else + return pgPatrolList.get(0); + + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + + } diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java index 103ba36..260b3ec 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java @@ -54,6 +54,7 @@ @Path("addConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map addConstructDoc( + @FormParam("list_name") String list_name, @FormParam("doc_name") String doc_name, @FormParam("construct_doc") String fileBuffer, @FormParam("cs_name") String cs_name)throws Exception { @@ -67,10 +68,11 @@ if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) pgCsDocument.setConstruct_doc(""); else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); + pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, list_name)); } PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); + pgCsDocument.setList_name(list_name); pgCsDocument.setDoc_name(doc_name); pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); @@ -96,6 +98,7 @@ @Path("editConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map editReservePlan(@FormParam("id") String id, + @FormParam("list_name") String List_name, @FormParam("doc_name") String doc_name, @FormParam("cs_name") String cs_name) throws Exception { diff --git a/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java b/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java index 2639058..1f2c0f2 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java @@ -1,9 +1,15 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; +import com.casic.PgInterface.patroler.manager.PgMaintainDocManager; import com.casic.PgInterface.patroler.manager.PgMaintainManager; +import com.casic.PgInterface.patroler.manager.PgPatrolDocManager; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -26,12 +32,19 @@ public class PgMaintainRs { PgMaintainManager pgMaintainManager=new PgMaintainManager(); + PgMaintainDocManager pgMaintainDocManager = new PgMaintainDocManager(); @Resource public void setPgMaintainManager(PgMaintainManager pgMaintainManager) { this.pgMaintainManager = pgMaintainManager; } + @Resource + public void setPgMaintainDocManager(PgMaintainDocManager pgMaintainDocManager) + { + this.pgMaintainDocManager = pgMaintainDocManager; + } + /** * 新增维护记录 */ @@ -41,7 +54,10 @@ public Map addMaintain(@FormParam("mainTainer") String mainTainer, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("maintain_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -49,6 +65,7 @@ String result = ""; String msg = ""; PgMaintain pgMaintain=new PgMaintain(); + PgMaintainDoc pgMaintainDoc = new PgMaintainDoc(); try { pgMaintain.setMainTainer(mainTainer); @@ -58,6 +75,20 @@ pgMaintain.setActive(1); pgMaintainManager.save(pgMaintain); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgMaintainDoc.setFile_path(""); + else { + pgMaintainDoc.setFile_path(pgMaintainDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + pgMaintainDoc.setList_name(list_name); + pgMaintainDoc.setFile_name(file_name); + pgMaintainDoc.setPgmaintain_id(pgMaintain); + pgMaintainDoc.setActive(1); + + pgMaintainDocManager.save(pgMaintainDoc); + result = "true"; msg = "保存成功"; } catch (Exception e) { @@ -80,7 +111,10 @@ @FormParam("mainTainer") String mainTainer, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("maintain_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map resultMap = new HashMap(); @@ -95,6 +129,25 @@ pgMaintain.setDescribe(describe); pgMaintainManager.save(pgMaintain); + + List pgMaintainDocList = pgMaintainDocManager.getMaintainDocById(pgMaintain); + PgMaintainDoc pgMaintainDocument = new PgMaintainDoc(); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgMaintainDocument.setFile_path(""); + else { + pgMaintainDocument.setFile_path(pgMaintainDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + for (PgMaintainDoc pgMaintainDoc : pgMaintainDocList) + { + pgMaintainDoc.setList_name(list_name); + pgMaintainDoc.setFile_name(file_name); + pgMaintainDoc.setActive(1); + pgMaintainDocManager.save(pgMaintainDoc); + } + pgMaintainDocManager.save(pgMaintainDocument); + msg = "维护记录编辑成功"; result = "true"; } catch (Exception e) { @@ -119,11 +172,11 @@ Map resultMap = new HashMap(); String result = ""; String msg = ""; - List pgMaintainDtoList=new ArrayList(); + List pgMaintainDocDtoList=new ArrayList(); try{ - pgMaintainDtoList=pgMaintainManager.getPgMaintainList(); - if(pgMaintainDtoList==null||pgMaintainDtoList.size()==0) + pgMaintainDocDtoList=pgMaintainManager.getPgMaintainList(); + if(pgMaintainDocDtoList==null||pgMaintainDocDtoList.size()==0) msg="不存在维护记录"; else msg="维护获取成功"; @@ -135,7 +188,7 @@ result="false"; } resultMap.put("msg",msg); - resultMap.put("result",pgMaintainDtoList); + resultMap.put("result",pgMaintainDocDtoList); return resultMap; } @@ -171,6 +224,30 @@ return resultMap; } + + @POST + @Path("fileDownload") + @Produces(MediaType.APPLICATION_JSON) + public Map downloadFile(@FormParam("id") String id)throws Exception + { + Map resultMap = new HashMap(); + + String msg = ""; + ResponseEntity path = null; + try{ + PgMaintainDoc pgMaintainDoc = pgMaintainDocManager.get(Long.valueOf(id)); + path = pgMaintainDocManager.downloadFile(pgMaintainDoc); + msg = "下载成功"; + + }catch (Exception e){ + e.printStackTrace(); + msg = "下载失败"; + } + + resultMap.put("result", path); + resultMap.put("msg", msg); + return resultMap; + } /** * 根据时间统计巡检次数 */ diff --git a/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java b/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java index 8ac807a..765e56d 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java @@ -1,9 +1,14 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import com.casic.PgInterface.patroler.dto.PgPatrolDocDto; import com.casic.PgInterface.patroler.dto.PgPatrolDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; +import com.casic.PgInterface.patroler.manager.PgPatrolDocManager; import com.casic.PgInterface.patroler.manager.PgPatrolManager; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -26,12 +31,16 @@ public class PgPatrolRs { PgPatrolManager pgPatrolManager = new PgPatrolManager(); + PgPatrolDocManager pgPatrolDocManager = new PgPatrolDocManager(); @Resource public void setPgPatrolManager(PgPatrolManager pgPatrolManager) { this.pgPatrolManager = pgPatrolManager; } + @Resource + public void setPgPatrolDocManager(PgPatrolDocManager pgPatrolDocManager) {this.pgPatrolDocManager = pgPatrolDocManager;} + /** * 新增巡检记录 */ @@ -41,7 +50,10 @@ public Map addPatrol(@FormParam("patroler") String patroler, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("patrol_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -49,8 +61,10 @@ String result = ""; String msg = ""; PgPatrol pgPatrol = new PgPatrol(); + PgPatrolDoc pgPatrolDoc = new PgPatrolDoc(); try { + pgPatrol.setPatroler(patroler); pgPatrol.setBeginTime(sdf.parse(beginTime)); pgPatrol.setTimeLimt(timeLimt); @@ -58,6 +72,19 @@ pgPatrol.setActive(1); pgPatrolManager.save(pgPatrol); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgPatrolDoc.setFile_path(""); + else { + pgPatrolDoc.setFile_path(pgPatrolDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + pgPatrol = pgPatrolManager.getPgPatrolByPT(patroler, beginTime); + pgPatrolDoc.setList_name(list_name); + pgPatrolDoc.setFile_name(file_name); + pgPatrolDoc.setPgpatrol_id(pgPatrol); + pgPatrolDoc.setActive(1); + pgPatrolDocManager.save(pgPatrolDoc); + result = "true"; msg = "保存成功"; } catch (Exception e) { @@ -80,7 +107,10 @@ @FormParam("patroler") String patroler, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("patrol_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map resultMap = new HashMap(); @@ -95,6 +125,22 @@ pgPatrol.setDescribe(describe); pgPatrolManager.save(pgPatrol); + + List pgPatrolDocList = pgPatrolDocManager.getPgPatrolDocById(pgPatrol); + PgPatrolDoc pgPatrolDocument = new PgPatrolDoc(); + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgPatrolDocument.setFile_path(""); + else { + pgPatrolDocument.setFile_path(pgPatrolDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + for (PgPatrolDoc pgPatrolDoc : pgPatrolDocList) { + pgPatrolDoc.setList_name(list_name); + pgPatrolDoc.setFile_name(file_name); + pgPatrolDoc.setActive(1); + pgPatrolDocManager.save(pgPatrolDoc); + } + pgPatrolDocManager.save(pgPatrolDocument); msg = "巡检记录编辑成功"; result = "true"; } catch (Exception e) { @@ -119,11 +165,11 @@ Map resultMap = new HashMap(); String result = ""; String msg = ""; - List pgPatrolDtoList=new ArrayList(); + List pgPatrolDocDtoList = new ArrayList(); try{ - pgPatrolDtoList=pgPatrolManager.getPgPatrolList(); - if(pgPatrolDtoList==null||pgPatrolDtoList.size()==0) + pgPatrolDocDtoList = pgPatrolManager.getPgPatrolList(); + if(pgPatrolDocDtoList==null||pgPatrolDocDtoList.size()==0) msg="不存在巡检记录"; else msg="巡检记录获取成功"; @@ -135,7 +181,7 @@ result="false"; } resultMap.put("msg",msg); - resultMap.put("result",pgPatrolDtoList); + resultMap.put("result",pgPatrolDocDtoList); return resultMap; } @@ -199,5 +245,27 @@ return resultMap; } + @POST + @Path("fileDownload") + @Produces(MediaType.APPLICATION_JSON) + public Map downloadFile(@FormParam("id") String id)throws Exception + { + Map resultMap = new HashMap(); + String msg = ""; + ResponseEntity path = null; + try{ + PgPatrolDoc pgPatrolDoc = pgPatrolDocManager.get(Long.valueOf(id)); + path = pgPatrolDocManager.downloadFile(pgPatrolDoc); + msg = "下载成功"; + + }catch (Exception e){ + e.printStackTrace(); + msg = "下载失败"; + } + + resultMap.put("result", path); + resultMap.put("msg", msg); + return resultMap; + } } \ No newline at end of file diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java new file mode 100644 index 0000000..2f101b0 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java @@ -0,0 +1,99 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by Administrator on 2018/4/24. + */ +public class PgPatrolDocDto implements Serializable{ + + private String id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private String patroler; + private String beginTime; + private String timeLimt; + private String describe; + private String active; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + public String getPatroler() { + return patroler; + } + + public void setPatroler(String patroler) { + this.patroler = patroler; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public PgPatrolDocDto() + { + + } + + public PgPatrolDocDto(PgPatrolDoc pgPatrolDoc) + { + this.setId(String.valueOf(pgPatrolDoc.getPgpatrol_id())); + this.setPatroler(pgPatrolDoc.getPgpatrol_id().getPatroler()); + this.setBeginTime(DateUtils.sdf4.format(pgPatrolDoc.getPgpatrol_id().getBeginTime())); + this.setList_name(pgPatrolDoc.getList_name()); + this.setFile_name(pgPatrolDoc.getFile_name()); + + this.setActive(String.valueOf(pgPatrolDoc.getActive())); + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java new file mode 100644 index 0000000..1968a8c --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/27. + */ + +@Service +public class PgMaintainDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + public ResponseEntity downloadFile(PgMaintainDoc pgMaintainDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgMaintainDoc.getList_name() + "\\" + pgMaintainDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getMaintainDocById(PgMaintain pgMaintain) + { + Criteria criteria = createCriteria(PgMaintainDoc.class); + criteria.add(Restrictions.eq("pgmaintain_id", pgMaintain)); + criteria.add(Restrictions.eq("active", 1)); + + List pgMaintainDocList = criteria.list(); + + if (pgMaintainDocList == null) + return null; + else + return pgMaintainDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index 321ebfa..cca3d1c 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -21,8 +23,8 @@ @Service public class PgMaintainManager extends HibernateEntityDao{ - public List getPgMaintainList() { - Criteria criteria=createCriteria(PgMaintain.class); + public List getPgMaintainList() { + /*Criteria criteria=createCriteria(PgMaintain.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +34,26 @@ { pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); } - return pgMaintainDtoList; + return pgMaintainDtoList;*/ + String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgMaintainDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); + pgMaintainDocDto.setId(objects.get(i)[0].toString()); + pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); + pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); + pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); + pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); + pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDtoList.add(pgMaintainDocDto); + } + return pgMaintainDocDtoList; } public List getPgMaintainByMaintainerOrTime(String mainTainer,String startTime,String endTime) { diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java new file mode 100644 index 0000000..c5ed9b5 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java @@ -0,0 +1,95 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/24. + */ + +@Service +public class PgPatrolDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + + /*下载文件*/ + public ResponseEntity downloadFile(PgPatrolDoc pgPatrolDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgPatrolDoc.getList_name() + "\\" + pgPatrolDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getPgPatrolDocById(PgPatrol pgPatrol) + { + Criteria criteria = createCriteria(PgPatrolDoc.class); + criteria.add(Restrictions.eq("pgpatrol_id", pgPatrol)); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolDocList = criteria.list(); + + if (pgPatrolDocList == null) + return null; + else + return pgPatrolDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java index e587023..6e96782 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import com.casic.PgInterface.patroler.dto.PgPatrolDocDto; import com.casic.PgInterface.patroler.dto.PgPatrolDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -11,6 +13,7 @@ import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; +import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; @@ -21,8 +24,8 @@ @Service public class PgPatrolManager extends HibernateEntityDao { - public List getPgPatrolList() { - Criteria criteria=createCriteria(PgPatrol.class); + public List getPgPatrolList() { + /*Criteria criteria=createCriteria(PgPatrol.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +35,27 @@ { pgPatrolDtoList.add(new PgPatrolDto(pgPatrol)); } - return pgPatrolDtoList; + return pgPatrolDtoList;*/ + + String sql = "SELECT B.ID,B.PATROLER,A.LIST_NAME,B.DESCRIBE,B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_PATROLDOC A LEFT JOIN PG_PATROL B ON B.ID = A.PGPATROL_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgPatrolDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgPatrolDocDto pgPatrolDocDto = new PgPatrolDocDto(); + pgPatrolDocDto.setId(objects.get(i)[0].toString()); + pgPatrolDocDto.setPatroler(objects.get(i)[1].toString()); + pgPatrolDocDto.setList_name(objects.get(i)[2].toString()); + pgPatrolDocDto.setDescribe(objects.get(i)[3].toString()); + pgPatrolDocDto.setBeginTime(objects.get(i)[4].toString()); + pgPatrolDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgPatrolDocDto.setFile_name(objects.get(i)[6].toString()); + pgPatrolDocDtoList.add(pgPatrolDocDto); + } + return pgPatrolDocDtoList; } public List getPgPatrolByPatrolerOrTime(String patroler,String startTime,String endTime) { @@ -110,4 +133,25 @@ return pgPatrolMaintainInfoDtoList; } + public PgPatrol getPgPatrolByPT(String name, String beginTime) { + try { + Criteria criteria = createCriteria(PgPatrol.class); + criteria.add(Restrictions.eq("patroler", name)); + criteria.add(Restrictions.eq("beginTime",DateUtils.sdf4.parse(beginTime))); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolList = criteria.list(); + + if (pgPatrolList == null) + return null; + else + return pgPatrolList.get(0); + + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + + } diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java index 103ba36..260b3ec 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java @@ -54,6 +54,7 @@ @Path("addConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map addConstructDoc( + @FormParam("list_name") String list_name, @FormParam("doc_name") String doc_name, @FormParam("construct_doc") String fileBuffer, @FormParam("cs_name") String cs_name)throws Exception { @@ -67,10 +68,11 @@ if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) pgCsDocument.setConstruct_doc(""); else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); + pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, list_name)); } PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); + pgCsDocument.setList_name(list_name); pgCsDocument.setDoc_name(doc_name); pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); @@ -96,6 +98,7 @@ @Path("editConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map editReservePlan(@FormParam("id") String id, + @FormParam("list_name") String List_name, @FormParam("doc_name") String doc_name, @FormParam("cs_name") String cs_name) throws Exception { diff --git a/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java b/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java index 2639058..1f2c0f2 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java @@ -1,9 +1,15 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; +import com.casic.PgInterface.patroler.manager.PgMaintainDocManager; import com.casic.PgInterface.patroler.manager.PgMaintainManager; +import com.casic.PgInterface.patroler.manager.PgPatrolDocManager; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -26,12 +32,19 @@ public class PgMaintainRs { PgMaintainManager pgMaintainManager=new PgMaintainManager(); + PgMaintainDocManager pgMaintainDocManager = new PgMaintainDocManager(); @Resource public void setPgMaintainManager(PgMaintainManager pgMaintainManager) { this.pgMaintainManager = pgMaintainManager; } + @Resource + public void setPgMaintainDocManager(PgMaintainDocManager pgMaintainDocManager) + { + this.pgMaintainDocManager = pgMaintainDocManager; + } + /** * 新增维护记录 */ @@ -41,7 +54,10 @@ public Map addMaintain(@FormParam("mainTainer") String mainTainer, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("maintain_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -49,6 +65,7 @@ String result = ""; String msg = ""; PgMaintain pgMaintain=new PgMaintain(); + PgMaintainDoc pgMaintainDoc = new PgMaintainDoc(); try { pgMaintain.setMainTainer(mainTainer); @@ -58,6 +75,20 @@ pgMaintain.setActive(1); pgMaintainManager.save(pgMaintain); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgMaintainDoc.setFile_path(""); + else { + pgMaintainDoc.setFile_path(pgMaintainDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + pgMaintainDoc.setList_name(list_name); + pgMaintainDoc.setFile_name(file_name); + pgMaintainDoc.setPgmaintain_id(pgMaintain); + pgMaintainDoc.setActive(1); + + pgMaintainDocManager.save(pgMaintainDoc); + result = "true"; msg = "保存成功"; } catch (Exception e) { @@ -80,7 +111,10 @@ @FormParam("mainTainer") String mainTainer, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("maintain_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map resultMap = new HashMap(); @@ -95,6 +129,25 @@ pgMaintain.setDescribe(describe); pgMaintainManager.save(pgMaintain); + + List pgMaintainDocList = pgMaintainDocManager.getMaintainDocById(pgMaintain); + PgMaintainDoc pgMaintainDocument = new PgMaintainDoc(); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgMaintainDocument.setFile_path(""); + else { + pgMaintainDocument.setFile_path(pgMaintainDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + for (PgMaintainDoc pgMaintainDoc : pgMaintainDocList) + { + pgMaintainDoc.setList_name(list_name); + pgMaintainDoc.setFile_name(file_name); + pgMaintainDoc.setActive(1); + pgMaintainDocManager.save(pgMaintainDoc); + } + pgMaintainDocManager.save(pgMaintainDocument); + msg = "维护记录编辑成功"; result = "true"; } catch (Exception e) { @@ -119,11 +172,11 @@ Map resultMap = new HashMap(); String result = ""; String msg = ""; - List pgMaintainDtoList=new ArrayList(); + List pgMaintainDocDtoList=new ArrayList(); try{ - pgMaintainDtoList=pgMaintainManager.getPgMaintainList(); - if(pgMaintainDtoList==null||pgMaintainDtoList.size()==0) + pgMaintainDocDtoList=pgMaintainManager.getPgMaintainList(); + if(pgMaintainDocDtoList==null||pgMaintainDocDtoList.size()==0) msg="不存在维护记录"; else msg="维护获取成功"; @@ -135,7 +188,7 @@ result="false"; } resultMap.put("msg",msg); - resultMap.put("result",pgMaintainDtoList); + resultMap.put("result",pgMaintainDocDtoList); return resultMap; } @@ -171,6 +224,30 @@ return resultMap; } + + @POST + @Path("fileDownload") + @Produces(MediaType.APPLICATION_JSON) + public Map downloadFile(@FormParam("id") String id)throws Exception + { + Map resultMap = new HashMap(); + + String msg = ""; + ResponseEntity path = null; + try{ + PgMaintainDoc pgMaintainDoc = pgMaintainDocManager.get(Long.valueOf(id)); + path = pgMaintainDocManager.downloadFile(pgMaintainDoc); + msg = "下载成功"; + + }catch (Exception e){ + e.printStackTrace(); + msg = "下载失败"; + } + + resultMap.put("result", path); + resultMap.put("msg", msg); + return resultMap; + } /** * 根据时间统计巡检次数 */ diff --git a/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java b/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java index 8ac807a..765e56d 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java @@ -1,9 +1,14 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import com.casic.PgInterface.patroler.dto.PgPatrolDocDto; import com.casic.PgInterface.patroler.dto.PgPatrolDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; +import com.casic.PgInterface.patroler.manager.PgPatrolDocManager; import com.casic.PgInterface.patroler.manager.PgPatrolManager; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -26,12 +31,16 @@ public class PgPatrolRs { PgPatrolManager pgPatrolManager = new PgPatrolManager(); + PgPatrolDocManager pgPatrolDocManager = new PgPatrolDocManager(); @Resource public void setPgPatrolManager(PgPatrolManager pgPatrolManager) { this.pgPatrolManager = pgPatrolManager; } + @Resource + public void setPgPatrolDocManager(PgPatrolDocManager pgPatrolDocManager) {this.pgPatrolDocManager = pgPatrolDocManager;} + /** * 新增巡检记录 */ @@ -41,7 +50,10 @@ public Map addPatrol(@FormParam("patroler") String patroler, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("patrol_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -49,8 +61,10 @@ String result = ""; String msg = ""; PgPatrol pgPatrol = new PgPatrol(); + PgPatrolDoc pgPatrolDoc = new PgPatrolDoc(); try { + pgPatrol.setPatroler(patroler); pgPatrol.setBeginTime(sdf.parse(beginTime)); pgPatrol.setTimeLimt(timeLimt); @@ -58,6 +72,19 @@ pgPatrol.setActive(1); pgPatrolManager.save(pgPatrol); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgPatrolDoc.setFile_path(""); + else { + pgPatrolDoc.setFile_path(pgPatrolDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + pgPatrol = pgPatrolManager.getPgPatrolByPT(patroler, beginTime); + pgPatrolDoc.setList_name(list_name); + pgPatrolDoc.setFile_name(file_name); + pgPatrolDoc.setPgpatrol_id(pgPatrol); + pgPatrolDoc.setActive(1); + pgPatrolDocManager.save(pgPatrolDoc); + result = "true"; msg = "保存成功"; } catch (Exception e) { @@ -80,7 +107,10 @@ @FormParam("patroler") String patroler, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("patrol_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map resultMap = new HashMap(); @@ -95,6 +125,22 @@ pgPatrol.setDescribe(describe); pgPatrolManager.save(pgPatrol); + + List pgPatrolDocList = pgPatrolDocManager.getPgPatrolDocById(pgPatrol); + PgPatrolDoc pgPatrolDocument = new PgPatrolDoc(); + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgPatrolDocument.setFile_path(""); + else { + pgPatrolDocument.setFile_path(pgPatrolDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + for (PgPatrolDoc pgPatrolDoc : pgPatrolDocList) { + pgPatrolDoc.setList_name(list_name); + pgPatrolDoc.setFile_name(file_name); + pgPatrolDoc.setActive(1); + pgPatrolDocManager.save(pgPatrolDoc); + } + pgPatrolDocManager.save(pgPatrolDocument); msg = "巡检记录编辑成功"; result = "true"; } catch (Exception e) { @@ -119,11 +165,11 @@ Map resultMap = new HashMap(); String result = ""; String msg = ""; - List pgPatrolDtoList=new ArrayList(); + List pgPatrolDocDtoList = new ArrayList(); try{ - pgPatrolDtoList=pgPatrolManager.getPgPatrolList(); - if(pgPatrolDtoList==null||pgPatrolDtoList.size()==0) + pgPatrolDocDtoList = pgPatrolManager.getPgPatrolList(); + if(pgPatrolDocDtoList==null||pgPatrolDocDtoList.size()==0) msg="不存在巡检记录"; else msg="巡检记录获取成功"; @@ -135,7 +181,7 @@ result="false"; } resultMap.put("msg",msg); - resultMap.put("result",pgPatrolDtoList); + resultMap.put("result",pgPatrolDocDtoList); return resultMap; } @@ -199,5 +245,27 @@ return resultMap; } + @POST + @Path("fileDownload") + @Produces(MediaType.APPLICATION_JSON) + public Map downloadFile(@FormParam("id") String id)throws Exception + { + Map resultMap = new HashMap(); + String msg = ""; + ResponseEntity path = null; + try{ + PgPatrolDoc pgPatrolDoc = pgPatrolDocManager.get(Long.valueOf(id)); + path = pgPatrolDocManager.downloadFile(pgPatrolDoc); + msg = "下载成功"; + + }catch (Exception e){ + e.printStackTrace(); + msg = "下载失败"; + } + + resultMap.put("result", path); + resultMap.put("msg", msg); + return resultMap; + } } \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index aa56bd8..5f21060 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -16,7 +16,7 @@ # db # ============================================================================ db.default.driverClassName=oracle.jdbc.driver.OracleDriver -db.default.url=jdbc:oracle:thin:@127.0.0.1:1521:szgh +db.default.url=jdbc:oracle:thin:@192.168.0.122:1521:szgh db.default.username=PG db.default.password=PG diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java new file mode 100644 index 0000000..2f101b0 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java @@ -0,0 +1,99 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by Administrator on 2018/4/24. + */ +public class PgPatrolDocDto implements Serializable{ + + private String id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private String patroler; + private String beginTime; + private String timeLimt; + private String describe; + private String active; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + public String getPatroler() { + return patroler; + } + + public void setPatroler(String patroler) { + this.patroler = patroler; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public PgPatrolDocDto() + { + + } + + public PgPatrolDocDto(PgPatrolDoc pgPatrolDoc) + { + this.setId(String.valueOf(pgPatrolDoc.getPgpatrol_id())); + this.setPatroler(pgPatrolDoc.getPgpatrol_id().getPatroler()); + this.setBeginTime(DateUtils.sdf4.format(pgPatrolDoc.getPgpatrol_id().getBeginTime())); + this.setList_name(pgPatrolDoc.getList_name()); + this.setFile_name(pgPatrolDoc.getFile_name()); + + this.setActive(String.valueOf(pgPatrolDoc.getActive())); + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java new file mode 100644 index 0000000..1968a8c --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/27. + */ + +@Service +public class PgMaintainDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + public ResponseEntity downloadFile(PgMaintainDoc pgMaintainDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgMaintainDoc.getList_name() + "\\" + pgMaintainDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getMaintainDocById(PgMaintain pgMaintain) + { + Criteria criteria = createCriteria(PgMaintainDoc.class); + criteria.add(Restrictions.eq("pgmaintain_id", pgMaintain)); + criteria.add(Restrictions.eq("active", 1)); + + List pgMaintainDocList = criteria.list(); + + if (pgMaintainDocList == null) + return null; + else + return pgMaintainDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index 321ebfa..cca3d1c 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -21,8 +23,8 @@ @Service public class PgMaintainManager extends HibernateEntityDao{ - public List getPgMaintainList() { - Criteria criteria=createCriteria(PgMaintain.class); + public List getPgMaintainList() { + /*Criteria criteria=createCriteria(PgMaintain.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +34,26 @@ { pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); } - return pgMaintainDtoList; + return pgMaintainDtoList;*/ + String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgMaintainDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); + pgMaintainDocDto.setId(objects.get(i)[0].toString()); + pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); + pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); + pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); + pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); + pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDtoList.add(pgMaintainDocDto); + } + return pgMaintainDocDtoList; } public List getPgMaintainByMaintainerOrTime(String mainTainer,String startTime,String endTime) { diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java new file mode 100644 index 0000000..c5ed9b5 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java @@ -0,0 +1,95 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/24. + */ + +@Service +public class PgPatrolDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + + /*下载文件*/ + public ResponseEntity downloadFile(PgPatrolDoc pgPatrolDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgPatrolDoc.getList_name() + "\\" + pgPatrolDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getPgPatrolDocById(PgPatrol pgPatrol) + { + Criteria criteria = createCriteria(PgPatrolDoc.class); + criteria.add(Restrictions.eq("pgpatrol_id", pgPatrol)); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolDocList = criteria.list(); + + if (pgPatrolDocList == null) + return null; + else + return pgPatrolDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java index e587023..6e96782 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import com.casic.PgInterface.patroler.dto.PgPatrolDocDto; import com.casic.PgInterface.patroler.dto.PgPatrolDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -11,6 +13,7 @@ import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; +import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; @@ -21,8 +24,8 @@ @Service public class PgPatrolManager extends HibernateEntityDao { - public List getPgPatrolList() { - Criteria criteria=createCriteria(PgPatrol.class); + public List getPgPatrolList() { + /*Criteria criteria=createCriteria(PgPatrol.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +35,27 @@ { pgPatrolDtoList.add(new PgPatrolDto(pgPatrol)); } - return pgPatrolDtoList; + return pgPatrolDtoList;*/ + + String sql = "SELECT B.ID,B.PATROLER,A.LIST_NAME,B.DESCRIBE,B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_PATROLDOC A LEFT JOIN PG_PATROL B ON B.ID = A.PGPATROL_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgPatrolDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgPatrolDocDto pgPatrolDocDto = new PgPatrolDocDto(); + pgPatrolDocDto.setId(objects.get(i)[0].toString()); + pgPatrolDocDto.setPatroler(objects.get(i)[1].toString()); + pgPatrolDocDto.setList_name(objects.get(i)[2].toString()); + pgPatrolDocDto.setDescribe(objects.get(i)[3].toString()); + pgPatrolDocDto.setBeginTime(objects.get(i)[4].toString()); + pgPatrolDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgPatrolDocDto.setFile_name(objects.get(i)[6].toString()); + pgPatrolDocDtoList.add(pgPatrolDocDto); + } + return pgPatrolDocDtoList; } public List getPgPatrolByPatrolerOrTime(String patroler,String startTime,String endTime) { @@ -110,4 +133,25 @@ return pgPatrolMaintainInfoDtoList; } + public PgPatrol getPgPatrolByPT(String name, String beginTime) { + try { + Criteria criteria = createCriteria(PgPatrol.class); + criteria.add(Restrictions.eq("patroler", name)); + criteria.add(Restrictions.eq("beginTime",DateUtils.sdf4.parse(beginTime))); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolList = criteria.list(); + + if (pgPatrolList == null) + return null; + else + return pgPatrolList.get(0); + + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + + } diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java index 103ba36..260b3ec 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java @@ -54,6 +54,7 @@ @Path("addConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map addConstructDoc( + @FormParam("list_name") String list_name, @FormParam("doc_name") String doc_name, @FormParam("construct_doc") String fileBuffer, @FormParam("cs_name") String cs_name)throws Exception { @@ -67,10 +68,11 @@ if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) pgCsDocument.setConstruct_doc(""); else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); + pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, list_name)); } PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); + pgCsDocument.setList_name(list_name); pgCsDocument.setDoc_name(doc_name); pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); @@ -96,6 +98,7 @@ @Path("editConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map editReservePlan(@FormParam("id") String id, + @FormParam("list_name") String List_name, @FormParam("doc_name") String doc_name, @FormParam("cs_name") String cs_name) throws Exception { diff --git a/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java b/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java index 2639058..1f2c0f2 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java @@ -1,9 +1,15 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; +import com.casic.PgInterface.patroler.manager.PgMaintainDocManager; import com.casic.PgInterface.patroler.manager.PgMaintainManager; +import com.casic.PgInterface.patroler.manager.PgPatrolDocManager; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -26,12 +32,19 @@ public class PgMaintainRs { PgMaintainManager pgMaintainManager=new PgMaintainManager(); + PgMaintainDocManager pgMaintainDocManager = new PgMaintainDocManager(); @Resource public void setPgMaintainManager(PgMaintainManager pgMaintainManager) { this.pgMaintainManager = pgMaintainManager; } + @Resource + public void setPgMaintainDocManager(PgMaintainDocManager pgMaintainDocManager) + { + this.pgMaintainDocManager = pgMaintainDocManager; + } + /** * 新增维护记录 */ @@ -41,7 +54,10 @@ public Map addMaintain(@FormParam("mainTainer") String mainTainer, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("maintain_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -49,6 +65,7 @@ String result = ""; String msg = ""; PgMaintain pgMaintain=new PgMaintain(); + PgMaintainDoc pgMaintainDoc = new PgMaintainDoc(); try { pgMaintain.setMainTainer(mainTainer); @@ -58,6 +75,20 @@ pgMaintain.setActive(1); pgMaintainManager.save(pgMaintain); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgMaintainDoc.setFile_path(""); + else { + pgMaintainDoc.setFile_path(pgMaintainDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + pgMaintainDoc.setList_name(list_name); + pgMaintainDoc.setFile_name(file_name); + pgMaintainDoc.setPgmaintain_id(pgMaintain); + pgMaintainDoc.setActive(1); + + pgMaintainDocManager.save(pgMaintainDoc); + result = "true"; msg = "保存成功"; } catch (Exception e) { @@ -80,7 +111,10 @@ @FormParam("mainTainer") String mainTainer, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("maintain_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map resultMap = new HashMap(); @@ -95,6 +129,25 @@ pgMaintain.setDescribe(describe); pgMaintainManager.save(pgMaintain); + + List pgMaintainDocList = pgMaintainDocManager.getMaintainDocById(pgMaintain); + PgMaintainDoc pgMaintainDocument = new PgMaintainDoc(); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgMaintainDocument.setFile_path(""); + else { + pgMaintainDocument.setFile_path(pgMaintainDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + for (PgMaintainDoc pgMaintainDoc : pgMaintainDocList) + { + pgMaintainDoc.setList_name(list_name); + pgMaintainDoc.setFile_name(file_name); + pgMaintainDoc.setActive(1); + pgMaintainDocManager.save(pgMaintainDoc); + } + pgMaintainDocManager.save(pgMaintainDocument); + msg = "维护记录编辑成功"; result = "true"; } catch (Exception e) { @@ -119,11 +172,11 @@ Map resultMap = new HashMap(); String result = ""; String msg = ""; - List pgMaintainDtoList=new ArrayList(); + List pgMaintainDocDtoList=new ArrayList(); try{ - pgMaintainDtoList=pgMaintainManager.getPgMaintainList(); - if(pgMaintainDtoList==null||pgMaintainDtoList.size()==0) + pgMaintainDocDtoList=pgMaintainManager.getPgMaintainList(); + if(pgMaintainDocDtoList==null||pgMaintainDocDtoList.size()==0) msg="不存在维护记录"; else msg="维护获取成功"; @@ -135,7 +188,7 @@ result="false"; } resultMap.put("msg",msg); - resultMap.put("result",pgMaintainDtoList); + resultMap.put("result",pgMaintainDocDtoList); return resultMap; } @@ -171,6 +224,30 @@ return resultMap; } + + @POST + @Path("fileDownload") + @Produces(MediaType.APPLICATION_JSON) + public Map downloadFile(@FormParam("id") String id)throws Exception + { + Map resultMap = new HashMap(); + + String msg = ""; + ResponseEntity path = null; + try{ + PgMaintainDoc pgMaintainDoc = pgMaintainDocManager.get(Long.valueOf(id)); + path = pgMaintainDocManager.downloadFile(pgMaintainDoc); + msg = "下载成功"; + + }catch (Exception e){ + e.printStackTrace(); + msg = "下载失败"; + } + + resultMap.put("result", path); + resultMap.put("msg", msg); + return resultMap; + } /** * 根据时间统计巡检次数 */ diff --git a/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java b/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java index 8ac807a..765e56d 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java @@ -1,9 +1,14 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import com.casic.PgInterface.patroler.dto.PgPatrolDocDto; import com.casic.PgInterface.patroler.dto.PgPatrolDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; +import com.casic.PgInterface.patroler.manager.PgPatrolDocManager; import com.casic.PgInterface.patroler.manager.PgPatrolManager; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -26,12 +31,16 @@ public class PgPatrolRs { PgPatrolManager pgPatrolManager = new PgPatrolManager(); + PgPatrolDocManager pgPatrolDocManager = new PgPatrolDocManager(); @Resource public void setPgPatrolManager(PgPatrolManager pgPatrolManager) { this.pgPatrolManager = pgPatrolManager; } + @Resource + public void setPgPatrolDocManager(PgPatrolDocManager pgPatrolDocManager) {this.pgPatrolDocManager = pgPatrolDocManager;} + /** * 新增巡检记录 */ @@ -41,7 +50,10 @@ public Map addPatrol(@FormParam("patroler") String patroler, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("patrol_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -49,8 +61,10 @@ String result = ""; String msg = ""; PgPatrol pgPatrol = new PgPatrol(); + PgPatrolDoc pgPatrolDoc = new PgPatrolDoc(); try { + pgPatrol.setPatroler(patroler); pgPatrol.setBeginTime(sdf.parse(beginTime)); pgPatrol.setTimeLimt(timeLimt); @@ -58,6 +72,19 @@ pgPatrol.setActive(1); pgPatrolManager.save(pgPatrol); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgPatrolDoc.setFile_path(""); + else { + pgPatrolDoc.setFile_path(pgPatrolDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + pgPatrol = pgPatrolManager.getPgPatrolByPT(patroler, beginTime); + pgPatrolDoc.setList_name(list_name); + pgPatrolDoc.setFile_name(file_name); + pgPatrolDoc.setPgpatrol_id(pgPatrol); + pgPatrolDoc.setActive(1); + pgPatrolDocManager.save(pgPatrolDoc); + result = "true"; msg = "保存成功"; } catch (Exception e) { @@ -80,7 +107,10 @@ @FormParam("patroler") String patroler, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("patrol_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map resultMap = new HashMap(); @@ -95,6 +125,22 @@ pgPatrol.setDescribe(describe); pgPatrolManager.save(pgPatrol); + + List pgPatrolDocList = pgPatrolDocManager.getPgPatrolDocById(pgPatrol); + PgPatrolDoc pgPatrolDocument = new PgPatrolDoc(); + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgPatrolDocument.setFile_path(""); + else { + pgPatrolDocument.setFile_path(pgPatrolDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + for (PgPatrolDoc pgPatrolDoc : pgPatrolDocList) { + pgPatrolDoc.setList_name(list_name); + pgPatrolDoc.setFile_name(file_name); + pgPatrolDoc.setActive(1); + pgPatrolDocManager.save(pgPatrolDoc); + } + pgPatrolDocManager.save(pgPatrolDocument); msg = "巡检记录编辑成功"; result = "true"; } catch (Exception e) { @@ -119,11 +165,11 @@ Map resultMap = new HashMap(); String result = ""; String msg = ""; - List pgPatrolDtoList=new ArrayList(); + List pgPatrolDocDtoList = new ArrayList(); try{ - pgPatrolDtoList=pgPatrolManager.getPgPatrolList(); - if(pgPatrolDtoList==null||pgPatrolDtoList.size()==0) + pgPatrolDocDtoList = pgPatrolManager.getPgPatrolList(); + if(pgPatrolDocDtoList==null||pgPatrolDocDtoList.size()==0) msg="不存在巡检记录"; else msg="巡检记录获取成功"; @@ -135,7 +181,7 @@ result="false"; } resultMap.put("msg",msg); - resultMap.put("result",pgPatrolDtoList); + resultMap.put("result",pgPatrolDocDtoList); return resultMap; } @@ -199,5 +245,27 @@ return resultMap; } + @POST + @Path("fileDownload") + @Produces(MediaType.APPLICATION_JSON) + public Map downloadFile(@FormParam("id") String id)throws Exception + { + Map resultMap = new HashMap(); + String msg = ""; + ResponseEntity path = null; + try{ + PgPatrolDoc pgPatrolDoc = pgPatrolDocManager.get(Long.valueOf(id)); + path = pgPatrolDocManager.downloadFile(pgPatrolDoc); + msg = "下载成功"; + + }catch (Exception e){ + e.printStackTrace(); + msg = "下载失败"; + } + + resultMap.put("result", path); + resultMap.put("msg", msg); + return resultMap; + } } \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index aa56bd8..5f21060 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -16,7 +16,7 @@ # db # ============================================================================ db.default.driverClassName=oracle.jdbc.driver.OracleDriver -db.default.url=jdbc:oracle:thin:@127.0.0.1:1521:szgh +db.default.url=jdbc:oracle:thin:@192.168.0.122:1521:szgh db.default.username=PG db.default.password=PG diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index 8086802..cf86447 100644 --- "a/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ diff --git a/.idea/artifacts/PgInterface.xml b/.idea/artifacts/PgInterface.xml index 7a84550..cb0167f 100644 --- a/.idea/artifacts/PgInterface.xml +++ b/.idea/artifacts/PgInterface.xml @@ -1,6 +1,6 @@ - $PROJECT_DIR$/../out/PgInterface/artifacts/PgInterface + D:/out/PgInterface/artifacts/PgInterface diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml new file mode 100644 index 0000000..280beb9 --- /dev/null +++ b/.idea/codeStyleSettings.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index 85d63f2..6563f4c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,6 +4,24 @@ + + - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1191417..236b037 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,17 +4,17 @@ - + + - - - - - - - - - + + + + + + + + @@ -39,7 +39,81 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,28 +131,10 @@ @@ -168,9 +242,10 @@ - @@ -200,6 +275,7 @@ + @@ -257,6 +333,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -274,7 +602,6 @@ - @@ -284,7 +611,7 @@ - + @@ -292,7 +619,7 @@ - + @@ -559,8 +886,9 @@ - @@ -893,80 +1230,44 @@ - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + - + - @@ -1020,318 +1329,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1339,9 +1340,6 @@ - - - @@ -1349,16 +1347,6 @@ - - - - - - - - - - @@ -1366,7 +1354,6 @@ - @@ -1374,9 +1361,6 @@ - - - @@ -1384,7 +1368,6 @@ - @@ -1392,7 +1375,6 @@ - @@ -1400,27 +1382,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java index a1f5342..14c7457 100644 --- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java +++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java @@ -13,10 +13,11 @@ @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{ +public class PgCsDocument implements Serializable { private static final long serialVersionUID = 1L; private long id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String construct_doc;//施工文档相对路径 private PgConstruction pgConstructionId;//项目 @@ -24,19 +25,40 @@ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_CSDOCUMENT_ID") - public long getId(){ return id; } + public long getId() { + return id; + } - public void setId(long id){ this.id = id; } + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } @Column(name = "DOC_NAME") - public String getDoc_name(){ return doc_name; } + public String getDoc_name() { + return doc_name; + } - public void setDoc_name(String doc_name){ this.doc_name = doc_name; } + public void setDoc_name(String doc_name) { + this.doc_name = doc_name; + } @Column(name = "CONSTRUCT_DOC") - public String getConstruct_doc(){ return construct_doc; } + public String getConstruct_doc() { + return construct_doc; + } - public void setConstruct_doc(String construct_doc){ this.construct_doc = construct_doc; } + public void setConstruct_doc(String construct_doc) { + this.construct_doc = construct_doc; + } @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) @NotFound(action = NotFoundAction.IGNORE) @@ -50,7 +72,12 @@ } @Column(name = "ACTIVE") - public int getActive(){ return active; } + public int getActive() { + return active; + } - public void setActive(int active){ this.active = active; } + public void setActive(int active) { + this.active = active; + } + } diff --git a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java index e9886fb..867388a 100644 --- a/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java +++ b/src/main/java/com/casic/PgInterface/construction/dto/PgCsDocumentDto.java @@ -11,6 +11,7 @@ public class PgCsDocumentDto implements Serializable{ private String id; + private String list_name;//表单名称 private String doc_name;//文档名称 private String cs_name;//项目名称 private String cs_type;//工程类别 @@ -26,6 +27,14 @@ this.id = id; } + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + public String getDoc_name(){ return doc_name; } public void setDoc_name(String doc_name){ this.doc_name = doc_name; } @@ -67,6 +76,7 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); this.setId(String.valueOf(pgCsDocument.getId())); + this.setList_name(pgCsDocument.getList_name()); this.setDoc_name(pgCsDocument.getDoc_name()); this.setCs_name(pgCsDocument.getPgConstructionId().getCs_name()); this.setCs_type(pgCsDocument.getPgConstructionId().getCs_type()); diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java new file mode 100644 index 0000000..3416572 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgMaintainDoc.java @@ -0,0 +1,82 @@ +package com.casic.PgInterface.patroler.domain; + + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +@Entity +@Table(name = "PG_MAINTAINDOC") +@SequenceGenerator(name = "SEQ_PG_MAINTAINDOC_ID", sequenceName = "SEQ_PG_MAINTAINDOC_ID", allocationSize = 1, initialValue = 1) +public class PgMaintainDoc implements Serializable { + + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgMaintain pgmaintain_id;//维护表id + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_MAINTAINDOC_ID" ) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + @Column(name = "FILE_PATH") + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + @Column(name = "FILE_NAME") + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGMAINTAIN_ID") + public PgMaintain getPgmaintain_id() { + return pgmaintain_id; + } + + public void setPgmaintain_id(PgMaintain pgmaintain_id) { + this.pgmaintain_id = pgmaintain_id; + } + + @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/patroler/domain/PgPatrol.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java index 27fbf99..7f7180b 100644 --- a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrol.java @@ -1,5 +1,8 @@ package com.casic.PgInterface.patroler.domain; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + import javax.persistence.*; import java.io.Serializable; import java.util.Date; @@ -17,6 +20,7 @@ private Date beginTime; private String timeLimt; private String describe; + private int active; @Id @@ -65,6 +69,7 @@ this.describe = describe; } + @Column(name = "ACTIVE") public int getActive() { return active; diff --git a/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java new file mode 100644 index 0000000..67cd7ad --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/domain/PgPatrolDoc.java @@ -0,0 +1,65 @@ +package com.casic.PgInterface.patroler.domain; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import javax.persistence.*; +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/24. + */ +@Entity +@Table(name = "PG_PATROLDOC") +@SequenceGenerator(name = "SEQ_PG_PATROLDOC_ID", sequenceName = "SEQ_PG_PATROLDOC_ID",allocationSize=1,initialValue=1) +public class PgPatrolDoc implements Serializable { + private static final long serialVersionUID = 1L; + private long id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private PgPatrol pgpatrol_id;//工单 + private int active; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_PATROLDOC_ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "LIST_NAME") + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + @Column(name = "FILE_PATH") + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + @Column(name = "FILE_NAME") + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST}) + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "PGPATROL_ID") + public PgPatrol getPgpatrol_id(){ return pgpatrol_id; } + + public void setPgpatrol_id(PgPatrol pgpatrol_id){this.pgpatrol_id = pgpatrol_id;} + + @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/patroler/dto/PgMaintainDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java new file mode 100644 index 0000000..d82ab14 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgMaintainDocDto.java @@ -0,0 +1,85 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; + +import java.io.Serializable; + +/** + * Created by Administrator on 2018/4/26. + */ +public class PgMaintainDocDto implements Serializable { + + private String id; + private String mainTainer;//维护人员 + private String beginTime;//开始时间 + private String timeLimt;//计划工期 + private String describe;//任务描述 + private String list_name;//工单名称 + private String file_name;//文件名称 + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMainTainer() { + return mainTainer; + } + + public void setMainTainer(String mainTainer) { + this.mainTainer = mainTainer; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getList_name() { + return list_name; + } + + public void setList_name(String list_name) { + this.list_name = list_name; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public PgMaintainDocDto() + { + + } + + public PgMaintainDocDto(PgMaintainDoc pgMaintainDoc) + { + + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java new file mode 100644 index 0000000..2f101b0 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/dto/PgPatrolDocDto.java @@ -0,0 +1,99 @@ +package com.casic.PgInterface.patroler.dto; + +import com.casic.PgInterface.core.util.DateUtils; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; + +import java.io.Serializable; +import java.text.SimpleDateFormat; + +/** + * Created by Administrator on 2018/4/24. + */ +public class PgPatrolDocDto implements Serializable{ + + private String id; + private String list_name;//工单名称 + private String file_path;//文件路径 + private String file_name;//文件名称 + private String patroler; + private String beginTime; + private String timeLimt; + private String describe; + private String active; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getList_name(){ return list_name; } + + public void setList_name(String list_name) { this.list_name = list_name; } + + public String getFile_path(){ return file_path; } + + public void setFile_path(String file_path) { this.file_path = file_path; } + + public String getFile_name(){ return file_name; } + + public void setFile_name(String file_name){ this.file_name = file_name; } + + public String getPatroler() { + return patroler; + } + + public void setPatroler(String patroler) { + this.patroler = patroler; + } + + public String getBeginTime() { + return beginTime; + } + + public void setBeginTime(String beginTime) { + this.beginTime = beginTime; + } + + public String getTimeLimt() { + return timeLimt; + } + + public void setTimeLimt(String timeLimt) { + this.timeLimt = timeLimt; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public PgPatrolDocDto() + { + + } + + public PgPatrolDocDto(PgPatrolDoc pgPatrolDoc) + { + this.setId(String.valueOf(pgPatrolDoc.getPgpatrol_id())); + this.setPatroler(pgPatrolDoc.getPgpatrol_id().getPatroler()); + this.setBeginTime(DateUtils.sdf4.format(pgPatrolDoc.getPgpatrol_id().getBeginTime())); + this.setList_name(pgPatrolDoc.getList_name()); + this.setFile_name(pgPatrolDoc.getFile_name()); + + this.setActive(String.valueOf(pgPatrolDoc.getActive())); + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java new file mode 100644 index 0000000..1968a8c --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainDocManager.java @@ -0,0 +1,93 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/27. + */ + +@Service +public class PgMaintainDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + public ResponseEntity downloadFile(PgMaintainDoc pgMaintainDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgMaintainDoc.getList_name() + "\\" + pgMaintainDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getMaintainDocById(PgMaintain pgMaintain) + { + Criteria criteria = createCriteria(PgMaintainDoc.class); + criteria.add(Restrictions.eq("pgmaintain_id", pgMaintain)); + criteria.add(Restrictions.eq("active", 1)); + + List pgMaintainDocList = criteria.list(); + + if (pgMaintainDocList == null) + return null; + else + return pgMaintainDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java index 321ebfa..cca3d1c 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgMaintainManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -21,8 +23,8 @@ @Service public class PgMaintainManager extends HibernateEntityDao{ - public List getPgMaintainList() { - Criteria criteria=createCriteria(PgMaintain.class); + public List getPgMaintainList() { + /*Criteria criteria=createCriteria(PgMaintain.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +34,26 @@ { pgMaintainDtoList.add(new PgMaintainDto(pgMaintain)); } - return pgMaintainDtoList; + return pgMaintainDtoList;*/ + String sql = "SELECT B.ID,B.MAINTAINER,A.LIST_NAME, B.DESCRIBE, B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_MAINTAINDOC A LEFT JOIN PG_MAINTAIN B ON B.ID = A.PGMAINTAIN_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgMaintainDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgMaintainDocDto pgMaintainDocDto = new PgMaintainDocDto(); + pgMaintainDocDto.setId(objects.get(i)[0].toString()); + pgMaintainDocDto.setMainTainer(objects.get(i)[1].toString()); + pgMaintainDocDto.setList_name(objects.get(i)[2].toString()); + pgMaintainDocDto.setDescribe(objects.get(i)[3].toString()); + pgMaintainDocDto.setBeginTime(objects.get(i)[4].toString()); + pgMaintainDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgMaintainDocDto.setFile_name(objects.get(i)[6].toString()); + pgMaintainDocDtoList.add(pgMaintainDocDto); + } + return pgMaintainDocDtoList; } public List getPgMaintainByMaintainerOrTime(String mainTainer,String startTime,String endTime) { diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java new file mode 100644 index 0000000..c5ed9b5 --- /dev/null +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolDocManager.java @@ -0,0 +1,95 @@ +package com.casic.PgInterface.patroler.manager; + +import com.casic.PgInterface.core.hibernate.HibernateEntityDao; +import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.util.List; + +/** + * Created by Administrator on 2018/4/24. + */ + +@Service +public class PgPatrolDocManager extends HibernateEntityDao { + + /*上传文件*/ + public String saveFiles(String fileBuffer, String file_name, String list_name){ + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String strDirPath = request.getSession().getServletContext().getRealPath(""); + + FileOutputStream fos = null; + String image_toDir = strDirPath + "\\"+list_name;//存储路径 + String imageName = ""; + imageName += list_name+"/"+file_name; + byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码 + File destDir = new File(image_toDir); + if (!destDir.exists()) + destDir.mkdirs(); + File imageFile = new File(destDir, file_name); + fos = new FileOutputStream(imageFile);//保存文件 + fos.write(buffer); + fos.flush(); + fos.close(); + return imageName; + } + catch(Exception ex) + { + ex.printStackTrace(); + return ""; + } + } + + + /*下载文件*/ + public ResponseEntity downloadFile(PgPatrolDoc pgPatrolDoc) throws Exception { + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String path = request.getSession().getServletContext().getRealPath(""); + String filePath = path + "\\"+pgPatrolDoc.getList_name() + "\\" + pgPatrolDoc.getFile_name(); + File file = new File(filePath);//找到具体的文件 + byte[] body = null; + InputStream inputStream = new FileInputStream(file); + body = new byte[inputStream.available()]; + inputStream.read(body); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Disposition",file.getName()); + HttpStatus status = HttpStatus.OK; + ResponseEntity entity = new ResponseEntity(body, headers, status); + + return entity; + //inputStream.close(); + } + catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public List getPgPatrolDocById(PgPatrol pgPatrol) + { + Criteria criteria = createCriteria(PgPatrolDoc.class); + criteria.add(Restrictions.eq("pgpatrol_id", pgPatrol)); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolDocList = criteria.list(); + + if (pgPatrolDocList == null) + return null; + else + return pgPatrolDocList; + } +} diff --git a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java index e587023..6e96782 100644 --- a/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java +++ b/src/main/java/com/casic/PgInterface/patroler/manager/PgPatrolManager.java @@ -4,6 +4,8 @@ import com.casic.PgInterface.core.util.DateUtils; import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import com.casic.PgInterface.patroler.dto.PgPatrolDocDto; import com.casic.PgInterface.patroler.dto.PgPatrolDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; import org.hibernate.Criteria; @@ -11,6 +13,7 @@ import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Service; +import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; @@ -21,8 +24,8 @@ @Service public class PgPatrolManager extends HibernateEntityDao { - public List getPgPatrolList() { - Criteria criteria=createCriteria(PgPatrol.class); + public List getPgPatrolList() { + /*Criteria criteria=createCriteria(PgPatrol.class); criteria.add(Restrictions.eq("active", 1)); criteria.addOrder(Order.desc("id")); @@ -32,7 +35,27 @@ { pgPatrolDtoList.add(new PgPatrolDto(pgPatrol)); } - return pgPatrolDtoList; + return pgPatrolDtoList;*/ + + String sql = "SELECT B.ID,B.PATROLER,A.LIST_NAME,B.DESCRIBE,B.BEGINTIME,B.TIMELIMT,A.FILE_NAME " + + "FROM PG_PATROLDOC A LEFT JOIN PG_PATROL B ON B.ID = A.PGPATROL_ID " + + "WHERE B.ACTIVE = 1 ORDER BY B.ID ASC"; + + List pgPatrolDocDtoList = new ArrayList(); + List objects = this.getSession().createSQLQuery(sql).list(); + + for (int i = 0; i < objects.size() ; i++) { + PgPatrolDocDto pgPatrolDocDto = new PgPatrolDocDto(); + pgPatrolDocDto.setId(objects.get(i)[0].toString()); + pgPatrolDocDto.setPatroler(objects.get(i)[1].toString()); + pgPatrolDocDto.setList_name(objects.get(i)[2].toString()); + pgPatrolDocDto.setDescribe(objects.get(i)[3].toString()); + pgPatrolDocDto.setBeginTime(objects.get(i)[4].toString()); + pgPatrolDocDto.setTimeLimt(objects.get(i)[5].toString()); + pgPatrolDocDto.setFile_name(objects.get(i)[6].toString()); + pgPatrolDocDtoList.add(pgPatrolDocDto); + } + return pgPatrolDocDtoList; } public List getPgPatrolByPatrolerOrTime(String patroler,String startTime,String endTime) { @@ -110,4 +133,25 @@ return pgPatrolMaintainInfoDtoList; } + public PgPatrol getPgPatrolByPT(String name, String beginTime) { + try { + Criteria criteria = createCriteria(PgPatrol.class); + criteria.add(Restrictions.eq("patroler", name)); + criteria.add(Restrictions.eq("beginTime",DateUtils.sdf4.parse(beginTime))); + criteria.add(Restrictions.eq("active", 1)); + + List pgPatrolList = criteria.list(); + + if (pgPatrolList == null) + return null; + else + return pgPatrolList.get(0); + + } catch (ParseException e) { + e.printStackTrace(); + return null; + } + } + + } diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java index 103ba36..260b3ec 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java @@ -54,6 +54,7 @@ @Path("addConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map addConstructDoc( + @FormParam("list_name") String list_name, @FormParam("doc_name") String doc_name, @FormParam("construct_doc") String fileBuffer, @FormParam("cs_name") String cs_name)throws Exception { @@ -67,10 +68,11 @@ if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(doc_name)) pgCsDocument.setConstruct_doc(""); else { - pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, "Construct_Doc")); + pgCsDocument.setConstruct_doc(pgCsDocumentManager.saveFiles(fileBuffer, doc_name, list_name)); } PgConstruction pgConstruction=pgConstructionManager.getPgContructionByName(cs_name); + pgCsDocument.setList_name(list_name); pgCsDocument.setDoc_name(doc_name); pgCsDocument.setPgConstructionId(pgConstruction); pgCsDocument.setActive(1); @@ -96,6 +98,7 @@ @Path("editConstructDoc") @Produces(MediaType.APPLICATION_JSON) public Map editReservePlan(@FormParam("id") String id, + @FormParam("list_name") String List_name, @FormParam("doc_name") String doc_name, @FormParam("cs_name") String cs_name) throws Exception { diff --git a/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java b/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java index 2639058..1f2c0f2 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgMaintainRs.java @@ -1,9 +1,15 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgMaintain; +import com.casic.PgInterface.patroler.domain.PgMaintainDoc; +import com.casic.PgInterface.patroler.dto.PgMaintainDocDto; import com.casic.PgInterface.patroler.dto.PgMaintainDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; +import com.casic.PgInterface.patroler.manager.PgMaintainDocManager; import com.casic.PgInterface.patroler.manager.PgMaintainManager; +import com.casic.PgInterface.patroler.manager.PgPatrolDocManager; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -26,12 +32,19 @@ public class PgMaintainRs { PgMaintainManager pgMaintainManager=new PgMaintainManager(); + PgMaintainDocManager pgMaintainDocManager = new PgMaintainDocManager(); @Resource public void setPgMaintainManager(PgMaintainManager pgMaintainManager) { this.pgMaintainManager = pgMaintainManager; } + @Resource + public void setPgMaintainDocManager(PgMaintainDocManager pgMaintainDocManager) + { + this.pgMaintainDocManager = pgMaintainDocManager; + } + /** * 新增维护记录 */ @@ -41,7 +54,10 @@ public Map addMaintain(@FormParam("mainTainer") String mainTainer, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("maintain_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -49,6 +65,7 @@ String result = ""; String msg = ""; PgMaintain pgMaintain=new PgMaintain(); + PgMaintainDoc pgMaintainDoc = new PgMaintainDoc(); try { pgMaintain.setMainTainer(mainTainer); @@ -58,6 +75,20 @@ pgMaintain.setActive(1); pgMaintainManager.save(pgMaintain); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgMaintainDoc.setFile_path(""); + else { + pgMaintainDoc.setFile_path(pgMaintainDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + pgMaintainDoc.setList_name(list_name); + pgMaintainDoc.setFile_name(file_name); + pgMaintainDoc.setPgmaintain_id(pgMaintain); + pgMaintainDoc.setActive(1); + + pgMaintainDocManager.save(pgMaintainDoc); + result = "true"; msg = "保存成功"; } catch (Exception e) { @@ -80,7 +111,10 @@ @FormParam("mainTainer") String mainTainer, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("maintain_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map resultMap = new HashMap(); @@ -95,6 +129,25 @@ pgMaintain.setDescribe(describe); pgMaintainManager.save(pgMaintain); + + List pgMaintainDocList = pgMaintainDocManager.getMaintainDocById(pgMaintain); + PgMaintainDoc pgMaintainDocument = new PgMaintainDoc(); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgMaintainDocument.setFile_path(""); + else { + pgMaintainDocument.setFile_path(pgMaintainDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + for (PgMaintainDoc pgMaintainDoc : pgMaintainDocList) + { + pgMaintainDoc.setList_name(list_name); + pgMaintainDoc.setFile_name(file_name); + pgMaintainDoc.setActive(1); + pgMaintainDocManager.save(pgMaintainDoc); + } + pgMaintainDocManager.save(pgMaintainDocument); + msg = "维护记录编辑成功"; result = "true"; } catch (Exception e) { @@ -119,11 +172,11 @@ Map resultMap = new HashMap(); String result = ""; String msg = ""; - List pgMaintainDtoList=new ArrayList(); + List pgMaintainDocDtoList=new ArrayList(); try{ - pgMaintainDtoList=pgMaintainManager.getPgMaintainList(); - if(pgMaintainDtoList==null||pgMaintainDtoList.size()==0) + pgMaintainDocDtoList=pgMaintainManager.getPgMaintainList(); + if(pgMaintainDocDtoList==null||pgMaintainDocDtoList.size()==0) msg="不存在维护记录"; else msg="维护获取成功"; @@ -135,7 +188,7 @@ result="false"; } resultMap.put("msg",msg); - resultMap.put("result",pgMaintainDtoList); + resultMap.put("result",pgMaintainDocDtoList); return resultMap; } @@ -171,6 +224,30 @@ return resultMap; } + + @POST + @Path("fileDownload") + @Produces(MediaType.APPLICATION_JSON) + public Map downloadFile(@FormParam("id") String id)throws Exception + { + Map resultMap = new HashMap(); + + String msg = ""; + ResponseEntity path = null; + try{ + PgMaintainDoc pgMaintainDoc = pgMaintainDocManager.get(Long.valueOf(id)); + path = pgMaintainDocManager.downloadFile(pgMaintainDoc); + msg = "下载成功"; + + }catch (Exception e){ + e.printStackTrace(); + msg = "下载失败"; + } + + resultMap.put("result", path); + resultMap.put("msg", msg); + return resultMap; + } /** * 根据时间统计巡检次数 */ diff --git a/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java b/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java index 8ac807a..765e56d 100644 --- a/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java +++ b/src/main/java/com/casic/PgInterface/rs/PgPatrolRs.java @@ -1,9 +1,14 @@ package com.casic.PgInterface.rs; +import com.casic.PgInterface.core.util.StringUtils; import com.casic.PgInterface.patroler.domain.PgPatrol; +import com.casic.PgInterface.patroler.domain.PgPatrolDoc; +import com.casic.PgInterface.patroler.dto.PgPatrolDocDto; import com.casic.PgInterface.patroler.dto.PgPatrolDto; import com.casic.PgInterface.patroler.dto.PgPatrolMaintainInfoDto; +import com.casic.PgInterface.patroler.manager.PgPatrolDocManager; import com.casic.PgInterface.patroler.manager.PgPatrolManager; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -26,12 +31,16 @@ public class PgPatrolRs { PgPatrolManager pgPatrolManager = new PgPatrolManager(); + PgPatrolDocManager pgPatrolDocManager = new PgPatrolDocManager(); @Resource public void setPgPatrolManager(PgPatrolManager pgPatrolManager) { this.pgPatrolManager = pgPatrolManager; } + @Resource + public void setPgPatrolDocManager(PgPatrolDocManager pgPatrolDocManager) {this.pgPatrolDocManager = pgPatrolDocManager;} + /** * 新增巡检记录 */ @@ -41,7 +50,10 @@ public Map addPatrol(@FormParam("patroler") String patroler, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("patrol_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -49,8 +61,10 @@ String result = ""; String msg = ""; PgPatrol pgPatrol = new PgPatrol(); + PgPatrolDoc pgPatrolDoc = new PgPatrolDoc(); try { + pgPatrol.setPatroler(patroler); pgPatrol.setBeginTime(sdf.parse(beginTime)); pgPatrol.setTimeLimt(timeLimt); @@ -58,6 +72,19 @@ pgPatrol.setActive(1); pgPatrolManager.save(pgPatrol); + + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgPatrolDoc.setFile_path(""); + else { + pgPatrolDoc.setFile_path(pgPatrolDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + pgPatrol = pgPatrolManager.getPgPatrolByPT(patroler, beginTime); + pgPatrolDoc.setList_name(list_name); + pgPatrolDoc.setFile_name(file_name); + pgPatrolDoc.setPgpatrol_id(pgPatrol); + pgPatrolDoc.setActive(1); + pgPatrolDocManager.save(pgPatrolDoc); + result = "true"; msg = "保存成功"; } catch (Exception e) { @@ -80,7 +107,10 @@ @FormParam("patroler") String patroler, @FormParam("beginTime") String beginTime, @FormParam("timeLimt") String timeLimt, - @FormParam("describe") String describe) + @FormParam("describe") String describe, + @FormParam("list_name") String list_name, + @FormParam("file_name") String file_name, + @FormParam("patrol_doc") String fileBuffer) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map resultMap = new HashMap(); @@ -95,6 +125,22 @@ pgPatrol.setDescribe(describe); pgPatrolManager.save(pgPatrol); + + List pgPatrolDocList = pgPatrolDocManager.getPgPatrolDocById(pgPatrol); + PgPatrolDoc pgPatrolDocument = new PgPatrolDoc(); + if (StringUtils.isBlank(fileBuffer)||StringUtils.isBlank(file_name)) + pgPatrolDocument.setFile_path(""); + else { + pgPatrolDocument.setFile_path(pgPatrolDocManager.saveFiles(fileBuffer, file_name, list_name )); + } + + for (PgPatrolDoc pgPatrolDoc : pgPatrolDocList) { + pgPatrolDoc.setList_name(list_name); + pgPatrolDoc.setFile_name(file_name); + pgPatrolDoc.setActive(1); + pgPatrolDocManager.save(pgPatrolDoc); + } + pgPatrolDocManager.save(pgPatrolDocument); msg = "巡检记录编辑成功"; result = "true"; } catch (Exception e) { @@ -119,11 +165,11 @@ Map resultMap = new HashMap(); String result = ""; String msg = ""; - List pgPatrolDtoList=new ArrayList(); + List pgPatrolDocDtoList = new ArrayList(); try{ - pgPatrolDtoList=pgPatrolManager.getPgPatrolList(); - if(pgPatrolDtoList==null||pgPatrolDtoList.size()==0) + pgPatrolDocDtoList = pgPatrolManager.getPgPatrolList(); + if(pgPatrolDocDtoList==null||pgPatrolDocDtoList.size()==0) msg="不存在巡检记录"; else msg="巡检记录获取成功"; @@ -135,7 +181,7 @@ result="false"; } resultMap.put("msg",msg); - resultMap.put("result",pgPatrolDtoList); + resultMap.put("result",pgPatrolDocDtoList); return resultMap; } @@ -199,5 +245,27 @@ return resultMap; } + @POST + @Path("fileDownload") + @Produces(MediaType.APPLICATION_JSON) + public Map downloadFile(@FormParam("id") String id)throws Exception + { + Map resultMap = new HashMap(); + String msg = ""; + ResponseEntity path = null; + try{ + PgPatrolDoc pgPatrolDoc = pgPatrolDocManager.get(Long.valueOf(id)); + path = pgPatrolDocManager.downloadFile(pgPatrolDoc); + msg = "下载成功"; + + }catch (Exception e){ + e.printStackTrace(); + msg = "下载失败"; + } + + resultMap.put("result", path); + resultMap.put("msg", msg); + return resultMap; + } } \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index aa56bd8..5f21060 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -16,7 +16,7 @@ # db # ============================================================================ db.default.driverClassName=oracle.jdbc.driver.OracleDriver -db.default.url=jdbc:oracle:thin:@127.0.0.1:1521:szgh +db.default.url=jdbc:oracle:thin:@192.168.0.122:1521:szgh db.default.username=PG db.default.password=PG diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index 8086802..cf86447 100644 --- "a/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ diff --git "a/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" "b/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" index 2d2e8b9..483b6d1 100644 --- "a/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" +++ "b/\347\256\241\345\273\212\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx" Binary files differ