package com.koobietech.eas.controller;

import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.handler.inter.IReadHandler;
import cn.afterturn.easypoi.handler.inter.IWriter;
import com.koobietech.eas.common.constant.UserType;
import com.koobietech.eas.common.pojo.JwtUserDto;
import com.koobietech.eas.common.service.RedisService;
import com.koobietech.eas.common.utils.JwtManager;
import com.koobietech.eas.common.utils.PasswordManager;
import com.koobietech.eas.common.utils.StudentArchiveGenerator;
import com.koobietech.eas.mbg.model.EasArcTlsScores;
import com.koobietech.eas.mbg.model.EasSysLogs;
import org.apache.poi.ss.usermodel.Workbook;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.io.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;


@SpringBootTest
class ControllerApplicationTests {

    @Value("${project.path}")
    String archivesSavePath;

    @Test
    void test() {

        System.out.println(
                archivesSavePath
        );

//        System.out.println(StudentArchiveGenerator.generateStudentCode(
//                "2211",
//                "232126198703194770", "12016", "2020"
//        ));
//        System.out.println(
//                StudentArchiveGenerator.generateArchiveCode(
//                        "ST2211XE6EE36M202412016",
//                        "20"
//                )
//        );
    }


//        List<Map> list = new ArrayList<>();
//        Workbook workbook = null;
//        ExportParams params = new ExportParams("大数据测试", "测试");
//
//        List<ExcelExportEntity> entity = new ArrayList<ExcelExportEntity>();
//        entity.add(new ExcelExportEntity("ID", "id"));
//        entity.add(new ExcelExportEntity("级别", "level"));
//        entity.add(new ExcelExportEntity("日志", "logger"));
//        entity.add(new ExcelExportEntity("消息", "message"));
//        entity.add(new ExcelExportEntity("时间", "timestamp"));
//        entity.add(new ExcelExportEntity("异常", "exception"));
//
//        Map<String, Object> map = new HashMap<>();
//        for (int i = 0; i < 10000; i++) {
//            map.put("id", i);
//            map.put("level", "ERROR");
//            map.put("logger", "发生错误" + i);
//            map.put("message", "这里是消息");
//            map.put("timestamp", new Date());
//            map.put("exception", "异常信息");
//            list.add(map);
//        }
//        workbook = ExcelExportUtil.exportExcel(params, entity, list);
//        list.clear();
//        File savefile = new File("C:/Users/lc/Desktop");
//        if (!savefile.exists()) {
//            savefile.mkdirs();
//        }
//        FileOutputStream fos = new FileOutputStream("C:/Users/lc/Desktop/bigDataExport.xlsx");
//        workbook.write(fos);
//        fos.close();



}
