diff --git a/pom.xml b/pom.xml
index 936fd8e..68e5f74 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,14 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
-
+
com.rzdata
tool-tech
3.8.8
tool-tech
工具与技术交流管理系统
-
+
3.8.8
UTF-8
@@ -285,4 +285,4 @@
-
\ No newline at end of file
+
diff --git a/tool-tech-admin/pom.xml b/tool-tech-admin/pom.xml
index 8d2e4f2..3b63802 100644
--- a/tool-tech-admin/pom.xml
+++ b/tool-tech-admin/pom.xml
@@ -16,7 +16,26 @@
-
+
+ com.google.guava
+ guava
+ 21.0
+
+
+ com.squareup.okhttp3
+ okhttp
+ 4.9.2
+
+
+ com.alibaba
+ fastjson
+ 1.2.76
+
+
+ com.blueland.bpmclient
+ workflow-sdk
+ 0.1.5
+
com.rzdata
@@ -66,6 +85,18 @@
lombok
+
+
+ com.documents4j
+ documents4j-local
+ 1.0.3
+
+
+ com.documents4j
+ documents4j-transformer-msoffice-word
+ 1.0.3
+
+
@@ -85,17 +116,17 @@
-
- org.apache.maven.plugins
- maven-war-plugin
- 3.1.0
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.1.0
false
${project.artifactId}
-
-
+
+
${project.artifactId}
-
\ No newline at end of file
+
diff --git a/tool-tech-admin/src/main/java/com/rzdata/web/controller/common/CommonController.java b/tool-tech-admin/src/main/java/com/rzdata/web/controller/common/CommonController.java
index 8d840cb..4cf0343 100644
--- a/tool-tech-admin/src/main/java/com/rzdata/web/controller/common/CommonController.java
+++ b/tool-tech-admin/src/main/java/com/rzdata/web/controller/common/CommonController.java
@@ -1,18 +1,5 @@
package com.rzdata.web.controller.common;
-import java.util.ArrayList;
-import java.util.List;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
import com.rzdata.common.config.JaConfig;
import com.rzdata.common.constant.Constants;
import com.rzdata.common.core.domain.AjaxResult;
@@ -20,6 +7,27 @@ import com.rzdata.common.utils.StringUtils;
import com.rzdata.common.utils.file.FileUploadUtils;
import com.rzdata.common.utils.file.FileUtils;
import com.rzdata.framework.config.ServerConfig;
+import com.rzdata.web.domain.Attachment;
+import com.rzdata.web.domain.FileOperationRequest;
+import com.rzdata.web.service.IAttachmentService;
+import com.rzdata.web.service.impl.AttachmentServiceImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.*;
/**
* 通用请求处理
@@ -34,9 +42,13 @@ public class CommonController
@Autowired
private ServerConfig serverConfig;
+ @Autowired
+ private IAttachmentService attachmentService;
+
private static final String FILE_DELIMETER = ",";
+
/**
* 通用下载请求
*
@@ -84,7 +96,8 @@ public class CommonController
String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success();
ajax.put("url", url);
- ajax.put("fileName", fileName);
+ ajax.put("filePath", fileName);
+ ajax.put("suffixType", FileUploadUtils.extractSuffix(fileName));
ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
return ajax;
@@ -160,4 +173,97 @@ public class CommonController
log.error("下载文件失败", e);
}
}
+
+
+
+ /**
+ * 预览下载
+ * txt、pdf、word(doc、docx格式)
+ */
+ @PostMapping("/preview/download")
+ public ResponseEntity resourceDownload(@RequestBody Attachment attachment)
+ {
+ byte[] bytes = attachmentService.loadFileAsBytes(attachment);
+ return ResponseEntity.ok()
+ .contentType(MediaType.parseMediaType("application/octet-stream"))
+ .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + attachment.getFileOldName() + "\"")
+ .body(bytes);
+ }
+
+ @PostMapping("/initUpload")
+ public ResponseEntity