| | |
| | | package com.ycl.utils; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.ycl.dto.UmsDepartDto; |
| | | import com.ycl.utils.listener.DepartListener; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Collection; |
| | | |
| | | public class EasyExcelUtils { |
| | | |
| | | |
| | | /** |
| | | * @Description 导出 |
| | |
| | | .sheet(sheetName) |
| | | .doWrite(collection); |
| | | } |
| | | |
| | | @SneakyThrows |
| | | public static void importDepartFile(MultipartFile file) throws IOException { |
| | | EasyExcel.read(file.getInputStream()) |
| | | .head(UmsDepartDto.class) |
| | | .registerReadListener(new DepartListener()).sheet().doRead(); |
| | | } |
| | | |
| | | } |