From a63e76f6fb44752f5d139511bde9d717d0446258 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Thu, 19 Oct 2023 17:26:41 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=B4=EC=A0=9C=EC=B0=A8=EB=9F=89=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D,=EC=88=98=EC=A0=95=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/fims/crdn/ExmptnVhcl.java | 91 +++++++++++++++++++ .../xit/fims/crdn/dao/ExmptnVhclMapper.java | 13 +++ .../fims/crdn/service/CrdnStngService.java | 13 +++ .../fims/crdn/service/bean/CrdnStngBean.java | 23 +++++ .../service/bean/CrdnStngServiceBean.java | 11 +++ .../xit/fims/crdn/web/Crdn08Controller.java | 49 ++++++++++ .../cokr/xit/fims/task/web/BpvController.java | 12 +++ .../mapper/fims/crdn/exmptn-vhcl-mapper.xml | 52 +++++++++++ .../WEB-INF/jsp/fims/crdn/crdn08010-main.jsp | 39 +++++++- .../WEB-INF/jsp/fims/crdn/crdn08020-info.jsp | 20 +++- 10 files changed, 315 insertions(+), 8 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/crdn/ExmptnVhcl.java diff --git a/src/main/java/cokr/xit/fims/crdn/ExmptnVhcl.java b/src/main/java/cokr/xit/fims/crdn/ExmptnVhcl.java new file mode 100644 index 00000000..a58109db --- /dev/null +++ b/src/main/java/cokr/xit/fims/crdn/ExmptnVhcl.java @@ -0,0 +1,91 @@ +package cokr.xit.fims.crdn; + +import cokr.xit.foundation.AbstractEntity; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ExmptnVhcl extends AbstractEntity { + + /** + * 면제차량 ID + */ + private String exmptnVhclId; + + /** + * 시군구 코드 + */ + private String sggCd; + + /** + * 차량번호 + */ + private String vhrno; + + /** + * 면제 사유 + */ + private String exmptnRsn; + + /** + * 문서 번호 + */ + private String docNo; + + /** + * 소유자 명 + */ + private String ownrNm; + + /** + * 면제 시작 일자 + */ + private String exmptnBgngYmd; + + /** + * 면제 종료 일자 + */ + private String exmptnEndYmd; + + /** + * 삭제 여부 + */ + private String delYn; + + /** + * 등록 일시 + */ + private String regDt; + + /** + * 등록자 + */ + private String rgtr; + + /** + * 수정 일시 + */ + private String mdfcnDt; + + /** + * 수정자 + */ + private String mdfr; + + /** + * 삭제 일시 + */ + private String delDt; + + /** + * 삭제자 + */ + private String dltr; + + /** + * 삭제 사유 + */ + private String delRsn; + +} diff --git a/src/main/java/cokr/xit/fims/crdn/dao/ExmptnVhclMapper.java b/src/main/java/cokr/xit/fims/crdn/dao/ExmptnVhclMapper.java index a075d9a7..d17fa14c 100644 --- a/src/main/java/cokr/xit/fims/crdn/dao/ExmptnVhclMapper.java +++ b/src/main/java/cokr/xit/fims/crdn/dao/ExmptnVhclMapper.java @@ -5,6 +5,7 @@ import java.util.List; import org.egovframe.rte.psl.dataaccess.mapper.Mapper; import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.ExmptnVhcl; import cokr.xit.foundation.component.AbstractMapper; import cokr.xit.foundation.data.DataObject; @@ -23,4 +24,16 @@ public interface ExmptnVhclMapper extends AbstractMapper { */ DataObject selectExemptionVehicleInfo(String exemptionVehicleId); + /**면제차량 정보를 등록한다. + * @param exmptnVhcl 면제차량 정보 + * return 저장된 정보 수 + */ + int insertExmptnVhclInfo(ExmptnVhcl exmptnVhcl); + + /**면제차량 정보를 수정한다. + * @param exmptnVhcl 면제차량 정보 + * return 저장된 정보 수 + */ + int updateExmptnVhclInfo(ExmptnVhcl exmptnVhcl); + } diff --git a/src/main/java/cokr/xit/fims/crdn/service/CrdnStngService.java b/src/main/java/cokr/xit/fims/crdn/service/CrdnStngService.java index 8a6bc405..bd7dce51 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/CrdnStngService.java +++ b/src/main/java/cokr/xit/fims/crdn/service/CrdnStngService.java @@ -3,6 +3,7 @@ package cokr.xit.fims.crdn.service; import java.util.List; import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.ExmptnVhcl; import cokr.xit.fims.crdn.parsing.LayoutDescriptor; import cokr.xit.foundation.data.DataObject; @@ -38,4 +39,16 @@ public interface CrdnStngService { */ DataObject getExemptionVehicleInfo(String exemptionVehicleId); + /** 면제차량 정보를 등록한다. + * @param exmptnVhcl 면제차량 정보 + * @return 저장여부 + */ + boolean createExmptnVhclInfo(ExmptnVhcl exmptnVhcl); + + /** 면제차량 정보를 수정한다. + * @param exmptnVhcl 면제차량 정보 + * @return 저장여부 + */ + boolean updateExmptnVhclInfo(ExmptnVhcl exmptnVhcl); + } diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java index ce21642d..17b04e51 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java @@ -9,6 +9,7 @@ import org.springframework.stereotype.Component; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.ExmptnVhcl; import cokr.xit.fims.crdn.dao.CrdnTeamMapper; import cokr.xit.fims.crdn.dao.ExmptnVhclMapper; import cokr.xit.fims.crdn.dao.GlobalStngMapper; @@ -248,4 +249,26 @@ public class CrdnStngBean extends AbstractComponent { return exmptnVhclMapper.selectExemptionVehicleInfo(exemptionVehicleId); } + /**면제차량 정보를 등록한다. + * @param exmptnVhcl 면제차량 정보 + * @return 저장 여부 + * + */ + public boolean createExmptnVhclInfo(ExmptnVhcl exmptnVhcl) { + return exmptnVhclMapper.insertExmptnVhclInfo(exmptnVhcl) == 1 ? true : false; + } + + /**면제차량 정보를 수정한다. + * @param exmptnVhcl 면제차량 정보 + * @return 저장 여부 + * + */ + public boolean updateExmptnVhclInfo(ExmptnVhcl exmptnVhcl) { + return exmptnVhclMapper.updateExmptnVhclInfo(exmptnVhcl) == 1 ? true : false; + } + } diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngServiceBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngServiceBean.java index aa39061f..947e0fef 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngServiceBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngServiceBean.java @@ -7,6 +7,7 @@ import javax.annotation.Resource; import org.springframework.stereotype.Service; import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.ExmptnVhcl; import cokr.xit.fims.crdn.parsing.LayoutDescriptor; import cokr.xit.fims.crdn.service.CrdnStngService; import cokr.xit.foundation.component.AbstractServiceBean; @@ -48,4 +49,14 @@ public class CrdnStngServiceBean extends AbstractServiceBean implements CrdnStng return crdnStngBean.getExemptionVehicleInfo(exemptionVehicleId); } + @Override + public boolean createExmptnVhclInfo(ExmptnVhcl exmptnVhcl) { + return crdnStngBean.createExmptnVhclInfo(exmptnVhcl); + } + + @Override + public boolean updateExmptnVhclInfo(ExmptnVhcl exmptnVhcl) { + return crdnStngBean.updateExmptnVhclInfo(exmptnVhcl); + } + } diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java index 0109c1cf..f58b2aa6 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java @@ -12,6 +12,7 @@ import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.ExmptnVhcl; import cokr.xit.fims.crdn.dao.GlobalStngMapper; import cokr.xit.fims.crdn.service.CrdnStngService; import cokr.xit.foundation.data.DataObject; @@ -29,6 +30,8 @@ public class Crdn08Controller extends ApplicationController { exemptionVehicleManagementMain = "/010/main.do" , getExemptionVehicleList = "/010/list.do" , getExemptionVehicleInfo = "/020/info.do" + , createExmptnVhclInfo = "/020/create.do" + , updateExmptnVhclInfo = "/020/update.do" ; } @@ -90,4 +93,50 @@ public class Crdn08Controller extends ApplicationController { return mav; } + /** 면제차량 정보를 등록한다. + * {@link CrdnStngService#createExmptnVhclInfo(exmptnVhcl)} 참고 + * @param exmptnVhcl 면제차량 정보 + * @return jsonView + *
 {
+	 *     "saved": 저장되었으면 true, 그렇지 않으면 false
+	 * }
+ */ + public ModelAndView createExmptnVhclInfo(ExmptnVhcl exmptnVhcl) { + + ManagedUser currentUser = userMapper.getUser(currentUser().getAccount(), currentUser().getInstitute()); + String deptCd = currentUser.getDeptCode(); + exmptnVhcl.setSggCd(globalStngMapper.selectSggCd(deptCd)); + + boolean saved = false; + + saved = crdnStngService.createExmptnVhclInfo(exmptnVhcl); + + return new ModelAndView("jsonView") + .addObject("saved", saved); + + } + + /** 면제차량 정보를 수정한다. + * {@link CrdnStngService#updateExmptnVhclInfo(exmptnVhcl)} 참고 + * @param exmptnVhcl 면제차량 정보 + * @return jsonView + *
 {
+	 *     "saved": 저장되었으면 true, 그렇지 않으면 false
+	 * }
+ */ + public ModelAndView updateExmptnVhclInfo(ExmptnVhcl exmptnVhcl) { + + ManagedUser currentUser = userMapper.getUser(currentUser().getAccount(), currentUser().getInstitute()); + String deptCd = currentUser.getDeptCode(); + exmptnVhcl.setSggCd(globalStngMapper.selectSggCd(deptCd)); + + boolean saved = false; + + saved = crdnStngService.updateExmptnVhclInfo(exmptnVhcl); + + return new ModelAndView("jsonView") + .addObject("saved", saved); + + } + } diff --git a/src/main/java/cokr/xit/fims/task/web/BpvController.java b/src/main/java/cokr/xit/fims/task/web/BpvController.java index 429f55c8..f791f6d7 100644 --- a/src/main/java/cokr/xit/fims/task/web/BpvController.java +++ b/src/main/java/cokr/xit/fims/task/web/BpvController.java @@ -9,6 +9,7 @@ import org.springframework.web.servlet.ModelAndView; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.ExmptnVhcl; import cokr.xit.fims.cvlc.CrdnCvlcpt; import cokr.xit.fims.excl.CrdnReReg; import cokr.xit.fims.excl.ExclQuery; @@ -324,6 +325,17 @@ public class BpvController { return super.getExemptionVehicleInfo(exmptnVhclId); } + @Override + @RequestMapping(name="전용차로과태료업무 면제차량 정보 등록", value=METHOD_URL.createExmptnVhclInfo) + public ModelAndView createExmptnVhclInfo(ExmptnVhcl exmptnVhcl) { + return super.createExmptnVhclInfo(exmptnVhcl); + } + + @Override + @RequestMapping(name="전용차로과태료업무 면제차량 정보 수정", value=METHOD_URL.updateExmptnVhclInfo) + public ModelAndView updateExmptnVhclInfo(ExmptnVhcl exmptnVhcl) { + return super.updateExmptnVhclInfo(exmptnVhcl); + } } @Controller diff --git a/src/main/resources/sql/mapper/fims/crdn/exmptn-vhcl-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/exmptn-vhcl-mapper.xml index 900db0aa..8a9a6eda 100644 --- a/src/main/resources/sql/mapper/fims/crdn/exmptn-vhcl-mapper.xml +++ b/src/main/resources/sql/mapper/fims/crdn/exmptn-vhcl-mapper.xml @@ -50,4 +50,56 @@ SELECT A.EXMPTN_VHCL_ID WHERE A.EXMPTN_VHCL_ID = #{exmptnVhclId} + +/* 면제차량 정보 등록(exmptnVhclMapper.insertExmptnVhclInfo) */ + +SELECT + LPAD(CAST(IFNULL(MAX(EXMPTN_VHCL_ID) + 1, 1) AS INT), 10, '0') + AS NEW_ID +FROM TB_EXMPTN_VHCL + +INSERT INTO TB_EXMPTN_VHCL ( + EXMPTN_VHCL_ID + , SGG_CD + , VHRNO + , EXMPTN_RSN + , DOC_NO + , OWNR_NM + , EXMPTN_BGNG_YMD + , EXMPTN_END_YMD + , DEL_YN + , REG_DT + , RGTR + , MDFCN_DT + , MDFR +) VALUES ( + #{exmptnVhclId} + , #{sggCd} + , #{vhrno} + , #{exmptnRsn} + , #{docNo} + , #{ownrNm} + , #{exmptnBgngYmd} + , #{exmptnEndYmd} + , 'N' + , #{createdAt} + , #{createdBy} + , #{lastModified} + , #{modifiedBy} +) + + + +/* 면제차량 정보 수정(exmptnVhclMapper.updateExmptnVhclInfo) */ +UPDATE TB_EXMPTN_VHCL + SET EXMPTN_RSN = #{exmptnRsn} + , DOC_NO = #{docNo} + , OWNR_NM = #{ownrNm} + , EXMPTN_BGNG_YMD = #{exmptnBgngYmd} + , EXMPTN_END_YMD = #{exmptnEndYmd} + , MDFCN_DT = #{lastModified} + , MDFR = #{modifiedBy} + WHERE EXMPTN_VHCL_ID = #{exmptnVhclId} + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08010-main.jsp index a8d8ca21..da9e4587 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08010-main.jsp @@ -119,7 +119,6 @@ pageObject["${pageName}"] = {}; - $(document).ready(function(){ var $P = pageObject["${pageName}"]; @@ -159,7 +158,20 @@ $(document).ready(function(){ title: "면제차량 등록", content:resp, size: "lg", - init:() => {} + init:() => { + var parentRes = new Object(); + var childReq = pageObject.childReq.pop(); + + for(var reqKey in childReq) { + if($P.provide[reqKey]){ + parentRes[reqKey] = $P.provide[reqKey]; + } else { + parentRes[reqKey] = function(){}; + } + } + + pageObject.parentRes.push(parentRes); + } }); } }); @@ -175,7 +187,20 @@ $(document).ready(function(){ title: "면제차량 수정", content:resp, size: "lg", - init:() => {} + init:() => { + var parentRes = new Object(); + var childReq = pageObject.childReq.pop(); + + for(var reqKey in childReq) { + if($P.provide[reqKey]){ + parentRes[reqKey] = $P.provide[reqKey]; + } else { + parentRes[reqKey] = function(){}; + } + } + + pageObject.parentRes.push(parentRes); + } }); } }); @@ -214,7 +239,7 @@ $(document).ready(function(){ $P.clickExmptnVhclList($P.exmptnVhclControl.getCurrent()["EXMPTN_VHCL_ID"], true); } } - + /************************************************************************** * pageObject.function **************************************************************************/ @@ -318,6 +343,12 @@ $(document).ready(function(){ return data; } + $P.provide = { + "refreshList" : function(){ + $P.refreshExmptnVhclList(); + } + } + /************************************************************************** * element.on **************************************************************************/ diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08020-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08020-info.jsp index 3717cb5f..c9b67912 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08020-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn08020-info.jsp @@ -72,11 +72,22 @@ **************************************************************************/ pageObject["${pageName}"] = {}; +pageObject["${pageName}"].provided = {}; + +pageObject.childReq = []; +pageObject.childReq.push({ + refreshList : function(){} +}); $(document).ready(function(){ var $P = pageObject["${pageName}"]; - + + if(pageObject.parentRes.length > 0){ + $P.provided = pageObject.parentRes.pop(); + } else { + $P.provided = pageObject.childReq.pop(); + } /************************************************************************** * DatasetControl, Dataset, FormFields @@ -98,16 +109,16 @@ $(document).ready(function(){ $P.exmptnVhclControl.setInfo = (item) => { $P.formFields.set(item); - + var create = isEmpty(item.EXMPTN_VHCL_ID); $("#vhrno--${pageName}").prop("readonly", !create); } $P.exmptnVhclControl.save = (info) => { if (!info) return; - var item = $P.exmptnVhclControl.getCurrent("item"), - create = "added" == item.state; + var create = isEmpty(info.exmptnVhclId); + ajax.post({ url : !create ? $P.exmptnVhclControl.urls.update : $P.exmptnVhclControl.urls.create, data : info, @@ -122,6 +133,7 @@ $(document).ready(function(){ $P.exmptnVhclControl.onSave = (resp) => { if (resp.saved) { dialog.alert("저장됐습니다."); + $P.provided.refreshList(); dialog.close("exmptnvhcldialog"); } };