|
@@ -1,38 +1,64 @@
|
|
package com.koobietech.eas.controller;
|
|
package com.koobietech.eas.controller;
|
|
|
|
|
|
|
|
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
|
+import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
|
+import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
|
|
+import cn.afterturn.easypoi.handler.inter.IWriter;
|
|
import com.koobietech.eas.common.constant.UserType;
|
|
import com.koobietech.eas.common.constant.UserType;
|
|
import com.koobietech.eas.common.pojo.JwtUserDto;
|
|
import com.koobietech.eas.common.pojo.JwtUserDto;
|
|
import com.koobietech.eas.common.service.RedisService;
|
|
import com.koobietech.eas.common.service.RedisService;
|
|
import com.koobietech.eas.common.utils.JwtManager;
|
|
import com.koobietech.eas.common.utils.JwtManager;
|
|
import com.koobietech.eas.common.utils.PasswordManager;
|
|
import com.koobietech.eas.common.utils.PasswordManager;
|
|
|
|
+import com.koobietech.eas.mbg.model.EasSysLogs;
|
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.io.FileNotFoundException;
|
|
|
|
+import java.io.FileOutputStream;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
|
|
@SpringBootTest
|
|
@SpringBootTest
|
|
class ControllerApplicationTests {
|
|
class ControllerApplicationTests {
|
|
|
|
|
|
- @Resource
|
|
|
|
- RedisService redisService;
|
|
|
|
-
|
|
|
|
- @Resource
|
|
|
|
- JwtManager jwtManager;
|
|
|
|
-
|
|
|
|
@Test
|
|
@Test
|
|
- void contextLoads() {
|
|
|
|
-
|
|
|
|
- JwtUserDto jwtUserDto = new JwtUserDto();
|
|
|
|
-
|
|
|
|
- jwtUserDto.setType(UserType.TEACHER);
|
|
|
|
- jwtUserDto.setId(12L);
|
|
|
|
- jwtUserDto.setUsername("李四");
|
|
|
|
-
|
|
|
|
- String jwt = jwtManager.createJwt(jwtUserDto);
|
|
|
|
- redisService.set("jwttoken", jwt);
|
|
|
|
-
|
|
|
|
|
|
+ void contextLoads() throws IOException {
|
|
|
|
+// 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();
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|