whycxzp
2023-08-03 04704cc4ca472375fdd9bd8c20d9fab4dca67b0a
src/main/java/com/whyc/controller/ProductBomApprovingController.java
@@ -1,20 +1,16 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.pojo.ProductBom;
import com.whyc.pojo.ProductBomApproving;
import com.whyc.service.ProductBomApprovingService;
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.nio.channels.MulticastChannel;
import java.util.List;
/**
@@ -22,7 +18,7 @@
 */
@RestController
@RequestMapping("bomApproving")
@Api(tags = "产品bom审批")
@Api(tags = "工作流子表-产品bom审批表")
public class ProductBomApprovingController {
    @Autowired
@@ -32,10 +28,11 @@
     * excel解析bom
     */
    @PostMapping("excelParse")
    @ApiOperation("excel解析")
    public Response excelParse(@RequestParam("file") MultipartFile file) throws IOException, InvalidFormatException {
        Response<Object> response = new Response<>();
        String name=file.getOriginalFilename();
        if(!name.substring(name.length()-4).equals(".xls") || !name.substring(name.length()-5).equals(".xlsx")){
        if(!name.substring(name.length()-4).equals(".xls") && !name.substring(name.length()-5).equals(".xlsx")){
            response.set(1,false,"文件解析错误");
        }else{
            List<ProductBomApproving> list = service.excelParse(file.getInputStream());
@@ -44,4 +41,16 @@
        return response;
    }
    @PostMapping("zipParse")
    @ApiOperation("zip解析")
    public Response zipParse(@RequestParam("file") MultipartFile file) throws IOException, InvalidFormatException {
        return service.zipParse(file);
    }
    @GetMapping("dwgReview")
    @ApiOperation("dwg文件预览")
    public Response dwgReview(@RequestParam String dwgUrl) throws IOException {
        return service.dwgReview(dwgUrl);
    }
}