| | |
| | | |
| | | |
| | | @GetMapping("/download") |
| | | @ApiOperation(notes = "需要在地址栏测试",value = "项目过程管理-文档材料下载") |
| | | public Object download(HttpServletResponse response, @RequestParam String filePath,@RequestParam String fileName) { |
| | | Response<Object> result = new Response<>(); |
| | | File file = new File( filePath); |
| | | @ApiOperation(notes = "需要在地址栏测试 http://localhost:8090/projectManage/download?fileName=申请书.pdf",value = "项目过程管理-文档材料下载") |
| | | public String download(HttpServletResponse response, @ApiParam(value = "文件路径",required = true)@RequestParam String filePath) { |
| | | String fileName = ""; |
| | | if (filePath.length() > 10&&filePath.contains("/")) { //IP地址+文件名 |
| | | int lastIndexOf = filePath.lastIndexOf("/"); |
| | | fileName = filePath.substring(lastIndexOf); |
| | | } else { |
| | | return "filePath is Error"; |
| | | } |
| | | |
| | | String projectPath = FileUtils.getProjectPath(); |
| | | File file = new File( projectPath+fileName); |
| | | if (file.exists()) { |
| | | try { |
| | | fileName= new String(fileName.getBytes("gbk"), "ISO8859-1"); |
| | |
| | | outputStream.write(buffer, 0, i); |
| | | i = bis.read(buffer); |
| | | } |
| | | return result.setMsg(1,"下载成功"); |
| | | // return result.setMsg(1,"下载成功"); |
| | | return "downloadSuccessful"; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return result.setMsg(0,"下载失败"); |
| | | // return result.setMsg(0,"下载失败"); |
| | | return "downloadFailed"; |
| | | } finally { |
| | | if (bis != null) { |
| | | try { |
| | |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | return "fileDoesNotExist"; |
| | | } |
| | | return result.setMsg(0,"文件不存在"); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | /** |
| | | * @param proNameCode |
| | | * @param proNum |
| | | * @return 实验名称、上传日期、归档日期 (操作TODO) |
| | | * @return 实验名称、试验日期、结论字段 etc |
| | | */ |
| | | @GetMapping("archiveExperimentData") |
| | | @ApiOperation(notes = "(操作TODO)",value = "项目归档管理-试验数据") |
| | | public Response searchArchiveExperimentData(@ApiParam(value = "项目名称代码", required = true) @RequestParam String proNameCode, |
| | | @ApiParam(value = "项目编号", required = true) @RequestParam String proNum) { |
| | | ProjectArchiveManage pam = new ProjectArchiveManage(); |
| | | pam.setProNum(proNum); |
| | | pam.setProNameCode(proNameCode); |
| | | return archiveManageService.searchArchiveExperimentData(pam); |
| | | @ApiOperation(notes = "TODO 文件格式和下载地址", value = "项目归档管理-试验数据") |
| | | public Response searchArchiveExperimentData(@ApiParam(value = "项目名称代码", required = true) @RequestParam String proNameCode) { |
| | | //TODO fileName file |
| | | return archiveManageService.searchArchiveExperimentData(proNameCode); |
| | | } |
| | | |
| | | @GetMapping("archiveTechnologicalAchievements") |