pdf추출 및 전자고지송신 수정

main
이범준 10 months ago
parent 8be358f532
commit d123051c01

@ -0,0 +1,5 @@
package cokr.xit.fims.cmmn.service;
public interface LinkService {
boolean insertElectronicNoticeSndng(String filePath, String sggCd, String taskSeCd, String tmplatId);
}

@ -0,0 +1,82 @@
package cokr.xit.fims.cmmn.service.bean;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.fims.cmmn.ExtrStngQuery;
import cokr.xit.fims.cmmn.dao.ExtrStngMapper;
import cokr.xit.fims.cmmn.pdf.extration.Extraction;
import cokr.xit.fims.cmmn.pdf.extration.PDFExtractionUtil;
import cokr.xit.fims.cmmn.service.LinkService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
@Service("linkService")
public class LinkServiceBean extends AbstractServiceBean implements LinkService {
@Resource(name = "linkBean")
private LinkBean linkBean;
@Resource(name = "extrStngMapper")
private ExtrStngMapper extrStngMapper;
@Override
public boolean insertElectronicNoticeSndng(String filePath, String sggCd, String taskSeCd, String tmplatId) {
ExtrStngQuery extrStngQuery = new ExtrStngQuery();
extrStngQuery.setSggCd(sggCd).setTaskSeCd(taskSeCd);
extrStngQuery.setTemplateId(tmplatId);
List<DataObject> extractStngs = extrStngMapper.selectExtrArtclStngList(extrStngQuery);
List<Extraction> extractionInfos = PDFExtractionUtil.extract(filePath, extractStngs);
for(int i=0; i < extractionInfos.size(); i++) {
Map<String, String> extractedText = extractionInfos.get(i).getTextItem();
List<String> crdnPhotoBase64 = extractionInfos.get(i).getBase64List();
//마스터
DataObject masterInfo = new DataObject();
masterInfo.set("signguCode", sggCd);
masterInfo.set("ffnlgCode", taskSeCd);
masterInfo.set("tmplatId", tmplatId);
masterInfo.set("sndngCo", extractionInfos.size());
masterInfo.set("sndngDt", extractedText.get("sndngDt")); //발송일시
masterInfo.set("closDt", extractedText.get("closDt")); //마감일시
//디테일
DataObject detailInfo = new DataObject();
detailInfo.set("signguCode", sggCd);
detailInfo.set("ffnlgCode", taskSeCd);
detailInfo.set("vhcleNo", extractedText.get("vhcleNo"));
detailInfo.set("ihidnum", extractedText.get("ihidnum"));
detailInfo.set("moblphonNo", extractedText.get("moblphonNo"));
detailInfo.set("nm", extractedText.get("nm"));
detailInfo.set("adres", extractedText.get("adres"));
detailInfo.set("detailAdres", extractedText.get("detailAdres"));
detailInfo.set("zip", extractedText.get("zip"));
//템플릿메시지데이터
detailInfo.set("tmpltMsgData", "");
//모바일페이지
String jsonTemplate = extrStngMapper.selectExtrBscStng(extrStngQuery).string("MOBILE_PAGE_TMPLT");
String json = linkBean.makeJson(jsonTemplate, extractedText, crdnPhotoBase64);
detailInfo.set("mobilePageCn", json);
//
detailInfo.set("mainCode", "");
//
detailInfo.set("useInsttIdntfcId", "");
//테이블 인서트
linkBean.insertElectronicNoticeSndng(masterInfo, List.of(detailInfo));
}
return true;
}
}

@ -1,18 +1,13 @@
package cokr.xit.fims.cmmn.web;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.fims.cmmn.ExtrStngQuery;
import cokr.xit.fims.cmmn.dao.ExtrStngMapper;
import cokr.xit.fims.cmmn.pdf.extration.Extraction;
import cokr.xit.fims.cmmn.pdf.extration.PDFExtractionUtil;
import cokr.xit.fims.cmmn.service.LinkService;
import cokr.xit.fims.cmmn.service.bean.LinkBean;
import cokr.xit.fims.mngt.service.bean.FactionBean;
import cokr.xit.foundation.UserInfo;
@ -26,6 +21,9 @@ public class LinkController extends AbstractController {
@Resource(name = "linkBean")
private LinkBean linkBean;
@Resource(name = "linkService")
private LinkService linkService;
@Resource(name = "factionBean")
private FactionBean factionBean;
@ -45,59 +43,14 @@ public class LinkController extends AbstractController {
DataObject dataObject = fromJson(param, DataObject.class);
//차세대 세외수입 pdf파일 정보 추출
if(job.equals("01")) {
String tmplatId = dataObject.string("tmplatId");
String taskSeCd = dataObject.string("taskSeCd");
String tmplatId = dataObject.string("tmplatId");
linkService.insertElectronicNoticeSndng(filePath, sggCd, taskSeCd, tmplatId);
ExtrStngQuery extrStngQuery = new ExtrStngQuery();
extrStngQuery.setSggCd(sggCd).setTaskSeCd(taskSeCd);
extrStngQuery.setTemplateId(tmplatId);
List<DataObject> extractStngs = extrStngMapper.selectExtrArtclStngList(extrStngQuery);
List<Extraction> extractionInfos = PDFExtractionUtil.extract(filePath, extractStngs);
for(int i=0; i < extractionInfos.size(); i++) {
Map<String, String> extractedText = extractionInfos.get(i).getTextItem();
List<String> crdnPhotoBase64 = extractionInfos.get(i).getBase64List();
//마스터
DataObject masterInfo = new DataObject();
masterInfo.set("signguCode", sggCd);
masterInfo.set("ffnlgCode", taskSeCd);
masterInfo.set("tmplatId", tmplatId);
masterInfo.set("sndngCo", extractionInfos.size());
masterInfo.set("sndngDt", extractedText.get("sndngDt")); //발송일시
masterInfo.set("closDt", extractedText.get("closDt")); //마감일시
//디테일
DataObject detailInfo = new DataObject();
detailInfo.set("signguCode", sggCd);
detailInfo.set("ffnlgCode", taskSeCd);
detailInfo.set("vhcleNo", extractedText.get("vhcleNo"));
detailInfo.set("ihidnum", extractedText.get("ihidnum"));
detailInfo.set("moblphonNo", extractedText.get("moblphonNo"));
detailInfo.set("nm", extractedText.get("nm"));
detailInfo.set("adres", extractedText.get("adres"));
detailInfo.set("detailAdres", extractedText.get("detailAdres"));
detailInfo.set("zip", extractedText.get("zip"));
//템플릿메시지데이터
detailInfo.set("tmpltMsgData", "");
//모바일페이지
String jsonTemplate = extrStngMapper.selectExtrBscStng(extrStngQuery).string("MOBILE_PAGE_TMPLT");
String json = linkBean.makeJson(jsonTemplate, extractedText, crdnPhotoBase64);
detailInfo.set("mobilePageCn", json);
//
detailInfo.set("mainCode", "");
//
detailInfo.set("useInsttIdntfcId", "");
//테이블 인서트
linkBean.insertElectronicNoticeSndng(masterInfo, List.of(detailInfo));
}
}

@ -9,7 +9,7 @@ SELECT EXTR_FORM_ID
, TASK_SE_CD
, TMPLAT_ID
, EXTR_ARTCL_NM
, EXTR_ARTCL_DSCRT
, EXTR_ARTCL_DSCRP
, LEFT_PSTN
, TOP_PSTN
, WIDTH_SZ

@ -137,7 +137,7 @@
<label>서식</label>
<select id="tmplatId" name="tmplatId" class="form-select">
<option value="JU001">사전통지서</option>
<option value="JU002">본고지(수분)</option>
<option value="JU002">본고지(수분)</option>
</select>
</form>

Loading…
Cancel
Save