엑셀 다운로드, MapperSupport 추가

main
mjkhan21 11 months ago
parent f5ef588b2d
commit ab56a9f1c4

@ -5,9 +5,13 @@ import java.util.Map;
import javax.annotation.Resource;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.excl.LevyExcl;
@ -82,9 +86,46 @@ public class Excl01Controller extends ApplicationController {
* }</code></pre>
*/
public ModelAndView getLevyExclusionList(LevyExclQuery req) {
if (!"xls".equals(req.getDownload())) {
List<?> result = levyExclService.getLevyExclList(setFetchSize(req));
return setCollectionInfo(new ModelAndView("jsonView"), result, "levyExcl");
} else {
XLSWriter xlsx = new XLSWriter()
.setFilename("부과제외 목록.xlsx")
.worksheet(0);
CellStyle
header = xlsx.cellStyle(new XLSWriter.Styler()
.width(20)
.foregroundColor(HSSFColor.HSSFColorPredefined.LIGHT_BLUE.getIndex())
.configure(styler -> {
Font font = xlsx.workbook().createFont();
font.setColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex());
styler.font(font);
})
),
numeric = xlsx.n_nn0();
xlsx.cell(0, 0)
.value("부과제외 목록", XLSWriter.Styler.CENTER)
.merge(0, 15)
.cell(3, 0)
.rowValues(List.of(
"업무구분", header, "부과제외일자", header, "부과제외구분", header, "부과제외사유", header, "기타내용", header,
"민원신청번호", header, "민원접수번호", header, "민원접수일자", header, "단속일시", header, "차량번호", header,
"법정동", header, "단속장소", header, "과태료금액", header, "처리상태", header, "납부자명", header, "납부자생일", header
))
.cell(4, 0)
.values(
levyExclService.getLevyExclList(req.setFetchSize(0)),
"TASK_SE_NM", xlsx.format(r -> xlsx.str2date(r.get("LEVY_EXCL_YMD"))), "LEVY_EXCL_SE_NM", "LEVY_EXCL_RSN_NM", "ETC_CN",
"CVLCPT_APLY_NO", "CVLCPT_RCPT_NO", xlsx.format(r -> xlsx.str2date(r.get("CVLCPT_RCPT_YMD"))), xlsx.format(r -> xlsx.str2date(r.get("CRDN_YMD")) + " " + xlsx.str2time(r.get("CRDN_TM"))),
"VHRNO", "CRDN_STDG_NM", "CRDN_PLC", xlsx.style("FFNLG_AMT", numeric), "CRDN_STTS_NM", "RTPYR_NM", xlsx.format(r -> xlsx.str2date(r.get("RTPYR_BRDT")))
);
return new ModelAndView("xlsView")
.addObject("xls", xlsx);
}
}
/** ID (info) .

@ -62,9 +62,9 @@
<appender-ref ref="Error"/>
</root>
<logger name="jdbc" level="OFF"/>
<logger name="org.apache.commons" level="OFF" additivity="false"/>
<logger name="org.mariadb" level="OFF" additivity="false"/>
<!--logger name="jdbc" level="OFF" additivity="false"/-->
<logger name="jdbc.connection" level="OFF" additivity="false"/>
<logger name="jdbc.sqlonly" level="OFF" additivity="false"/>
<logger name="jdbc.resultset" level="OFF" additivity="false"/>

@ -19,7 +19,7 @@
</typeHandlers>
<plugins>
<plugin interceptor="cokr.xit.foundation.data.paging.PagingAid" />
<plugin interceptor="cokr.xit.foundation.data.paging.MapperSupport" />
</plugins>
</configuration>

@ -533,9 +533,7 @@
}
// 엑셀 버튼 이벤트
fnExcel${pageName} = () => {
}
fnExcel${pageName} = () => ${pageName}Control.download();
// 사용자 조회 버튼 이벤트
fnFindUser${pageName} = () => {

@ -1274,6 +1274,7 @@ class DatasetControl {
_load() {
if (!this.query.pageNum)
this.query.pageNum = 1;
ajax.get({
url:this.urls.load,
data:this.query,
@ -1287,6 +1288,13 @@ class DatasetControl {
});
}
download(type) {
this.query.download = type || "xls";
let query = toQuery(this.query);
this.query.download = null;
document.location.href = this.urls.load + "?" + query;
}
setData(obj) {
this.dataset.setData(obj);
}

Loading…
Cancel
Save