PDF자료 추출 설정 조회 기능 추가
parent
f9be1cb0f5
commit
90d8b005a2
@ -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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cokr.xit.fims.cmmn.pdf.extration.PredefinedSet;
|
||||
|
||||
/**
|
||||
* 전자고지
|
||||
*/
|
||||
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;
|
||||
|
||||
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<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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue