From 5e127bec7fdd0272fa90c97ea79d26b0d8d42581 Mon Sep 17 00:00:00 2001
From: whycrzg <ruanzhigang@whycst.com>
Date: 星期三, 31 三月 2021 14:27:54 +0800
Subject: [PATCH] 更新

---
 src/main/java/com/whyc/controller/ProjectManageController.java |   51 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/whyc/controller/ProjectManageController.java b/src/main/java/com/whyc/controller/ProjectManageController.java
index e990255..0c81067 100644
--- a/src/main/java/com/whyc/controller/ProjectManageController.java
+++ b/src/main/java/com/whyc/controller/ProjectManageController.java
@@ -18,6 +18,7 @@
 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.*;
@@ -49,7 +50,7 @@
     }
 
     @PostMapping("add")
-    @ApiOperation(value = "鏂板缓椤圭洰",notes = "fileList 瀛樻枃浠跺湴鍧� {\n" +
+    @ApiOperation(value = "椤圭洰杩囩▼绠$悊-鏂板缓椤圭洰",notes = "fileList 瀛樻枃浠跺湴鍧� {\n" +
             "  \"fileList\": [\n" +
             "    \n" +
             "  ],\n" +
@@ -69,7 +70,7 @@
             "  \"proState\": 0,\n" +
             "  \"proProgress\": 0\n" +
             "}")
-    public Response add(@RequestBody ProjectManage projectManage) {
+    public Response add(@RequestBody @Valid ProjectManage projectManage) {
         Response response = service.add(projectManage);
         return response;
     }
@@ -82,7 +83,7 @@
      * @return
      */
     @PostMapping("upload")
-    @ApiOperation(notes = "杩斿洖鏂囦欢鍦板潃锛岀‘璁ゆ椂鎻愪氦淇濆瓨鍒板瓧娈�", value = "鏂囨。鏉愭枡娣诲姞(閫夋嫨鏂囦欢)")
+    @ApiOperation(notes = "杩斿洖鏂囦欢鍦板潃锛岀‘璁ゆ椂鎻愪氦淇濆瓨鍒板瓧娈�", value = "椤圭洰杩囩▼绠$悊-鏂囨。鏉愭枡娣诲姞(閫夋嫨鏂囦欢)")
     public Response upload(@RequestParam("file") MultipartFile file) {
         // 鑾峰彇鍘熷鍚嶅瓧
         String originalFilename = file.getOriginalFilename();
@@ -103,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("fileName", 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, "涓婁紶澶辫触");
@@ -122,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, "璇烽�夋嫨瑕佷笂浼犵殑鏂囦欢");
             }
@@ -148,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);
 
         }
@@ -159,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);
@@ -211,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();
@@ -226,7 +226,7 @@
      * @return
      */
     @PutMapping("updateManageState")
-    @ApiOperation(notes = "椤圭洰杩涘害纭1-6 瀵瑰簲 绔嬮」-瀹℃壒-鐮旂┒-缁撻-楠屾敹-褰掓。",value = "椤圭洰绠$悊-鏈‘璁ら樁娈垫洿鏂�")
+    @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,
@@ -239,9 +239,22 @@
         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();
@@ -252,7 +265,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