From 3e9ea659ab76fa036390c49ca63e6f64fc451598 Mon Sep 17 00:00:00 2001 From: whycrzg <ruanzhigang@whycst.com> Date: 星期四, 01 四月 2021 11:46:17 +0800 Subject: [PATCH] 修改 项目管理更新 --- src/main/java/com/whyc/controller/ProjectManageController.java | 77 +++++++++++++++++++++----------------- 1 files changed, 43 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/whyc/controller/ProjectManageController.java b/src/main/java/com/whyc/controller/ProjectManageController.java index 293b106..9b8e63c 100644 --- a/src/main/java/com/whyc/controller/ProjectManageController.java +++ b/src/main/java/com/whyc/controller/ProjectManageController.java @@ -18,7 +18,9 @@ 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.*; @@ -48,13 +50,16 @@ } @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" + @@ -63,10 +68,9 @@ " \"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; } @@ -79,7 +83,7 @@ * @return */ @PostMapping("upload") - @ApiOperation(notes = "杩斿洖鏂囦欢鍦板潃锛岀‘璁ゆ椂鎻愪氦淇濆瓨鍒板瓧娈�", value = "鏂囨。鏉愭枡娣诲姞(閫夋嫨鏂囦欢)") + @ApiOperation(notes = "杩斿洖鏂囦欢鍦板潃锛岀‘璁ゆ椂鎻愪氦淇濆瓨鍒板瓧娈�", value = "椤圭洰杩囩▼绠$悊-鏂囨。鏉愭枡娣诲姞(閫夋嫨鏂囦欢)") public Response upload(@RequestParam("file") MultipartFile file) { // 鑾峰彇鍘熷鍚嶅瓧 String originalFilename = file.getOriginalFilename(); @@ -100,13 +104,12 @@ 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, "涓婁紶澶辫触"); @@ -119,15 +122,15 @@ @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, "璇烽�夋嫨瑕佷笂浼犵殑鏂囦欢"); } @@ -145,8 +148,8 @@ 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); } @@ -156,7 +159,7 @@ @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); @@ -208,7 +211,7 @@ @GetMapping("managesState") - @ApiOperation(notes = "", value = "椤圭洰绠$悊-宸辩‘璁�/鏈‘璁ら樁娈垫煡璇�") + @ApiOperation(notes = "", value = "椤圭洰杩囩▼绠$悊-宸辩‘璁�/鏈‘璁ら樁娈垫煡璇�") public Response<Object> searchManageStateByCondition(@ApiParam(value = "椤圭洰缂栧彿", required = true) @RequestParam String proNum, @ApiParam(value = "椤圭洰鍚嶇О浠g爜", required = true) @RequestParam String proNameCode) { ProjectManage projectManage = new ProjectManage(); @@ -223,22 +226,28 @@ * @return */ @PutMapping("updateManageState") - @ApiOperation(notes = "椤圭洰杩涘害纭1-6 瀵瑰簲 绔嬮」-瀹℃壒-鐮旂┒-缁撻-楠屾敹-褰掓。",value = "椤圭洰绠$悊-鏈‘璁ら樁娈垫洿鏂�") - public Response updateManageState(@ApiParam(value = "椤圭洰缂栧彿", required = true) @RequestParam String proNum, - @ApiParam(value = "椤圭洰鍚嶇О浠g爜", 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 = "椤圭洰鍚嶇О浠g爜", 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 = "椤圭洰鍚嶇О浠g爜", required = true) @RequestParam String proNameCode){ ProjectArchiveManage projectArchiveManage = new ProjectArchiveManage(); @@ -249,7 +258,7 @@ } @DeleteMapping("delDoc") - @ApiOperation(notes = "椤圭洰杩囩▼绠$悊-椤圭洰绠$悊",value = "鏂囨。鏉愭枡鍒犻櫎") + @ApiOperation(notes = "椤圭洰杩囩▼绠$悊-椤圭洰绠$悊",value = "椤圭洰杩囩▼绠$悊-鏂囨。鏉愭枡鍒犻櫎") public Response delDocumentation(@ApiParam(value = "椤圭洰缂栧彿", required = true) @RequestParam String proNum, @ApiParam(value = "椤圭洰鍚嶇О浠g爜", required = true) @RequestParam String proNameCode, @ApiParam(value = "鏂囨。璺緞", required = true) @RequestParam String proFilePath){ -- Gitblit v1.9.1