감액 수정.

main
JoJH 4 days ago
parent 8b641e44f9
commit 1f3c892d09

@ -31,197 +31,210 @@ import cokr.xit.foundation.data.DataObject;
*
* <pre>
* ============ ============
* 2024-02-01 JoJH
* 2024-02-01 JoJH
* ================================
* </pre>
*/
public class Rdca01Controller extends ApplicationController {
public static final String CLASS_URL = "/rdca/rdca01";
public class METHOD_URL {
public static final String
reducedAmountMain = "/010/main.do" // 감액 관리 메인 화면
, getReducedAmountList = "/010/list.do" // 감액 대장 목록 조회
, getReducedAmountInfo = "/020/info.do" // 감액 대장 조회
, createReducedAmount = "/020/create.do" // 감액 대장 등록
, updateReducedAmount = "/020/update.do" // 감액 대장 수정
, removeReducedAmount = "/010/remove.do" // 감액 대장 삭제
;
}
/**감액 대장 서비스*/
@Resource(name = "rdamtService")
private RdamtService rdamtService;
@Resource(name = "stngBean")
private StngBean stngBean;
/** (rdamt/rdamt-main) .
* {@link #getRdamtList(RdamtQuery) } .
* @return /rdcamt/rdamt-main
*/
public ModelAndView reducedAmountMain() {
ModelAndView mav = new ModelAndView("fims/rdca/rdca01010-main");
// 사용자 정보
FimsUser fimsUser = (FimsUser)currentUser().getUser();
// View(jsp)에서 사용할 공통코드를 조회
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM021", "FIM022", "FIM054", "FIM085");
addCodes(commonCodes, mav, "FIM021", "FIM022", "FIM085");
return mav
.addObject("pageName", "rdca01010") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
.addObject("infoPrefix", "rdamt") // prefix
.addObject("sggCd", fimsUser.getOrgID()) // 시군구 코드(SGG_CD)
.addObject("taskListForSgg", stngBean.filterTaskSectionCodeForSgg(commonCodes.get("FIM054")))
.addObject("FIM021List", commonCodes.get("FIM021")) // 부과 제외 구분 코드(LEVY_EXCL_SE_CD)
.addObject("FIM022List", commonCodes.get("FIM022")) // 부과 제외 사유 코드(LEVY_EXCL_RSN_CD)
.addObject("FIM054List", commonCodes.get("FIM054")) // 업무 구분 코드(TASK_SE_CD)
.addObject("FIM085List", commonCodes.get("FIM085")) // 감액 구분 코드(RDAMT_SE_CD)
;
}
/** .<br />
* {@link RdamtService#getRdamtList(RdamtQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "rdamtList": [ ]
* "rdamtStart":
* "rdamtFetch":
* "rdamtTotal":
* }</code></pre>
*/
public ModelAndView getReducedAmountList(RdamtQuery req) {
if (!"xls".equals(req.getDownload())) {
List<?> result = rdamtService.getRdamtList(setFetchSize(req));
return setCollectionInfo(new ModelAndView("jsonView"), result, "rdamt");
} else {
// 현재 날짜 구하기
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String dateTime = dateFormat.format(System.currentTimeMillis());
List<CellDef> cellDefs = fromJson(req.getCellDefs(), CellDef.listType());
XLSWriter xlsx = new XLSWriter().worksheet(0);
Format format = new Format(xlsx);
CellStyle center = format.cellStyle(Style.CENTER);
CellStyle numeric = format.n_nn0();
CellStyle dateYMD = format.yyyy_mm_dd();
CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss();
List<DataObject> list = rdamtService.getRdamtList(req.setFetchSize(0));
Map<String,Object> valueMap = new HashMap<String,Object>();
valueMap.put("업무구분", format.of("TASK_SE_NM").style(center));
valueMap.put("부과제외일자", FormatMaker.yyyy_mm_dd(format, "LEVY_EXCL_YMD").style(dateYMD));
valueMap.put("부과제외구분", format.of("LEVY_EXCL_SE_NM").style(center));
valueMap.put("부과제외사유", format.of("LEVY_EXCL_RSN_NM"));
valueMap.put("기타내용", format.of("ETC_CN"));
valueMap.put("민원신청번호", format.of("CVLCPT_APLY_NO").style(center));
valueMap.put("민원접수번호", format.of("CVLCPT_RCPT_NO").style(center));
valueMap.put("민원접수일자", FormatMaker.yyyy_mm_dd(format, "CVLCPT_RCPT_YMD").style(dateYMD));
valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT));
valueMap.put("차량번호", format.of("VHRNO"));
valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center));
valueMap.put("납부자번호", format.of("RTPYR_NO").style(center));
valueMap.put("납부자명", format.of("RTPYR_NM"));
valueMap.put("단속법정동", format.of("CRDN_STDG_NM").style(center));
valueMap.put("단속장소", format.of("CRDN_PLC"));
valueMap.put("상세단속장소", format.of("DTL_CRDN_PLC"));
valueMap.put("위반항목", format.of("VLTN_ARTCL"));
valueMap.put("단속원금", format.of("FFNLG_CRDN_AMT").style(numeric));
valueMap.put("처리상태", format.of("CRDN_STTS_NM"));
valueMap.put("단속특별구역", format.of("CRDN_SPAREA_NM").style(center));
valueMap.put("사용연료", format.of("USE_FUEL_NM").style(center));
valueMap.put("주차가능여부", format.of("PRK_PSBLTY_RSLT_NM").style(center));
valueMap.put("우편번호", format.of("ZIP").style(center));
valueMap.put("주소", format.of("ADDR"));
valueMap.put("상세주소", format.of("DTL_ADDR"));
valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT));
valueMap.put("등록사용자", format.of("RGTR_NM").style(center));
valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT));
valueMap.put("수정사용자", format.of("MDFR_NM").style(center));
CellDef.setValues(cellDefs, valueMap);
xlsx.cell(0, 0).value("감액").value(center).merge(0, cellDefs.size() - 1)
.cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx)))
.cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> {if(i.getValue() instanceof Format) {i.setField(null);}; return i;}).toList()));
return new ModelAndView("downloadView")
.addObject("download", xlsx.getDownloadable().setFilename("감액" + "_목록_" + dateTime + ".xlsx"));
}
}
/** .
* @param rdamt
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView createReducedAmount(Rdamt rdamt) {
boolean saved = false;
String rtnMsg = rdamtService.createRdamt(rdamt);
if (rtnMsg.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("rtnMsg", rtnMsg);
}
/** .
* @param rdamt
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView updateReducedAmount(Rdamt rdamt) {
boolean saved = false;
String rtnMsg = rdamtService.updateRdamt(rdamt);
if (rtnMsg.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("rtnMsg", rtnMsg);
}
/** .
* @param rdamtIds
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
public ModelAndView removeReducedAmount(Rdamt rdamt) {
boolean saved = false;
String rtnMsg = rdamtService.removeRdamt(rdamt);
if (rtnMsg.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("rtnMsg", rtnMsg);
}
public static final String CLASS_URL = "/rdca/rdca01";
public class METHOD_URL {
public static final String
reducedAmountMain = "/010/main.do" // 감액 관리 메인 화면
, getReducedAmountList = "/010/list.do" // 감액 대장 목록 조회
, getReducedAmountInfo = "/020/info.do" // 감액 대장 조회
, createReducedAmount = "/020/create.do" // 감액 대장 등록
, updateReducedAmount = "/020/update.do" // 감액 대장 수정
, removeReducedAmount = "/010/remove.do" // 감액 대장 삭제
;
}
/**감액 대장 서비스*/
@Resource(name = "rdamtService")
private RdamtService rdamtService;
@Resource(name = "stngBean")
private StngBean stngBean;
/** (rdamt/rdamt-main) .
* {@link #getRdamtList(RdamtQuery) } .
* @return /rdcamt/rdamt-main
*/
public ModelAndView reducedAmountMain() {
ModelAndView mav = new ModelAndView("fims/rdca/rdca01010-main");
// 사용자 정보
FimsUser fimsUser = (FimsUser)currentUser().getUser();
// View(jsp)에서 사용할 공통코드를 조회
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM054", "FIM085", "FIM086");
addCodes(commonCodes, mav, "FIM085", "FIM086");
return mav
.addObject("pageName", "rdca01010") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
.addObject("prefixUrl", CLASS_URL) // prefixUrl
.addObject("sggCd", fimsUser.getOrgID()) // 시군구 코드(SGG_CD)
.addObject("taskListForSgg", stngBean.filterTaskSectionCodeForSgg(commonCodes.get("FIM054")))
.addObject("FIM086List", commonCodes.get("FIM086")) // 감액 사유 코드(RDAMT_RSN_CD)
;
}
/** .<br />
* {@link RdamtService#getRdamtList(RdamtQuery)}
* @param req
* @return jsonView
* <pre><code> {
* "rdamtList": [ ]
* "rdamtStart":
* "rdamtFetch":
* "rdamtTotal":
* }</code></pre>
*/
public ModelAndView getReducedAmountList(RdamtQuery req) {
if (!"xls".equals(req.getDownload())) {
List<?> result = rdamtService.getRdamtList(setFetchSize(req));
return setPagingInfo(new ModelAndView("jsonView"), result, "");
} else {
// 현재 날짜 구하기
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String dateTime = dateFormat.format(System.currentTimeMillis());
List<CellDef> cellDefs = fromJson(req.getCellDefs(), CellDef.listType());
XLSWriter xlsx = new XLSWriter().worksheet(0);
Format format = new Format(xlsx);
CellStyle center = format.cellStyle(Style.CENTER);
CellStyle numeric = format.n_nn0();
CellStyle dateYMD = format.yyyy_mm_dd();
CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss();
List<DataObject> list = rdamtService.getRdamtList(req.setFetchSize(0));
Map<String,Object> valueMap = new HashMap<String,Object>();
valueMap.put("업무구분", format.of("TASK_SE_NM").style(center));
valueMap.put("감액일자", FormatMaker.yyyy_mm_dd(format, "RDAMT_YMD").style(dateYMD));
valueMap.put("감액구분", format.of("RDAMT_SE_CD_NM").style(center));
valueMap.put("감액사유", format.of("RDAMT_RSN_CD_NM"));
valueMap.put("기타내용", format.of("ETC_CN"));
valueMap.put("민원신청번호", format.of("CVLCPT_APLY_NO").style(center));
valueMap.put("민원접수번호", format.of("CVLCPT_RCPT_NO").style(center));
valueMap.put("민원접수일자", FormatMaker.yyyy_mm_dd(format, "CVLCPT_RCPT_YMD").style(dateYMD));
valueMap.put("단속일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "CRDN_YMD_TM").style(dateDT));
valueMap.put("차량번호", format.of("VHRNO"));
valueMap.put("납부자구분", format.of("RTPYR_SE_NM").style(center));
valueMap.put("납부자번호", format.of("RTPYR_NO").style(center));
valueMap.put("납부자명", format.of("RTPYR_NM"));
valueMap.put("단속법정동", format.of("CRDN_STDG_NM").style(center));
valueMap.put("단속장소", format.of("CRDN_PLC"));
valueMap.put("상세단속장소", format.of("DTL_CRDN_PLC"));
valueMap.put("위반항목", format.of("VLTN_ARTCL"));
valueMap.put("단속원금", format.of("FFNLG_CRDN_AMT").style(numeric));
valueMap.put("처리상태", format.of("CRDN_STTS_NM"));
valueMap.put("단속특별구역", format.of("CRDN_SPAREA_NM").style(center));
valueMap.put("사용연료", format.of("USE_FUEL_NM").style(center));
valueMap.put("주차가능여부", format.of("PRK_PSBLTY_RSLT_NM").style(center));
valueMap.put("우편번호", format.of("ZIP").style(center));
valueMap.put("주소", format.of("ADDR"));
valueMap.put("상세주소", format.of("DTL_ADDR"));
valueMap.put("등록일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "REG_DT").style(dateDT));
valueMap.put("등록사용자", format.of("RGTR_NM").style(center));
valueMap.put("수정일시", FormatMaker.yyyy_mm_dd_hh_mm_ss(format, "MDFCN_DT").style(dateDT));
valueMap.put("수정사용자", format.of("MDFR_NM").style(center));
CellDef.setValues(cellDefs, valueMap);
xlsx.cell(0, 0).value("감액").value(center).merge(0, cellDefs.size() - 1)
.cell(3, 0).rowValues(CellDef.header(cellDefs, () -> StyleMaker.headerStyle(xlsx)))
.cell(4, 0).values(list, CellDef.values(cellDefs.stream().map(i -> { if(i.getValue() instanceof Format) { i.setField(null); }; return i; }).toList()));
return new ModelAndView("downloadView")
.addObject("download", xlsx.getDownloadable().setFilename("감액" + "_목록_" + dateTime + ".xlsx"));
}
}
/** .
* @param rdamt
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView createReducedAmount(Rdamt rdamt) {
boolean saved = false;
String rtnMsg = rdamtService.createRdamt(rdamt);
if (rtnMsg.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("rtnMsg", rtnMsg);
}
/** .
* @param rdamt
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView updateReducedAmount(Rdamt rdamt) {
boolean saved = false;
String rtnMsg = rdamtService.updateRdamt(rdamt);
if (rtnMsg.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("rtnMsg", rtnMsg);
}
/** .
* @param rdamtIds
* @return jsonView
* <pre><code> {
* "affected":
* "saved": true, false
* }</code></pre>
*/
public ModelAndView removeReducedAmount(Rdamt rdamt) {
boolean saved = false;
String rtnMsg = "";
// 감액(rdamtId) 단건 삭제
if (rdamt.getRdamtIds() == null || rdamt.getRdamtIds().length < 1) {
rtnMsg = rdamtService.removeRdamt(rdamt);
} else {
// 부과제외 IDs 만큼 부과제외 삭제 반복..
for (String rdamtId : rdamt.getRdamtIds()) {
Rdamt deltRdamt = new Rdamt();
deltRdamt.setRdamtId(rdamtId);
deltRdamt.setDelRsn(rdamt.getDelRsn());
// 감액 삭제 호출
rtnMsg = rdamtService.removeRdamt(deltRdamt);
if (!rtnMsg.contains("[S]")) // 오류가 발생하였으면 종료..
break;
}
}
if (rtnMsg.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("rtnMsg", rtnMsg);
}
}

Loading…
Cancel
Save