From 66db1d15cf5d4b51a346a42b66f0505bd7f31ce0 Mon Sep 17 00:00:00 2001 From: whycxzp <glperry@163.com> Date: 星期三, 03 一月 2024 15:23:47 +0800 Subject: [PATCH] 解压 --- src/main/java/com/whyc/controller/SOPController.java | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/whyc/controller/SOPController.java b/src/main/java/com/whyc/controller/SOPController.java index 74d4396..57bf7f4 100644 --- a/src/main/java/com/whyc/controller/SOPController.java +++ b/src/main/java/com/whyc/controller/SOPController.java @@ -1,19 +1,21 @@ package com.whyc.controller; import com.whyc.dto.Response; +import com.whyc.dto.SopDto; +import com.whyc.pojo.SOP; +import com.whyc.pojo.SOPLockLog; import com.whyc.service.SOPService; +import com.whyc.util.ActionUtil; import io.swagger.annotations.Api; 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 java.io.IOException; import java.text.ParseException; +import java.util.List; @RequestMapping("sop") @RestController @@ -32,8 +34,42 @@ if(!name.substring(name.length()-4).equals(".xls") && !name.substring(name.length()-5).equals(".xlsx")){ response.set(1,false,"鏂囦欢瑙f瀽閿欒:涓婁紶鏍煎紡闈瀍xcel鏍煎紡"); }else{ - response = service.excelParse(multipartFile.getInputStream()); + response = service.excelParse(multipartFile); } return response; } + + @ApiOperation("纭畾sop") + @PostMapping("confirm") + public Response add(@RequestParam MultipartFile multipartFile,@RequestParam String sopStr) throws IOException { + SOP sop=ActionUtil.getGson().fromJson(sopStr,SOP.class); + return service.add(sop,multipartFile); + } + + @ApiOperation("鏌ヨsop淇℃伅") + @PostMapping("getSopInfo") + public Response getSopInfo(@RequestBody(required = false) List<SopDto> list + , @RequestParam(required = false) String code, @RequestParam(required = false) String model, @RequestParam(required = false) Integer status + , @RequestParam int pageCurr, @RequestParam int pageSize) { + return service.getSopInfo(list,code,model,status,pageCurr,pageSize); + } + + @ApiOperation("鏌ヨsop鍘嗗彶") + @GetMapping("getSopHis") + public Response getSopHis(@RequestParam(required = false) String fileName) { + return service.getSopHis(fileName); + } + + @ApiOperation("鏇存柊sop璇存槑锛堜笉鍚攣淇℃伅锛�") + @PostMapping("updateSop") + public Response updateSop(@RequestBody SOP sop) { + return service.updateSop(sop); + } + + @ApiOperation("璁剧疆sop鏈夋晥鐘舵��") + @PutMapping("updateStatusById") + public Response updateStatusById(@RequestBody SOPLockLog lockLog) { + return service.updateStatusById(lockLog); + } + } -- Gitblit v1.9.1