From 22c2dcfdcdd0e4eddbfe3429a75b69cf61a9d0ff Mon Sep 17 00:00:00 2001 From: lxw <810412026@qq.com> Date: 星期五, 09 九月 2022 10:04:27 +0800 Subject: [PATCH] 产品设定可行性 --- src/main/java/com/whyc/controller/SoftwareController.java | 40 +++++++++++++++++++++++++++++++++------- 1 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/whyc/controller/SoftwareController.java b/src/main/java/com/whyc/controller/SoftwareController.java index d8fb87c..785aae7 100644 --- a/src/main/java/com/whyc/controller/SoftwareController.java +++ b/src/main/java/com/whyc/controller/SoftwareController.java @@ -1,17 +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.*; 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 = "杞欢绠$悊-鏂扮増") @@ -22,9 +26,9 @@ @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; @@ -37,11 +41,33 @@ return response; } - @ApiOperation(value = "鏌ヨ杞欢鍒楄〃鐨勪俊鎭�") - @GetMapping("getAllSoftware") - public Response getAllSoftware(@RequestParam(required = false) String fileName,@RequestParam int pageCurr,@RequestParam int pageSize ){ - return service.getAllSoftware(fileName,pageCurr,pageSize); + @ApiOperation("杞欢涓婁紶") + @PostMapping("upload") + public Response upload(@RequestParam MultipartFile file1,@RequestParam MultipartFile file2,@RequestParam String softwareStr) throws IOException { + List<Software> softwareList = ActionUtil.getGson().fromJson(softwareStr,new TypeToken<List<Software>>(){}.getType()); + return service.upload(file1,file2,softwareList); } + @ApiOperation(value = "鏌ヨ杞欢鍒楄〃鐨勪俊鎭�") + @GetMapping("getAllSoftware") + public Response getAllSoftware(@RequestParam(required = false) String fileName, + @RequestParam(required = false) String applyMaterialCode, + @RequestParam(required = false) String applyModel, + @RequestParam(required = false) String owner, + @RequestParam int pageCurr,@RequestParam int pageSize ){ + return service.getAllSoftware(fileName,applyMaterialCode,applyModel,owner,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); + } } -- Gitblit v1.9.1