瀏覽代碼

花都智慧文档系统,pc下载链接

wanyuan 6 月之前
父節點
當前提交
62f51cb2dd

+ 37 - 0
tip-front/src/main/java/com/minto/app/organization/workpro/controller/WorkproController.java

@@ -1,12 +1,18 @@
 package com.minto.app.organization.workpro.controller;
 
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.net.URLDecoder;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.text.MessageFormat;
 import java.util.HashMap;
 import java.util.Map;
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -53,6 +59,9 @@ public class WorkproController{
     @Autowired
     private PrincipalService principalService;
 
+    @Autowired
+    private ServletContext servletContext;
+
     @PostMapping("/sync")
     public void syncSystem(HttpServletResponse response) throws IOException{
         Map<String, Object> res = new HashMap<>();
@@ -123,4 +132,32 @@ public class WorkproController{
         }
         return null;
     }
+
+    @GetMapping("/client/download")
+    @NeedlessCheckLogin
+    public void download(HttpServletResponse response) throws IOException{
+        String filePath = "/WEB-INF/lib/";
+        String fileName = "WorkProClient_Setup_V2.3.09.1800-20240719.exe";
+        String realPath = servletContext.getRealPath(filePath + fileName);
+
+        // 检查文件是否存在
+        Path path = Paths.get(realPath);
+        if(!Files.exists(path)){
+            response.sendError(HttpServletResponse.SC_NOT_FOUND, "File not found");
+            return;
+        }
+
+        // 设置响应头
+        response.setContentType("application/octet-stream");
+        response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
+
+        // 流式传输文件
+        try(InputStream in = Files.newInputStream(path); OutputStream out = response.getOutputStream()){
+            byte[] buffer = new byte[4096];
+            int bytesRead;
+            while((bytesRead = in.read(buffer)) != -1){
+                out.write(buffer, 0, bytesRead);
+            }
+        }
+    }
 }

二進制
tip-front/src/main/webapp/WEB-INF/lib/WorkProClient_Setup_V2.3.09.1800-20240719.exe


+ 3 - 0
tip-front/src/main/webapp/WEB-INF/pages/tip/main/login.html

@@ -139,6 +139,9 @@
                          :src="baseUrl + qrCodeImg" @error="qrCodeImgError()">
                 </div>
             </div>-->
+            <div class="checkbox-content" style="margin-top: 5rem">
+                <a :href="baseUrl+'/workpro/client/download'">点击下载IM客户端</a>
+            </div>
         </div>
 
         <h6 id="h6" v-if="isShow">版权所有:成都明途科技有限公司 ©2011-{{year}}