地质所 沉降监测网建设项目
suerwei
2024-05-18 563619a5cb13b6f9fdaac2a87467780ced71c135
javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/ProjectDataController.java
@@ -1,7 +1,12 @@
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;
@@ -70,6 +75,16 @@
        }
        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";
    }
    /**
@@ -159,4 +174,38 @@
        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);
    }
}