1. 엑셀저장 수정.

2. 불필요 소스 제거.
main
jjh 11 months ago
parent ed63a988ce
commit ac4c5a9571

@ -63,31 +63,4 @@ public interface LevyExclService {
*/ */
String removeLevyExcl(LevyExcl levyExcl); String removeLevyExcl(LevyExcl levyExcl);
/** .
* @param levyExcl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean create(LevyExcl levyExcl);
/** .
* @param levyExcl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean update(LevyExcl levyExcl);
/** .
* @param levyExcl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
boolean remove(LevyExcl levyExcl);
} }

@ -278,39 +278,6 @@ public class LevyExclBean extends AbstractComponent {
return rtnMsg; return rtnMsg;
} }
/** .
* @param levyExcl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean create(LevyExcl levyExcl) {
return levyExclMapper.insert(levyExcl);
}
/** .
* @param levyExcl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean update(LevyExcl levyExcl) {
return levyExclMapper.update(levyExcl);
}
/** .
* @param levyExcl
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean remove(LevyExcl levyExcl) {
return levyExclMapper.delete(levyExcl);
}
} }

@ -92,19 +92,4 @@ public class LevyExclServiceBean extends AbstractServiceBean implements LevyExcl
return rtnMsg; return rtnMsg;
} }
@Override
public boolean create(LevyExcl levyExcl) {
return levyExclBean.create(levyExcl);
}
@Override
public boolean update(LevyExcl levyExcl) {
return levyExclBean.update(levyExcl);
}
@Override
public boolean remove(LevyExcl levyExcl) {
return levyExclBean.remove(levyExcl);
}
} }

@ -3,15 +3,17 @@ package cokr.xit.fims.excl.web;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.BiFunction;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode; import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.xls.XLSWriter; import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.file.xls.XLSWriter.CellDef;
import cokr.xit.base.file.xls.XLSWriter.Styler; import cokr.xit.base.file.xls.XLSWriter.Styler;
import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.web.ApplicationController; import cokr.xit.base.web.ApplicationController;
@ -91,69 +93,51 @@ public class Excl01Controller extends ApplicationController {
List<?> result = levyExclService.getLevyExclList(setFetchSize(req)); List<?> result = levyExclService.getLevyExclList(setFetchSize(req));
return setCollectionInfo(new ModelAndView("jsonView"), result, "levyExcl"); return setCollectionInfo(new ModelAndView("jsonView"), result, "levyExcl");
} else { } else {
ArrayList<CellDef> cellDefs = fromJson(req.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
XLSWriter xlsx = new XLSWriter() XLSWriter xlsx = new XLSWriter()
.setFilename("부과제외 목록.xlsx") .setFilename("부과제외 목록.xlsx")
.worksheet(0); .worksheet(0);
CellStyle center = xlsx.cellStyle(Styler.CENTER) // 가운데 정렬 CellStyle center = xlsx.cellStyle(Styler.CENTER); // 가운데 정렬
, numeric = xlsx.n_nn0() // 숫자 3자리 콤마(,) CellStyle numeric = xlsx.n_nn0(); // 숫자 3자리 콤마(,)
, dateYMD = xlsx.yyyy_mm_dd() // 연월일 CellStyle dateYMD = xlsx.yyyy_mm_dd(); // 연월일
, dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간 CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss(); // 연월일+시간
String[] excelTitle = req.getExcelTitle();
List<String> titles = new ArrayList<String>();
for (int iLoop = 0; iLoop < excelTitle.length; iLoop++) {
String item = excelTitle[iLoop];
titles.add(item);
}
int[] excelTitleWidth = req.getExcelTitleWidth(); List<DataObject> list = levyExclService.getLevyExclList(req.setFetchSize(0));
List<Integer> widths = new ArrayList<>();
for (int jLoop = 0; jLoop < excelTitleWidth.length; jLoop++) {
int item = excelTitleWidth[jLoop];
widths.add(item);
}
List<Styler> headerStylers = CmmnUtil.makeHeadersByDiffrentWidths(widths, xlsx); CellDef.setValues(cellDefs, Map.ofEntries(
Map.entry("업무구분", xlsx.style("TASK_SE_NM", center))
, Map.entry("부과제외일자", xlsx.format(o -> xlsx.str2date(o.get("LEVY_EXCL_YMD"))).style(dateYMD))
, Map.entry("부과제외구분", xlsx.style("LEVY_EXCL_SE_NM", center))
, Map.entry("부과제외사유", "LEVY_EXCL_RSN_NM")
, Map.entry("기타내용", "ETC_CN")
, Map.entry("민원신청번호", xlsx.style("CVLCPT_APLY_NO", center))
, Map.entry("민원접수번호", xlsx.style("CVLCPT_RCPT_NO", center))
, Map.entry("민원접수일자", xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD))
, Map.entry("단속일시", xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT))
, Map.entry("차량번호", "VHRNO")
, Map.entry("단속법정동", "CRDN_STDG_NM")
, Map.entry("단속장소", "CRDN_PLC")
, Map.entry("위반항목", "VLTN_ARTCL")
, Map.entry("최초단속금액", xlsx.style("FFNLG_CRDN_AMT", numeric))
, Map.entry("처리상태", "CRDN_STTS_NM")
, Map.entry("납부자명", "RTPYR_NM")
, Map.entry("납부자생일", xlsx.style("RTPYR_BRDT_MASK", center))
, Map.entry("등록일시", xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT))
, Map.entry("등록사용자", xlsx.style("RGTR_NM", center))
, Map.entry("수정일시", xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT))
, Map.entry("수정사용자", xlsx.style("MDFR_NM", center))
)
);
xlsx.cell(0, 0) xlsx.cell(0, 0)
.value("부과제외", XLSWriter.Styler.CENTER) .value("부과제외", center)
.merge(0, 11) .merge(0, cellDefs.size()-1)
.cell(3, 0) .cell(3, 0)
.rowValues(CmmnUtil.mergeListByIndex(titles, headerStylers)); .rowValues(CellDef.header(cellDefs, () -> CmmnUtil.headerStyle(xlsx)))
.cell(4, 0)
List<DataObject> list = levyExclService.getLevyExclList(req.setFetchSize(0)); .values(list, CellDef.values(cellDefs));
BiFunction<String, String, ?> getValue = (titleNm, nothing) -> {
switch (titleNm) {
case "업무구분" : return xlsx.style("TASK_SE_NM", center);
case "부과제외일자" : return xlsx.format(o -> xlsx.str2date(o.get("LEVY_EXCL_YMD"))).style(dateYMD);
case "부과제외구분" : return xlsx.style("LEVY_EXCL_SE_NM", center);
case "부과제외사유" : return xlsx.style("LEVY_EXCL_RSN_NM", center);
case "기타내용" : return "ETC_CN";
case "민원신청번호" : return xlsx.style("CVLCPT_APLY_NO", center);
case "민원접수번호" : return xlsx.style("CVLCPT_RCPT_NO", center);
case "민원접수일자" : return xlsx.format(o -> xlsx.str2date(o.get("CVLCPT_RCPT_YMD"))).style(dateYMD);
case "단속일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("CRDN_YMD_TM"))).style(dateDT);
case "차량번호" : return "VHRNO";
case "단속법정동" : return "CRDN_STDG_NM";
case "단속장소" : return "CRDN_PLC";
case "위반항목" : return "VLTN_ARTCL";
case "최초단속금액" : return xlsx.style("FFNLG_CRDN_AMT", numeric);
case "처리상태" : return "CRDN_STTS_NM";
case "납부자명" : return "RTPYR_NM";
case "납부자생일" : return xlsx.style("RTPYR_BRDT_MASK", center);
case "등록일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("REG_DT"))).style(dateDT);
case "등록사용자" : return xlsx.style("RGTR_NM", center);
case "수정일시" : return xlsx.format(o -> xlsx.str2datetime(o.get("MDFCN_DT"))).style(dateDT);
case "수정사용자" : return xlsx.style("MDFR_NM", center);
}
return "";
};
xlsx.cell(4, 0)
.values(list, titles.stream().map((item) -> { return getValue.apply(item, null); }).toArray());
return new ModelAndView("xlsView") return new ModelAndView("xlsView")
.addObject("xls", xlsx); .addObject("xls", xlsx);
@ -269,47 +253,4 @@ public class Excl01Controller extends ApplicationController {
.addObject("rtnMsg", rtnMsg); .addObject("rtnMsg", rtnMsg);
} }
/** .
* @param levyExcl
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
// @PostMapping(name = "부과제외 대장 등록", value = "/create.do")
public ModelAndView create(LevyExcl levyExcl) {
boolean saved = levyExclService.create(levyExcl);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param levyExcl
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
// @PostMapping(name = "부과제외 대장 수정", value = "/update.do")
public ModelAndView update(LevyExcl levyExcl) {
boolean saved = levyExclService.update(levyExcl);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .
* @param levyExclIDs
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
// @PostMapping(name = "부과제외 대장 제거", value = "/remove.do")
public ModelAndView remove(LevyExcl levyExcl) {
boolean saved = levyExclService.remove(levyExcl);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
} }

@ -213,7 +213,6 @@
<th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('VLTN_ARTCL', this.innerText, 'match', 'part');">위반항목</th> <th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('VLTN_ARTCL', this.innerText, 'match', 'part');">위반항목</th>
<th class="cmn" style="width: 120px;" onclick="searchFromGridTitle('FFNLG_CRDN_AMT', this.innerText, 'match', 'part');">최초단속금액</th> <th class="cmn" style="width: 120px;" onclick="searchFromGridTitle('FFNLG_CRDN_AMT', this.innerText, 'match', 'part');">최초단속금액</th>
<th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('CRDN_STTS_CD', this.innerText, 'codeValue', 'FIM010');">처리상태</th> <th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('CRDN_STTS_CD', this.innerText, 'codeValue', 'FIM010');">처리상태</th>
<th class="cmn" style="width: 160px;" onclick="searchFromGridTitle('RTPYR_NO', this.innerText, 'match', 'part');">납부자번호</th>
<th class="cmn" style="width: 200px;" onclick="searchFromGridTitle('RTPYR_NM', this.innerText, 'match', 'part');">납부자명</th> <th class="cmn" style="width: 200px;" onclick="searchFromGridTitle('RTPYR_NM', this.innerText, 'match', 'part');">납부자명</th>
<th class="cmn" style="width: 120px;" onclick="searchFromGridTitle('RTPYR_BRDT', this.innerText, 'ymd', '');">납부자생일</th> <th class="cmn" style="width: 120px;" onclick="searchFromGridTitle('RTPYR_BRDT', this.innerText, 'ymd', '');">납부자생일</th>
<th class="cmn" style="width: 180px;">등록일시</th> <th class="cmn" style="width: 180px;">등록일시</th>
@ -244,7 +243,6 @@
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{VLTN_ARTCL}</td> <td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{VLTN_ARTCL}</td>
<td class="cmn text-end" onclick="{onclick}" ondblclick="{ondblclick}">{FFNLG_CRDN_AMT}</td> <td class="cmn text-end" onclick="{onclick}" ondblclick="{ondblclick}">{FFNLG_CRDN_AMT}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{CRDN_STTS_NM}</td> <td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{CRDN_STTS_NM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{RTPYR_NO}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{RTPYR_NM}</td> <td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{RTPYR_NM}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{RTPYR_BRDT_MASK}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{RTPYR_BRDT_MASK}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{REG_DT}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{REG_DT}</td>
@ -568,12 +566,7 @@
return; return;
} }
// DataTables(그리드) 타이틀 // DataTables(그리드)
let headerInfo = $("#theadTr--${pageName} th").not(".dummy-th").not(":eq(0)").getHeaderInfo();
${pageName}Control.query.excelTitle = headerInfo.excelTitle;
${pageName}Control.query.excelTitleWidth = headerInfo.excelTitleWidth;
// DataTables(그리드) 데이터
let cellDefs = getCellDefs($("#theadTr--${pageName} th").not(".dummy-th").not(":eq(0)") let cellDefs = getCellDefs($("#theadTr--${pageName} th").not(".dummy-th").not(":eq(0)")
, $($("#${infoPrefix}Row--${pageName}")[0].content).find("td").not(".dummy-td").not(":eq(0)")); , $($("#${infoPrefix}Row--${pageName}")[0].content).find("td").not(".dummy-td").not(":eq(0)"));
${pageName}Control.query.cellDefs = cellDefs; ${pageName}Control.query.cellDefs = cellDefs;

Loading…
Cancel
Save