From eb33c60306f707ec7b30a048388e4de702ca2f15 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期四, 06 三月 2025 08:24:51 +0800
Subject: [PATCH] 查询日期三天内的所有上传软件

---
 src/main/java/com/whyc/controller/SoftwareController.java |   77 ++++++++++++++++++++++++++++++++++----
 1 files changed, 68 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/whyc/controller/SoftwareController.java b/src/main/java/com/whyc/controller/SoftwareController.java
index 0ac33c0..d38d2d3 100644
--- a/src/main/java/com/whyc/controller/SoftwareController.java
+++ b/src/main/java/com/whyc/controller/SoftwareController.java
@@ -1,19 +1,21 @@
 package com.whyc.controller;
 
+import com.google.gson.reflect.TypeToken;
 import com.whyc.dto.Response;
 import com.whyc.pojo.Software;
 import com.whyc.service.SoftwareService;
+import com.whyc.util.ActionUtil;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.text.ParseException;
 import java.util.List;
 
 @Api(tags = "杞欢绠$悊-鏂扮増")
@@ -24,19 +26,76 @@
     @Autowired
     private SoftwareService service;
 
-    @ApiModelProperty("excel瑙f瀽")
+    @ApiOperation("excel瑙f瀽")
     @PostMapping("excelParse")
-    public Response excelParse(@RequestParam MultipartFile multipartFile) throws IOException, InvalidFormatException {
+    public Response excelParse(@RequestParam MultipartFile multipartFile) throws IOException, InvalidFormatException, ParseException {
         Response<Object> response = new Response<>();
         String name=multipartFile.getOriginalFilename();
         assert name != null;
         if(!name.substring(name.length()-4).equals(".xls") && !name.substring(name.length()-5).equals(".xlsx")){
             response.set(1,false,"鏂囦欢瑙f瀽閿欒:涓婁紶鏍煎紡闈瀍xcel鏍煎紡");
         }else{
-            List<Software> list = service.excelParse(multipartFile.getInputStream());
-            response.setII(1,true,list,"鏂囦欢瑙f瀽鎴愬姛");
+            response =  service.excelParse(multipartFile.getInputStream());
         }
         return response;
     }
 
+    @ApiOperation("杞欢涓婁紶")
+    @PostMapping("upload")
+    public Response upload(@RequestParam MultipartFile file1,@RequestParam MultipartFile file2,@RequestParam String fontUpdateTime,@RequestParam String softwareStr) throws IOException {
+        List<Software> softwareList = ActionUtil.getGson().fromJson(softwareStr,new TypeToken<List<Software>>(){}.getType());
+        return service.upload(file1,file2,fontUpdateTime,softwareList);
+    }
+
+    @ApiOperation("鏇存柊杞欢鐗堟湰瀵瑰簲鐨勯�傜敤鏈哄瀷")
+    @PutMapping("applyModel")
+    public Response updateApplyModel(@RequestParam MultipartFile multipartFile,@RequestParam String softwareStr) throws IOException {
+        List<Software> softwareList = ActionUtil.getGson().fromJson(softwareStr,new TypeToken<List<Software>>(){}.getType());
+        return service.updateApplyModel(multipartFile,softwareList);
+    }
+
+    /**
+     *lockFlag :
+     * 鍏ㄩ儴 11
+     * 鍙敤 0
+     * 涓嶅彲鐢� 12
+     * 寰呮祴璇� -1
+     */
+    @ApiOperation(value = "鏌ヨ杞欢鍒楄〃鐨勪俊鎭�")
+    @GetMapping("getAllSoftware")
+    public Response getAllSoftware(
+                                   @RequestParam(required = false) Integer lockFlag,
+                                   @RequestParam(required = false) String fileName,
+                                   @RequestParam(required = false) String applyMaterialCode,
+                                   @RequestParam(required = false) String applyModel,
+                                   @RequestParam(required = false) String owner,
+                                   @RequestParam(required = false) String boardNumber,
+                                   @RequestParam(required = false) String version,
+                                   @RequestParam int pageCurr,@RequestParam int pageSize ){
+        return service.getAllSoftware(lockFlag,fileName,applyMaterialCode,applyModel,owner,boardNumber,version,pageCurr,pageSize);
+    }
+
+    @ApiOperation(value = "鏍规嵁subcode鏌ヨ杞欢鍒楄〃")
+    @GetMapping("getSoftBySubCode")
+    public Response getSoftBySubCode(@RequestParam String subCode ){
+        return service.getSoftBySubCode(subCode);
+    }
+
+    @ApiOperation(value = "鏍规嵁杞欢id瀹炵幇杞欢涓嬭浇")
+    @GetMapping("downLoadSoftware")
+    public void downLoadSoftware(HttpServletRequest req, HttpServletResponse resp, @RequestParam int id){
+        service.downLoadSoftware(req,resp,id);
+    }
+
+    @ApiOperation(value = "鏍规嵁杞欢id淇敼杞欢閿佸畾鐘舵��")
+    @GetMapping("updateSoftwareLock")
+    public Response updateSoftwareLock(@RequestParam String fileUrl,@RequestParam int lockFlag,@RequestParam int lockFlagNow,@RequestParam String localReason){
+        return service.updateSoftwareLock(fileUrl,lockFlagNow,lockFlag,localReason);
+    }
+
+    @ApiOperation(value = "鏍规嵁杞欢杞欢鍚嶅疄鐜拌蒋浠跺垹闄�")
+    @GetMapping("deleteSoftware")
+    public Response deleteSoftware( @RequestParam String fileName,@RequestParam String version){
+        return service.deleteSoftware(fileName,version);
+    }
 }

--
Gitblit v1.9.1