| | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | mmap.put("projectId", id); |
| | | mmap.put("type", type); |
| | | 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"; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |