@Test
    public  void write2Excel(){
       String filePath = "C:/logpath/"+"202003"+"/";
       String fileName="202003log.xlsx";
       XSSFWorkbook workbook = new XSSFWorkbook();
        // 创建一个工作表sheet
        try {
            // 创建一个文件
            File file = new File(filePath+fileName);
            if (!file.getParentFile().exists()) {
                //判断父目录路径是否存在,即202003log.xlsx前的C:/logpath/202003/
                try {
                    file.getParentFile().mkdirs();
                    //不存在则创建父目录
                    file.createNewFile();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            FileOutputStream outputStream = new FileOutputStream(file);
            workbook.write(outputStream);
            workbook.close();
            outputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }