lxw
2023-06-26 6985cc8f84d3f6e6b1dc6b7002edc13bbca457c2
src/main/java/com/whyc/controller/SOPController.java
@@ -1,19 +1,27 @@
package com.whyc.controller;
import com.google.gson.reflect.TypeToken;
import com.whyc.dto.Response;
import com.whyc.dto.SopDto;
import com.whyc.pojo.SOP;
import com.whyc.pojo.SOPProduct;
import com.whyc.pojo.Software;
import com.whyc.service.SOPService;
import com.whyc.util.ActionUtil;
import com.whyc.util.DateUtil;
import com.whyc.util.FileUtil;
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.ArrayList;
import java.util.Date;
import java.util.List;
@RequestMapping("sop")
@RestController
@@ -32,8 +40,30 @@
        if(!name.substring(name.length()-4).equals(".xls") && !name.substring(name.length()-5).equals(".xlsx")){
            response.set(1,false,"文件解析错误:上传格式非excel格式");
        }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 int pageCurr, @RequestParam int pageSize) {
        return service.getSopInfo(list,code,model,pageCurr,pageSize);
    }
    @ApiOperation("更新sop说明(不含锁信息)")
    @PostMapping("updateSop")
    public Response updateSop(@RequestBody SOP sop) {
        return service.updateSop(sop);
    }
}