| | |
| | | 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; |
| | |
| | | * 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()); |