Browse Source

Configure Continuous Integration ....

master
zhangqiyang 8 months ago
parent
commit
7622067c38
  1. 18
      src/main/java/com/system/log/service/LogService.java

18
src/main/java/com/system/log/service/LogService.java

@ -387,7 +387,7 @@ public class LogService {
selectResult.add(logEntity);
}
}
//Object jsonObject = JSONObject.toJSON(selectResult);
// Object jsonObject = JSONObject.toJSON(selectResult);
return exportLogExcelZip(selectResult, password);
}
@ -409,17 +409,17 @@ public class LogService {
return date.getTime();
}
//导出为Excel类型
// 导出为Excel类型
public File exportLogExcelZip(List<LogEntity> selectResult, String password) throws IOException {
//创建一个工作簿,也就是Excel文件
// 创建一个工作簿,也就是Excel文件
HSSFWorkbook wb = new HSSFWorkbook();
//创建一个工作表
// 创建一个工作表
HSSFSheet sheet = wb.createSheet();
//第一行,标题
// 第一行,标题
HSSFRow row0 = sheet.createRow(0);
HSSFCell cell0 = row0.createCell(0);
cell0.setCellValue("操作日志表");
//第二行,表头
// 第二行,表头
HSSFRow row1 = sheet.createRow(1);
row1.createCell(0).setCellValue("id");
row1.createCell(1).setCellValue("address");
@ -438,7 +438,7 @@ public class LogService {
row1.createCell(14).setCellValue("userAuthDesc");
row1.createCell(15).setCellValue("userId");
//向表中写入数据
// 向表中写入数据
int rowInt = 2;
for (LogEntity logEntity : selectResult) {
HSSFRow row = sheet.createRow(rowInt++);
@ -462,8 +462,8 @@ public class LogService {
}
FileOutputStream fos = null;
try {
//输出文件,创建字节输出流
File tempFile = new File(File.createTempFile("log", ".xlsx").getPath());
// 输出文件,创建字节输出流
File tempFile = new File(File.createTempFile("log", ".xls").getPath());
fos = new FileOutputStream(tempFile);
wb.write(fos);
fos.flush();

Loading…
Cancel
Save