PDF자료 추출 설정 조회 기능 추가

main
이범준 9 months ago
parent f9be1cb0f5
commit 90d8b005a2

@ -4,14 +4,14 @@ public class ExtrStngQuery extends CmmnQuery {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String templateId; private String tmplatId;
public String getTemplateId() { public String getTmplatId() {
return ifEmpty(templateId, () -> null); return ifEmpty(tmplatId, () -> null);
} }
public <T extends ExtrStngQuery> T setTemplateId(String templateId) { public <T extends ExtrStngQuery> T setTmplatId(String tmplatId) {
this.templateId = templateId; this.tmplatId = tmplatId;
return self(); return self();
} }

@ -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;
}

@ -1,8 +1,24 @@
package cokr.xit.fims.cmmn.pdf.extration.format; 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 class ElectronicNotice extends PDFExtractFormat {
public ElectronicNotice(){
this.predefinedSetList = new ArrayList<PredefinedSet>();
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","우편번호"));
}
} }

@ -1,5 +1,37 @@
package cokr.xit.fims.cmmn.pdf.extration.format; 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 { public abstract class PDFExtractFormat {
protected List<PredefinedSet> predefinedSetList = new ArrayList<PredefinedSet>();
public void appendPredefinedYn(List<DataObject> extrArtclStngList) {
if(extrArtclStngList!=null && !extrArtclStngList.isEmpty()) {
List<PredefinedSet> prototypeStngs = this.getPredefinedSetList();
for(DataObject extrArtclStng : extrArtclStngList) {
String extrArtclNm = (String) extrArtclStng.get("EXTR_ARTCL_NM");
List<PredefinedSet> 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<PredefinedSet> getPredefinedSetList(){
return this.predefinedSetList;
}
} }

@ -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<String, Object> getExtrArtclStngMap(ExtrStngQuery query){
Map<String,Object> otptStngMap = new HashMap<String,Object>();
PDFExtractFormat pdfFormat = null;
pdfFormat = new ElectronicNotice();
List<DataObject> extrArtclStngList = extrStngMapper.selectExtrArtclStngList(query);
if(extrArtclStngList == null) {
extrArtclStngList = new ArrayList<DataObject>();
}
pdfFormat.appendPredefinedYn(extrArtclStngList);
List<PredefinedSet> predefinedSetList = pdfFormat.getPredefinedSetList();
List<DataObject> predefinedDataList = extrArtclStngList.stream().filter(item -> item.string("PREDEFINED_YN").equals("Y")).toList();
List<DataObject> customDataList = extrArtclStngList.stream().filter(item -> item.string("PREDEFINED_YN").equals("N")).toList();
Map<String, Object> predefined = new HashMap<String,Object>();
predefined.put("dataList", predefinedDataList);
Map<String, Object> custom = new HashMap<String,Object>();
custom.put("dataList", customDataList);
otptStngMap.put("predefinedSetList", predefinedSetList);
otptStngMap.put("predefined", predefined);
otptStngMap.put("custom", custom);
return otptStngMap;
}
}

@ -29,7 +29,7 @@ public class LinkServiceBean extends AbstractServiceBean implements LinkService
ExtrStngQuery extrStngQuery = new ExtrStngQuery(); ExtrStngQuery extrStngQuery = new ExtrStngQuery();
extrStngQuery.setSggCd(sggCd).setTaskSeCd(taskSeCd); extrStngQuery.setSggCd(sggCd).setTaskSeCd(taskSeCd);
extrStngQuery.setTemplateId(tmplatId); extrStngQuery.setTmplatId(tmplatId);
List<DataObject> extractStngs = extrStngMapper.selectExtrArtclStngList(extrStngQuery); List<DataObject> extractStngs = extrStngMapper.selectExtrArtclStngList(extrStngQuery);
List<Extraction> extractionInfos = PDFExtractionUtil.extract(filePath, extractStngs); List<Extraction> extractionInfos = PDFExtractionUtil.extract(filePath, extractStngs);

@ -14,9 +14,11 @@ import cokr.xit.base.code.CommonCode;
import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.web.ApplicationController; import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.cmmn.ExtrStngQuery;
import cokr.xit.fims.cmmn.OtptForm; import cokr.xit.fims.cmmn.OtptForm;
import cokr.xit.fims.cmmn.OtptStngQuery; import cokr.xit.fims.cmmn.OtptStngQuery;
import cokr.xit.fims.cmmn.service.StngService; 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.OtptStngBean;
import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.cmmn.service.bean.StngBean;
import cokr.xit.fims.crdn.dao.GlobalStngMapper; import cokr.xit.fims.crdn.dao.GlobalStngMapper;
@ -56,6 +58,9 @@ public class StngController extends ApplicationController {
@Resource(name = "otptStngBean") @Resource(name = "otptStngBean")
private OtptStngBean otptStngBean; private OtptStngBean otptStngBean;
@Resource(name = "extrStngBean")
private ExtrStngBean extrStngBean;
@Resource(name = "userMapper") @Resource(name = "userMapper")
private UserMapper userMapper; private UserMapper userMapper;
@ -65,7 +70,6 @@ public class StngController extends ApplicationController {
@Resource(name = "statMapper") @Resource(name = "statMapper")
private StatMapper statMapper; private StatMapper statMapper;
/** . /** .
* @return * @return
*/ */
@ -195,4 +199,56 @@ public class StngController extends ApplicationController {
return mav; 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<String, List<CommonCode>> commonCodes = getCodesOf("FIM054","FIM047","FIM078");
List<CommonCode> FIM047 = commonCodes.get("FIM047");
List<CommonCode> 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<String,Object> extrArtclStngMap = extrStngBean.getExtrArtclStngMap(extrStngQuery);
mav.addObject("extrArtclStngMap", extrArtclStngMap);
return mav;
}
} }

@ -8,6 +8,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import cokr.xit.fims.cmmn.CmmnQuery; import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.cmmn.ExtrStngQuery;
import cokr.xit.fims.cmmn.OtptForm; import cokr.xit.fims.cmmn.OtptForm;
import cokr.xit.fims.cmmn.OtptStngQuery; import cokr.xit.fims.cmmn.OtptStngQuery;
import cokr.xit.fims.cmmn.PrintOption; import cokr.xit.fims.cmmn.PrintOption;
@ -726,5 +727,11 @@ public class CmnController {
public ModelAndView extrStngMain() { public ModelAndView extrStngMain() {
return super.extrStngMain(); return super.extrStngMain();
} }
@Override
@RequestMapping(name="PDF 자료 추출 설정 정보 조회", value=METHOD_URL.getExtrStngInfo)
public ModelAndView getExtrStngInfo(ExtrStngQuery extrStngQuery) {
return super.getExtrStngInfo(extrStngQuery);
}
} }
} }

@ -18,7 +18,7 @@ SELECT EXTR_FORM_ID
WHERE USE_YN = 'Y' WHERE USE_YN = 'Y'
AND SGG_CD = #{sggCd} AND SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd} AND TASK_SE_CD = #{taskSeCd}
AND TMPLAT_ID = #{templateId} AND TMPLAT_ID = #{tmplatId}
</select> </select>
<select id="selectExtrBscStng" parameterType="cokr.xit.fims.cmmn.ExtrStngQuery" resultType="dataobject"> <select id="selectExtrBscStng" parameterType="cokr.xit.fims.cmmn.ExtrStngQuery" resultType="dataobject">
@ -31,7 +31,7 @@ SELECT EXTR_BSC_ID
WHERE USE_YN = 'Y' WHERE USE_YN = 'Y'
AND SGG_CD = #{sggCd} AND SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd} AND TASK_SE_CD = #{taskSeCd}
AND TMPLAT_ID = #{templateId} AND TMPLAT_ID = #{tmplatId}
</select> </select>
</mapper> </mapper>

@ -135,10 +135,10 @@
<input type="checkbox" name="del" class="form-check-input" /> <input type="checkbox" name="del" class="form-check-input" />
</td> </td>
<td data-col="extrArtclNm" class="text-center"> <td data-col="extrArtclNm" class="text-center">
<input type="text" class="form-control w-px-80" /> <input type="text" class="form-control w-px-180" />
</td> </td>
<td data-col="extrArtclDscrp" class="text-center"> <td data-col="extrArtclDscrp" class="text-center">
<input type="text" class="form-control w-px-80" /> <input type="text" class="form-control w-px-180" />
</td> </td>
<td data-col="componentType" class="text-center"> <td data-col="componentType" class="text-center">
<input type="text" class="form-control w-px-80" readonly /> <input type="text" class="form-control w-px-80" readonly />
@ -216,10 +216,8 @@ $(document).ready(function(){
$P.extrArtclStngMap = resp.extrArtclStngMap; $P.extrArtclStngMap = resp.extrArtclStngMap;
$P.renderExtrArtclStngGrid("tbodyPredefined--${pageName}", $P.renderExtrArtclStngGrid("tbodyPredefined--${pageName}",
$P.extrArtclStngMap.predefined.prototypeList,
$P.extrArtclStngMap.predefined.dataList); $P.extrArtclStngMap.predefined.dataList);
$P.renderExtrArtclStngGrid("tbodyCustom--${pageName}", $P.renderExtrArtclStngGrid("tbodyCustom--${pageName}",
$P.extrArtclStngMap.custom.prototypeList,
$P.extrArtclStngMap.custom.dataList); $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++){ for(var i=0; i < dataList.length; i++){
var data = dataList[i]; var data = dataList[i];
@ -242,7 +240,11 @@ $(document).ready(function(){
$($P.fnGetElement(lastTr,"extrArtclNm")).set(data.EXTR_ARTCL_NM); $($P.fnGetElement(lastTr,"extrArtclNm")).set(data.EXTR_ARTCL_NM);
$($P.fnGetElement(lastTr,"extrArtclDscrp")).set(data.EXTR_ARTCL_DSCRP); $($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,"leftPstn")).set(!isEmpty(data.LEFT_PSTN) ? data.LEFT_PSTN : "0");
$($P.fnGetElement(lastTr,"topPstn")).set(!isEmpty(data.TOP_PSTN) ? data.TOP_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(){ $("#"+tbodyId).find("tr").each(function(){
if(tbodyId == "tbodyPredefined--${pageName}"){ if(tbodyId == "tbodyPredefined--${pageName}"){
var el = $P.fnGetElement(this,"extrArtclNm"); $($P.fnGetElement(this,"extrArtclNm")).attr("disabled","disabled").addClass("no-bgi");
$(el).attr("disabled","disabled"); $($P.fnGetElement(this,"extrArtclDscrp")).attr("disabled","disabled").addClass("no-bgi");
$(el).addClass("no-bgi");
} }
var scrollDiv = ""; var scrollDiv = "";
if(tbodyId == "tbodyPredefined--${pageName}"){ if(tbodyId == "tbodyPredefined--${pageName}"){
scrollDiv = "scrollPredefined--${pageName}"; scrollDiv = "scrollPredefined--${pageName}";
@ -283,7 +282,7 @@ $(document).ready(function(){
$P.choiceExtrArtclNm = () => { $P.choiceExtrArtclNm = () => {
$("#dropdownPredefinedAdd--${pageName}").html(""); $("#dropdownPredefinedAdd--${pageName}").html("");
var prototypeList = $P.extrArtclStngMap.predefined.prototypeList; var predefinedSetList = $P.extrArtclStngMap.predefinedSetList;
var existArr = []; var existArr = [];
$("#tbodyPredefined--${pageName} tr").each(function(){ $("#tbodyPredefined--${pageName} tr").each(function(){
@ -291,7 +290,7 @@ $(document).ready(function(){
existArr.push($(el).val()); 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}"); var template = document.getElementById("dropdownTemplate--${pageName}");
@ -313,14 +312,11 @@ $(document).ready(function(){
//행 추가 //행 추가
$P.addRow = (extrArtclNm, extrArtclDscrp) => { $P.addRow = (extrArtclNm, extrArtclDscrp) => {
var prototypeList;
var tbodyId; var tbodyId;
if(extrArtclNm == null || extrArtclNm == ""){ if(extrArtclNm == null || extrArtclNm == ""){
prototypeList = $P.extrArtclStngMap.custom.prototypeList;
tbodyId = "tbodyCustom--${pageName}"; tbodyId = "tbodyCustom--${pageName}";
} else { } else {
prototypeList = $P.extrArtclStngMap.predefined.prototypeList;
tbodyId = "tbodyPredefined--${pageName}"; tbodyId = "tbodyPredefined--${pageName}";
} }

Loading…
Cancel
Save