Commit 5bf34d81 by fudahua

feat:时间格式

parent efc6d1bd
......@@ -25,12 +25,11 @@ import org.apache.commons.lang.time.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -973,10 +972,9 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
cell = row.createCell(j);
cell.setCellValue(columnMate.get(j).getKey());
}
HSSFWorkbook demoWorkBook = new HSSFWorkbook();
HSSFCellStyle dateStyle = demoWorkBook.createCellStyle();
HSSFDataFormat format= demoWorkBook.createDataFormat();
dateStyle.setDataFormat(format.getFormat("yyyy/MM/dd HH:mm:ss"));
CellStyle cellStyle = wb.createCellStyle();
DataFormat dataFormat = wb.createDataFormat();
cellStyle.setDataFormat(dataFormat.getFormat("yyyy/MM/dd HH:mm:ss"));
// 遍历输出行
......@@ -989,10 +987,8 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
Integer type = columnMate.get(j).getValue();
Cell midCell = row.createCell(j);
switch (type) {
case Types.DATE:
case Types.TIMESTAMP:
case Types.TIME:
midCell.setCellStyle(dateStyle);
midCell.setCellStyle(cellStyle);
}
midCell.setCellValue(columnValues[j]);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment