엑셀 다운로드 추가

master
mjkhan21 6 months ago
parent b926330ea1
commit 79dfb2ee52

@ -3,7 +3,6 @@ package cokr.xit.base.syslog.web;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.IntStream;
import javax.annotation.Resource;
@ -14,6 +13,7 @@ import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import cokr.xit.base.docs.xls.CellDef;
import cokr.xit.base.docs.xls.Style;
import cokr.xit.base.docs.xls.XLSWriter;
import cokr.xit.base.syslog.LogQuery;
import cokr.xit.base.syslog.service.LoggingService;
@ -59,7 +59,7 @@ public class LoggingController extends AbstractController {
req.setToDate(toDate.replace("-", ""));
if (isEmpty(fromDate)) {
fromDate = DataFormat.yyyy_mm_dd(new Date(date.getTime() - 1000L * 60L * 60L * 24L * 30L));
fromDate = DataFormat.yyyy_mm_dd(dateDiff(date, -30));
req.setFromDate(fromDate.replace("-", ""));
}
}
@ -97,29 +97,27 @@ public class LoggingController extends AbstractController {
private ModelAndView download(List<DataObject> list) {
List<CellDef> cellDefs = List.of(
new CellDef().setLabel("계정").setField("USER_ACNT"),
new CellDef().setLabel("사용자이름").setField("USER_NM"),
new CellDef().setLabel("IP 주소").setField("IP_ADDR"),
new CellDef().setLabel("로그유형").setField("LOG_TYPE_NM"),
new CellDef().setLabel("접속일시").setField("REG_DT"),
new CellDef().setLabel("URL").setField("URL"),
new CellDef().setLabel("설명").setField("DSCRP"),
new CellDef().setLabel("파일이름").setField("FILE_NM"),
new CellDef().setLabel("민감정보").setField("PSNL_INFO")
new CellDef().setLabel("계정").setField("USER_ACNT").setWidth(10),
new CellDef().setLabel("사용자이름").setField("USER_NM").setWidth(16),
new CellDef().setLabel("IP 주소").setField("IP_ADDR").setWidth(16),
new CellDef().setLabel("로그유형").setField("LOG_TYPE_NM").setWidth(16),
new CellDef().setLabel("접속일시").setField("REG_DT").setWidth(24),
new CellDef().setLabel("URL").setField("URL").setWidth(32),
new CellDef().setLabel("설명").setField("DSCRP").setWidth(32),
new CellDef().setLabel("파일이름").setField("FILE_NM").setWidth(32),
new CellDef().setLabel("민감정보").setField("PSNL_INFO").setWidth(32)
);
XLSWriter xlsx = new XLSWriter()
.worksheet(0)
.trackWidth(IntStream.range(0, cellDefs.size()).toArray())
.cell(0, 0)
.value("시스템 로그 목록").merge(0, cellDefs.size() - 1)
.cell(2, 0)
.rowValues(CellDef.header(cellDefs, null))
.rowValues(CellDef.header(cellDefs, Style::new))
.cell(3, 0)
.values(
list,
CellDef.values(cellDefs)
)
.autoWidth();
);
return new ModelAndView("downloadView")
.addObject("download",

Loading…
Cancel
Save