diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFExtractFormat.java b/src/main/java/cokr/xit/fims/cmmn/pdf/PDFExtractFormat.java deleted file mode 100644 index d16add70..00000000 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFExtractFormat.java +++ /dev/null @@ -1,5 +0,0 @@ -package cokr.xit.fims.cmmn.pdf; - -public abstract class PDFExtractFormat { - -} diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFUtil.java b/src/main/java/cokr/xit/fims/cmmn/pdf/PDFUtil.java index a9006c16..defcfb31 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/PDFUtil.java @@ -1,72 +1,8 @@ package cokr.xit.fims.cmmn.pdf; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.pdfbox.Loader; -import org.apache.pdfbox.pdmodel.PDDocument; -import org.apache.pdfbox.pdmodel.PDPage; -import org.apache.pdfbox.pdmodel.PDPageTree; - public class PDFUtil { - public static List extract(String pdfPath, String taskSeCd, String templateId) { - - List extractList = new ArrayList(); - - File file = null; - try { - file = new File(pdfPath); - } catch (Exception e2) { - e2.printStackTrace(); - } - PDDocument pdDocument = null; - try { - pdDocument = Loader.loadPDF(file); - } catch (IOException e) { - e.printStackTrace(); - } - - - PDPageTree pages = pdDocument.getPages(); - int pageCount = pages.getCount(); - - int pageIndex = 0; - - Extraction extraction = new Extraction(); - - for(;pageIndex < pageCount; pageIndex++) { - - extraction = new Extraction(); - extraction.setPage(pageIndex+1); - - //설정 = mapper.get설정(query.setSggCd().setTaskSeCd(taskSeCd).setTemplateId(templateId)); - String epayNo = ExtractText.getExtractByStng(pdDocument, pageIndex+1, 0, 0, 100, 100); - - extraction.setEpayNo(epayNo); - - - PDPage page = pages.get(pageIndex); - List b64imageList = new ArrayList<>(); - try { - ExtractImageEngine printer = new ExtractImageEngine(); - printer.processPage(page); - b64imageList = printer.getBase64List(); - printer.clearBase64List(); - - } catch (IOException e1) { - e1.printStackTrace(); - } - extraction.setBase64List(b64imageList); - - - extractList.add(extraction); - } - return extractList; - } } diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/ExtractImageEngine.java b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/ExtractImageEngine.java similarity index 99% rename from src/main/java/cokr/xit/fims/cmmn/pdf/ExtractImageEngine.java rename to src/main/java/cokr/xit/fims/cmmn/pdf/extration/ExtractImageEngine.java index a7b9a6cd..bbed4feb 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/ExtractImageEngine.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/ExtractImageEngine.java @@ -1,4 +1,4 @@ -package cokr.xit.fims.cmmn.pdf; +package cokr.xit.fims.cmmn.pdf.extration; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/ExtractText.java b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/ExtractText.java similarity index 97% rename from src/main/java/cokr/xit/fims/cmmn/pdf/ExtractText.java rename to src/main/java/cokr/xit/fims/cmmn/pdf/extration/ExtractText.java index 9ddb9e84..8872ed1c 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/ExtractText.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/ExtractText.java @@ -1,4 +1,4 @@ -package cokr.xit.fims.cmmn.pdf; +package cokr.xit.fims.cmmn.pdf.extration; import java.awt.geom.Rectangle2D; import java.io.IOException; diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/Extraction.java b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/Extraction.java similarity index 87% rename from src/main/java/cokr/xit/fims/cmmn/pdf/Extraction.java rename to src/main/java/cokr/xit/fims/cmmn/pdf/extration/Extraction.java index 523f5dfe..827cd147 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/Extraction.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/Extraction.java @@ -1,4 +1,4 @@ -package cokr.xit.fims.cmmn.pdf; +package cokr.xit.fims.cmmn.pdf.extration; import java.util.List; diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/extration/PDFExtractionUtil.java b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/PDFExtractionUtil.java new file mode 100644 index 00000000..5b592029 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/PDFExtractionUtil.java @@ -0,0 +1,69 @@ +package cokr.xit.fims.cmmn.pdf.extration; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.pdfbox.Loader; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.apache.pdfbox.pdmodel.PDPage; +import org.apache.pdfbox.pdmodel.PDPageTree; + +public class PDFExtractionUtil { + public static List extract(String pdfPath, String taskSeCd, String templateId) { + + List extractList = new ArrayList(); + + File file = null; + try { + file = new File(pdfPath); + } catch (Exception e2) { + e2.printStackTrace(); + } + PDDocument pdDocument = null; + try { + pdDocument = Loader.loadPDF(file); + } catch (IOException e) { + e.printStackTrace(); + } + + + PDPageTree pages = pdDocument.getPages(); + int pageCount = pages.getCount(); + + int pageIndex = 0; + + Extraction extraction = new Extraction(); + + for(;pageIndex < pageCount; pageIndex++) { + + extraction = new Extraction(); + extraction.setPage(pageIndex+1); + + //설정 = mapper.get설정(query.setSggCd().setTaskSeCd(taskSeCd).setTemplateId(templateId)); + String epayNo = ExtractText.getExtractByStng(pdDocument, pageIndex+1, 0, 0, 100, 100); + + extraction.setEpayNo(epayNo); + + + PDPage page = pages.get(pageIndex); + List b64imageList = new ArrayList<>(); + try { + ExtractImageEngine printer = new ExtractImageEngine(); + printer.processPage(page); + b64imageList = printer.getBase64List(); + printer.clearBase64List(); + + } catch (IOException e1) { + e1.printStackTrace(); + } + extraction.setBase64List(b64imageList); + + + extractList.add(extraction); + } + + return extractList; + } +} 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 new file mode 100644 index 00000000..2cd9fb32 --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/format/ElectronicNotice.java @@ -0,0 +1,8 @@ +package cokr.xit.fims.cmmn.pdf.extration.format; + +/** + * 전자고지 + */ +public class ElectronicNotice extends PDFExtractFormat { + +} 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 new file mode 100644 index 00000000..1f9ddf0f --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/extration/format/PDFExtractFormat.java @@ -0,0 +1,5 @@ +package cokr.xit.fims.cmmn.pdf.extration.format; + +public abstract class PDFExtractFormat { + +} diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/extrationFormat/ElectronicNotice.java b/src/main/java/cokr/xit/fims/cmmn/pdf/extrationFormat/ElectronicNotice.java deleted file mode 100644 index 3d749425..00000000 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/extrationFormat/ElectronicNotice.java +++ /dev/null @@ -1,10 +0,0 @@ -package cokr.xit.fims.cmmn.pdf.extrationFormat; - -import cokr.xit.fims.cmmn.pdf.PDFExtractFormat; - -/** - * 전자고지 - */ -public class ElectronicNotice extends PDFExtractFormat { - -} diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/DefaultOtptArtclStng.java b/src/main/java/cokr/xit/fims/cmmn/pdf/print/DefaultOtptArtclStng.java similarity index 97% rename from src/main/java/cokr/xit/fims/cmmn/pdf/DefaultOtptArtclStng.java rename to src/main/java/cokr/xit/fims/cmmn/pdf/print/DefaultOtptArtclStng.java index 96009a21..15f2485a 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/DefaultOtptArtclStng.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/print/DefaultOtptArtclStng.java @@ -1,5 +1,6 @@ -package cokr.xit.fims.cmmn.pdf; +package cokr.xit.fims.cmmn.pdf.print; +import cokr.xit.fims.cmmn.pdf.Pstn; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintUtil.java b/src/main/java/cokr/xit/fims/cmmn/pdf/print/PDFPrintUtil.java similarity index 98% rename from src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintUtil.java rename to src/main/java/cokr/xit/fims/cmmn/pdf/print/PDFPrintUtil.java index 3c0b530c..0d5db78f 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/print/PDFPrintUtil.java @@ -1,4 +1,4 @@ -package cokr.xit.fims.cmmn.pdf; +package cokr.xit.fims.cmmn.pdf.print; import java.io.File; import java.io.IOException; @@ -18,6 +18,11 @@ import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode; import org.springframework.core.io.ClassPathResource; import cokr.xit.fims.cmmn.PrintUtil; +import cokr.xit.fims.cmmn.pdf.PDFColors; +import cokr.xit.fims.cmmn.pdf.PDFCoordinate; +import cokr.xit.fims.cmmn.pdf.Pstn; +import cokr.xit.fims.cmmn.pdf.PstnAndSize; +import cokr.xit.fims.cmmn.pdf.Size; import cokr.xit.foundation.data.DataObject; public class PDFPrintUtil extends PrintUtil { diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/printFormat/Advntce.java b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Advntce.java similarity index 98% rename from src/main/java/cokr/xit/fims/cmmn/pdf/printFormat/Advntce.java rename to src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Advntce.java index 6b620c0d..743530ca 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/printFormat/Advntce.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Advntce.java @@ -1,12 +1,11 @@ -package cokr.xit.fims.cmmn.pdf.printFormat; +package cokr.xit.fims.cmmn.pdf.print.format; import java.util.ArrayList; import java.util.List; import java.util.Map; import cokr.xit.fims.cmmn.CmmnUtil; -import cokr.xit.fims.cmmn.pdf.PDFPrintFormat; -import cokr.xit.fims.cmmn.pdf.PDFPrintUtil; +import cokr.xit.fims.cmmn.pdf.print.PDFPrintUtil; import cokr.xit.fims.mngt.FactionUtil; import cokr.xit.fims.sprt.PrintOption; import cokr.xit.foundation.data.DataFormat; diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/printFormat/Nht.java b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Nht.java similarity index 99% rename from src/main/java/cokr/xit/fims/cmmn/pdf/printFormat/Nht.java rename to src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Nht.java index b56470a4..ae9f4bec 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/printFormat/Nht.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/Nht.java @@ -1,12 +1,11 @@ -package cokr.xit.fims.cmmn.pdf.printFormat; +package cokr.xit.fims.cmmn.pdf.print.format; import java.util.ArrayList; import java.util.List; import java.util.Map; import cokr.xit.fims.cmmn.CmmnUtil; -import cokr.xit.fims.cmmn.pdf.PDFPrintFormat; -import cokr.xit.fims.cmmn.pdf.PDFPrintUtil; +import cokr.xit.fims.cmmn.pdf.print.PDFPrintUtil; import cokr.xit.fims.mngt.FactionUtil; import cokr.xit.fims.sprt.PrintOption; import cokr.xit.foundation.data.DataFormat; diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintFormat.java b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/PDFPrintFormat.java similarity index 95% rename from src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintFormat.java rename to src/main/java/cokr/xit/fims/cmmn/pdf/print/format/PDFPrintFormat.java index 8b94ec11..77be5226 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintFormat.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/print/format/PDFPrintFormat.java @@ -1,8 +1,10 @@ -package cokr.xit.fims.cmmn.pdf; +package cokr.xit.fims.cmmn.pdf.print.format; import java.util.ArrayList; import java.util.List; +import cokr.xit.fims.cmmn.pdf.print.DefaultOtptArtclStng; +import cokr.xit.fims.cmmn.pdf.print.PDFPrintUtil; import cokr.xit.fims.sprt.PrintOption; import cokr.xit.foundation.data.DataObject; 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 8da0487d..29fd6a75 100644 --- a/src/main/java/cokr/xit/fims/cmmn/web/LinkController.java +++ b/src/main/java/cokr/xit/fims/cmmn/web/LinkController.java @@ -1,10 +1,18 @@ package cokr.xit.fims.cmmn.web; +import java.util.List; + +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.pdf.PDFUtil; +import cokr.xit.fims.cmmn.pdf.extration.Extraction; +import cokr.xit.fims.cmmn.pdf.extration.PDFExtractionUtil; +import cokr.xit.fims.cmmn.service.bean.LinkBean; +import cokr.xit.fims.mngt.service.bean.FactionBean; +import cokr.xit.foundation.UserInfo; import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.web.AbstractController; @@ -12,14 +20,21 @@ import cokr.xit.foundation.web.AbstractController; @RequestMapping(name = "연계 처리", value = "/link") public class LinkController extends AbstractController { + @Resource(name = "linkBean") + private LinkBean linkBean; + + @Resource(name = "factionBean") + private FactionBean factionBean; + @RequestMapping(name = "파일 처리", value = "/fileProcess.do") public ModelAndView fileProcess(String filePath, String job, String param) { ModelAndView mav = new ModelAndView("jsonView"); boolean saved = false; + UserInfo userInfo = currentUser(); + factionBean.initUserInfo(userInfo); + String sggCd = (String) userInfo.getInfo().get("sggCd"); - System.out.println("파일경로 : " +filePath); - System.out.println("업무 : " + job); System.out.println("파라미터 : "+ param); DataObject dataObject = fromJson(param, DataObject.class); @@ -28,7 +43,32 @@ public class LinkController extends AbstractController { if(job.equals("01")) { String tmplatId = dataObject.string("tmplatId"); String taskSeCd = dataObject.string("taskSeCd"); - PDFUtil.extract(filePath, taskSeCd, tmplatId); + + List extractionInfos = PDFExtractionUtil.extract(filePath, taskSeCd, tmplatId); + + for(int i=0; i < extractionInfos.size(); i++) { + + DataObject masterInfo = new DataObject(); + masterInfo.set("signguCode", sggCd); + masterInfo.set("ffnlgCode", taskSeCd); + masterInfo.set("tmplatId", tmplatId); + masterInfo.set("sndngCo", extractionInfos.size()); + //발송일시! + //마감일시! + + DataObject detailInfo = new DataObject(); + detailInfo.set("signguCode", sggCd); + masterInfo.set("ffnlgCode", taskSeCd); + + //차량번호,주민등록번호,핸드폰번호,성명,주소,상세주소,우편번호 + //mmdd + //모바일페이지 + //masterInfo.set("mainCode", ); //통합플랫폼 단속id? 전자납부번호? + //masterInfo.set("useInsttIdntfcId", ); //통합플랫폼 발송id? + + linkBean.insertElectronicNoticeSndng(masterInfo, List.of(detailInfo)); + } + } mav.addObject("saved", saved); diff --git a/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java b/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java index feafa3d5..2dcd4093 100644 --- a/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java +++ b/src/main/java/cokr/xit/fims/sprt/service/bean/IntegrationSearchServiceBean.java @@ -40,12 +40,12 @@ import cokr.xit.fims.cmmn.hwp.format.CrdnList; import cokr.xit.fims.cmmn.hwp.format.RcvmtConfirm; import cokr.xit.fims.cmmn.hwp.format.ReportOnClaims; import cokr.xit.fims.cmmn.hwp.format.RequestForDelivery; -import cokr.xit.fims.cmmn.pdf.DefaultOtptArtclStng; -import cokr.xit.fims.cmmn.pdf.PDFPrintFormat; -import cokr.xit.fims.cmmn.pdf.PDFPrintUtil; import cokr.xit.fims.cmmn.pdf.PstnAndSize; -import cokr.xit.fims.cmmn.pdf.printFormat.Advntce; -import cokr.xit.fims.cmmn.pdf.printFormat.Nht; +import cokr.xit.fims.cmmn.pdf.print.DefaultOtptArtclStng; +import cokr.xit.fims.cmmn.pdf.print.PDFPrintUtil; +import cokr.xit.fims.cmmn.pdf.print.format.Advntce; +import cokr.xit.fims.cmmn.pdf.print.format.Nht; +import cokr.xit.fims.cmmn.pdf.print.format.PDFPrintFormat; import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; diff --git a/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java b/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java index 63264175..11210247 100644 --- a/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java +++ b/src/main/java/cokr/xit/fims/sprt/service/bean/OtptStngBean.java @@ -9,10 +9,10 @@ import javax.annotation.Resource; import org.springframework.stereotype.Component; -import cokr.xit.fims.cmmn.pdf.DefaultOtptArtclStng; -import cokr.xit.fims.cmmn.pdf.PDFPrintFormat; -import cokr.xit.fims.cmmn.pdf.printFormat.Advntce; -import cokr.xit.fims.cmmn.pdf.printFormat.Nht; +import cokr.xit.fims.cmmn.pdf.print.DefaultOtptArtclStng; +import cokr.xit.fims.cmmn.pdf.print.format.Advntce; +import cokr.xit.fims.cmmn.pdf.print.format.Nht; +import cokr.xit.fims.cmmn.pdf.print.format.PDFPrintFormat; import cokr.xit.fims.sprt.OtptArtclStng; import cokr.xit.fims.sprt.OtptForm; import cokr.xit.fims.sprt.OtptStngQuery;