diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c61db81..1a87419 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,14 +8,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,10 +27,10 @@
-
+
-
+
@@ -39,38 +38,102 @@
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,6 +147,8 @@
getPgConstructionList
statisticType
reoair
+ downloadFile
+ queryConstructDoc
@@ -113,6 +178,11 @@
+
+
+
+
+
@@ -136,10 +206,9 @@
-
-
-
-
+
+
+
@@ -147,9 +216,8 @@
-
-
+
@@ -190,54 +258,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -271,6 +304,7 @@
+
@@ -363,17 +397,28 @@
-
+
+
+
+
+ 1558940248477
+
+
+
+ 1558940248477
+
+
-
+
-
+
+
-
+
@@ -384,7 +429,7 @@
-
+
@@ -392,7 +437,7 @@
-
+
@@ -415,6 +460,10 @@
+
+
+
+
@@ -428,69 +477,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -649,29 +635,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -679,16 +642,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -731,16 +684,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -769,12 +712,6 @@
-
-
-
-
-
-
@@ -827,6 +764,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c61db81..1a87419 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,14 +8,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,10 +27,10 @@
-
+
-
+
@@ -39,38 +38,102 @@
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,6 +147,8 @@
getPgConstructionList
statisticType
reoair
+ downloadFile
+ queryConstructDoc
@@ -113,6 +178,11 @@
+
+
+
+
+
@@ -136,10 +206,9 @@
-
-
-
-
+
+
+
@@ -147,9 +216,8 @@
-
-
+
@@ -190,54 +258,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -271,6 +304,7 @@
+
@@ -363,17 +397,28 @@
-
+
+
+
+
+ 1558940248477
+
+
+
+ 1558940248477
+
+
-
+
-
+
+
-
+
@@ -384,7 +429,7 @@
-
+
@@ -392,7 +437,7 @@
-
+
@@ -415,6 +460,10 @@
+
+
+
+
@@ -428,69 +477,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -649,29 +635,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -679,16 +642,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -731,16 +684,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -769,12 +712,6 @@
-
-
-
-
-
-
@@ -827,6 +764,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 737836b..67be508 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,16 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+
+import org.apache.commons.codec.binary.Base64;
+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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -42,7 +45,8 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+// byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -70,7 +74,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
/*MediaType mediaType = new MediaType("text", "html", Charset.forName("UTF-8"));*/
headers.add("Content-Disposition",file.getName());
@@ -88,6 +94,17 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
/*查询*/
public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) {
@@ -95,8 +112,11 @@
try {
List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name,
cs_type, null,startTime, endTime);
- if(pgConstructionList==null||pgConstructionList.size()==0)
- return null;
+ if(pgConstructionList==null||pgConstructionList.size()==0) {
+
+ pgCsDocumentDtoList=getAllPgCsDocument();
+ return pgCsDocumentDtoList;
+ }
else
{
for(PgConstruction pgConstruction : pgConstructionList)
@@ -116,8 +136,7 @@
}
}
- private PgCsDocumentDto getDtoByObject(Object[] objectArray)
- {
+ private PgCsDocumentDto getDtoByObject(Object[] objectArray){
PgCsDocumentDto pgCsDocumentDto=new PgCsDocumentDto();
pgCsDocumentDto.setId(String.valueOf(objectArray[0]));
@@ -129,4 +148,16 @@
return pgCsDocumentDto;
}
+ public List getAllPgCsDocument() {
+ Criteria criteria=createCriteria(PgCsDocument.class);
+ criteria.add(Restrictions.eq("active",1));
+
+ List pgCsDocumentList=criteria.list();
+ List pgCsDocumentDtoList = new ArrayList();
+ for (PgCsDocument pgCsDocument : pgCsDocumentList) {
+ pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument));
+ }
+ return pgCsDocumentDtoList;
+ }
+
}
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c61db81..1a87419 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,14 +8,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,10 +27,10 @@
-
+
-
+
@@ -39,38 +38,102 @@
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,6 +147,8 @@
getPgConstructionList
statisticType
reoair
+ downloadFile
+ queryConstructDoc
@@ -113,6 +178,11 @@
+
+
+
+
+
@@ -136,10 +206,9 @@
-
-
-
-
+
+
+
@@ -147,9 +216,8 @@
-
-
+
@@ -190,54 +258,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -271,6 +304,7 @@
+
@@ -363,17 +397,28 @@
-
+
+
+
+
+ 1558940248477
+
+
+
+ 1558940248477
+
+
-
+
-
+
+
-
+
@@ -384,7 +429,7 @@
-
+
@@ -392,7 +437,7 @@
-
+
@@ -415,6 +460,10 @@
+
+
+
+
@@ -428,69 +477,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -649,29 +635,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -679,16 +642,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -731,16 +684,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -769,12 +712,6 @@
-
-
-
-
-
-
@@ -827,6 +764,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 737836b..67be508 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,16 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+
+import org.apache.commons.codec.binary.Base64;
+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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -42,7 +45,8 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+// byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -70,7 +74,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
/*MediaType mediaType = new MediaType("text", "html", Charset.forName("UTF-8"));*/
headers.add("Content-Disposition",file.getName());
@@ -88,6 +94,17 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
/*查询*/
public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) {
@@ -95,8 +112,11 @@
try {
List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name,
cs_type, null,startTime, endTime);
- if(pgConstructionList==null||pgConstructionList.size()==0)
- return null;
+ if(pgConstructionList==null||pgConstructionList.size()==0) {
+
+ pgCsDocumentDtoList=getAllPgCsDocument();
+ return pgCsDocumentDtoList;
+ }
else
{
for(PgConstruction pgConstruction : pgConstructionList)
@@ -116,8 +136,7 @@
}
}
- private PgCsDocumentDto getDtoByObject(Object[] objectArray)
- {
+ private PgCsDocumentDto getDtoByObject(Object[] objectArray){
PgCsDocumentDto pgCsDocumentDto=new PgCsDocumentDto();
pgCsDocumentDto.setId(String.valueOf(objectArray[0]));
@@ -129,4 +148,16 @@
return pgCsDocumentDto;
}
+ public List getAllPgCsDocument() {
+ Criteria criteria=createCriteria(PgCsDocument.class);
+ criteria.add(Restrictions.eq("active",1));
+
+ List pgCsDocumentList=criteria.list();
+ List pgCsDocumentDtoList = new ArrayList();
+ for (PgCsDocument pgCsDocument : pgCsDocumentList) {
+ pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument));
+ }
+ return pgCsDocumentDtoList;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
index 64c1467..d97e316 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
@@ -72,6 +72,7 @@
}
public PgReservePlanDto(PgReservePlan pgReservePlan) {
+ this.setId(String.valueOf(pgReservePlan.getId()));
this.setPlanName(pgReservePlan.getPlanName());
this.setPlanType(pgReservePlan.getPlanType());
if (pgReservePlan.getPgAlarmTypeId() == null)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c61db81..1a87419 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,14 +8,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,10 +27,10 @@
-
+
-
+
@@ -39,38 +38,102 @@
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,6 +147,8 @@
getPgConstructionList
statisticType
reoair
+ downloadFile
+ queryConstructDoc
@@ -113,6 +178,11 @@
+
+
+
+
+
@@ -136,10 +206,9 @@
-
-
-
-
+
+
+
@@ -147,9 +216,8 @@
-
-
+
@@ -190,54 +258,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -271,6 +304,7 @@
+
@@ -363,17 +397,28 @@
-
+
+
+
+
+ 1558940248477
+
+
+
+ 1558940248477
+
+
-
+
-
+
+
-
+
@@ -384,7 +429,7 @@
-
+
@@ -392,7 +437,7 @@
-
+
@@ -415,6 +460,10 @@
+
+
+
+
@@ -428,69 +477,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -649,29 +635,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -679,16 +642,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -731,16 +684,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -769,12 +712,6 @@
-
-
-
-
-
-
@@ -827,6 +764,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 737836b..67be508 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,16 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+
+import org.apache.commons.codec.binary.Base64;
+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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -42,7 +45,8 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+// byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -70,7 +74,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
/*MediaType mediaType = new MediaType("text", "html", Charset.forName("UTF-8"));*/
headers.add("Content-Disposition",file.getName());
@@ -88,6 +94,17 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
/*查询*/
public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) {
@@ -95,8 +112,11 @@
try {
List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name,
cs_type, null,startTime, endTime);
- if(pgConstructionList==null||pgConstructionList.size()==0)
- return null;
+ if(pgConstructionList==null||pgConstructionList.size()==0) {
+
+ pgCsDocumentDtoList=getAllPgCsDocument();
+ return pgCsDocumentDtoList;
+ }
else
{
for(PgConstruction pgConstruction : pgConstructionList)
@@ -116,8 +136,7 @@
}
}
- private PgCsDocumentDto getDtoByObject(Object[] objectArray)
- {
+ private PgCsDocumentDto getDtoByObject(Object[] objectArray){
PgCsDocumentDto pgCsDocumentDto=new PgCsDocumentDto();
pgCsDocumentDto.setId(String.valueOf(objectArray[0]));
@@ -129,4 +148,16 @@
return pgCsDocumentDto;
}
+ public List getAllPgCsDocument() {
+ Criteria criteria=createCriteria(PgCsDocument.class);
+ criteria.add(Restrictions.eq("active",1));
+
+ List pgCsDocumentList=criteria.list();
+ List pgCsDocumentDtoList = new ArrayList();
+ for (PgCsDocument pgCsDocument : pgCsDocumentList) {
+ pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument));
+ }
+ return pgCsDocumentDtoList;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
index 64c1467..d97e316 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
@@ -72,6 +72,7 @@
}
public PgReservePlanDto(PgReservePlan pgReservePlan) {
+ this.setId(String.valueOf(pgReservePlan.getId()));
this.setPlanName(pgReservePlan.getPlanName());
this.setPlanType(pgReservePlan.getPlanType());
if (pgReservePlan.getPgAlarmTypeId() == null)
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
index 64056b7..4384fb6 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
@@ -4,6 +4,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.reservePlan.domain.PgReservePlan;
import com.casic.PgInterface.reservePlan.dto.PgReservePlanDto;
+import org.apache.commons.codec.binary.Base64;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
@@ -13,7 +14,7 @@
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 javax.swing.*;
@@ -27,8 +28,9 @@
@Service
public class PgReservePlanManager extends HibernateEntityDao {
- public List getpgReservePlanDto() {
+ public List getPgReservePlanDto() {
Criteria criteria=createCriteria(PgReservePlan.class);
+ criteria.add(Restrictions.eq("active",1));
List pgReservePlanList=criteria.list();
List pgReservePlanDtoList = new ArrayList();
@@ -48,7 +50,9 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -88,8 +92,7 @@
}
}
- public boolean getPgReservePlanByFileName(String planName)
- {
+ public boolean getPgReservePlanByFileName(String planName){
String sql="select count(*) from PG_RESERVE_PLAN where PLAN_NAME = '" +planName+"'";
Object object=this.getSession().createSQLQuery(sql).uniqueResult();
@@ -101,7 +104,7 @@
}
/*下载文件*/
- public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
+ public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String path = request.getSession().getServletContext().getRealPath("");
@@ -110,7 +113,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Disposition",file.getName());
HttpStatus status = HttpStatus.OK;
@@ -124,4 +129,15 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);;
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
}
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c61db81..1a87419 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,14 +8,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,10 +27,10 @@
-
+
-
+
@@ -39,38 +38,102 @@
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,6 +147,8 @@
getPgConstructionList
statisticType
reoair
+ downloadFile
+ queryConstructDoc
@@ -113,6 +178,11 @@
+
+
+
+
+
@@ -136,10 +206,9 @@
-
-
-
-
+
+
+
@@ -147,9 +216,8 @@
-
-
+
@@ -190,54 +258,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -271,6 +304,7 @@
+
@@ -363,17 +397,28 @@
-
+
+
+
+
+ 1558940248477
+
+
+
+ 1558940248477
+
+
-
+
-
+
+
-
+
@@ -384,7 +429,7 @@
-
+
@@ -392,7 +437,7 @@
-
+
@@ -415,6 +460,10 @@
+
+
+
+
@@ -428,69 +477,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -649,29 +635,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -679,16 +642,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -731,16 +684,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -769,12 +712,6 @@
-
-
-
-
-
-
@@ -827,6 +764,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 737836b..67be508 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,16 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+
+import org.apache.commons.codec.binary.Base64;
+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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -42,7 +45,8 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+// byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -70,7 +74,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
/*MediaType mediaType = new MediaType("text", "html", Charset.forName("UTF-8"));*/
headers.add("Content-Disposition",file.getName());
@@ -88,6 +94,17 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
/*查询*/
public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) {
@@ -95,8 +112,11 @@
try {
List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name,
cs_type, null,startTime, endTime);
- if(pgConstructionList==null||pgConstructionList.size()==0)
- return null;
+ if(pgConstructionList==null||pgConstructionList.size()==0) {
+
+ pgCsDocumentDtoList=getAllPgCsDocument();
+ return pgCsDocumentDtoList;
+ }
else
{
for(PgConstruction pgConstruction : pgConstructionList)
@@ -116,8 +136,7 @@
}
}
- private PgCsDocumentDto getDtoByObject(Object[] objectArray)
- {
+ private PgCsDocumentDto getDtoByObject(Object[] objectArray){
PgCsDocumentDto pgCsDocumentDto=new PgCsDocumentDto();
pgCsDocumentDto.setId(String.valueOf(objectArray[0]));
@@ -129,4 +148,16 @@
return pgCsDocumentDto;
}
+ public List getAllPgCsDocument() {
+ Criteria criteria=createCriteria(PgCsDocument.class);
+ criteria.add(Restrictions.eq("active",1));
+
+ List pgCsDocumentList=criteria.list();
+ List pgCsDocumentDtoList = new ArrayList();
+ for (PgCsDocument pgCsDocument : pgCsDocumentList) {
+ pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument));
+ }
+ return pgCsDocumentDtoList;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
index 64c1467..d97e316 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
@@ -72,6 +72,7 @@
}
public PgReservePlanDto(PgReservePlan pgReservePlan) {
+ this.setId(String.valueOf(pgReservePlan.getId()));
this.setPlanName(pgReservePlan.getPlanName());
this.setPlanType(pgReservePlan.getPlanType());
if (pgReservePlan.getPgAlarmTypeId() == null)
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
index 64056b7..4384fb6 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
@@ -4,6 +4,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.reservePlan.domain.PgReservePlan;
import com.casic.PgInterface.reservePlan.dto.PgReservePlanDto;
+import org.apache.commons.codec.binary.Base64;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
@@ -13,7 +14,7 @@
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 javax.swing.*;
@@ -27,8 +28,9 @@
@Service
public class PgReservePlanManager extends HibernateEntityDao {
- public List getpgReservePlanDto() {
+ public List getPgReservePlanDto() {
Criteria criteria=createCriteria(PgReservePlan.class);
+ criteria.add(Restrictions.eq("active",1));
List pgReservePlanList=criteria.list();
List pgReservePlanDtoList = new ArrayList();
@@ -48,7 +50,9 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -88,8 +92,7 @@
}
}
- public boolean getPgReservePlanByFileName(String planName)
- {
+ public boolean getPgReservePlanByFileName(String planName){
String sql="select count(*) from PG_RESERVE_PLAN where PLAN_NAME = '" +planName+"'";
Object object=this.getSession().createSQLQuery(sql).uniqueResult();
@@ -101,7 +104,7 @@
}
/*下载文件*/
- public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
+ public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String path = request.getSession().getServletContext().getRealPath("");
@@ -110,7 +113,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Disposition",file.getName());
HttpStatus status = HttpStatus.OK;
@@ -124,4 +129,15 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);;
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
index b1fe121..455e9af 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
@@ -220,7 +220,7 @@
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c61db81..1a87419 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,14 +8,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,10 +27,10 @@
-
+
-
+
@@ -39,38 +38,102 @@
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,6 +147,8 @@
getPgConstructionList
statisticType
reoair
+ downloadFile
+ queryConstructDoc
@@ -113,6 +178,11 @@
+
+
+
+
+
@@ -136,10 +206,9 @@
-
-
-
-
+
+
+
@@ -147,9 +216,8 @@
-
-
+
@@ -190,54 +258,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -271,6 +304,7 @@
+
@@ -363,17 +397,28 @@
-
+
+
+
+
+ 1558940248477
+
+
+
+ 1558940248477
+
+
-
+
-
+
+
-
+
@@ -384,7 +429,7 @@
-
+
@@ -392,7 +437,7 @@
-
+
@@ -415,6 +460,10 @@
+
+
+
+
@@ -428,69 +477,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -649,29 +635,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -679,16 +642,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -731,16 +684,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -769,12 +712,6 @@
-
-
-
-
-
-
@@ -827,6 +764,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 737836b..67be508 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,16 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+
+import org.apache.commons.codec.binary.Base64;
+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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -42,7 +45,8 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+// byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -70,7 +74,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
/*MediaType mediaType = new MediaType("text", "html", Charset.forName("UTF-8"));*/
headers.add("Content-Disposition",file.getName());
@@ -88,6 +94,17 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
/*查询*/
public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) {
@@ -95,8 +112,11 @@
try {
List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name,
cs_type, null,startTime, endTime);
- if(pgConstructionList==null||pgConstructionList.size()==0)
- return null;
+ if(pgConstructionList==null||pgConstructionList.size()==0) {
+
+ pgCsDocumentDtoList=getAllPgCsDocument();
+ return pgCsDocumentDtoList;
+ }
else
{
for(PgConstruction pgConstruction : pgConstructionList)
@@ -116,8 +136,7 @@
}
}
- private PgCsDocumentDto getDtoByObject(Object[] objectArray)
- {
+ private PgCsDocumentDto getDtoByObject(Object[] objectArray){
PgCsDocumentDto pgCsDocumentDto=new PgCsDocumentDto();
pgCsDocumentDto.setId(String.valueOf(objectArray[0]));
@@ -129,4 +148,16 @@
return pgCsDocumentDto;
}
+ public List getAllPgCsDocument() {
+ Criteria criteria=createCriteria(PgCsDocument.class);
+ criteria.add(Restrictions.eq("active",1));
+
+ List pgCsDocumentList=criteria.list();
+ List pgCsDocumentDtoList = new ArrayList();
+ for (PgCsDocument pgCsDocument : pgCsDocumentList) {
+ pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument));
+ }
+ return pgCsDocumentDtoList;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
index 64c1467..d97e316 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
@@ -72,6 +72,7 @@
}
public PgReservePlanDto(PgReservePlan pgReservePlan) {
+ this.setId(String.valueOf(pgReservePlan.getId()));
this.setPlanName(pgReservePlan.getPlanName());
this.setPlanType(pgReservePlan.getPlanType());
if (pgReservePlan.getPgAlarmTypeId() == null)
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
index 64056b7..4384fb6 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
@@ -4,6 +4,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.reservePlan.domain.PgReservePlan;
import com.casic.PgInterface.reservePlan.dto.PgReservePlanDto;
+import org.apache.commons.codec.binary.Base64;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
@@ -13,7 +14,7 @@
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 javax.swing.*;
@@ -27,8 +28,9 @@
@Service
public class PgReservePlanManager extends HibernateEntityDao {
- public List getpgReservePlanDto() {
+ public List getPgReservePlanDto() {
Criteria criteria=createCriteria(PgReservePlan.class);
+ criteria.add(Restrictions.eq("active",1));
List pgReservePlanList=criteria.list();
List pgReservePlanDtoList = new ArrayList();
@@ -48,7 +50,9 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -88,8 +92,7 @@
}
}
- public boolean getPgReservePlanByFileName(String planName)
- {
+ public boolean getPgReservePlanByFileName(String planName){
String sql="select count(*) from PG_RESERVE_PLAN where PLAN_NAME = '" +planName+"'";
Object object=this.getSession().createSQLQuery(sql).uniqueResult();
@@ -101,7 +104,7 @@
}
/*下载文件*/
- public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
+ public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String path = request.getSession().getServletContext().getRealPath("");
@@ -110,7 +113,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Disposition",file.getName());
HttpStatus status = HttpStatus.OK;
@@ -124,4 +129,15 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);;
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
index b1fe121..455e9af 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
@@ -220,7 +220,7 @@
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
index 8f2cc69..672b376 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
@@ -8,6 +8,7 @@
import com.casic.PgInterface.reservePlan.manager.PgReservePlanManager;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
+import sun.misc.BASE64Decoder;
import javax.annotation.Resource;
import javax.ws.rs.FormParam;
@@ -34,7 +35,7 @@
private PgAlarmTypeManager pgAlarmTypeManager;
/*
- * 获取角色信息
+ * 获取预案信息
*/
@POST
@Path("getReservePlan")
@@ -44,7 +45,7 @@
String msg = "";
List pgReservePlanDtoList = new ArrayList();
try {
- pgReservePlanDtoList = pgReservePlanManager.getpgReservePlanDto();
+ pgReservePlanDtoList = pgReservePlanManager.getPgReservePlanDto();
if (pgReservePlanDtoList == null)
msg = "不存在预案信息";
else
@@ -69,17 +70,17 @@
try {
PgReservePlan pgReservePlan = pgReservePlanManager.get(Long.valueOf(id));
path = pgReservePlanManager.downloadFile(pgReservePlan);
+
if (path == null)
msg = "不存在该文档";
else
msg = "下载成功";
-
} catch (Exception e) {
e.printStackTrace();
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
@@ -210,7 +211,7 @@
msg="不存在该预案信息";
}
else{
- pgReservePlan.setActive(0);
+ pgReservePlan.setActive(0);;
pgReservePlanManager.save(pgReservePlan);
result="true";
msg="删除成功";
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c61db81..1a87419 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,14 +8,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,10 +27,10 @@
-
+
-
+
@@ -39,38 +38,102 @@
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,6 +147,8 @@
getPgConstructionList
statisticType
reoair
+ downloadFile
+ queryConstructDoc
@@ -113,6 +178,11 @@
+
+
+
+
+
@@ -136,10 +206,9 @@
-
-
-
-
+
+
+
@@ -147,9 +216,8 @@
-
-
+
@@ -190,54 +258,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -271,6 +304,7 @@
+
@@ -363,17 +397,28 @@
-
+
+
+
+
+ 1558940248477
+
+
+
+ 1558940248477
+
+
-
+
-
+
+
-
+
@@ -384,7 +429,7 @@
-
+
@@ -392,7 +437,7 @@
-
+
@@ -415,6 +460,10 @@
+
+
+
+
@@ -428,69 +477,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -649,29 +635,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -679,16 +642,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -731,16 +684,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -769,12 +712,6 @@
-
-
-
-
-
-
@@ -827,6 +764,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 737836b..67be508 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,16 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+
+import org.apache.commons.codec.binary.Base64;
+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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -42,7 +45,8 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+// byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -70,7 +74,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
/*MediaType mediaType = new MediaType("text", "html", Charset.forName("UTF-8"));*/
headers.add("Content-Disposition",file.getName());
@@ -88,6 +94,17 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
/*查询*/
public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) {
@@ -95,8 +112,11 @@
try {
List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name,
cs_type, null,startTime, endTime);
- if(pgConstructionList==null||pgConstructionList.size()==0)
- return null;
+ if(pgConstructionList==null||pgConstructionList.size()==0) {
+
+ pgCsDocumentDtoList=getAllPgCsDocument();
+ return pgCsDocumentDtoList;
+ }
else
{
for(PgConstruction pgConstruction : pgConstructionList)
@@ -116,8 +136,7 @@
}
}
- private PgCsDocumentDto getDtoByObject(Object[] objectArray)
- {
+ private PgCsDocumentDto getDtoByObject(Object[] objectArray){
PgCsDocumentDto pgCsDocumentDto=new PgCsDocumentDto();
pgCsDocumentDto.setId(String.valueOf(objectArray[0]));
@@ -129,4 +148,16 @@
return pgCsDocumentDto;
}
+ public List getAllPgCsDocument() {
+ Criteria criteria=createCriteria(PgCsDocument.class);
+ criteria.add(Restrictions.eq("active",1));
+
+ List pgCsDocumentList=criteria.list();
+ List pgCsDocumentDtoList = new ArrayList();
+ for (PgCsDocument pgCsDocument : pgCsDocumentList) {
+ pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument));
+ }
+ return pgCsDocumentDtoList;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
index 64c1467..d97e316 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
@@ -72,6 +72,7 @@
}
public PgReservePlanDto(PgReservePlan pgReservePlan) {
+ this.setId(String.valueOf(pgReservePlan.getId()));
this.setPlanName(pgReservePlan.getPlanName());
this.setPlanType(pgReservePlan.getPlanType());
if (pgReservePlan.getPgAlarmTypeId() == null)
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
index 64056b7..4384fb6 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
@@ -4,6 +4,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.reservePlan.domain.PgReservePlan;
import com.casic.PgInterface.reservePlan.dto.PgReservePlanDto;
+import org.apache.commons.codec.binary.Base64;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
@@ -13,7 +14,7 @@
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 javax.swing.*;
@@ -27,8 +28,9 @@
@Service
public class PgReservePlanManager extends HibernateEntityDao {
- public List getpgReservePlanDto() {
+ public List getPgReservePlanDto() {
Criteria criteria=createCriteria(PgReservePlan.class);
+ criteria.add(Restrictions.eq("active",1));
List pgReservePlanList=criteria.list();
List pgReservePlanDtoList = new ArrayList();
@@ -48,7 +50,9 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -88,8 +92,7 @@
}
}
- public boolean getPgReservePlanByFileName(String planName)
- {
+ public boolean getPgReservePlanByFileName(String planName){
String sql="select count(*) from PG_RESERVE_PLAN where PLAN_NAME = '" +planName+"'";
Object object=this.getSession().createSQLQuery(sql).uniqueResult();
@@ -101,7 +104,7 @@
}
/*下载文件*/
- public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
+ public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String path = request.getSession().getServletContext().getRealPath("");
@@ -110,7 +113,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Disposition",file.getName());
HttpStatus status = HttpStatus.OK;
@@ -124,4 +129,15 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);;
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
index b1fe121..455e9af 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
@@ -220,7 +220,7 @@
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
index 8f2cc69..672b376 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
@@ -8,6 +8,7 @@
import com.casic.PgInterface.reservePlan.manager.PgReservePlanManager;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
+import sun.misc.BASE64Decoder;
import javax.annotation.Resource;
import javax.ws.rs.FormParam;
@@ -34,7 +35,7 @@
private PgAlarmTypeManager pgAlarmTypeManager;
/*
- * 获取角色信息
+ * 获取预案信息
*/
@POST
@Path("getReservePlan")
@@ -44,7 +45,7 @@
String msg = "";
List pgReservePlanDtoList = new ArrayList();
try {
- pgReservePlanDtoList = pgReservePlanManager.getpgReservePlanDto();
+ pgReservePlanDtoList = pgReservePlanManager.getPgReservePlanDto();
if (pgReservePlanDtoList == null)
msg = "不存在预案信息";
else
@@ -69,17 +70,17 @@
try {
PgReservePlan pgReservePlan = pgReservePlanManager.get(Long.valueOf(id));
path = pgReservePlanManager.downloadFile(pgReservePlan);
+
if (path == null)
msg = "不存在该文档";
else
msg = "下载成功";
-
} catch (Exception e) {
e.printStackTrace();
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
@@ -210,7 +211,7 @@
msg="不存在该预案信息";
}
else{
- pgReservePlan.setActive(0);
+ pgReservePlan.setActive(0);;
pgReservePlanManager.save(pgReservePlan);
result="true";
msg="删除成功";
diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx"
new file mode 100644
index 0000000..a4ec716
--- /dev/null
+++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx"
Binary files differ
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c61db81..1a87419 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,14 +8,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,10 +27,10 @@
-
+
-
+
@@ -39,38 +38,102 @@
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,6 +147,8 @@
getPgConstructionList
statisticType
reoair
+ downloadFile
+ queryConstructDoc
@@ -113,6 +178,11 @@
+
+
+
+
+
@@ -136,10 +206,9 @@
-
-
-
-
+
+
+
@@ -147,9 +216,8 @@
-
-
+
@@ -190,54 +258,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -271,6 +304,7 @@
+
@@ -363,17 +397,28 @@
-
+
+
+
+
+ 1558940248477
+
+
+
+ 1558940248477
+
+
-
+
-
+
+
-
+
@@ -384,7 +429,7 @@
-
+
@@ -392,7 +437,7 @@
-
+
@@ -415,6 +460,10 @@
+
+
+
+
@@ -428,69 +477,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -649,29 +635,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -679,16 +642,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -731,16 +684,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -769,12 +712,6 @@
-
-
-
-
-
-
@@ -827,6 +764,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 737836b..67be508 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,16 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+
+import org.apache.commons.codec.binary.Base64;
+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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -42,7 +45,8 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+// byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -70,7 +74,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
/*MediaType mediaType = new MediaType("text", "html", Charset.forName("UTF-8"));*/
headers.add("Content-Disposition",file.getName());
@@ -88,6 +94,17 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
/*查询*/
public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) {
@@ -95,8 +112,11 @@
try {
List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name,
cs_type, null,startTime, endTime);
- if(pgConstructionList==null||pgConstructionList.size()==0)
- return null;
+ if(pgConstructionList==null||pgConstructionList.size()==0) {
+
+ pgCsDocumentDtoList=getAllPgCsDocument();
+ return pgCsDocumentDtoList;
+ }
else
{
for(PgConstruction pgConstruction : pgConstructionList)
@@ -116,8 +136,7 @@
}
}
- private PgCsDocumentDto getDtoByObject(Object[] objectArray)
- {
+ private PgCsDocumentDto getDtoByObject(Object[] objectArray){
PgCsDocumentDto pgCsDocumentDto=new PgCsDocumentDto();
pgCsDocumentDto.setId(String.valueOf(objectArray[0]));
@@ -129,4 +148,16 @@
return pgCsDocumentDto;
}
+ public List getAllPgCsDocument() {
+ Criteria criteria=createCriteria(PgCsDocument.class);
+ criteria.add(Restrictions.eq("active",1));
+
+ List pgCsDocumentList=criteria.list();
+ List pgCsDocumentDtoList = new ArrayList();
+ for (PgCsDocument pgCsDocument : pgCsDocumentList) {
+ pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument));
+ }
+ return pgCsDocumentDtoList;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
index 64c1467..d97e316 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
@@ -72,6 +72,7 @@
}
public PgReservePlanDto(PgReservePlan pgReservePlan) {
+ this.setId(String.valueOf(pgReservePlan.getId()));
this.setPlanName(pgReservePlan.getPlanName());
this.setPlanType(pgReservePlan.getPlanType());
if (pgReservePlan.getPgAlarmTypeId() == null)
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
index 64056b7..4384fb6 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
@@ -4,6 +4,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.reservePlan.domain.PgReservePlan;
import com.casic.PgInterface.reservePlan.dto.PgReservePlanDto;
+import org.apache.commons.codec.binary.Base64;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
@@ -13,7 +14,7 @@
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 javax.swing.*;
@@ -27,8 +28,9 @@
@Service
public class PgReservePlanManager extends HibernateEntityDao {
- public List getpgReservePlanDto() {
+ public List getPgReservePlanDto() {
Criteria criteria=createCriteria(PgReservePlan.class);
+ criteria.add(Restrictions.eq("active",1));
List pgReservePlanList=criteria.list();
List pgReservePlanDtoList = new ArrayList();
@@ -48,7 +50,9 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -88,8 +92,7 @@
}
}
- public boolean getPgReservePlanByFileName(String planName)
- {
+ public boolean getPgReservePlanByFileName(String planName){
String sql="select count(*) from PG_RESERVE_PLAN where PLAN_NAME = '" +planName+"'";
Object object=this.getSession().createSQLQuery(sql).uniqueResult();
@@ -101,7 +104,7 @@
}
/*下载文件*/
- public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
+ public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String path = request.getSession().getServletContext().getRealPath("");
@@ -110,7 +113,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Disposition",file.getName());
HttpStatus status = HttpStatus.OK;
@@ -124,4 +129,15 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);;
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
index b1fe121..455e9af 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
@@ -220,7 +220,7 @@
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
index 8f2cc69..672b376 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
@@ -8,6 +8,7 @@
import com.casic.PgInterface.reservePlan.manager.PgReservePlanManager;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
+import sun.misc.BASE64Decoder;
import javax.annotation.Resource;
import javax.ws.rs.FormParam;
@@ -34,7 +35,7 @@
private PgAlarmTypeManager pgAlarmTypeManager;
/*
- * 获取角色信息
+ * 获取预案信息
*/
@POST
@Path("getReservePlan")
@@ -44,7 +45,7 @@
String msg = "";
List pgReservePlanDtoList = new ArrayList();
try {
- pgReservePlanDtoList = pgReservePlanManager.getpgReservePlanDto();
+ pgReservePlanDtoList = pgReservePlanManager.getPgReservePlanDto();
if (pgReservePlanDtoList == null)
msg = "不存在预案信息";
else
@@ -69,17 +70,17 @@
try {
PgReservePlan pgReservePlan = pgReservePlanManager.get(Long.valueOf(id));
path = pgReservePlanManager.downloadFile(pgReservePlan);
+
if (path == null)
msg = "不存在该文档";
else
msg = "下载成功";
-
} catch (Exception e) {
e.printStackTrace();
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
@@ -210,7 +211,7 @@
msg="不存在该预案信息";
}
else{
- pgReservePlan.setActive(0);
+ pgReservePlan.setActive(0);;
pgReservePlanManager.save(pgReservePlan);
result="true";
msg="删除成功";
diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx"
new file mode 100644
index 0000000..a4ec716
--- /dev/null
+++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx"
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190522.docx" "b/~$\350\257\264\346\230\21620190522.docx"
deleted file mode 100644
index 5e5bd25..0000000
--- "a/~$\350\257\264\346\230\21620190522.docx"
+++ /dev/null
Binary files differ
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c61db81..1a87419 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,14 +8,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,10 +27,10 @@
-
+
-
+
@@ -39,38 +38,102 @@
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,6 +147,8 @@
getPgConstructionList
statisticType
reoair
+ downloadFile
+ queryConstructDoc
@@ -113,6 +178,11 @@
+
+
+
+
+
@@ -136,10 +206,9 @@
-
-
-
-
+
+
+
@@ -147,9 +216,8 @@
-
-
+
@@ -190,54 +258,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -271,6 +304,7 @@
+
@@ -363,17 +397,28 @@
-
+
+
+
+
+ 1558940248477
+
+
+
+ 1558940248477
+
+
-
+
-
+
+
-
+
@@ -384,7 +429,7 @@
-
+
@@ -392,7 +437,7 @@
-
+
@@ -415,6 +460,10 @@
+
+
+
+
@@ -428,69 +477,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -649,29 +635,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -679,16 +642,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -731,16 +684,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -769,12 +712,6 @@
-
-
-
-
-
-
@@ -827,6 +764,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 737836b..67be508 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,16 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+
+import org.apache.commons.codec.binary.Base64;
+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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -42,7 +45,8 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+// byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -70,7 +74,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
/*MediaType mediaType = new MediaType("text", "html", Charset.forName("UTF-8"));*/
headers.add("Content-Disposition",file.getName());
@@ -88,6 +94,17 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
/*查询*/
public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) {
@@ -95,8 +112,11 @@
try {
List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name,
cs_type, null,startTime, endTime);
- if(pgConstructionList==null||pgConstructionList.size()==0)
- return null;
+ if(pgConstructionList==null||pgConstructionList.size()==0) {
+
+ pgCsDocumentDtoList=getAllPgCsDocument();
+ return pgCsDocumentDtoList;
+ }
else
{
for(PgConstruction pgConstruction : pgConstructionList)
@@ -116,8 +136,7 @@
}
}
- private PgCsDocumentDto getDtoByObject(Object[] objectArray)
- {
+ private PgCsDocumentDto getDtoByObject(Object[] objectArray){
PgCsDocumentDto pgCsDocumentDto=new PgCsDocumentDto();
pgCsDocumentDto.setId(String.valueOf(objectArray[0]));
@@ -129,4 +148,16 @@
return pgCsDocumentDto;
}
+ public List getAllPgCsDocument() {
+ Criteria criteria=createCriteria(PgCsDocument.class);
+ criteria.add(Restrictions.eq("active",1));
+
+ List pgCsDocumentList=criteria.list();
+ List pgCsDocumentDtoList = new ArrayList();
+ for (PgCsDocument pgCsDocument : pgCsDocumentList) {
+ pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument));
+ }
+ return pgCsDocumentDtoList;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
index 64c1467..d97e316 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
@@ -72,6 +72,7 @@
}
public PgReservePlanDto(PgReservePlan pgReservePlan) {
+ this.setId(String.valueOf(pgReservePlan.getId()));
this.setPlanName(pgReservePlan.getPlanName());
this.setPlanType(pgReservePlan.getPlanType());
if (pgReservePlan.getPgAlarmTypeId() == null)
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
index 64056b7..4384fb6 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
@@ -4,6 +4,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.reservePlan.domain.PgReservePlan;
import com.casic.PgInterface.reservePlan.dto.PgReservePlanDto;
+import org.apache.commons.codec.binary.Base64;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
@@ -13,7 +14,7 @@
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 javax.swing.*;
@@ -27,8 +28,9 @@
@Service
public class PgReservePlanManager extends HibernateEntityDao {
- public List getpgReservePlanDto() {
+ public List getPgReservePlanDto() {
Criteria criteria=createCriteria(PgReservePlan.class);
+ criteria.add(Restrictions.eq("active",1));
List pgReservePlanList=criteria.list();
List pgReservePlanDtoList = new ArrayList();
@@ -48,7 +50,9 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -88,8 +92,7 @@
}
}
- public boolean getPgReservePlanByFileName(String planName)
- {
+ public boolean getPgReservePlanByFileName(String planName){
String sql="select count(*) from PG_RESERVE_PLAN where PLAN_NAME = '" +planName+"'";
Object object=this.getSession().createSQLQuery(sql).uniqueResult();
@@ -101,7 +104,7 @@
}
/*下载文件*/
- public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
+ public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String path = request.getSession().getServletContext().getRealPath("");
@@ -110,7 +113,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Disposition",file.getName());
HttpStatus status = HttpStatus.OK;
@@ -124,4 +129,15 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);;
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
index b1fe121..455e9af 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
@@ -220,7 +220,7 @@
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
index 8f2cc69..672b376 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
@@ -8,6 +8,7 @@
import com.casic.PgInterface.reservePlan.manager.PgReservePlanManager;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
+import sun.misc.BASE64Decoder;
import javax.annotation.Resource;
import javax.ws.rs.FormParam;
@@ -34,7 +35,7 @@
private PgAlarmTypeManager pgAlarmTypeManager;
/*
- * 获取角色信息
+ * 获取预案信息
*/
@POST
@Path("getReservePlan")
@@ -44,7 +45,7 @@
String msg = "";
List pgReservePlanDtoList = new ArrayList();
try {
- pgReservePlanDtoList = pgReservePlanManager.getpgReservePlanDto();
+ pgReservePlanDtoList = pgReservePlanManager.getPgReservePlanDto();
if (pgReservePlanDtoList == null)
msg = "不存在预案信息";
else
@@ -69,17 +70,17 @@
try {
PgReservePlan pgReservePlan = pgReservePlanManager.get(Long.valueOf(id));
path = pgReservePlanManager.downloadFile(pgReservePlan);
+
if (path == null)
msg = "不存在该文档";
else
msg = "下载成功";
-
} catch (Exception e) {
e.printStackTrace();
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
@@ -210,7 +211,7 @@
msg="不存在该预案信息";
}
else{
- pgReservePlan.setActive(0);
+ pgReservePlan.setActive(0);;
pgReservePlanManager.save(pgReservePlan);
result="true";
msg="删除成功";
diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx"
new file mode 100644
index 0000000..a4ec716
--- /dev/null
+++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx"
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190522.docx" "b/~$\350\257\264\346\230\21620190522.docx"
deleted file mode 100644
index 5e5bd25..0000000
--- "a/~$\350\257\264\346\230\21620190522.docx"
+++ /dev/null
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190527.docx" "b/~$\350\257\264\346\230\21620190527.docx"
new file mode 100644
index 0000000..c68c40b
--- /dev/null
+++ "b/~$\350\257\264\346\230\21620190527.docx"
Binary files differ
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c61db81..1a87419 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,14 +8,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,10 +27,10 @@
-
+
-
+
@@ -39,38 +38,102 @@
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,6 +147,8 @@
getPgConstructionList
statisticType
reoair
+ downloadFile
+ queryConstructDoc
@@ -113,6 +178,11 @@
+
+
+
+
+
@@ -136,10 +206,9 @@
-
-
-
-
+
+
+
@@ -147,9 +216,8 @@
-
-
+
@@ -190,54 +258,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -271,6 +304,7 @@
+
@@ -363,17 +397,28 @@
-
+
+
+
+
+ 1558940248477
+
+
+
+ 1558940248477
+
+
-
+
-
+
+
-
+
@@ -384,7 +429,7 @@
-
+
@@ -392,7 +437,7 @@
-
+
@@ -415,6 +460,10 @@
+
+
+
+
@@ -428,69 +477,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -649,29 +635,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -679,16 +642,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -731,16 +684,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -769,12 +712,6 @@
-
-
-
-
-
-
@@ -827,6 +764,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 737836b..67be508 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,16 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+
+import org.apache.commons.codec.binary.Base64;
+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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -42,7 +45,8 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+// byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -70,7 +74,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
/*MediaType mediaType = new MediaType("text", "html", Charset.forName("UTF-8"));*/
headers.add("Content-Disposition",file.getName());
@@ -88,6 +94,17 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
/*查询*/
public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) {
@@ -95,8 +112,11 @@
try {
List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name,
cs_type, null,startTime, endTime);
- if(pgConstructionList==null||pgConstructionList.size()==0)
- return null;
+ if(pgConstructionList==null||pgConstructionList.size()==0) {
+
+ pgCsDocumentDtoList=getAllPgCsDocument();
+ return pgCsDocumentDtoList;
+ }
else
{
for(PgConstruction pgConstruction : pgConstructionList)
@@ -116,8 +136,7 @@
}
}
- private PgCsDocumentDto getDtoByObject(Object[] objectArray)
- {
+ private PgCsDocumentDto getDtoByObject(Object[] objectArray){
PgCsDocumentDto pgCsDocumentDto=new PgCsDocumentDto();
pgCsDocumentDto.setId(String.valueOf(objectArray[0]));
@@ -129,4 +148,16 @@
return pgCsDocumentDto;
}
+ public List getAllPgCsDocument() {
+ Criteria criteria=createCriteria(PgCsDocument.class);
+ criteria.add(Restrictions.eq("active",1));
+
+ List pgCsDocumentList=criteria.list();
+ List pgCsDocumentDtoList = new ArrayList();
+ for (PgCsDocument pgCsDocument : pgCsDocumentList) {
+ pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument));
+ }
+ return pgCsDocumentDtoList;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
index 64c1467..d97e316 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
@@ -72,6 +72,7 @@
}
public PgReservePlanDto(PgReservePlan pgReservePlan) {
+ this.setId(String.valueOf(pgReservePlan.getId()));
this.setPlanName(pgReservePlan.getPlanName());
this.setPlanType(pgReservePlan.getPlanType());
if (pgReservePlan.getPgAlarmTypeId() == null)
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
index 64056b7..4384fb6 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
@@ -4,6 +4,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.reservePlan.domain.PgReservePlan;
import com.casic.PgInterface.reservePlan.dto.PgReservePlanDto;
+import org.apache.commons.codec.binary.Base64;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
@@ -13,7 +14,7 @@
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 javax.swing.*;
@@ -27,8 +28,9 @@
@Service
public class PgReservePlanManager extends HibernateEntityDao {
- public List getpgReservePlanDto() {
+ public List getPgReservePlanDto() {
Criteria criteria=createCriteria(PgReservePlan.class);
+ criteria.add(Restrictions.eq("active",1));
List pgReservePlanList=criteria.list();
List pgReservePlanDtoList = new ArrayList();
@@ -48,7 +50,9 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -88,8 +92,7 @@
}
}
- public boolean getPgReservePlanByFileName(String planName)
- {
+ public boolean getPgReservePlanByFileName(String planName){
String sql="select count(*) from PG_RESERVE_PLAN where PLAN_NAME = '" +planName+"'";
Object object=this.getSession().createSQLQuery(sql).uniqueResult();
@@ -101,7 +104,7 @@
}
/*下载文件*/
- public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
+ public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String path = request.getSession().getServletContext().getRealPath("");
@@ -110,7 +113,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Disposition",file.getName());
HttpStatus status = HttpStatus.OK;
@@ -124,4 +129,15 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);;
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
index b1fe121..455e9af 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
@@ -220,7 +220,7 @@
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
index 8f2cc69..672b376 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
@@ -8,6 +8,7 @@
import com.casic.PgInterface.reservePlan.manager.PgReservePlanManager;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
+import sun.misc.BASE64Decoder;
import javax.annotation.Resource;
import javax.ws.rs.FormParam;
@@ -34,7 +35,7 @@
private PgAlarmTypeManager pgAlarmTypeManager;
/*
- * 获取角色信息
+ * 获取预案信息
*/
@POST
@Path("getReservePlan")
@@ -44,7 +45,7 @@
String msg = "";
List pgReservePlanDtoList = new ArrayList();
try {
- pgReservePlanDtoList = pgReservePlanManager.getpgReservePlanDto();
+ pgReservePlanDtoList = pgReservePlanManager.getPgReservePlanDto();
if (pgReservePlanDtoList == null)
msg = "不存在预案信息";
else
@@ -69,17 +70,17 @@
try {
PgReservePlan pgReservePlan = pgReservePlanManager.get(Long.valueOf(id));
path = pgReservePlanManager.downloadFile(pgReservePlan);
+
if (path == null)
msg = "不存在该文档";
else
msg = "下载成功";
-
} catch (Exception e) {
e.printStackTrace();
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
@@ -210,7 +211,7 @@
msg="不存在该预案信息";
}
else{
- pgReservePlan.setActive(0);
+ pgReservePlan.setActive(0);;
pgReservePlanManager.save(pgReservePlan);
result="true";
msg="删除成功";
diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx"
new file mode 100644
index 0000000..a4ec716
--- /dev/null
+++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx"
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190522.docx" "b/~$\350\257\264\346\230\21620190522.docx"
deleted file mode 100644
index 5e5bd25..0000000
--- "a/~$\350\257\264\346\230\21620190522.docx"
+++ /dev/null
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190527.docx" "b/~$\350\257\264\346\230\21620190527.docx"
new file mode 100644
index 0000000..c68c40b
--- /dev/null
+++ "b/~$\350\257\264\346\230\21620190527.docx"
Binary files differ
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\21620190522.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\21620190522.docx"
deleted file mode 100644
index 833b97a..0000000
--- "a/\346\216\245\345\217\243\350\257\264\346\230\21620190522.docx"
+++ /dev/null
Binary files differ
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c61db81..1a87419 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -8,14 +8,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,10 +27,10 @@
-
+
-
+
@@ -39,38 +38,102 @@
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -84,6 +147,8 @@
getPgConstructionList
statisticType
reoair
+ downloadFile
+ queryConstructDoc
@@ -113,6 +178,11 @@
+
+
+
+
+
@@ -136,10 +206,9 @@
-
-
-
-
+
+
+
@@ -147,9 +216,8 @@
-
-
+
@@ -190,54 +258,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -271,6 +304,7 @@
+
@@ -363,17 +397,28 @@
-
+
+
+
+
+ 1558940248477
+
+
+
+ 1558940248477
+
+
-
+
-
+
+
-
+
@@ -384,7 +429,7 @@
-
+
@@ -392,7 +437,7 @@
-
+
@@ -415,6 +460,10 @@
+
+
+
+
@@ -428,69 +477,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -649,29 +635,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -679,16 +642,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -731,16 +684,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -769,12 +712,6 @@
-
-
-
-
-
-
@@ -827,6 +764,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 737836b..67be508 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,16 @@
import com.casic.PgInterface.construction.domain.PgCsDocument;
import com.casic.PgInterface.construction.dto.PgCsDocumentDto;
import com.casic.PgInterface.core.hibernate.HibernateEntityDao;
+
+import org.apache.commons.codec.binary.Base64;
+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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -42,7 +45,8 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+// byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -70,7 +74,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
/*MediaType mediaType = new MediaType("text", "html", Charset.forName("UTF-8"));*/
headers.add("Content-Disposition",file.getName());
@@ -88,6 +94,17 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
/*查询*/
public List getAllDocData(String cs_name ,String cs_type,String startTime,String endTime) {
@@ -95,8 +112,11 @@
try {
List pgConstructionList = pgConstructionManager.getPgContructionByNameOrType(cs_name,
cs_type, null,startTime, endTime);
- if(pgConstructionList==null||pgConstructionList.size()==0)
- return null;
+ if(pgConstructionList==null||pgConstructionList.size()==0) {
+
+ pgCsDocumentDtoList=getAllPgCsDocument();
+ return pgCsDocumentDtoList;
+ }
else
{
for(PgConstruction pgConstruction : pgConstructionList)
@@ -116,8 +136,7 @@
}
}
- private PgCsDocumentDto getDtoByObject(Object[] objectArray)
- {
+ private PgCsDocumentDto getDtoByObject(Object[] objectArray){
PgCsDocumentDto pgCsDocumentDto=new PgCsDocumentDto();
pgCsDocumentDto.setId(String.valueOf(objectArray[0]));
@@ -129,4 +148,16 @@
return pgCsDocumentDto;
}
+ public List getAllPgCsDocument() {
+ Criteria criteria=createCriteria(PgCsDocument.class);
+ criteria.add(Restrictions.eq("active",1));
+
+ List pgCsDocumentList=criteria.list();
+ List pgCsDocumentDtoList = new ArrayList();
+ for (PgCsDocument pgCsDocument : pgCsDocumentList) {
+ pgCsDocumentDtoList.add(new PgCsDocumentDto(pgCsDocument));
+ }
+ return pgCsDocumentDtoList;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
index 64c1467..d97e316 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/dto/PgReservePlanDto.java
@@ -72,6 +72,7 @@
}
public PgReservePlanDto(PgReservePlan pgReservePlan) {
+ this.setId(String.valueOf(pgReservePlan.getId()));
this.setPlanName(pgReservePlan.getPlanName());
this.setPlanType(pgReservePlan.getPlanType());
if (pgReservePlan.getPgAlarmTypeId() == null)
diff --git a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
index 64056b7..4384fb6 100644
--- a/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
+++ b/src/main/java/com/casic/PgInterface/reservePlan/manager/PgReservePlanManager.java
@@ -4,6 +4,7 @@
import com.casic.PgInterface.devTable.domain.PgAlarm;
import com.casic.PgInterface.reservePlan.domain.PgReservePlan;
import com.casic.PgInterface.reservePlan.dto.PgReservePlanDto;
+import org.apache.commons.codec.binary.Base64;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
@@ -13,7 +14,7 @@
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 javax.swing.*;
@@ -27,8 +28,9 @@
@Service
public class PgReservePlanManager extends HibernateEntityDao {
- public List getpgReservePlanDto() {
+ public List getPgReservePlanDto() {
Criteria criteria=createCriteria(PgReservePlan.class);
+ criteria.add(Restrictions.eq("active",1));
List pgReservePlanList=criteria.list();
List pgReservePlanDtoList = new ArrayList();
@@ -48,7 +50,9 @@
String image_toDir = strDirPath + "\\"+fileType;//存储路径
String imageName = "";
imageName += fileType+"/"+fileName;
- byte[] buffer = new BASE64Decoder().decodeBuffer(fileBuffer);//对android传过来的图片字符串进行解码
+
+ byte[] buffer = Base64.decodeBase64(fileBuffer.getBytes());
+
File destDir = new File(image_toDir);
if (!destDir.exists())
destDir.mkdirs();
@@ -88,8 +92,7 @@
}
}
- public boolean getPgReservePlanByFileName(String planName)
- {
+ public boolean getPgReservePlanByFileName(String planName){
String sql="select count(*) from PG_RESERVE_PLAN where PLAN_NAME = '" +planName+"'";
Object object=this.getSession().createSQLQuery(sql).uniqueResult();
@@ -101,7 +104,7 @@
}
/*下载文件*/
- public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
+ public ResponseEntity downloadFile(PgReservePlan pgReservePlan) throws Exception {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String path = request.getSession().getServletContext().getRealPath("");
@@ -110,7 +113,9 @@
byte[] body = null;
InputStream inputStream = new FileInputStream(file);
body = new byte[inputStream.available()];
+// body=readInputStream(inputStream);
inputStream.read(body);
+
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Disposition",file.getName());
HttpStatus status = HttpStatus.OK;
@@ -124,4 +129,15 @@
}
}
+ public byte[] readInputStream(InputStream inStream) throws Exception{
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = 0;
+ while( (len=inStream.read(buffer)) != -1 ){
+ outStream.write(buffer, 0, len);;
+ }
+// inStream.close();
+ return outStream.toByteArray();
+ }
+
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
index b1fe121..455e9af 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgCsDocumentRs.java
@@ -220,7 +220,7 @@
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
diff --git a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
index 8f2cc69..672b376 100644
--- a/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
+++ b/src/main/java/com/casic/PgInterface/rs/PgReservePlanRs.java
@@ -8,6 +8,7 @@
import com.casic.PgInterface.reservePlan.manager.PgReservePlanManager;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
+import sun.misc.BASE64Decoder;
import javax.annotation.Resource;
import javax.ws.rs.FormParam;
@@ -34,7 +35,7 @@
private PgAlarmTypeManager pgAlarmTypeManager;
/*
- * 获取角色信息
+ * 获取预案信息
*/
@POST
@Path("getReservePlan")
@@ -44,7 +45,7 @@
String msg = "";
List pgReservePlanDtoList = new ArrayList();
try {
- pgReservePlanDtoList = pgReservePlanManager.getpgReservePlanDto();
+ pgReservePlanDtoList = pgReservePlanManager.getPgReservePlanDto();
if (pgReservePlanDtoList == null)
msg = "不存在预案信息";
else
@@ -69,17 +70,17 @@
try {
PgReservePlan pgReservePlan = pgReservePlanManager.get(Long.valueOf(id));
path = pgReservePlanManager.downloadFile(pgReservePlan);
+
if (path == null)
msg = "不存在该文档";
else
msg = "下载成功";
-
} catch (Exception e) {
e.printStackTrace();
msg = "下载失败";
}
- resultMap.put("result", path);
+ resultMap.put("result", path.getBody());
resultMap.put("msg", msg);
return resultMap;
}
@@ -210,7 +211,7 @@
msg="不存在该预案信息";
}
else{
- pgReservePlan.setActive(0);
+ pgReservePlan.setActive(0);;
pgReservePlanManager.save(pgReservePlan);
result="true";
msg="删除成功";
diff --git "a/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx" "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx"
new file mode 100644
index 0000000..a4ec716
--- /dev/null
+++ "b/~$\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\350\257\264\346\230\21620190522.docx"
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190522.docx" "b/~$\350\257\264\346\230\21620190522.docx"
deleted file mode 100644
index 5e5bd25..0000000
--- "a/~$\350\257\264\346\230\21620190522.docx"
+++ /dev/null
Binary files differ
diff --git "a/~$\350\257\264\346\230\21620190527.docx" "b/~$\350\257\264\346\230\21620190527.docx"
new file mode 100644
index 0000000..c68c40b
--- /dev/null
+++ "b/~$\350\257\264\346\230\21620190527.docx"
Binary files differ
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\21620190522.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\21620190522.docx"
deleted file mode 100644
index 833b97a..0000000
--- "a/\346\216\245\345\217\243\350\257\264\346\230\21620190522.docx"
+++ /dev/null
Binary files differ
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx" "b/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx"
new file mode 100644
index 0000000..833b97a
--- /dev/null
+++ "b/\346\216\245\345\217\243\350\257\264\346\230\21620190527.docx"
Binary files differ