| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.*; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | @PostMapping("add") |
| | | @ApiOperation(value = "新建项目",notes = "notes中存文件地址用 ; 分隔 {\n" + |
| | | " \"proNum\": S0900033,\n" + |
| | | " \"proName\": \"\",\n" + |
| | | " \"proNameCode\": \"yyyyMMddHHmmss格式字符串\",\n" + |
| | | @ApiOperation(value = "项目过程管理-新建项目",notes = "fileList 存文件地址 {\n" + |
| | | " \"fileList\": [\n" + |
| | | " \n" + |
| | | " ],\n" + |
| | | " \"proNum\": \"S0900033\",\n" + |
| | | " \"proName\": \"舰船电气动力试验\",\n" + |
| | | " \"proSort\": 0,\n" + |
| | | " \"proAdmin\": \"张三\",\n" + |
| | | " \"proTel\": 13800003131,\n" + |
| | | " \"proDepartment\": \"xxxx\",\n" + |
| | | " \"proTel\": \"13800003131\",\n" + |
| | | " \"proCreatedate\": \"2021-03-27 08:18:27\",\n" + |
| | | " \"proExecutionDate\": \"2021-03-27 08:18:27\",\n" + |
| | | " \"proExecutionDate1\": \"2021-03-27 08:18:27\",\n" + |
| | |
| | | " \"proFundingSource\": \"经费来源\",\n" + |
| | | " \"proContent\": \" \",\n" + |
| | | " \"proState\": 0,\n" + |
| | | " \"note\": \"拼接多个文件地址\"\n" + |
| | | " \"proProgress\": 0\n" + |
| | | "}") |
| | | public Response add(@RequestBody ProjectManage projectManage) { |
| | | |
| | | public Response add(@RequestBody @Valid ProjectManage projectManage) { |
| | | Response response = service.add(projectManage); |
| | | return response; |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("upload") |
| | | @ApiOperation(notes = "返回文件地址,确认时提交保存到字段", value = "文档材料添加(选择文件)") |
| | | @ApiOperation(notes = "返回文件地址,确认时提交保存到字段", value = "项目过程管理-文档材料添加(选择文件)") |
| | | public Response upload(@RequestParam("file") MultipartFile file) { |
| | | // 获取原始名字 |
| | | String originalFilename = file.getOriginalFilename(); |
| | |
| | | try { |
| | | // 保存到服务器中 |
| | | file.transferTo(dest); |
| | | map.put("文件类型:", file.getContentType()); |
| | | map.put("原文件名:", originalFilename); |
| | | map.put("是否为空:", file.isEmpty()); |
| | | map.put("fileType", file.getContentType()); |
| | | map.put("name", originalFilename); |
| | | Double size = file.getSize() * 0.01 / 1024 / 1024 * 100; |
| | | String douStr = String.format("%.2f", size); |
| | | map.put("文件大小:", douStr+" M"); |
| | | map.put("文件地址:",fileName); |
| | | map.put("fileSize", douStr+" M"); |
| | | map.put("url",fileName); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return response.setMsg(0, "上传失败"); |
| | |
| | | |
| | | |
| | | @PostMapping("/uploads") |
| | | @ApiOperation(notes = "返回文件地址,确认时提交保存到字段", value = "文档材料添加(多选)") |
| | | public Response uploads(MultipartFile[] files) throws IOException { |
| | | @ApiOperation(notes = "返回文件地址,确认时提交保存到字段", value = "项目过程管理-文档材料添加(多选)") |
| | | public Response uploads(MultipartFile[] file) throws IOException { |
| | | Response<Object> response = new Response<>(); |
| | | if (files.length == 0) { |
| | | if (file.length == 0) { |
| | | return response.setMsg(0, "请选择要上传的文件"); |
| | | } |
| | | |
| | | ArrayList<Object> list = new ArrayList<>(); |
| | | for (MultipartFile multipartFile : files) { |
| | | for (MultipartFile multipartFile : file) { |
| | | if (multipartFile.isEmpty()) { |
| | | return response.setMsg(0, "请选择要上传的文件"); |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | return response.setMsg(0, "上传失败"); |
| | | } |
| | | map.put("原文件名:", originalFilename); |
| | | map.put("文件地址:", filePath + fileName); |
| | | map.put("fileName", originalFilename); |
| | | map.put("url", filePath + fileName); |
| | | list.add(map); |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | @GetMapping("/download") |
| | | @ApiOperation(notes = "需要在地址栏测试",value = "文档材料下载") |
| | | @ApiOperation(notes = "需要在地址栏测试",value = "项目过程管理-文档材料下载") |
| | | public Object download(HttpServletResponse response, @RequestParam String filePath,@RequestParam String fileName) { |
| | | Response<Object> result = new Response<>(); |
| | | File file = new File( filePath); |
| | |
| | | |
| | | |
| | | @GetMapping("managesState") |
| | | @ApiOperation(notes = "", value = "项目管理-己确认/未确认阶段查询") |
| | | @ApiOperation(notes = "", value = "项目过程管理-己确认/未确认阶段查询") |
| | | public Response<Object> searchManageStateByCondition(@ApiParam(value = "项目编号", required = true) @RequestParam String proNum, |
| | | @ApiParam(value = "项目名称代码", required = true) @RequestParam String proNameCode) { |
| | | ProjectManage projectManage = new ProjectManage(); |
| | |
| | | * @return |
| | | */ |
| | | @PutMapping("updateManageState") |
| | | @ApiOperation(notes = "项目进度确认1-6 对应 立项-审批-研究-结题-验收-归档",value = "项目管理-未确认阶段更新") |
| | | public Response updateManageState(@ApiParam(value = "项目编号", required = true) @RequestParam String proNum, |
| | | @ApiParam(value = "项目名称代码", required = true) @RequestParam String proNameCode, |
| | | @ApiParam(value = "项目进度确认1-6",required = true)@RequestParam int proProgress, |
| | | @ApiParam(value = "文档上传保存地址(如果无传空字符串)",required = true)@RequestParam String proFilePath) { |
| | | ProjectManage projectManage = new ProjectManage(); |
| | | projectManage.setProNum(proNum); |
| | | projectManage.setProNameCode(proNameCode); |
| | | projectManage.setProProgress(proProgress); |
| | | projectManage.setNote(proFilePath); |
| | | @ApiOperation(notes = "项目进度确认1-6 对应 立项-审批-研究-结题-验收-归档",value = "项目过程管理-未确认阶段更新") |
| | | public Response updateManageState(@RequestBody ProjectManage projectManage) { |
| | | |
| | | return service.updateManageState(projectManage); |
| | | } |
| | | |
| | | @PutMapping("updateArchive") |
| | | @ApiOperation(notes = "",value = "项目过程管理-归档") |
| | | public Response updateArchive(@ApiParam(value = "项目编号", required = true) @RequestParam String proNum, |
| | | @ApiParam(value = "项目名称代码", required = true) @RequestParam String proNameCode) { |
| | | ProjectManage projectManage = new ProjectManage(); |
| | | projectManage.setProNum(proNum); |
| | | projectManage.setProNameCode(proNameCode); |
| | | projectManage.setProProgress(6); |
| | | return service.updateProjectProgress(projectManage); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("searchDoc") |
| | | @ApiOperation(notes = "项目过程管理-项目管理",value = "文档材料查询") |
| | | @ApiOperation(notes = "项目过程管理-项目管理",value = "项目过程管理-文档材料查询") |
| | | public Response searchDocumentation(@ApiParam(value = "项目编号", required = true) @RequestParam String proNum, |
| | | @ApiParam(value = "项目名称代码", required = true) @RequestParam String proNameCode){ |
| | | ProjectArchiveManage projectArchiveManage = new ProjectArchiveManage(); |
| | |
| | | } |
| | | |
| | | @DeleteMapping("delDoc") |
| | | @ApiOperation(notes = "项目过程管理-项目管理",value = "文档材料删除") |
| | | @ApiOperation(notes = "项目过程管理-项目管理",value = "项目过程管理-文档材料删除") |
| | | public Response delDocumentation(@ApiParam(value = "项目编号", required = true) @RequestParam String proNum, |
| | | @ApiParam(value = "项目名称代码", required = true) @RequestParam String proNameCode, |
| | | @ApiParam(value = "文档路径", required = true) @RequestParam String proFilePath){ |
| | |
| | | return archiveManageService.delDocumentation(projectArchiveManage); |
| | | } |
| | | |
| | | @GetMapping("archiveAll") |
| | | @ApiOperation(value = "项目归档管理-查询所有") |
| | | public Response<List<ProjectManage>> searchArchiveAll() { |
| | | |
| | | return archiveManageService.searchArchiveAll(); |
| | | } |
| | | |
| | | @PostMapping("archiveByCondition") |
| | | @ApiOperation(value = "项目归档管理-查询分页-根据筛选条件") |