From d123051c013913ec836fbba02a6a88d30cf0f1bf Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Tue, 9 Jan 2024 18:10:17 +0900 Subject: [PATCH] =?UTF-8?q?pdf=EC=B6=94=EC=B6=9C=20=EB=B0=8F=20=EC=A0=84?= =?UTF-8?q?=EC=9E=90=EA=B3=A0=EC=A7=80=EC=86=A1=EC=8B=A0=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/fims/cmmn/service/LinkService.java | 5 ++ .../cmmn/service/bean/LinkServiceBean.java | 82 +++++++++++++++++++ .../xit/fims/cmmn/web/LinkController.java | 63 ++------------ .../sql/mapper/fims/cmmn/extrStng-mapper.xml | 2 +- .../webapp/resources/html/fileUpload.html | 2 +- 5 files changed, 97 insertions(+), 57 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/cmmn/service/LinkService.java create mode 100644 src/main/java/cokr/xit/fims/cmmn/service/bean/LinkServiceBean.java diff --git a/src/main/java/cokr/xit/fims/cmmn/service/LinkService.java b/src/main/java/cokr/xit/fims/cmmn/service/LinkService.java new file mode 100644 index 00000000..7ffc5067 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/service/LinkService.java @@ -0,0 +1,5 @@ +package cokr.xit.fims.cmmn.service; + +public interface LinkService { + boolean insertElectronicNoticeSndng(String filePath, String sggCd, String taskSeCd, String tmplatId); +} 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 new file mode 100644 index 00000000..23059de1 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/service/bean/LinkServiceBean.java @@ -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 extractStngs = extrStngMapper.selectExtrArtclStngList(extrStngQuery); + + List extractionInfos = PDFExtractionUtil.extract(filePath, extractStngs); + + + for(int i=0; i < extractionInfos.size(); i++) { + + Map extractedText = extractionInfos.get(i).getTextItem(); + List 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; + } +} diff --git a/src/main/java/cokr/xit/fims/cmmn/web/LinkController.java b/src/main/java/cokr/xit/fims/cmmn/web/LinkController.java index 1f338358..bc27886c 100644 --- a/src/main/java/cokr/xit/fims/cmmn/web/LinkController.java +++ b/src/main/java/cokr/xit/fims/cmmn/web/LinkController.java @@ -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 extractStngs = extrStngMapper.selectExtrArtclStngList(extrStngQuery); - - List extractionInfos = PDFExtractionUtil.extract(filePath, extractStngs); - - for(int i=0; i < extractionInfos.size(); i++) { - - Map extractedText = extractionInfos.get(i).getTextItem(); - List 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)); - } } 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 bd7deb10..548c1e63 100644 --- a/src/main/resources/sql/mapper/fims/cmmn/extrStng-mapper.xml +++ b/src/main/resources/sql/mapper/fims/cmmn/extrStng-mapper.xml @@ -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 diff --git a/src/main/webapp/resources/html/fileUpload.html b/src/main/webapp/resources/html/fileUpload.html index ccb4c3c8..442199ba 100644 --- a/src/main/webapp/resources/html/fileUpload.html +++ b/src/main/webapp/resources/html/fileUpload.html @@ -137,7 +137,7 @@