From 563619a5cb13b6f9fdaac2a87467780ced71c135 Mon Sep 17 00:00:00 2001
From: suerwei <18810552194@163.com>
Date: 星期六, 18 五月 2024 16:22:39 +0800
Subject: [PATCH] 附件详情

---
 javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java |   97 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 92 insertions(+), 5 deletions(-)

diff --git a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java
index 7380ad3..73a71ef 100644
--- a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java
+++ b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java
@@ -1,16 +1,18 @@
 package com.javaweb.geo.controller;
 
+import java.io.File;
+import java.util.ArrayList;
 import java.util.List;
 
+import cn.hutool.core.io.FileUtil;
+import com.javaweb.common.config.Global;
+import com.javaweb.geo.vo.FileVo;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.*;
 import com.javaweb.common.annotation.Log;
 import com.javaweb.common.enums.BusinessType;
 import com.javaweb.geo.domain.ProjectData;
@@ -19,6 +21,9 @@
 import com.javaweb.common.core.domain.AjaxResult;
 import com.javaweb.common.utils.poi.ExcelUtil;
 import com.javaweb.common.core.page.TableDataInfo;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * 椤圭洰璧勬枡Controller
@@ -42,7 +47,45 @@
         return prefix + "/projectData";
     }
 
+    @RequiresPermissions("geo:projectData:view")
+    @GetMapping("/2")
+    public String projectData2(String id, String type, ModelMap mmap) {
+        mmap.put("projectId", id);
+        mmap.put("type", type);
+        return prefix + "/projectData2";
+    }
 
+    /**
+     * 瀵煎叆鍘嬬缉鍖�
+     */
+    @GetMapping("/importImg")
+    public String importPdf(){
+        return prefix + "/upload";
+    }
+
+    /**
+     * 鍥剧墖灞曠ず
+     */
+    @GetMapping("/viewImage")
+    public String viewImage(ModelMap mmap, @RequestParam("id") String id){
+        ProjectData data = projectDataService.selectProjectDataById(id);
+        String path = "";
+        if (!ObjectUtils.isEmpty(data)){
+            path = data.getDataUrl();
+        }
+        mmap.put("urlAddress",path);
+        return  prefix + "/image_view";
+    }
+
+    /**
+     * 椤圭洰鏂囦欢鍒楄〃椤甸潰
+     * @return
+     */
+    @GetMapping("/projectDataFileList")
+    public String projectDataFileList(String id ,ModelMap modelMap){
+        modelMap.put("id",id);
+        return prefix + "/files";
+    }
 
     /**
      * 鏌ヨ椤圭洰璧勬枡鍒楄〃
@@ -121,4 +164,48 @@
     public AjaxResult remove(String ids) {
         return toAjax(projectDataService.deleteProjectDataByIds(ids));
     }
+
+    /**
+     * 涓婁紶鍘嬬缉鍖�
+     */
+    @PostMapping("/uploadZIP")
+    @ResponseBody
+    public AjaxResult uploadZIP(MultipartFile file, HttpServletRequest request){
+        return projectDataService.uploadZIP(file,request);
+    }
+
+    /**
+     * 鑾峰彇鏂囦欢鍒楄〃
+     * @param id
+     * @return
+     */
+    @PostMapping( "/listFile")
+    @ResponseBody
+    public TableDataInfo listFile(String id){
+        List<FileVo> paths = new ArrayList<>();
+        ProjectData projectData = projectDataService.selectProjectDataById(id);
+//        if (!ObjectUtils.isEmpty(projectData)){
+//            String num = project.getNum();
+//
+//            String diskPath = Global.getUploadPath()  + "\\sources\\椤圭洰璧勬枡\\"+num;
+//
+//            File file = new File(diskPath);
+//
+//            if(FileUtil.exist(file)){
+//                if(file.isDirectory()){
+//                    File []lists  = file.listFiles();
+//                    for(int i =0;i<lists.length;i++){
+//                        String name =lists[i].getName();
+//                        String path = urlPrefixPath + num + "/" +name;
+//                        FileVo vo  = new FileVo() ;
+//                        vo.setName(name);
+//                        vo.setPath(path);
+//                        paths.add(vo);
+//                    }
+//                }
+//            }
+//        }
+        return getDataTable(paths);
+    }
+
 }

--
Gitblit v1.9.1