From 1a467292b5a2d2e61e00dc05c04ad1890dd58e5c Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Tue, 20 Feb 2024 17:39:30 +0900 Subject: [PATCH] =?UTF-8?q?PDF=20=EC=9E=90=EB=A3=8C=20=EC=B6=94=EC=B6=9C?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EC=A0=80=EC=9E=A5=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cokr/xit/fims/cmmn/ExtrArtclStng.java | 22 ++++ .../java/cokr/xit/fims/cmmn/ExtrForm.java | 19 +++ .../xit/fims/cmmn/dao/ExtrStngMapper.java | 23 +++- .../fims/cmmn/service/bean/ExtrStngBean.java | 73 ++++++++++- .../xit/fims/cmmn/web/StngController.java | 17 +++ .../cokr/xit/fims/task/web/CmnController.java | 7 ++ .../sql/mapper/fims/cmmn/extrStng-mapper.xml | 116 ++++++++++++++++-- .../WEB-INF/jsp/fims/stng01020-main.jsp | 2 - 8 files changed, 260 insertions(+), 19 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/cmmn/ExtrArtclStng.java create mode 100644 src/main/java/cokr/xit/fims/cmmn/ExtrForm.java diff --git a/src/main/java/cokr/xit/fims/cmmn/ExtrArtclStng.java b/src/main/java/cokr/xit/fims/cmmn/ExtrArtclStng.java new file mode 100644 index 00000000..2d33a137 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/ExtrArtclStng.java @@ -0,0 +1,22 @@ +package cokr.xit.fims.cmmn; + +import cokr.xit.foundation.AbstractEntity; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ExtrArtclStng extends AbstractEntity { + private String extrFormId; //추출항목ID + private String extrArtclNm; //추출항목명 + private String extrArtclDscrp; //추출항목설명 + private String leftPstn; //좌측 위치 + private String topPstn; //상단 위치 + private String widthSz; //영역크기 길이 + private String heightSz; //영역크기 높이 + + private String otptArtclOrdr; //출력항목순서 + private String sggCd; + private String taskSeCd; + private String tmplatId; +} diff --git a/src/main/java/cokr/xit/fims/cmmn/ExtrForm.java b/src/main/java/cokr/xit/fims/cmmn/ExtrForm.java new file mode 100644 index 00000000..8a86ee60 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/ExtrForm.java @@ -0,0 +1,19 @@ +package cokr.xit.fims.cmmn; + +import java.util.List; + +import cokr.xit.foundation.AbstractEntity; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ExtrForm extends AbstractEntity { + private String extrBscId; + private String sggCd; + private String taskSeCd; + private String tmplatId; + private String mobilePageTmplt; + private List extrArtclStngList; + private String[] extrFormIDs; +} diff --git a/src/main/java/cokr/xit/fims/cmmn/dao/ExtrStngMapper.java b/src/main/java/cokr/xit/fims/cmmn/dao/ExtrStngMapper.java index ed28b233..f20af81a 100644 --- a/src/main/java/cokr/xit/fims/cmmn/dao/ExtrStngMapper.java +++ b/src/main/java/cokr/xit/fims/cmmn/dao/ExtrStngMapper.java @@ -4,6 +4,8 @@ import java.util.List; import org.egovframe.rte.psl.dataaccess.mapper.Mapper; +import cokr.xit.fims.cmmn.ExtrArtclStng; +import cokr.xit.fims.cmmn.ExtrForm; import cokr.xit.fims.cmmn.ExtrStngQuery; import cokr.xit.foundation.component.AbstractMapper; import cokr.xit.foundation.data.DataObject; @@ -11,8 +13,27 @@ import cokr.xit.foundation.data.DataObject; @Mapper("extrStngMapper") public interface ExtrStngMapper extends AbstractMapper { + /**지정한 조건에 따라 자료 추출 템플릿 문구를 조회한다.
+ * @param query 자료 추출 설정 조회 조건 + * @return 자료 추출 템플릿 문구 + */ + DataObject selectExtrBscStng(ExtrStngQuery extrStngQuery); + + int insertBscStng(ExtrForm extrForm); + + int updateBscStng(ExtrForm extrForm); + + /**지정한 조건에 따라 추출 항목 설정을 조회한다.
+ * @param query 자료 추출 설정 조회 조건 + * @return 자료 추출 설정 항목 + */ List selectExtrArtclStngList(ExtrStngQuery extrStngQuery); - DataObject selectExtrBscStng(ExtrStngQuery extrStngQuery); + int updateArtclStng(ExtrArtclStng update); + + int deleteArtclStng(ExtrForm extrForm); + + int insertArtclStng(ExtrArtclStng insert); + } diff --git a/src/main/java/cokr/xit/fims/cmmn/service/bean/ExtrStngBean.java b/src/main/java/cokr/xit/fims/cmmn/service/bean/ExtrStngBean.java index 77226721..84a014a1 100644 --- a/src/main/java/cokr/xit/fims/cmmn/service/bean/ExtrStngBean.java +++ b/src/main/java/cokr/xit/fims/cmmn/service/bean/ExtrStngBean.java @@ -9,6 +9,8 @@ import javax.annotation.Resource; import org.springframework.stereotype.Component; +import cokr.xit.fims.cmmn.ExtrArtclStng; +import cokr.xit.fims.cmmn.ExtrForm; import cokr.xit.fims.cmmn.ExtrStngQuery; import cokr.xit.fims.cmmn.dao.ExtrStngMapper; import cokr.xit.fims.cmmn.pdf.extration.PredefinedSet; @@ -37,7 +39,7 @@ public class ExtrStngBean extends AbstractComponent { * @return 출력 요소 설정 */ public Map getExtrArtclStngMap(ExtrStngQuery query){ - Map otptStngMap = new HashMap(); + Map extrStngMap = new HashMap(); PDFExtractFormat pdfFormat = null; pdfFormat = new ElectronicNotice(); @@ -59,9 +61,70 @@ public class ExtrStngBean extends AbstractComponent { Map custom = new HashMap(); custom.put("dataList", customDataList); - otptStngMap.put("predefinedSetList", predefinedSetList); - otptStngMap.put("predefined", predefined); - otptStngMap.put("custom", custom); - return otptStngMap; + extrStngMap.put("predefinedSetList", predefinedSetList); + extrStngMap.put("predefined", predefined); + extrStngMap.put("custom", custom); + return extrStngMap; + } + + + public boolean saveExtrBscStng(ExtrForm extrForm) { + + boolean result = false; + String userId = currentUser().getId(); + + if(ifEmpty(extrForm.getExtrBscId(), ()-> "").equals("")) { + extrForm.setCreatedBy(userId); + result = extrStngMapper.insertBscStng(extrForm) == 1 ? true : false; + + } else { + extrForm.setModifiedBy(userId); + result = extrStngMapper.updateBscStng(extrForm) == 1 ? true : false; + } + + return result; + } + + + public boolean saveExtrArtclStng(ExtrForm extrForm) { + try { + + String userId = currentUser().getId(); + List extrArtclStngList = extrForm.getExtrArtclStngList(); + + List updateKeyList = new ArrayList(); + List insertList = new ArrayList(); + + if(extrArtclStngList != null && !extrArtclStngList.isEmpty()) { + + List updateList = extrArtclStngList.stream().filter(item -> !ifEmpty(item.getExtrFormId(), () -> "").equals("")).toList(); + if(!updateList.isEmpty()) { + for(ExtrArtclStng update : updateList) { + update.setModifiedBy(userId); + int u = extrStngMapper.updateArtclStng(update); + updateKeyList.add(update.getExtrFormId()); + } + } + insertList = extrArtclStngList.stream().filter(item -> ifEmpty(item.getExtrFormId(), () -> "").equals("")).toList(); + } + + if(!updateKeyList.isEmpty()) { + extrForm.setExtrFormIDs(updateKeyList.toArray(new String[updateKeyList.size()])); + } + extrForm.setModifiedBy(userId); + int d = extrStngMapper.deleteArtclStng(extrForm); + + if(!insertList.isEmpty()) { + for(ExtrArtclStng insert : insertList) { + insert.setCreatedBy(userId); + int i = extrStngMapper.insertArtclStng(insert); + } + } + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("[F]추출 설정 저장 중 오류가 발생하였습니다."); + } + + 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 5a3fa3e6..c20b6eb4 100644 --- a/src/main/java/cokr/xit/fims/cmmn/web/StngController.java +++ b/src/main/java/cokr/xit/fims/cmmn/web/StngController.java @@ -14,6 +14,7 @@ import cokr.xit.base.code.CommonCode; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.web.ApplicationController; +import cokr.xit.fims.cmmn.ExtrForm; import cokr.xit.fims.cmmn.ExtrStngQuery; import cokr.xit.fims.cmmn.OtptForm; import cokr.xit.fims.cmmn.OtptStngQuery; @@ -251,4 +252,20 @@ public class StngController extends ApplicationController { return mav; } + + /** PDF 추출 설정 정보를 저장한다. + * @return 저장 여부 + */ + public ModelAndView saveExtrStngInfo(ExtrForm extrForm) { + ModelAndView mav = new ModelAndView("jsonView"); + boolean saved = false; + + saved = extrStngBean.saveExtrBscStng(extrForm); + if(saved) { + saved = extrStngBean.saveExtrArtclStng(extrForm); + } + + 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 7972a091..3c1779e2 100644 --- a/src/main/java/cokr/xit/fims/task/web/CmnController.java +++ b/src/main/java/cokr/xit/fims/task/web/CmnController.java @@ -8,6 +8,7 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import cokr.xit.fims.cmmn.CmmnQuery; +import cokr.xit.fims.cmmn.ExtrForm; import cokr.xit.fims.cmmn.ExtrStngQuery; import cokr.xit.fims.cmmn.OtptForm; import cokr.xit.fims.cmmn.OtptStngQuery; @@ -733,5 +734,11 @@ public class CmnController { public ModelAndView getExtrStngInfo(ExtrStngQuery extrStngQuery) { return super.getExtrStngInfo(extrStngQuery); } + + @Override + @RequestMapping(name="PDF 자료 추출 설정 정보 저장", value=METHOD_URL.saveExtrStngInfo) + public ModelAndView saveExtrStngInfo(ExtrForm extrForm) { + return super.saveExtrStngInfo(extrForm); + } } } diff --git a/src/main/resources/sql/mapper/fims/cmmn/extrStng-mapper.xml b/src/main/resources/sql/mapper/fims/cmmn/extrStng-mapper.xml index aa74e0a0..4cdcff10 100644 --- a/src/main/resources/sql/mapper/fims/cmmn/extrStng-mapper.xml +++ b/src/main/resources/sql/mapper/fims/cmmn/extrStng-mapper.xml @@ -2,8 +2,53 @@ + + + +/* PDF 자료 추출 템플릿 문구 설정 등록(extrStngMapper.insertBscStng) */ + +SELECT + LPAD(CAST(IFNULL(MAX(EXTR_BSC_ID) + 1, 1) AS INT), 10, '0') + AS NEW_ID +FROM TB_EXTR_BSC_STNG + +INSERT + INTO TB_EXTR_BSC_STNG ( + EXTR_BSC_ID + , SGG_CD + , TASK_SE_CD + , MOBILE_PAGE_TMPLT + , USE_YN + ) VALUES ( + #{extrBscId} + , #{sggCd} + , #{taskSeCd} + , #{mobilePageTmplt} + , 'Y' + ) + + + +/* PDF 자료 추출 템플릿 문구 수정(extrStngMapper.updateBscStng) */ +UPDATE TB_EXTR_BSC_STNG + SET MOBILE_PAGE_TMPLT = #{mobilePageTmplt} + WHERE EXTR_BSC_ID = #{extrBscId} + AND USE_YN = 'Y' + + - + , TMPLAT_ID + , EXTR_ARTCL_NM + , EXTR_ARTCL_DSCRP + , LEFT_PSTN + , TOP_PSTN + , WIDTH_SZ + , HEIGHT_SZ + , USE_YN + ) VALUES ( + #{extrFormId} + , #{sggCd} + , #{taskSeCd} + , #{tmplatId} + , #{extrArtclNm} + , #{extrArtclDscrp} + , #{leftPstn} + , #{topPstn} + , #{widthSz} + , #{heightSz} + , 'Y' + ) + + + +/* 추출 설정 수정(extrStngMapper.updateArtclStng) */ +UPDATE TB_EXTR_FORM_STNG + SET EXTR_ARTCL_NM = #{extrArtclNm} + , EXTR_ARTCL_DSCRP= #{extrArtclDscrp} + , LEFT_PSTN = #{leftPstn} + , TOP_PSTN = #{topPstn} + , WIDTH_SZ = #{widthSz} + , HEIGHT_SZ = #{heightSz} + WHERE EXTR_FORM_ID = #{extrFormId} + AND USE_YN = 'Y' + + + +/* 추출 설정 삭제(extrStngMapper.deleteArtclStng) */ +UPDATE TB_EXTR_FORM_STNG + SET USE_YN = 'N' + WHERE SGG_CD = #{sggCd} + AND TASK_SE_CD = #{taskSeCd} + AND TMPLAT_ID = #{tmplatId} + AND USE_YN = 'Y' + + AND EXTR_FORM_ID NOT IN (#{EXTR_FORM_ID}) + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/fims/stng01020-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/stng01020-main.jsp index ce57889a..44c1673f 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/stng01020-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/stng01020-main.jsp @@ -386,8 +386,6 @@ $(document).ready(function(){ return; } - //TODO : 삭제 불가 항목 확인 - $("#"+tbodyId).find("tr").filter(function(index, selector){ if($(selector).find("input[name='del'][type='checkbox']").is(":checked")){ $(selector).remove();