diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b0a73f0..d282e5f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,20 +3,13 @@
-
+
+
-
-
-
-
-
-
-
-
@@ -44,67 +37,24 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -128,7 +78,6 @@
@@ -272,7 +222,6 @@
-
@@ -287,6 +236,7 @@
+
@@ -405,7 +355,7 @@
-
+
@@ -438,34 +388,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1001,7 +925,8 @@
-
+
+
1510219102698
@@ -1135,13 +1060,17 @@
1523251402143
1523251402143
-
+
+ 1523267544495
+ 1523267544495
+
+
-
+
-
+
@@ -1175,19 +1104,20 @@
-
+
+
-
+
@@ -1196,23 +1126,22 @@
-
-
+
-
+
-
+
-
+
@@ -1232,8 +1161,8 @@
-
+
@@ -1252,8 +1181,6 @@
-
-
@@ -1277,11 +1204,13 @@
-
+
+
+
-
+
@@ -1289,20 +1218,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1385,7 +1300,6 @@
-
@@ -1428,7 +1342,6 @@
-
@@ -1439,13 +1352,6 @@
-
-
-
-
-
-
-
@@ -1502,13 +1408,6 @@
-
-
-
-
-
-
-
@@ -1520,7 +1419,6 @@
-
@@ -1543,9 +1441,6 @@
-
-
-
@@ -1553,7 +1448,6 @@
-
@@ -1561,17 +1455,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -1579,7 +1462,6 @@
-
@@ -1587,40 +1469,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1628,9 +1476,6 @@
-
-
-
@@ -1639,65 +1484,28 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1705,22 +1513,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b0a73f0..d282e5f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,20 +3,13 @@
-
+
+
-
-
-
-
-
-
-
-
@@ -44,67 +37,24 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -128,7 +78,6 @@
-
@@ -169,16 +118,17 @@
-
-
-
+
+
+
+
@@ -272,7 +222,6 @@
-
@@ -287,6 +236,7 @@
+
@@ -405,7 +355,7 @@
-
+
@@ -438,34 +388,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1001,7 +925,8 @@
-
+
+
1510219102698
@@ -1135,13 +1060,17 @@
1523251402143
1523251402143
-
+
+ 1523267544495
+ 1523267544495
+
+
-
+
-
+
@@ -1175,19 +1104,20 @@
-
+
+
-
+
@@ -1196,23 +1126,22 @@
-
-
+
-
+
-
+
-
+
@@ -1232,8 +1161,8 @@
-
+
@@ -1252,8 +1181,6 @@
-
-
@@ -1277,11 +1204,13 @@
-
+
+
+
-
+
@@ -1289,20 +1218,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1385,7 +1300,6 @@
-
@@ -1428,7 +1342,6 @@
-
@@ -1439,13 +1352,6 @@
-
-
-
-
-
-
-
@@ -1502,13 +1408,6 @@
-
-
-
-
-
-
-
@@ -1520,7 +1419,6 @@
-
@@ -1543,9 +1441,6 @@
-
-
-
@@ -1553,7 +1448,6 @@
-
@@ -1561,17 +1455,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -1579,7 +1462,6 @@
-
@@ -1587,40 +1469,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1628,9 +1476,6 @@
-
-
-
@@ -1639,65 +1484,28 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1705,22 +1513,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
index 658efa9..fad34cb 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
@@ -28,7 +28,7 @@
private String cs_phone;//联系方式
private String cs_type;//工程类别
private PgPartition pgPartitionId;//施工区域
- private List pgConstructionList;//施工文档
+ private List pgCsDocumentList;//施工文档
private int active;//状态位
@Id
@@ -89,14 +89,15 @@
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId")
- public List getPgConstructionList() {
- return pgConstructionList;
+ public List getPgCsDocumentList() {
+ return pgCsDocumentList;
}
- public void setPgConstructionList(List pgConstructionList) {
- this.pgConstructionList = pgConstructionList;
+ public void setPgCsDocumentList(List pgCsDocumentList) {
+ this.pgCsDocumentList = pgCsDocumentList;
}
+
@Column(name = "ACTIVE")
public int getActive(){ return active; }
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b0a73f0..d282e5f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,20 +3,13 @@
-
+
+
-
-
-
-
-
-
-
-
@@ -44,67 +37,24 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -128,7 +78,6 @@
-
@@ -169,16 +118,17 @@
-
-
-
+
+
+
+
@@ -272,7 +222,6 @@
-
@@ -287,6 +236,7 @@
+
@@ -405,7 +355,7 @@
-
+
@@ -438,34 +388,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1001,7 +925,8 @@
-
+
+
1510219102698
@@ -1135,13 +1060,17 @@
1523251402143
1523251402143
-
+
+ 1523267544495
+ 1523267544495
+
+
-
+
-
+
@@ -1175,19 +1104,20 @@
-
+
+
-
+
@@ -1196,23 +1126,22 @@
-
-
+
-
+
-
+
-
+
@@ -1232,8 +1161,8 @@
-
+
@@ -1252,8 +1181,6 @@
-
-
@@ -1277,11 +1204,13 @@
-
+
+
+
-
+
@@ -1289,20 +1218,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1385,7 +1300,6 @@
-
@@ -1428,7 +1342,6 @@
-
@@ -1439,13 +1352,6 @@
-
-
-
-
-
-
-
@@ -1502,13 +1408,6 @@
-
-
-
-
-
-
-
@@ -1520,7 +1419,6 @@
-
@@ -1543,9 +1441,6 @@
-
-
-
@@ -1553,7 +1448,6 @@
-
@@ -1561,17 +1455,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -1579,7 +1462,6 @@
-
@@ -1587,40 +1469,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1628,9 +1476,6 @@
-
-
-
@@ -1639,65 +1484,28 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1705,22 +1513,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
index 658efa9..fad34cb 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
@@ -28,7 +28,7 @@
private String cs_phone;//联系方式
private String cs_type;//工程类别
private PgPartition pgPartitionId;//施工区域
- private List pgConstructionList;//施工文档
+ private List pgCsDocumentList;//施工文档
private int active;//状态位
@Id
@@ -89,14 +89,15 @@
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId")
- public List getPgConstructionList() {
- return pgConstructionList;
+ public List getPgCsDocumentList() {
+ return pgCsDocumentList;
}
- public void setPgConstructionList(List pgConstructionList) {
- this.pgConstructionList = pgConstructionList;
+ public void setPgCsDocumentList(List pgCsDocumentList) {
+ this.pgCsDocumentList = pgCsDocumentList;
}
+
@Column(name = "ACTIVE")
public int getActive(){ return active; }
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
index 8bef2b4..a1f5342 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
@@ -18,7 +18,7 @@
private static final long serialVersionUID = 1L;
private long id;
private String doc_name;//文档名称
- private String construct_doc;//施工文档
+ private String construct_doc;//施工文档相对路径
private PgConstruction pgConstructionId;//项目
private int active;//状态位
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b0a73f0..d282e5f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,20 +3,13 @@
-
+
+
-
-
-
-
-
-
-
-
@@ -44,67 +37,24 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -128,7 +78,6 @@
-
@@ -169,16 +118,17 @@
-
-
-
+
+
+
+
@@ -272,7 +222,6 @@
-
@@ -287,6 +236,7 @@
+
@@ -405,7 +355,7 @@
-
+
@@ -438,34 +388,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1001,7 +925,8 @@
-
+
+
1510219102698
@@ -1135,13 +1060,17 @@
1523251402143
1523251402143
-
+
+ 1523267544495
+ 1523267544495
+
+
-
+
-
+
@@ -1175,19 +1104,20 @@
-
+
+
-
+
@@ -1196,23 +1126,22 @@
-
-
+
-
+
-
+
-
+
@@ -1232,8 +1161,8 @@
-
+
@@ -1252,8 +1181,6 @@
-
-
@@ -1277,11 +1204,13 @@
-
+
+
+
-
+
@@ -1289,20 +1218,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1385,7 +1300,6 @@
-
@@ -1428,7 +1342,6 @@
-
@@ -1439,13 +1352,6 @@
-
-
-
-
-
-
-
@@ -1502,13 +1408,6 @@
-
-
-
-
-
-
-
@@ -1520,7 +1419,6 @@
-
@@ -1543,9 +1441,6 @@
-
-
-
@@ -1553,7 +1448,6 @@
-
@@ -1561,17 +1455,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -1579,7 +1462,6 @@
-
@@ -1587,40 +1469,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1628,9 +1476,6 @@
-
-
-
@@ -1639,65 +1484,28 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1705,22 +1513,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
index 658efa9..fad34cb 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
@@ -28,7 +28,7 @@
private String cs_phone;//联系方式
private String cs_type;//工程类别
private PgPartition pgPartitionId;//施工区域
- private List pgConstructionList;//施工文档
+ private List pgCsDocumentList;//施工文档
private int active;//状态位
@Id
@@ -89,14 +89,15 @@
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId")
- public List getPgConstructionList() {
- return pgConstructionList;
+ public List getPgCsDocumentList() {
+ return pgCsDocumentList;
}
- public void setPgConstructionList(List pgConstructionList) {
- this.pgConstructionList = pgConstructionList;
+ public void setPgCsDocumentList(List pgCsDocumentList) {
+ this.pgCsDocumentList = pgCsDocumentList;
}
+
@Column(name = "ACTIVE")
public int getActive(){ return active; }
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
index 8bef2b4..a1f5342 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
@@ -18,7 +18,7 @@
private static final long serialVersionUID = 1L;
private long id;
private String doc_name;//文档名称
- private String construct_doc;//施工文档
+ private String construct_doc;//施工文档相对路径
private PgConstruction pgConstructionId;//项目
private int active;//状态位
diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
index 68d1c49..57246ce 100644
--- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
+++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
@@ -4,13 +4,9 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
-import com.sun.org.apache.xml.internal.security.utils.Base64;
-import org.hibernate.Criteria;
-import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Decoder;
import javax.annotation.Resource;
@@ -34,44 +30,6 @@
this.pgConstructionManager = pgConstructionManager;
}
- public String saveFiles(List files,String fileType){
- String [] fileNames = new String[files.size()];
- String [] fileBuffers = new String[files.size()];
- try {
- for (int i = 0; i < files.size(); i++) {
- fileNames[i] = files.get(i).getOriginalFilename();
- byte[] fis = files.get(i).getBytes();
- fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH));
- }
- HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
- String strDirPath = request.getSession().getServletContext().getRealPath("");
-
- FileOutputStream fos = null;
- String image_toDir = strDirPath + "\\"+fileType;//存储路径
- String imageName = "";
- for (int i = 0; i < fileBuffers.length; i++) {
- if (fileBuffers[i] != null && fileNames[i] != null) {
- imageName += fileType+"/"+fileNames[i] + ",";
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码
- File destDir = new File(image_toDir);
- if (!destDir.exists())
- destDir.mkdirs();
- File imageFile = new File(destDir, fileNames[i]);
- fos = new FileOutputStream(imageFile);//保存图片
- fos.write(buffer);
- fos.flush();
- fos.close();
- }
- }
- return imageName.substring(0,imageName.length()-1);
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- return "";
- }
- }
-
public String saveFiles(String fileBuffer, String fileName, String fileType){
try {
@@ -101,36 +59,20 @@
}
/*下载*/
- public String downFile(String fileName, String fileType){
+ public boolean downFile(PgCsDocument pgCsDocument){
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String strDirPath = request.getSession().getServletContext().getRealPath("");
- Criteria criteria = createCriteria(PgCsDocument.class);
- criteria.add(Restrictions.eq("active", 1));
- List pgCsDocumentList = criteria.list();
+ String image_toDir = strDirPath + "\\"+pgCsDocument.getConstruct_doc();//存储路径
- if (pgCsDocumentList == null || pgCsDocumentList.size() == 0)
- return null;
- FileOutputStream fos = null;
- String image_toDir = strDirPath + "\\" + fileType + "/" + fileName;
-
- File destDir = new File(image_toDir);
- if (!destDir.exists())
- destDir.mkdirs();
-
- byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir);
- fos.write(buffer);
- fos.flush();
- fos.close();
-
- return image_toDir;
+ return true;
}
catch (Exception e)
{
e.printStackTrace();
- return "";
+ return false;
}
}
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b0a73f0..d282e5f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,20 +3,13 @@
-
+
+
-
-
-
-
-
-
-
-
@@ -44,67 +37,24 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -128,7 +78,6 @@
-
@@ -169,16 +118,17 @@
-
-
-
+
+
+
+
@@ -272,7 +222,6 @@
-
@@ -287,6 +236,7 @@
+
@@ -405,7 +355,7 @@
-
+
@@ -438,34 +388,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1001,7 +925,8 @@
-
+
+
1510219102698
@@ -1135,13 +1060,17 @@
1523251402143
1523251402143
-
+
+ 1523267544495
+ 1523267544495
+
+
-
+
-
+
@@ -1175,19 +1104,20 @@
-
+
+
-
+
@@ -1196,23 +1126,22 @@
-
-
+
-
+
-
+
-
+
@@ -1232,8 +1161,8 @@
-
+
@@ -1252,8 +1181,6 @@
-
-
@@ -1277,11 +1204,13 @@
-
+
+
+
-
+
@@ -1289,20 +1218,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1385,7 +1300,6 @@
-
@@ -1428,7 +1342,6 @@
-
@@ -1439,13 +1352,6 @@
-
-
-
-
-
-
-
@@ -1502,13 +1408,6 @@
-
-
-
-
-
-
-
@@ -1520,7 +1419,6 @@
-
@@ -1543,9 +1441,6 @@
-
-
-
@@ -1553,7 +1448,6 @@
-
@@ -1561,17 +1455,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -1579,7 +1462,6 @@
-
@@ -1587,40 +1469,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1628,9 +1476,6 @@
-
-
-
@@ -1639,65 +1484,28 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1705,22 +1513,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
index 658efa9..fad34cb 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
@@ -28,7 +28,7 @@
private String cs_phone;//联系方式
private String cs_type;//工程类别
private PgPartition pgPartitionId;//施工区域
- private List pgConstructionList;//施工文档
+ private List pgCsDocumentList;//施工文档
private int active;//状态位
@Id
@@ -89,14 +89,15 @@
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId")
- public List getPgConstructionList() {
- return pgConstructionList;
+ public List getPgCsDocumentList() {
+ return pgCsDocumentList;
}
- public void setPgConstructionList(List pgConstructionList) {
- this.pgConstructionList = pgConstructionList;
+ public void setPgCsDocumentList(List pgCsDocumentList) {
+ this.pgCsDocumentList = pgCsDocumentList;
}
+
@Column(name = "ACTIVE")
public int getActive(){ return active; }
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
index 8bef2b4..a1f5342 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
@@ -18,7 +18,7 @@
private static final long serialVersionUID = 1L;
private long id;
private String doc_name;//文档名称
- private String construct_doc;//施工文档
+ private String construct_doc;//施工文档相对路径
private PgConstruction pgConstructionId;//项目
private int active;//状态位
diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
index 68d1c49..57246ce 100644
--- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
+++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
@@ -4,13 +4,9 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
-import com.sun.org.apache.xml.internal.security.utils.Base64;
-import org.hibernate.Criteria;
-import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Decoder;
import javax.annotation.Resource;
@@ -34,44 +30,6 @@
this.pgConstructionManager = pgConstructionManager;
}
- public String saveFiles(List files,String fileType){
- String [] fileNames = new String[files.size()];
- String [] fileBuffers = new String[files.size()];
- try {
- for (int i = 0; i < files.size(); i++) {
- fileNames[i] = files.get(i).getOriginalFilename();
- byte[] fis = files.get(i).getBytes();
- fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH));
- }
- HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
- String strDirPath = request.getSession().getServletContext().getRealPath("");
-
- FileOutputStream fos = null;
- String image_toDir = strDirPath + "\\"+fileType;//存储路径
- String imageName = "";
- for (int i = 0; i < fileBuffers.length; i++) {
- if (fileBuffers[i] != null && fileNames[i] != null) {
- imageName += fileType+"/"+fileNames[i] + ",";
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码
- File destDir = new File(image_toDir);
- if (!destDir.exists())
- destDir.mkdirs();
- File imageFile = new File(destDir, fileNames[i]);
- fos = new FileOutputStream(imageFile);//保存图片
- fos.write(buffer);
- fos.flush();
- fos.close();
- }
- }
- return imageName.substring(0,imageName.length()-1);
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- return "";
- }
- }
-
public String saveFiles(String fileBuffer, String fileName, String fileType){
try {
@@ -101,36 +59,20 @@
}
/*下载*/
- public String downFile(String fileName, String fileType){
+ public boolean downFile(PgCsDocument pgCsDocument){
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String strDirPath = request.getSession().getServletContext().getRealPath("");
- Criteria criteria = createCriteria(PgCsDocument.class);
- criteria.add(Restrictions.eq("active", 1));
- List pgCsDocumentList = criteria.list();
+ String image_toDir = strDirPath + "\\"+pgCsDocument.getConstruct_doc();//存储路径
- if (pgCsDocumentList == null || pgCsDocumentList.size() == 0)
- return null;
- FileOutputStream fos = null;
- String image_toDir = strDirPath + "\\" + fileType + "/" + fileName;
-
- File destDir = new File(image_toDir);
- if (!destDir.exists())
- destDir.mkdirs();
-
- byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir);
- fos.write(buffer);
- fos.flush();
- fos.close();
-
- return image_toDir;
+ return true;
}
catch (Exception e)
{
e.printStackTrace();
- return "";
+ return false;
}
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
index 89163aa..4a0be2f 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
@@ -70,18 +70,19 @@
Map resultMap = new HashMap();
String msg = "";
- PgDevice pgDevice = null;
+ PgDeviceDto pgDeviceDto = null;
try {
- PgAlarm pgAlarm = pgAlarmManager.get(id);
- pgDevice = pgDeviceManager.get(pgAlarm.getAlarmDevId());
+ PgAlarm pgAlarm = pgAlarmManager.get(Long.valueOf(id));
+ PgDevice pgDevice = pgAlarm.getAlarmDevId();
+ pgDeviceDto=new PgDeviceDto(pgDevice);
msg = "报警关联设备获取成功";
} catch (Exception e) {
e.printStackTrace();
msg = "获取关联设备失败";
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDevice);
+ resultMap.put("result", pgDeviceDto);
return resultMap;
}
@@ -98,8 +99,8 @@
List pgDeviceDtoList = new ArrayList();
try {
- PgAlarm pgAlarm = pgAlarmManager.get(id);
- PgDevice pgDevice = pgDeviceManager.get(pgAlarm.getAlarmDevId());
+ PgAlarm pgAlarm = pgAlarmManager.get(Long.valueOf(id));
+ PgDevice pgDevice = pgAlarm.getAlarmDevId();
pgDeviceDtoList = pgDeviceManager.getPgDeviceDtoListByPartition(pgDevice.getPartition());
msg = "关联设备获取成功";
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b0a73f0..d282e5f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,20 +3,13 @@
-
+
+
-
-
-
-
-
-
-
-
@@ -44,67 +37,24 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -128,7 +78,6 @@
-
@@ -169,16 +118,17 @@
-
-
-
+
+
+
+
@@ -272,7 +222,6 @@
-
@@ -287,6 +236,7 @@
+
@@ -405,7 +355,7 @@
-
+
@@ -438,34 +388,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1001,7 +925,8 @@
-
+
+
1510219102698
@@ -1135,13 +1060,17 @@
1523251402143
1523251402143
-
+
+ 1523267544495
+ 1523267544495
+
+
-
+
-
+
@@ -1175,19 +1104,20 @@
-
+
+
-
+
@@ -1196,23 +1126,22 @@
-
-
+
-
+
-
+
-
+
@@ -1232,8 +1161,8 @@
-
+
@@ -1252,8 +1181,6 @@
-
-
@@ -1277,11 +1204,13 @@
-
+
+
+
-
+
@@ -1289,20 +1218,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1385,7 +1300,6 @@
-
@@ -1428,7 +1342,6 @@
-
@@ -1439,13 +1352,6 @@
-
-
-
-
-
-
-
@@ -1502,13 +1408,6 @@
-
-
-
-
-
-
-
@@ -1520,7 +1419,6 @@
-
@@ -1543,9 +1441,6 @@
-
-
-
@@ -1553,7 +1448,6 @@
-
@@ -1561,17 +1455,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -1579,7 +1462,6 @@
-
@@ -1587,40 +1469,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1628,9 +1476,6 @@
-
-
-
@@ -1639,65 +1484,28 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1705,22 +1513,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
index 658efa9..fad34cb 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
@@ -28,7 +28,7 @@
private String cs_phone;//联系方式
private String cs_type;//工程类别
private PgPartition pgPartitionId;//施工区域
- private List pgConstructionList;//施工文档
+ private List pgCsDocumentList;//施工文档
private int active;//状态位
@Id
@@ -89,14 +89,15 @@
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId")
- public List getPgConstructionList() {
- return pgConstructionList;
+ public List getPgCsDocumentList() {
+ return pgCsDocumentList;
}
- public void setPgConstructionList(List pgConstructionList) {
- this.pgConstructionList = pgConstructionList;
+ public void setPgCsDocumentList(List pgCsDocumentList) {
+ this.pgCsDocumentList = pgCsDocumentList;
}
+
@Column(name = "ACTIVE")
public int getActive(){ return active; }
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
index 8bef2b4..a1f5342 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
@@ -18,7 +18,7 @@
private static final long serialVersionUID = 1L;
private long id;
private String doc_name;//文档名称
- private String construct_doc;//施工文档
+ private String construct_doc;//施工文档相对路径
private PgConstruction pgConstructionId;//项目
private int active;//状态位
diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
index 68d1c49..57246ce 100644
--- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
+++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
@@ -4,13 +4,9 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
-import com.sun.org.apache.xml.internal.security.utils.Base64;
-import org.hibernate.Criteria;
-import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Decoder;
import javax.annotation.Resource;
@@ -34,44 +30,6 @@
this.pgConstructionManager = pgConstructionManager;
}
- public String saveFiles(List files,String fileType){
- String [] fileNames = new String[files.size()];
- String [] fileBuffers = new String[files.size()];
- try {
- for (int i = 0; i < files.size(); i++) {
- fileNames[i] = files.get(i).getOriginalFilename();
- byte[] fis = files.get(i).getBytes();
- fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH));
- }
- HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
- String strDirPath = request.getSession().getServletContext().getRealPath("");
-
- FileOutputStream fos = null;
- String image_toDir = strDirPath + "\\"+fileType;//存储路径
- String imageName = "";
- for (int i = 0; i < fileBuffers.length; i++) {
- if (fileBuffers[i] != null && fileNames[i] != null) {
- imageName += fileType+"/"+fileNames[i] + ",";
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码
- File destDir = new File(image_toDir);
- if (!destDir.exists())
- destDir.mkdirs();
- File imageFile = new File(destDir, fileNames[i]);
- fos = new FileOutputStream(imageFile);//保存图片
- fos.write(buffer);
- fos.flush();
- fos.close();
- }
- }
- return imageName.substring(0,imageName.length()-1);
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- return "";
- }
- }
-
public String saveFiles(String fileBuffer, String fileName, String fileType){
try {
@@ -101,36 +59,20 @@
}
/*下载*/
- public String downFile(String fileName, String fileType){
+ public boolean downFile(PgCsDocument pgCsDocument){
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String strDirPath = request.getSession().getServletContext().getRealPath("");
- Criteria criteria = createCriteria(PgCsDocument.class);
- criteria.add(Restrictions.eq("active", 1));
- List pgCsDocumentList = criteria.list();
+ String image_toDir = strDirPath + "\\"+pgCsDocument.getConstruct_doc();//存储路径
- if (pgCsDocumentList == null || pgCsDocumentList.size() == 0)
- return null;
- FileOutputStream fos = null;
- String image_toDir = strDirPath + "\\" + fileType + "/" + fileName;
-
- File destDir = new File(image_toDir);
- if (!destDir.exists())
- destDir.mkdirs();
-
- byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir);
- fos.write(buffer);
- fos.flush();
- fos.close();
-
- return image_toDir;
+ return true;
}
catch (Exception e)
{
e.printStackTrace();
- return "";
+ return false;
}
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
index 89163aa..4a0be2f 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
@@ -70,18 +70,19 @@
Map resultMap = new HashMap();
String msg = "";
- PgDevice pgDevice = null;
+ PgDeviceDto pgDeviceDto = null;
try {
- PgAlarm pgAlarm = pgAlarmManager.get(id);
- pgDevice = pgDeviceManager.get(pgAlarm.getAlarmDevId());
+ PgAlarm pgAlarm = pgAlarmManager.get(Long.valueOf(id));
+ PgDevice pgDevice = pgAlarm.getAlarmDevId();
+ pgDeviceDto=new PgDeviceDto(pgDevice);
msg = "报警关联设备获取成功";
} catch (Exception e) {
e.printStackTrace();
msg = "获取关联设备失败";
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDevice);
+ resultMap.put("result", pgDeviceDto);
return resultMap;
}
@@ -98,8 +99,8 @@
List pgDeviceDtoList = new ArrayList();
try {
- PgAlarm pgAlarm = pgAlarmManager.get(id);
- PgDevice pgDevice = pgDeviceManager.get(pgAlarm.getAlarmDevId());
+ PgAlarm pgAlarm = pgAlarmManager.get(Long.valueOf(id));
+ PgDevice pgDevice = pgAlarm.getAlarmDevId();
pgDeviceDtoList = pgDeviceManager.getPgDeviceDtoListByPartition(pgDevice.getPartition());
msg = "关联设备获取成功";
diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
index 2e08ac5..dbffae0 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
@@ -210,27 +210,22 @@
@POST
@Path("downLoadConstructDoc")
@Produces(MediaType.APPLICATION_JSON)
- public Map downLoadConstructDoc(@FormParam("cs_type")String cs_type,
- @FormParam("doc_name") String doc_name)throws Exception {
+ public Map downLoadConstructDoc(@FormParam("id")String id)throws Exception {
Map resultMap = new HashMap();
- PgCsDocument pgCsDocument = new PgCsDocument();
String result = "";
String msg = "";
try {
- if (doc_name != null) {
- pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type));
-
+ PgCsDocument pgCsDocument =pgCsDocumentManager.get(Long.valueOf(id));
+ boolean bl=pgCsDocumentManager.downFile(pgCsDocument);
+ if(bl==true) {
result = "true";
msg = "下载成功";
- logger.info("下载成功");
}
- else
- {
+ else {
result = "false";
- msg = "文件名不能为空";
- logger.info("文件名不能为空");
+ msg = "下载失败";
}
} catch (Exception ex) {
@@ -239,7 +234,7 @@
ex.printStackTrace();
}
- resultMap.put("success", result);
+ resultMap.put("result", result);
resultMap.put("msg", msg);
return resultMap;
}
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b0a73f0..d282e5f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,20 +3,13 @@
-
+
+
-
-
-
-
-
-
-
-
@@ -44,67 +37,24 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -128,7 +78,6 @@
-
@@ -169,16 +118,17 @@
-
-
-
+
+
+
+
@@ -272,7 +222,6 @@
-
@@ -287,6 +236,7 @@
+
@@ -405,7 +355,7 @@
-
+
@@ -438,34 +388,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1001,7 +925,8 @@
-
+
+
1510219102698
@@ -1135,13 +1060,17 @@
1523251402143
1523251402143
-
+
+ 1523267544495
+ 1523267544495
+
+
-
+
-
+
@@ -1175,19 +1104,20 @@
-
+
+
-
+
@@ -1196,23 +1126,22 @@
-
-
+
-
+
-
+
-
+
@@ -1232,8 +1161,8 @@
-
+
@@ -1252,8 +1181,6 @@
-
-
@@ -1277,11 +1204,13 @@
-
+
+
+
-
+
@@ -1289,20 +1218,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1385,7 +1300,6 @@
-
@@ -1428,7 +1342,6 @@
-
@@ -1439,13 +1352,6 @@
-
-
-
-
-
-
-
@@ -1502,13 +1408,6 @@
-
-
-
-
-
-
-
@@ -1520,7 +1419,6 @@
-
@@ -1543,9 +1441,6 @@
-
-
-
@@ -1553,7 +1448,6 @@
-
@@ -1561,17 +1455,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -1579,7 +1462,6 @@
-
@@ -1587,40 +1469,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1628,9 +1476,6 @@
-
-
-
@@ -1639,65 +1484,28 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1705,22 +1513,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
index 658efa9..fad34cb 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
@@ -28,7 +28,7 @@
private String cs_phone;//联系方式
private String cs_type;//工程类别
private PgPartition pgPartitionId;//施工区域
- private List pgConstructionList;//施工文档
+ private List pgCsDocumentList;//施工文档
private int active;//状态位
@Id
@@ -89,14 +89,15 @@
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId")
- public List getPgConstructionList() {
- return pgConstructionList;
+ public List getPgCsDocumentList() {
+ return pgCsDocumentList;
}
- public void setPgConstructionList(List pgConstructionList) {
- this.pgConstructionList = pgConstructionList;
+ public void setPgCsDocumentList(List pgCsDocumentList) {
+ this.pgCsDocumentList = pgCsDocumentList;
}
+
@Column(name = "ACTIVE")
public int getActive(){ return active; }
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
index 8bef2b4..a1f5342 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
@@ -18,7 +18,7 @@
private static final long serialVersionUID = 1L;
private long id;
private String doc_name;//文档名称
- private String construct_doc;//施工文档
+ private String construct_doc;//施工文档相对路径
private PgConstruction pgConstructionId;//项目
private int active;//状态位
diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
index 68d1c49..57246ce 100644
--- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
+++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
@@ -4,13 +4,9 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
-import com.sun.org.apache.xml.internal.security.utils.Base64;
-import org.hibernate.Criteria;
-import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Decoder;
import javax.annotation.Resource;
@@ -34,44 +30,6 @@
this.pgConstructionManager = pgConstructionManager;
}
- public String saveFiles(List files,String fileType){
- String [] fileNames = new String[files.size()];
- String [] fileBuffers = new String[files.size()];
- try {
- for (int i = 0; i < files.size(); i++) {
- fileNames[i] = files.get(i).getOriginalFilename();
- byte[] fis = files.get(i).getBytes();
- fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH));
- }
- HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
- String strDirPath = request.getSession().getServletContext().getRealPath("");
-
- FileOutputStream fos = null;
- String image_toDir = strDirPath + "\\"+fileType;//存储路径
- String imageName = "";
- for (int i = 0; i < fileBuffers.length; i++) {
- if (fileBuffers[i] != null && fileNames[i] != null) {
- imageName += fileType+"/"+fileNames[i] + ",";
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码
- File destDir = new File(image_toDir);
- if (!destDir.exists())
- destDir.mkdirs();
- File imageFile = new File(destDir, fileNames[i]);
- fos = new FileOutputStream(imageFile);//保存图片
- fos.write(buffer);
- fos.flush();
- fos.close();
- }
- }
- return imageName.substring(0,imageName.length()-1);
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- return "";
- }
- }
-
public String saveFiles(String fileBuffer, String fileName, String fileType){
try {
@@ -101,36 +59,20 @@
}
/*下载*/
- public String downFile(String fileName, String fileType){
+ public boolean downFile(PgCsDocument pgCsDocument){
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String strDirPath = request.getSession().getServletContext().getRealPath("");
- Criteria criteria = createCriteria(PgCsDocument.class);
- criteria.add(Restrictions.eq("active", 1));
- List pgCsDocumentList = criteria.list();
+ String image_toDir = strDirPath + "\\"+pgCsDocument.getConstruct_doc();//存储路径
- if (pgCsDocumentList == null || pgCsDocumentList.size() == 0)
- return null;
- FileOutputStream fos = null;
- String image_toDir = strDirPath + "\\" + fileType + "/" + fileName;
-
- File destDir = new File(image_toDir);
- if (!destDir.exists())
- destDir.mkdirs();
-
- byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir);
- fos.write(buffer);
- fos.flush();
- fos.close();
-
- return image_toDir;
+ return true;
}
catch (Exception e)
{
e.printStackTrace();
- return "";
+ return false;
}
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
index 89163aa..4a0be2f 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
@@ -70,18 +70,19 @@
Map resultMap = new HashMap();
String msg = "";
- PgDevice pgDevice = null;
+ PgDeviceDto pgDeviceDto = null;
try {
- PgAlarm pgAlarm = pgAlarmManager.get(id);
- pgDevice = pgDeviceManager.get(pgAlarm.getAlarmDevId());
+ PgAlarm pgAlarm = pgAlarmManager.get(Long.valueOf(id));
+ PgDevice pgDevice = pgAlarm.getAlarmDevId();
+ pgDeviceDto=new PgDeviceDto(pgDevice);
msg = "报警关联设备获取成功";
} catch (Exception e) {
e.printStackTrace();
msg = "获取关联设备失败";
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDevice);
+ resultMap.put("result", pgDeviceDto);
return resultMap;
}
@@ -98,8 +99,8 @@
List pgDeviceDtoList = new ArrayList();
try {
- PgAlarm pgAlarm = pgAlarmManager.get(id);
- PgDevice pgDevice = pgDeviceManager.get(pgAlarm.getAlarmDevId());
+ PgAlarm pgAlarm = pgAlarmManager.get(Long.valueOf(id));
+ PgDevice pgDevice = pgAlarm.getAlarmDevId();
pgDeviceDtoList = pgDeviceManager.getPgDeviceDtoListByPartition(pgDevice.getPartition());
msg = "关联设备获取成功";
diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
index 2e08ac5..dbffae0 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
@@ -210,27 +210,22 @@
@POST
@Path("downLoadConstructDoc")
@Produces(MediaType.APPLICATION_JSON)
- public Map downLoadConstructDoc(@FormParam("cs_type")String cs_type,
- @FormParam("doc_name") String doc_name)throws Exception {
+ public Map downLoadConstructDoc(@FormParam("id")String id)throws Exception {
Map resultMap = new HashMap();
- PgCsDocument pgCsDocument = new PgCsDocument();
String result = "";
String msg = "";
try {
- if (doc_name != null) {
- pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type));
-
+ PgCsDocument pgCsDocument =pgCsDocumentManager.get(Long.valueOf(id));
+ boolean bl=pgCsDocumentManager.downFile(pgCsDocument);
+ if(bl==true) {
result = "true";
msg = "下载成功";
- logger.info("下载成功");
}
- else
- {
+ else {
result = "false";
- msg = "文件名不能为空";
- logger.info("文件名不能为空");
+ msg = "下载失败";
}
} catch (Exception ex) {
@@ -239,7 +234,7 @@
ex.printStackTrace();
}
- resultMap.put("success", result);
+ resultMap.put("result", result);
resultMap.put("msg", msg);
return resultMap;
}
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 b8dd4cd..471ee96 100644
--- "a/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx"
+++ "b/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\260\351\234\200\346\261\202.docx"
Binary files differ
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b0a73f0..d282e5f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,20 +3,13 @@
-
+
+
-
-
-
-
-
-
-
-
@@ -44,67 +37,24 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -128,7 +78,6 @@
-
@@ -169,16 +118,17 @@
-
-
-
+
+
+
+
@@ -272,7 +222,6 @@
-
@@ -287,6 +236,7 @@
+
@@ -405,7 +355,7 @@
-
+
@@ -438,34 +388,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1001,7 +925,8 @@
-
+
+
1510219102698
@@ -1135,13 +1060,17 @@
1523251402143
1523251402143
-
+
+ 1523267544495
+ 1523267544495
+
+
-
+
-
+
@@ -1175,19 +1104,20 @@
-
+
+
-
+
@@ -1196,23 +1126,22 @@
-
-
+
-
+
-
+
-
+
@@ -1232,8 +1161,8 @@
-
+
@@ -1252,8 +1181,6 @@
-
-
@@ -1277,11 +1204,13 @@
-
+
+
+
-
+
@@ -1289,20 +1218,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1385,7 +1300,6 @@
-
@@ -1428,7 +1342,6 @@
-
@@ -1439,13 +1352,6 @@
-
-
-
-
-
-
-
@@ -1502,13 +1408,6 @@
-
-
-
-
-
-
-
@@ -1520,7 +1419,6 @@
-
@@ -1543,9 +1441,6 @@
-
-
-
@@ -1553,7 +1448,6 @@
-
@@ -1561,17 +1455,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -1579,7 +1462,6 @@
-
@@ -1587,40 +1469,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1628,9 +1476,6 @@
-
-
-
@@ -1639,65 +1484,28 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1705,22 +1513,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
index 658efa9..fad34cb 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgConstruction.java
@@ -28,7 +28,7 @@
private String cs_phone;//联系方式
private String cs_type;//工程类别
private PgPartition pgPartitionId;//施工区域
- private List pgConstructionList;//施工文档
+ private List pgCsDocumentList;//施工文档
private int active;//状态位
@Id
@@ -89,14 +89,15 @@
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId")
- public List getPgConstructionList() {
- return pgConstructionList;
+ public List getPgCsDocumentList() {
+ return pgCsDocumentList;
}
- public void setPgConstructionList(List pgConstructionList) {
- this.pgConstructionList = pgConstructionList;
+ public void setPgCsDocumentList(List pgCsDocumentList) {
+ this.pgCsDocumentList = pgCsDocumentList;
}
+
@Column(name = "ACTIVE")
public int getActive(){ return active; }
diff --git a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
index 8bef2b4..a1f5342 100644
--- a/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
+++ b/src/main/java/com/casic/PgInterface/construction/domain/PgCsDocument.java
@@ -18,7 +18,7 @@
private static final long serialVersionUID = 1L;
private long id;
private String doc_name;//文档名称
- private String construct_doc;//施工文档
+ private String construct_doc;//施工文档相对路径
private PgConstruction pgConstructionId;//项目
private int active;//状态位
diff --git a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
index 68d1c49..57246ce 100644
--- a/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
+++ b/src/main/java/com/casic/PgInterface/construction/manager/PgCsDocumentManager.java
@@ -4,13 +4,9 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
-import com.sun.org.apache.xml.internal.security.utils.Base64;
-import org.hibernate.Criteria;
-import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Decoder;
import javax.annotation.Resource;
@@ -34,44 +30,6 @@
this.pgConstructionManager = pgConstructionManager;
}
- public String saveFiles(List files,String fileType){
- String [] fileNames = new String[files.size()];
- String [] fileBuffers = new String[files.size()];
- try {
- for (int i = 0; i < files.size(); i++) {
- fileNames[i] = files.get(i).getOriginalFilename();
- byte[] fis = files.get(i).getBytes();
- fileBuffers[i] = new String(Base64.encode(fis, Base64.BASE64DEFAULTLENGTH));
- }
- HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
- String strDirPath = request.getSession().getServletContext().getRealPath("");
-
- FileOutputStream fos = null;
- String image_toDir = strDirPath + "\\"+fileType;//存储路径
- String imageName = "";
- for (int i = 0; i < fileBuffers.length; i++) {
- if (fileBuffers[i] != null && fileNames[i] != null) {
- imageName += fileType+"/"+fileNames[i] + ",";
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffers[i]);//对android传过来的图片字符串进行解码
- File destDir = new File(image_toDir);
- if (!destDir.exists())
- destDir.mkdirs();
- File imageFile = new File(destDir, fileNames[i]);
- fos = new FileOutputStream(imageFile);//保存图片
- fos.write(buffer);
- fos.flush();
- fos.close();
- }
- }
- return imageName.substring(0,imageName.length()-1);
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- return "";
- }
- }
-
public String saveFiles(String fileBuffer, String fileName, String fileType){
try {
@@ -101,36 +59,20 @@
}
/*下载*/
- public String downFile(String fileName, String fileType){
+ public boolean downFile(PgCsDocument pgCsDocument){
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String strDirPath = request.getSession().getServletContext().getRealPath("");
- Criteria criteria = createCriteria(PgCsDocument.class);
- criteria.add(Restrictions.eq("active", 1));
- List pgCsDocumentList = criteria.list();
+ String image_toDir = strDirPath + "\\"+pgCsDocument.getConstruct_doc();//存储路径
- if (pgCsDocumentList == null || pgCsDocumentList.size() == 0)
- return null;
- FileOutputStream fos = null;
- String image_toDir = strDirPath + "\\" + fileType + "/" + fileName;
-
- File destDir = new File(image_toDir);
- if (!destDir.exists())
- destDir.mkdirs();
-
- byte[] buffer = new BASE64Decoder().decodeBuffer(image_toDir);
- fos.write(buffer);
- fos.flush();
- fos.close();
-
- return image_toDir;
+ return true;
}
catch (Exception e)
{
e.printStackTrace();
- return "";
+ return false;
}
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java b/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
index 89163aa..4a0be2f 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgAlarmLinkRs.java
@@ -70,18 +70,19 @@
Map resultMap = new HashMap();
String msg = "";
- PgDevice pgDevice = null;
+ PgDeviceDto pgDeviceDto = null;
try {
- PgAlarm pgAlarm = pgAlarmManager.get(id);
- pgDevice = pgDeviceManager.get(pgAlarm.getAlarmDevId());
+ PgAlarm pgAlarm = pgAlarmManager.get(Long.valueOf(id));
+ PgDevice pgDevice = pgAlarm.getAlarmDevId();
+ pgDeviceDto=new PgDeviceDto(pgDevice);
msg = "报警关联设备获取成功";
} catch (Exception e) {
e.printStackTrace();
msg = "获取关联设备失败";
}
resultMap.put("msg", msg);
- resultMap.put("result", pgDevice);
+ resultMap.put("result", pgDeviceDto);
return resultMap;
}
@@ -98,8 +99,8 @@
List pgDeviceDtoList = new ArrayList();
try {
- PgAlarm pgAlarm = pgAlarmManager.get(id);
- PgDevice pgDevice = pgDeviceManager.get(pgAlarm.getAlarmDevId());
+ PgAlarm pgAlarm = pgAlarmManager.get(Long.valueOf(id));
+ PgDevice pgDevice = pgAlarm.getAlarmDevId();
pgDeviceDtoList = pgDeviceManager.getPgDeviceDtoListByPartition(pgDevice.getPartition());
msg = "关联设备获取成功";
diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
index 2e08ac5..dbffae0 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
@@ -210,27 +210,22 @@
@POST
@Path("downLoadConstructDoc")
@Produces(MediaType.APPLICATION_JSON)
- public Map downLoadConstructDoc(@FormParam("cs_type")String cs_type,
- @FormParam("doc_name") String doc_name)throws Exception {
+ public Map downLoadConstructDoc(@FormParam("id")String id)throws Exception {
Map resultMap = new HashMap();
- PgCsDocument pgCsDocument = new PgCsDocument();
String result = "";
String msg = "";
try {
- if (doc_name != null) {
- pgCsDocument.setConstruct_doc(pgCsDocumentManager.downFile(doc_name, cs_type));
-
+ PgCsDocument pgCsDocument =pgCsDocumentManager.get(Long.valueOf(id));
+ boolean bl=pgCsDocumentManager.downFile(pgCsDocument);
+ if(bl==true) {
result = "true";
msg = "下载成功";
- logger.info("下载成功");
}
- else
- {
+ else {
result = "false";
- msg = "文件名不能为空";
- logger.info("文件名不能为空");
+ msg = "下载失败";
}
} catch (Exception ex) {
@@ -239,7 +234,7 @@
ex.printStackTrace();
}
- resultMap.put("success", result);
+ resultMap.put("result", result);
resultMap.put("msg", msg);
return resultMap;
}
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 b8dd4cd..471ee96 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 c7f1d4e..82d5c2f 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