From 79dfb2ee52d0600b1fd1d31f0cc5693646ba2b52 Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Fri, 10 May 2024 10:46:59 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=91=EC=85=80=20=EB=8B=A4=EC=9A=B4?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/syslog/web/LoggingController.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/main/java/cokr/xit/base/syslog/web/LoggingController.java b/src/main/java/cokr/xit/base/syslog/web/LoggingController.java index 73fc666..92a01c9 100644 --- a/src/main/java/cokr/xit/base/syslog/web/LoggingController.java +++ b/src/main/java/cokr/xit/base/syslog/web/LoggingController.java @@ -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 list) { List 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",