From 87f04a7cd18b529883a10d82d766f6cc0d7ef74a Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Fri, 1 Dec 2023 17:49:07 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B6=9C=EB=A0=A5=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20=EA=B8=B0=EB=8A=A5=20=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/sprt/OtptForm.java | 18 ++++ .../java/cokr/xit/fims/sprt/OtptStng.java | 25 ++++++ .../xit/fims/sprt/dao/OtptStngMapper.java | 8 ++ .../fims/sprt/service/bean/OtptStngBean.java | 43 ++++++++++ .../xit/fims/sprt/web/Sprt01Controller.java | 16 +++- .../cokr/xit/fims/task/web/CmnController.java | 7 ++ .../sql/mapper/fims/sprt/otptStng-mapper.xml | 85 ++++++++++++++++++- .../WEB-INF/jsp/fims/sprt/sprt01200-main.jsp | 65 ++++++++++++++ 8 files changed, 265 insertions(+), 2 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/sprt/OtptForm.java create mode 100644 src/main/java/cokr/xit/fims/sprt/OtptStng.java diff --git a/src/main/java/cokr/xit/fims/sprt/OtptForm.java b/src/main/java/cokr/xit/fims/sprt/OtptForm.java new file mode 100644 index 00000000..e62ad2a1 --- /dev/null +++ b/src/main/java/cokr/xit/fims/sprt/OtptForm.java @@ -0,0 +1,18 @@ +package cokr.xit.fims.sprt; + +import java.util.List; + +import cokr.xit.foundation.AbstractEntity; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class OtptForm extends AbstractEntity { + private String sggCd; + private String taskSeCd; + private String sndngSeCd; + private String otptPaperSeCd; + private List otptStngList; + private String[] otptFormIDs; +} diff --git a/src/main/java/cokr/xit/fims/sprt/OtptStng.java b/src/main/java/cokr/xit/fims/sprt/OtptStng.java new file mode 100644 index 00000000..7f8514e8 --- /dev/null +++ b/src/main/java/cokr/xit/fims/sprt/OtptStng.java @@ -0,0 +1,25 @@ +package cokr.xit.fims.sprt; + +import cokr.xit.foundation.AbstractEntity; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class OtptStng extends AbstractEntity { + private String otptFormId; //출력항목ID + private String otptNm; //출력항목명 + private String leftPstn; //좌측 위치 + private String topPstn; //상단 위치 + private String widthSz; //영역크기 길이 + private String heightSz; //영역크기 높이 + private String textSort; //텍스트정렬 + private String fontNm; //글꼴명 + private String fontSz; //글꼴크기 + private String fontColor; //글꼴색 + private String fontStyle; //글꼴스타일 + private String sggCd; + private String taskSeCd; + private String sndngSeCd; + private String otptPaperSeCd; +} diff --git a/src/main/java/cokr/xit/fims/sprt/dao/OtptStngMapper.java b/src/main/java/cokr/xit/fims/sprt/dao/OtptStngMapper.java index 65f105a2..9154c6f5 100644 --- a/src/main/java/cokr/xit/fims/sprt/dao/OtptStngMapper.java +++ b/src/main/java/cokr/xit/fims/sprt/dao/OtptStngMapper.java @@ -4,6 +4,8 @@ import java.util.List; import org.egovframe.rte.psl.dataaccess.mapper.Mapper; +import cokr.xit.fims.sprt.OtptForm; +import cokr.xit.fims.sprt.OtptStng; import cokr.xit.fims.sprt.OtptStngQuery; import cokr.xit.foundation.component.AbstractMapper; import cokr.xit.foundation.data.DataObject; @@ -17,4 +19,10 @@ public interface OtptStngMapper extends AbstractMapper { */ List selectOtptStngList(OtptStngQuery query); + int updateStng(OtptStng update); + + int deleteStng(OtptForm otptForm); + + int insertStng(OtptStng insert); + } diff --git a/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java b/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java index 020728f9..99b0de08 100644 --- a/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java +++ b/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java @@ -12,6 +12,8 @@ import org.springframework.stereotype.Component; import cokr.xit.fims.cmmn.pdf.DefaultOtptStng; import cokr.xit.fims.cmmn.pdf.PDFFormat; import cokr.xit.fims.cmmn.pdf.format.Advntce; +import cokr.xit.fims.sprt.OtptForm; +import cokr.xit.fims.sprt.OtptStng; import cokr.xit.fims.sprt.OtptStngQuery; import cokr.xit.fims.sprt.dao.OtptStngMapper; import cokr.xit.foundation.AbstractComponent; @@ -59,4 +61,45 @@ public class OtptStngBean extends AbstractComponent { otptStngMap.put("multiple", multiple); return otptStngMap; } + + public boolean saveOtptStng(OtptForm otptForm) { + try { + + String userId = currentUser().getId(); + List otptStngList = otptForm.getOtptStngList(); + + List updateKeyList = new ArrayList(); + List insertList = new ArrayList(); + + if(otptStngList != null && !otptStngList.isEmpty()) { + + List updateList = otptStngList.stream().filter(item -> !ifEmpty(item.getOtptFormId(), () -> "").equals("")).toList(); + if(!updateList.isEmpty()) { + for(OtptStng update : updateList) { + update.setModifiedBy(userId); + int u = otptStngMapper.updateStng(update); + updateKeyList.add(update.getOtptFormId()); + } + } + insertList = otptStngList.stream().filter(item -> ifEmpty(item.getOtptFormId(), () -> "").equals("")).toList(); + } + + if(!updateKeyList.isEmpty()) { + otptForm.setOtptFormIDs(updateKeyList.toArray(new String[updateKeyList.size()])); + } + otptForm.setModifiedBy(userId); + int d = otptStngMapper.deleteStng(otptForm); + + if(!insertList.isEmpty()) { + for(OtptStng insert : insertList) { + insert.setCreatedBy(userId); + int i = otptStngMapper.insertStng(insert); + } + } + } catch (Exception e) { + throw new RuntimeException("출력 설정 저장 중 오류가 발생하였습니다."); + } + + return true; + } } diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java index e00e97b5..bd013482 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java @@ -17,6 +17,7 @@ import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.dao.GlobalStngMapper; import cokr.xit.fims.sprt.Keyword; +import cokr.xit.fims.sprt.OtptForm; import cokr.xit.fims.sprt.OtptStngQuery; import cokr.xit.fims.sprt.PrintOption; import cokr.xit.fims.sprt.SprtQuery; @@ -59,7 +60,8 @@ public class Sprt01Controller extends ApplicationController { makeAdvntceOutsourcing = "/140/makeAdvntceOutsourcing.do", otptStngMain = "/200/main.do", - getOtptStngInfo = "/200/info.do" + getOtptStngInfo = "/200/info.do", + saveOtptStngInfo = "/200/save.do" ; } @@ -475,4 +477,16 @@ public class Sprt01Controller extends ApplicationController { return mav; } + /** 출력물 설정 정보를 저장한다. + * @return 저장 여부 + */ + public ModelAndView saveOtptStngInfo(OtptForm otptForm) { + ModelAndView mav = new ModelAndView("jsonView"); + boolean saved = false; + + saved = otptStngBean.saveOtptStng(otptForm); + + 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 c9a8ce8e..8e54aea9 100644 --- a/src/main/java/cokr/xit/fims/task/web/CmnController.java +++ b/src/main/java/cokr/xit/fims/task/web/CmnController.java @@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import cokr.xit.fims.crdn.Crdn; +import cokr.xit.fims.sprt.OtptForm; import cokr.xit.fims.sprt.OtptStngQuery; import cokr.xit.fims.sprt.PrintOption; import cokr.xit.fims.sprt.SprtQuery; @@ -444,6 +445,12 @@ public class CmnController { return super.getOtptStngInfo(otptStngQuery); } + @Override + @RequestMapping(name="출력물 설정 정보 저장", value=METHOD_URL.saveOtptStngInfo) + public ModelAndView saveOtptStngInfo(OtptForm otptForm) { + return super.saveOtptStngInfo(otptForm); + } + } @Controller diff --git a/src/main/resources/sql/mapper/fims/sprt/otptStng-mapper.xml b/src/main/resources/sql/mapper/fims/sprt/otptStng-mapper.xml index 060dbbc3..c239b082 100644 --- a/src/main/resources/sql/mapper/fims/sprt/otptStng-mapper.xml +++ b/src/main/resources/sql/mapper/fims/sprt/otptStng-mapper.xml @@ -27,4 +27,87 @@ SELECT OTPT_FORM_ID AND OTPT_PAPER_SE_CD = #{otptPaperSeCd} - \ No newline at end of file + +/* 출력 설정 등록(otptStngMapper.insertStng) */ + +SELECT + CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(OTPT_FORM_ID,5)) + 1, 1) AS INT), 16, '0')) + AS NEW_ID +FROM TB_OTPT_FORM + +INSERT + INTO TB_OTPT_FORM ( + OTPT_FORM_ID + , SGG_CD + , TASK_SE_CD + , SNDNG_SE_CD + , OTPT_PAPER_SE_CD + , OTPT_NM + , LEFT_PSTN + , TOP_PSTN + , WIDTH_SZ + , HEIGHT_SZ + , TEXT_SORT + , FONT_NM + , FONT_SZ + , FONT_COLOR + , FONT_STYLE + , USE_YN + , REG_DT + , RGTR + ) VALUES ( + #{otptFormId} + , #{sggCd} + , #{taskSeCd} + , #{sndngSeCd} + , #{otptPaperSeCd} + , #{otptNm} + , #{leftPstn} + , #{topPstn} + , #{widthSz} + , #{heightSz} + , #{textSort} + , #{fontNm} + , #{fontSz} + , #{fontColor} + , #{fontStyle} + , 'Y' + , + , #{createdBy} + ) + + + +/* 출력 설정 수정(otptStngMapper.updateStng) */ +UPDATE TB_OTPT_FORM + SET OTPT_NM = #{otptNm} + , LEFT_PSTN = #{leftPstn} + , TOP_PSTN = #{topPstn} + , WIDTH_SZ = #{widthSz} + , HEIGHT_SZ = #{heightSz} + , TEXT_SORT = #{textSort} + , FONT_NM = #{fontNm} + , FONT_SZ = #{fontSz} + , FONT_COLOR = #{fontColor} + , FONT_STYLE = #{fontStyle} + , MDFCN_DT = + , MDFR = #{modifiedBy} + WHERE OTPT_FORM_ID = #{otptFormId} + + + +/* 출력 설정 삭제(otptStngMapper.deleteStng) */ +UPDATE TB_OTPT_FORM + SET USE_YN = 'N' + , MDFCN_DT = + , MDFR = #{modifiedBy} + WHERE SGG_CD = #{sggCd} + AND TASK_SE_CD = #{taskSeCd} + AND SNDNG_SE_CD = #{sndngSeCd} + AND OTPT_PAPER_SE_CD = #{otptPaperSeCd} + + AND OTPT_FORM_ID NOT IN (#{OTPT_FORM_ID}) + + + + diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp index 9b622a43..2750ce02 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01200-main.jsp @@ -504,8 +504,73 @@ $(document).ready(function(){ } + $P.getRowData = (tbodyId, query) => { + var rowArr = []; + $("#"+tbodyId+" tr").each(function(){ + var otptFormId = this.dataset.key; + var otptNm = $($P.fnGetElement(this,"otptNm")).val(); + var leftPstn = $($P.fnGetElement(this,"leftPstn")).val(); + var topPstn = $($P.fnGetElement(this,"topPstn")).val(); + var widthSz = $($P.fnGetElement(this,"widthSz")).val(); + var heightSz = $($P.fnGetElement(this,"heightSz")).val(); + var textSort = $($P.fnGetElement(this,"textSort")).val(); + var fontNm = $($P.fnGetElement(this,"fontNm")).val(); + var fontSz = $($P.fnGetElement(this,"fontSz")).val(); + var fontColor = $($P.fnGetElement(this,"fontColor")).val(); + var fontStyle = $($P.fnGetElement(this,"fontStyle")).val(); + + var row = { + otptFormId : otptFormId, + otptNm : otptNm, + leftPstn : leftPstn, + topPstn : topPstn, + widthSz : widthSz, + heightSz : heightSz, + textSort : textSort, + fontNm : fontNm, + fontSz : fontSz, + fontColor : fontColor, + fontStyle : fontStyle, + + sggCd : query.sggCd, + taskSeCd : query.taskSeCd, + sndngSeCd : query.sndngSeCd, + otptPaperSeCd : query.otptPaperSeCd + }; + rowArr.push(row); + }); + + return rowArr; + } + $P.fnSave = () => { + var ff = new FimsFormFields("#frmEdit--${pageName}"); + var query = ff.get(); + var rowArr1 = $P.getRowData("tbodyUnique--${pageName}", query); + var rowArr2 = $P.getRowData("tbodyMultiple--${pageName}", query); + var rowArr = [...rowArr1, ...rowArr2]; + + query.otptStngList = rowArr; + + query = fnJsonToFormData(query,"otptStngList"); + + ajax.post({ + url : wctx.url("/sprt/sprt01/200/save.do"), + data : query, + success : (resp) => { + if(resp.saved){ + dialog.alert("저장되었습니다."); + + $("#frmSearch--${pageName}").find("[name='sggCd']").val(query.sggCd); + $("#frmSearch--${pageName}").find("[name='taskSeCd']").val(query.taskSeCd); + $("#frmSearch--${pageName}").find("[name='sndngSeCd']").val(query.sndngSeCd); + $("#frmSearch--${pageName}").find("[name='otptPaperSeCd']").val(query.otptPaperSeCd); + + $("#btnLoad--${pageName}").click(); + } + } + }); } $("#theadUnique--${pageName}").html($("#theadTr--${pageName}")[0].innerHTML);