From 79d8b2b94a3e9da47c4e0f64e72a1d9803e3ad1c Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Thu, 28 Mar 2024 17:04:11 +0900 Subject: [PATCH] =?UTF-8?q?=EC=99=B8=EC=A3=BC=EC=9A=94=EC=B2=AD=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EC=84=9C=EC=8B=9D=20=EC=84=A4=EC=A0=95=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/fims/cmmn/OutsourcingArtclStng.java | 21 ++++++ .../cokr/xit/fims/cmmn/OutsourcingForm.java | 20 ++++++ .../fims/cmmn/dao/OutsourcingStngMapper.java | 8 +++ .../service/bean/OutsourcingStngBean.java | 47 +++++++++++++ .../xit/fims/cmmn/web/StngController.java | 21 +++++- .../cokr/xit/fims/task/web/CmnController.java | 7 ++ .../fims/cmmn/outsourcingStng-mapper.xml | 67 +++++++++++++++++++ .../WEB-INF/jsp/fims/stng01030-main.jsp | 8 +-- 8 files changed, 194 insertions(+), 5 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/cmmn/OutsourcingArtclStng.java create mode 100644 src/main/java/cokr/xit/fims/cmmn/OutsourcingForm.java diff --git a/src/main/java/cokr/xit/fims/cmmn/OutsourcingArtclStng.java b/src/main/java/cokr/xit/fims/cmmn/OutsourcingArtclStng.java new file mode 100644 index 00000000..b7cc3151 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/OutsourcingArtclStng.java @@ -0,0 +1,21 @@ +package cokr.xit.fims.cmmn; + +import cokr.xit.foundation.AbstractEntity; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class OutsourcingArtclStng extends AbstractEntity { + private String outsourcingFormId; //항목ID + private String artclOrdr; //항목순서 + private String artclNm; //항목명 + private String artclSz; //항목 바이트수 + private String paddingDirection; //공백방향 + private String formatting; + + private String sggCd; + private String taskSeCd; + private String sndngSeCd; + +} diff --git a/src/main/java/cokr/xit/fims/cmmn/OutsourcingForm.java b/src/main/java/cokr/xit/fims/cmmn/OutsourcingForm.java new file mode 100644 index 00000000..df1fc82b --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/OutsourcingForm.java @@ -0,0 +1,20 @@ +package cokr.xit.fims.cmmn; + +import java.util.List; + +import cokr.xit.foundation.AbstractEntity; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class OutsourcingForm extends AbstractEntity { + + private String outsourcingBscId; + private String sggCd; + private String taskSeCd; + private String sndngSeCd; + private List zipArtclStngList; + private String[] outsourcingFormIDs; + +} diff --git a/src/main/java/cokr/xit/fims/cmmn/dao/OutsourcingStngMapper.java b/src/main/java/cokr/xit/fims/cmmn/dao/OutsourcingStngMapper.java index 316ee541..5ff65439 100644 --- a/src/main/java/cokr/xit/fims/cmmn/dao/OutsourcingStngMapper.java +++ b/src/main/java/cokr/xit/fims/cmmn/dao/OutsourcingStngMapper.java @@ -4,6 +4,8 @@ import java.util.List; import org.egovframe.rte.psl.dataaccess.mapper.Mapper; +import cokr.xit.fims.cmmn.OutsourcingArtclStng; +import cokr.xit.fims.cmmn.OutsourcingForm; import cokr.xit.fims.cmmn.OutsourcingStngQuery; import cokr.xit.foundation.component.AbstractMapper; import cokr.xit.foundation.data.DataObject; @@ -17,4 +19,10 @@ public interface OutsourcingStngMapper extends AbstractMapper { */ List selectArtclStngList(OutsourcingStngQuery query); + int updateArtclStng(OutsourcingArtclStng update); + + int deleteArtclStng(OutsourcingForm outsourcingForm); + + int insertArtclStng(OutsourcingArtclStng insert); + } diff --git a/src/main/java/cokr/xit/fims/cmmn/service/bean/OutsourcingStngBean.java b/src/main/java/cokr/xit/fims/cmmn/service/bean/OutsourcingStngBean.java index 7a29d6fd..d13372d8 100644 --- a/src/main/java/cokr/xit/fims/cmmn/service/bean/OutsourcingStngBean.java +++ b/src/main/java/cokr/xit/fims/cmmn/service/bean/OutsourcingStngBean.java @@ -10,6 +10,8 @@ import javax.annotation.Resource; import org.springframework.stereotype.Component; +import cokr.xit.fims.cmmn.OutsourcingArtclStng; +import cokr.xit.fims.cmmn.OutsourcingForm; import cokr.xit.fims.cmmn.OutsourcingStngQuery; import cokr.xit.fims.cmmn.dao.OutsourcingStngMapper; import cokr.xit.fims.cmmn.pdf.extraction.PredefinedSet; @@ -88,4 +90,49 @@ public class OutsourcingStngBean extends AbstractComponent { return outsourcingStngMap; } + + /** 출력 요소 설정을 저장 및 삭제 처리한다. + * @param outsourcingForm 출력 설정 + * @return 저장여부 + */ + public boolean saveOutsourcingArtclStng(OutsourcingForm outsourcingForm) { + try { + + String userId = currentUser().getId(); + List outsourcingArtclStngList = outsourcingForm.getZipArtclStngList(); + + List updateKeyList = new ArrayList(); + List insertList = new ArrayList(); + + if(outsourcingArtclStngList != null && !outsourcingArtclStngList.isEmpty()) { + + List updateList = outsourcingArtclStngList.stream().filter(item -> !ifEmpty(item.getOutsourcingFormId(), () -> "").equals("")).toList(); + if(!updateList.isEmpty()) { + for(OutsourcingArtclStng update : updateList) { + update.setModifiedBy(userId); + outsourcingStngMapper.updateArtclStng(update); + updateKeyList.add(update.getOutsourcingFormId()); + } + } + insertList = outsourcingArtclStngList.stream().filter(item -> ifEmpty(item.getOutsourcingFormId(), () -> "").equals("")).toList(); + } + + if(!updateKeyList.isEmpty()) { + outsourcingForm.setOutsourcingFormIDs(updateKeyList.toArray(new String[updateKeyList.size()])); + } + outsourcingForm.setModifiedBy(userId); + outsourcingStngMapper.deleteArtclStng(outsourcingForm); + + if(!insertList.isEmpty()) { + for(OutsourcingArtclStng insert : insertList) { + insert.setCreatedBy(userId); + outsourcingStngMapper.insertArtclStng(insert); + } + } + } catch (Exception e) { + throw new RuntimeException("출력 설정 저장 중 오류가 발생하였습니다."); + } + + return true; + } } diff --git a/src/main/java/cokr/xit/fims/cmmn/web/StngController.java b/src/main/java/cokr/xit/fims/cmmn/web/StngController.java index bd68c6f0..2e73e24c 100644 --- a/src/main/java/cokr/xit/fims/cmmn/web/StngController.java +++ b/src/main/java/cokr/xit/fims/cmmn/web/StngController.java @@ -18,6 +18,7 @@ import cokr.xit.fims.cmmn.ExtrForm; import cokr.xit.fims.cmmn.ExtrStngQuery; import cokr.xit.fims.cmmn.OtptForm; import cokr.xit.fims.cmmn.OtptStngQuery; +import cokr.xit.fims.cmmn.OutsourcingForm; import cokr.xit.fims.cmmn.OutsourcingStngQuery; import cokr.xit.fims.cmmn.service.StngService; import cokr.xit.fims.cmmn.service.bean.ExtrStngBean; @@ -49,7 +50,8 @@ public class StngController extends ApplicationController { getExtrStngInfo = "/020/info.do", saveExtrStngInfo = "/020/save.do", outsourcingStngMain = "/030/main.do", - getOutsourcingStngInfo = "/030/info.do" + getOutsourcingStngInfo = "/030/info.do", + saveOutsourcingStngInfo = "/030/save.do" ; } @@ -322,4 +324,21 @@ public class StngController extends ApplicationController { return mav; } + + + /** 외주요청파일 서식 설정 정보를 저장한다. + * @return 저장 여부 + */ + public ModelAndView saveOutsourcingStngInfo(OutsourcingForm outsourcingForm) { + ModelAndView mav = new ModelAndView("jsonView"); + boolean saved = false; + + //saved = outsourcingStngBean.saveBscStng(otptForm); + //if(saved) { + saved = outsourcingStngBean.saveOutsourcingArtclStng(outsourcingForm); + //} + + mav.addObject("saved", saved); + return mav; + } } diff --git a/src/main/java/cokr/xit/fims/task/web/CmnController.java b/src/main/java/cokr/xit/fims/task/web/CmnController.java index 39fbfa3d..6ba18e3c 100644 --- a/src/main/java/cokr/xit/fims/task/web/CmnController.java +++ b/src/main/java/cokr/xit/fims/task/web/CmnController.java @@ -12,6 +12,7 @@ import cokr.xit.fims.cmmn.ExtrForm; import cokr.xit.fims.cmmn.ExtrStngQuery; import cokr.xit.fims.cmmn.OtptForm; import cokr.xit.fims.cmmn.OtptStngQuery; +import cokr.xit.fims.cmmn.OutsourcingForm; import cokr.xit.fims.cmmn.OutsourcingStngQuery; import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.crdn.Crdn; @@ -833,5 +834,11 @@ public class CmnController { public ModelAndView getOutsourcingStngInfo(OutsourcingStngQuery outsourcingStngQuery) { return super.getOutsourcingStngInfo(outsourcingStngQuery); } + + @Override + @RequestMapping(name="외주요청파일 서식 설정 정보 저장", value=METHOD_URL.saveOutsourcingStngInfo) + public ModelAndView saveOutsourcingStngInfo(OutsourcingForm outsourcingForm) { + return super.saveOutsourcingStngInfo(outsourcingForm); + } } } diff --git a/src/main/resources/sql/mapper/fims/cmmn/outsourcingStng-mapper.xml b/src/main/resources/sql/mapper/fims/cmmn/outsourcingStng-mapper.xml index 37e6ad93..6156b664 100644 --- a/src/main/resources/sql/mapper/fims/cmmn/outsourcingStng-mapper.xml +++ b/src/main/resources/sql/mapper/fims/cmmn/outsourcingStng-mapper.xml @@ -21,4 +21,71 @@ SELECT OUTSOURCING_FORM_ID ORDER BY ARTCL_ORDR + +/* 외주요청파일서식 설정 등록(outsourcingStngMapper.insertArtclStng) */ + +SELECT + LPAD(CAST(IFNULL(MAX(OUTSOURCING_FORM_ID) + 1, 1) AS INT), 10, '0') + AS NEW_ID +FROM TB_OUTSOURCING_FORM_STNG + +INSERT + INTO TB_OUTSOURCING_FORM_STNG ( + OUTSOURCING_FORM_ID + , SGG_CD + , TASK_SE_CD + , SNDNG_SE_CD + , ARTCL_ORDR + , ARTCL_NM + , ARTCL_SZ + , PADDING_DIRECTION + , FORMATTING + , USE_YN + , REG_DT + , RGTR + ) VALUES ( + #{outsourcingFormId} + , #{sggCd} + , #{taskSeCd} + , #{sndngSeCd} + , #{artclOrdr} + , #{artclNm} + , #{artclSz} + , #{paddingDirection} + , #{formatting} + , 'Y' + , + , #{createdBy} + ) + + + +/* 외주요청파일서식 설정 수정(outsourcingStngMapper.updateArtclStng) */ +UPDATE TB_OUTSOURCING_FORM_STNG + SET ARTCL_ORDR = #{artclOrdr} + , ARTCL_NM = #{artclNm} + , ARTCL_SZ = #{artclSz} + , PADDING_DIRECTION = #{paddingDirection} + , FORMATTING = #{formatting} + , MDFCN_DT = + , MDFR = #{modifiedBy} + WHERE OUTSOURCING_FORM_ID = #{outsourcingFormId} + AND USE_YN = 'Y' + + + +/* 외주요청파일서식 설정 삭제(outsourcingStngMapper.deleteArtclStng) */ +UPDATE TB_OUTSOURCING_FORM_STNG + SET USE_YN = 'N' + , MDFCN_DT = + , MDFR = #{modifiedBy} + WHERE SGG_CD = #{sggCd} + AND TASK_SE_CD = #{taskSeCd} + AND SNDNG_SE_CD = #{sndngSeCd} + AND USE_YN = 'Y' + + AND OUTSOURCING_FORM_ID NOT IN (#{OUTSOURCING_FORM_ID}) + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/fims/stng01030-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/stng01030-main.jsp index 069acb86..64ca4faf 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/stng01030-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/stng01030-main.jsp @@ -250,7 +250,7 @@ $(document).ready(function(){ var components = ""; for(var i=0; i < predefinedSetList.length; i++){ var p = predefinedSetList[i]; - components += ""; + components += ""; } var template = document.getElementById("found--${pageName}").innerHTML; template = template.replace(/{OUTSOURCING_FORM_ID}/gi, ""); @@ -300,12 +300,12 @@ $(document).ready(function(){ var row = {}; row.outsourcingFormId = this.dataset.key; - row.artclNm = $($P.fnGetElement(this,"artclNm")).val(); row.artclOrdr = $($P.fnGetElement(this,"artclOrdr")).val(); + row.artclNm = $($P.fnGetElement(this,"artclNm")).val(); row.artclSz = $($P.fnGetElement(this,"artclSz")).val(); - row.paddingDirection = $($P.fnGetElement(this,"paddingDirection")).val(); - + row.formatting = $($P.fnGetElement(this,"formatting")).val(); + row.sggCd = formData.get("sggCd"); row.taskSeCd = formData.get("taskSeCd"); row.sndngSeCd = formData.get("sndngSeCd");