diff --git a/src/main/java/cokr/xit/fims/cmmn/ExtrStngQuery.java b/src/main/java/cokr/xit/fims/cmmn/ExtrStngQuery.java index 8a993a77..0db06bd8 100644 --- a/src/main/java/cokr/xit/fims/cmmn/ExtrStngQuery.java +++ b/src/main/java/cokr/xit/fims/cmmn/ExtrStngQuery.java @@ -4,14 +4,14 @@ public class ExtrStngQuery extends CmmnQuery { private static final long serialVersionUID = 1L; - private String templateId; + private String tmplatId; - public String getTemplateId() { - return ifEmpty(templateId, () -> null); + public String getTmplatId() { + return ifEmpty(tmplatId, () -> null); } - public T setTemplateId(String templateId) { - this.templateId = templateId; + public T setTmplatId(String tmplatId) { + this.tmplatId = tmplatId; return self(); } diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/extration/PredefinedSet.java b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/PredefinedSet.java new file mode 100644 index 00000000..7e67866b --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/PredefinedSet.java @@ -0,0 +1,16 @@ +package cokr.xit.fims.cmmn.pdf.extration; + + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class PredefinedSet { + public PredefinedSet(String extrArtclNm, String extrArtclDscrp) { + this.extrArtclNm = extrArtclNm; + this.extrArtclDscrp = extrArtclDscrp; + } + private String extrArtclNm; + private String extrArtclDscrp; +} diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/extration/format/ElectronicNotice.java b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/format/ElectronicNotice.java index 2cd9fb32..360307d3 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/extration/format/ElectronicNotice.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/format/ElectronicNotice.java @@ -1,8 +1,24 @@ package cokr.xit.fims.cmmn.pdf.extration.format; +import java.util.ArrayList; + +import cokr.xit.fims.cmmn.pdf.extration.PredefinedSet; + /** * 전자고지 */ public class ElectronicNotice extends PDFExtractFormat { + public ElectronicNotice(){ + this.predefinedSetList = new ArrayList(); + predefinedSetList.add(new PredefinedSet("photoArea","사진영역")); + predefinedSetList.add(new PredefinedSet("vhcleNo","차량번호")); + predefinedSetList.add(new PredefinedSet("ihidnum","주민번호")); + predefinedSetList.add(new PredefinedSet("moblphonNo","휴대폰번호")); + predefinedSetList.add(new PredefinedSet("nm","성명")); + predefinedSetList.add(new PredefinedSet("adres","주소")); + predefinedSetList.add(new PredefinedSet("detailAdres","상세주소")); + predefinedSetList.add(new PredefinedSet("zip","우편번호")); + } + } diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/extration/format/PDFExtractFormat.java b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/format/PDFExtractFormat.java index 1f9ddf0f..feb78460 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/extration/format/PDFExtractFormat.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/format/PDFExtractFormat.java @@ -1,5 +1,37 @@ package cokr.xit.fims.cmmn.pdf.extration.format; +import java.util.ArrayList; +import java.util.List; + +import cokr.xit.fims.cmmn.pdf.extration.PredefinedSet; +import cokr.xit.foundation.data.DataObject; + public abstract class PDFExtractFormat { + protected List predefinedSetList = new ArrayList(); + + public void appendPredefinedYn(List extrArtclStngList) { + + if(extrArtclStngList!=null && !extrArtclStngList.isEmpty()) { + + List prototypeStngs = this.getPredefinedSetList(); + + for(DataObject extrArtclStng : extrArtclStngList) { + String extrArtclNm = (String) extrArtclStng.get("EXTR_ARTCL_NM"); + + List prototypeStng = prototypeStngs.stream().filter(item -> item.getExtrArtclNm().equals(extrArtclNm)).toList(); + if(prototypeStng != null && !prototypeStng.isEmpty()) { + extrArtclStng.set("PREDEFINED_YN", "Y"); + } else { + extrArtclStng.set("PREDEFINED_YN", "N"); + } + } + } + + + } + + public List getPredefinedSetList(){ + return this.predefinedSetList; + } } 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 new file mode 100644 index 00000000..77226721 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/service/bean/ExtrStngBean.java @@ -0,0 +1,67 @@ +package cokr.xit.fims.cmmn.service.bean; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Component; + +import cokr.xit.fims.cmmn.ExtrStngQuery; +import cokr.xit.fims.cmmn.dao.ExtrStngMapper; +import cokr.xit.fims.cmmn.pdf.extration.PredefinedSet; +import cokr.xit.fims.cmmn.pdf.extration.format.ElectronicNotice; +import cokr.xit.fims.cmmn.pdf.extration.format.PDFExtractFormat; +import cokr.xit.foundation.AbstractComponent; +import cokr.xit.foundation.data.DataObject; + +@Component("extrStngBean") +public class ExtrStngBean extends AbstractComponent { + + @Resource(name = "extrStngMapper") + private ExtrStngMapper extrStngMapper; + + /**지정한 조건에 따라 자료 추출 템플릿 문구를 조회한다. + * @param query 조회 조건 + * @return 출력물 전역 설정 + */ + public DataObject getExtrBscStng(ExtrStngQuery extrStngQuery) { + return extrStngMapper.selectExtrBscStng(extrStngQuery); + } + + + /**지정한 조건에 따라 추출요소별 설정을 조회한다. + * @param query 조회 조건 + * @return 출력 요소 설정 + */ + public Map getExtrArtclStngMap(ExtrStngQuery query){ + Map otptStngMap = new HashMap(); + + PDFExtractFormat pdfFormat = null; + pdfFormat = new ElectronicNotice(); + + List extrArtclStngList = extrStngMapper.selectExtrArtclStngList(query); + if(extrArtclStngList == null) { + extrArtclStngList = new ArrayList(); + } + pdfFormat.appendPredefinedYn(extrArtclStngList); + + List predefinedSetList = pdfFormat.getPredefinedSetList(); + + List predefinedDataList = extrArtclStngList.stream().filter(item -> item.string("PREDEFINED_YN").equals("Y")).toList(); + List customDataList = extrArtclStngList.stream().filter(item -> item.string("PREDEFINED_YN").equals("N")).toList(); + + Map predefined = new HashMap(); + predefined.put("dataList", predefinedDataList); + + Map custom = new HashMap(); + custom.put("dataList", customDataList); + + otptStngMap.put("predefinedSetList", predefinedSetList); + otptStngMap.put("predefined", predefined); + otptStngMap.put("custom", custom); + return otptStngMap; + } +} diff --git a/src/main/java/cokr/xit/fims/cmmn/service/bean/LinkServiceBean.java b/src/main/java/cokr/xit/fims/cmmn/service/bean/LinkServiceBean.java index ee5f5cc2..860ea2bb 100644 --- a/src/main/java/cokr/xit/fims/cmmn/service/bean/LinkServiceBean.java +++ b/src/main/java/cokr/xit/fims/cmmn/service/bean/LinkServiceBean.java @@ -29,7 +29,7 @@ public class LinkServiceBean extends AbstractServiceBean implements LinkService ExtrStngQuery extrStngQuery = new ExtrStngQuery(); extrStngQuery.setSggCd(sggCd).setTaskSeCd(taskSeCd); - extrStngQuery.setTemplateId(tmplatId); + extrStngQuery.setTmplatId(tmplatId); List extractStngs = extrStngMapper.selectExtrArtclStngList(extrStngQuery); List extractionInfos = PDFExtractionUtil.extract(filePath, extractStngs); 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 f5c59736..5a3fa3e6 100644 --- a/src/main/java/cokr/xit/fims/cmmn/web/StngController.java +++ b/src/main/java/cokr/xit/fims/cmmn/web/StngController.java @@ -14,9 +14,11 @@ 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.ExtrStngQuery; import cokr.xit.fims.cmmn.OtptForm; import cokr.xit.fims.cmmn.OtptStngQuery; import cokr.xit.fims.cmmn.service.StngService; +import cokr.xit.fims.cmmn.service.bean.ExtrStngBean; import cokr.xit.fims.cmmn.service.bean.OtptStngBean; import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.crdn.dao.GlobalStngMapper; @@ -56,6 +58,9 @@ public class StngController extends ApplicationController { @Resource(name = "otptStngBean") private OtptStngBean otptStngBean; + @Resource(name = "extrStngBean") + private ExtrStngBean extrStngBean; + @Resource(name = "userMapper") private UserMapper userMapper; @@ -65,7 +70,6 @@ public class StngController extends ApplicationController { @Resource(name = "statMapper") private StatMapper statMapper; - /** 출력물 설정 메인 화면을 연다. * @return 출력물 설정 메인 화면 */ @@ -195,4 +199,56 @@ public class StngController extends ApplicationController { return mav; } + + /** PDF 자료 추출 설정 정보를 불러온다. + * @return PDF 자료 추출 설정 정보 + */ + public ModelAndView getExtrStngInfo(ExtrStngQuery extrStngQuery) { + + ModelAndView mav = new ModelAndView("jsonView"); + + //설정 제목 + String institute = currentUser().getInstitute(); + String account = currentUser().getAccount(); + ManagedUser currentUser = userMapper.getUser(account, institute); + String deptCd = currentUser.getDeptCode(); + String sggCd = globalStngMapper.selectSggCd(deptCd); + DataObject sgg = statMapper.selectSggByCode(sggCd); + String sggNm = sgg.string("NAME"); + + Map> commonCodes = getCodesOf("FIM054","FIM047","FIM078"); + List FIM047 = commonCodes.get("FIM047"); + List FIM054 = commonCodes.get("FIM054"); + + + String taskSeNm = FIM054.stream(). + filter(item -> item.getCode().equals(extrStngQuery.getTaskSeCd())).findFirst().get().getValue(); + + String templateName = ""; + if(extrStngQuery.getTmplatId().equals("JU001")) { + templateName = "사전통지서"; + } else if(extrStngQuery.getTmplatId().equals("JU002")){ + templateName = "본고지(수시분)"; + } + + String extrStngTitle = "["+sggNm+", "+taskSeNm+"]"+" "+templateName; + mav.addObject("extrStngTitle", extrStngTitle); + + + //추출 기본 설정 + DataObject extrBscStng = extrStngBean.getExtrBscStng(extrStngQuery); + if(extrBscStng == null) { + mav.addObject("EXTR_BSC_ID", ""); + mav.addObject("MOBILE_PAGE_TMPLT", ""); + } else { + mav.addObject("EXTR_BSC_ID", extrBscStng.string("EXTR_BSC_ID")); + mav.addObject("MOBILE_PAGE_TMPLT", extrBscStng.string("MOBILE_PAGE_TMPLT")); + } + + //추출 요소별 설정 + Map extrArtclStngMap = extrStngBean.getExtrArtclStngMap(extrStngQuery); + mav.addObject("extrArtclStngMap", extrArtclStngMap); + + 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 f2c02cb2..7972a091 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.ExtrStngQuery; import cokr.xit.fims.cmmn.OtptForm; import cokr.xit.fims.cmmn.OtptStngQuery; import cokr.xit.fims.cmmn.PrintOption; @@ -726,5 +727,11 @@ public class CmnController { public ModelAndView extrStngMain() { return super.extrStngMain(); } + + @Override + @RequestMapping(name="PDF 자료 추출 설정 정보 조회", value=METHOD_URL.getExtrStngInfo) + public ModelAndView getExtrStngInfo(ExtrStngQuery extrStngQuery) { + return super.getExtrStngInfo(extrStngQuery); + } } } 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 548c1e63..aa74e0a0 100644 --- a/src/main/resources/sql/mapper/fims/cmmn/extrStng-mapper.xml +++ b/src/main/resources/sql/mapper/fims/cmmn/extrStng-mapper.xml @@ -18,7 +18,7 @@ SELECT EXTR_FORM_ID WHERE USE_YN = 'Y' AND SGG_CD = #{sggCd} AND TASK_SE_CD = #{taskSeCd} - AND TMPLAT_ID = #{templateId} + AND TMPLAT_ID = #{tmplatId} \ 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 83e06555..ce57889a 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/stng01020-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/stng01020-main.jsp @@ -135,10 +135,10 @@ - + - + @@ -216,10 +216,8 @@ $(document).ready(function(){ $P.extrArtclStngMap = resp.extrArtclStngMap; $P.renderExtrArtclStngGrid("tbodyPredefined--${pageName}", - $P.extrArtclStngMap.predefined.prototypeList, $P.extrArtclStngMap.predefined.dataList); $P.renderExtrArtclStngGrid("tbodyCustom--${pageName}", - $P.extrArtclStngMap.custom.prototypeList, $P.extrArtclStngMap.custom.dataList); } }); @@ -228,7 +226,7 @@ $(document).ready(function(){ //추출 요소 그리드 렌더링 - $P.renderExtrArtclStngGrid = (tbodyId, prototypeList, dataList) => { + $P.renderExtrArtclStngGrid = (tbodyId, dataList) => { for(var i=0; i < dataList.length; i++){ var data = dataList[i]; @@ -242,7 +240,11 @@ $(document).ready(function(){ $($P.fnGetElement(lastTr,"extrArtclNm")).set(data.EXTR_ARTCL_NM); $($P.fnGetElement(lastTr,"extrArtclDscrp")).set(data.EXTR_ARTCL_DSCRP); - $($P.fnGetElement(lastTr,"componentType")).set(data.COMPONENT_TYPE); + if(data.EXTR_ARTCL_NM == "photoArea"){ + $($P.fnGetElement(lastTr,"componentType")).set("사진"); + } else { + $($P.fnGetElement(lastTr,"componentType")).set("텍스트"); + } $($P.fnGetElement(lastTr,"leftPstn")).set(!isEmpty(data.LEFT_PSTN) ? data.LEFT_PSTN : "0"); $($P.fnGetElement(lastTr,"topPstn")).set(!isEmpty(data.TOP_PSTN) ? data.TOP_PSTN : "0"); @@ -254,13 +256,10 @@ $(document).ready(function(){ $("#"+tbodyId).find("tr").each(function(){ if(tbodyId == "tbodyPredefined--${pageName}"){ - var el = $P.fnGetElement(this,"extrArtclNm"); - $(el).attr("disabled","disabled"); - $(el).addClass("no-bgi"); + $($P.fnGetElement(this,"extrArtclNm")).attr("disabled","disabled").addClass("no-bgi"); + $($P.fnGetElement(this,"extrArtclDscrp")).attr("disabled","disabled").addClass("no-bgi"); } - - var scrollDiv = ""; if(tbodyId == "tbodyPredefined--${pageName}"){ scrollDiv = "scrollPredefined--${pageName}"; @@ -283,7 +282,7 @@ $(document).ready(function(){ $P.choiceExtrArtclNm = () => { $("#dropdownPredefinedAdd--${pageName}").html(""); - var prototypeList = $P.extrArtclStngMap.predefined.prototypeList; + var predefinedSetList = $P.extrArtclStngMap.predefinedSetList; var existArr = []; $("#tbodyPredefined--${pageName} tr").each(function(){ @@ -291,7 +290,7 @@ $(document).ready(function(){ existArr.push($(el).val()); }); - var selectableArr = prototypeList.filter(item => existArr.indexOf(item.extrArtclNm) == -1); + var selectableArr = predefinedSetList.filter(item => existArr.indexOf(item.extrArtclNm) == -1); var template = document.getElementById("dropdownTemplate--${pageName}"); @@ -313,14 +312,11 @@ $(document).ready(function(){ //행 추가 $P.addRow = (extrArtclNm, extrArtclDscrp) => { - var prototypeList; var tbodyId; if(extrArtclNm == null || extrArtclNm == ""){ - prototypeList = $P.extrArtclStngMap.custom.prototypeList; tbodyId = "tbodyCustom--${pageName}"; } else { - prototypeList = $P.extrArtclStngMap.predefined.prototypeList; tbodyId = "tbodyPredefined--${pageName}"; }