diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/PrintUtil.java b/src/main/java/cokr/xit/fims/cmmn/hwp/HWPPrintUtil.java similarity index 99% rename from src/main/java/cokr/xit/fims/cmmn/hwp/PrintUtil.java rename to src/main/java/cokr/xit/fims/cmmn/hwp/HWPPrintUtil.java index 0df763a2..0a39d1d8 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/PrintUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/HWPPrintUtil.java @@ -19,7 +19,7 @@ import kr.dogfoot.hwplib.object.HWPFile; import kr.dogfoot.hwplib.reader.HWPReader; import kr.dogfoot.hwplib.writer.HWPWriter; -public class PrintUtil { +public class HWPPrintUtil { private String formatType; private String formatName; @@ -72,6 +72,7 @@ public class PrintUtil { return this.attachFormatFilePath; } + public void calcTotalPartFileCount(int totalDataCount) { if(this.formatType.equals("list")) { diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintUtil.java b/src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintUtil.java new file mode 100644 index 00000000..4143033d --- /dev/null +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/PDFPrintUtil.java @@ -0,0 +1,35 @@ +package cokr.xit.fims.cmmn.pdf; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Date; + +public class PDFPrintUtil { + + private int fileNameIndex = 0; + + public String filePathForNewFile() { + + SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + String currentTime = ymdhmsFormat.format(new Date()); + String year = currentTime.substring(0, 4); + String month = currentTime.substring(4, 6); + String day = currentTime.substring(6, 8); + + String fileResultRootPath = "files" + File.separator + "result" + File.separator + "print"; + + String fileResultFolderPath = fileResultRootPath + + File.separator + year + File.separator + month + File.separator + day; + File formatFileResultFolder = new File(fileResultFolderPath); + if(!formatFileResultFolder.exists()) { + formatFileResultFolder.mkdirs(); + } + String resultPdfPath = fileResultFolderPath + + File.separator + currentTime + "_" + (this.fileNameIndex++) + ".pdf"; + + + return resultPdfPath; + + } + +} diff --git a/src/main/java/cokr/xit/fims/sprt/service/Sprt01Service.java b/src/main/java/cokr/xit/fims/sprt/service/Sprt01Service.java index 08c0f6b2..9c21ffe2 100644 --- a/src/main/java/cokr/xit/fims/sprt/service/Sprt01Service.java +++ b/src/main/java/cokr/xit/fims/sprt/service/Sprt01Service.java @@ -40,4 +40,8 @@ public interface Sprt01Service { */ Map makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds); + Map makePdfFile(String formatType, String formatName, PrintOption printOption, String[] crdnIds); + + Map makeOutsourcingFile(String formatName, PrintOption printOption, String[] crdnIds); + } diff --git a/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java b/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java index 7b54f0eb..fc57be0a 100644 --- a/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java +++ b/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java @@ -12,7 +12,7 @@ import org.springframework.stereotype.Service; import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.fims.cmmn.hwp.AddUtil; -import cokr.xit.fims.cmmn.hwp.PrintUtil; +import cokr.xit.fims.cmmn.hwp.HWPPrintUtil; import cokr.xit.fims.cmmn.service.bean.FactionBean; import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.crdn.Crdn; @@ -77,7 +77,7 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv public Map makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds) { Map result = new HashMap<>(); - PrintUtil printUtil = new PrintUtil(); + HWPPrintUtil printUtil = new HWPPrintUtil(); printUtil.setting(formatType, formatName); UserInfo userInfo = currentUser(); @@ -218,6 +218,21 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv return result; } + @Override + public Map makePdfFile(String formatType, String formatName, PrintOption printOption, String[] crdnIds) { + Map result = new HashMap<>(); + + + + + return result; + } + + @Override + public Map makeOutsourcingFile(String formatName, PrintOption printOption, String[] crdnIds) { + return null; + } + } diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java index cab92465..f3b7cb25 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java @@ -50,7 +50,10 @@ public class Sprt01Controller extends ApplicationController { printBillMain = "/120/info.do", makeRequestForDeliveryFileFromHwpFormat = "/120/makeRequestForDeliveryFileFromHwpFormat.do", makeReportOnClaimsFileFromHwpFormat = "/120/makeReportOnClaimsFileFromHwpFormat.do", - makeRcvmtConfirmFileFromHwpFormat = "/130/makeRcvmtConfirmFileFromHwpFormat.do" + makeRcvmtConfirmFileFromHwpFormat = "/130/makeRcvmtConfirmFileFromHwpFormat.do", + printAdvntceMain = "/140/info.do", + makeAdvntcePdf = "/140/makeAdvntcePdf.do", + makeAdvntceOutsourcing = "/140/makeAdvntceOutsourcing.do" ; } @@ -287,7 +290,7 @@ public class Sprt01Controller extends ApplicationController { } /** 단속내역서를 한글 파일로 작성한다. - * @return hwp파일 + * @return 단속내역서 hwp파일 */ public ModelAndView makeCrdnListFileFromHwpFormat(String privateInfoYn, String[] crdnIds) { Map result = null; @@ -303,7 +306,7 @@ public class Sprt01Controller extends ApplicationController { } /** 단속확인서를 한글 파일로 작성한다. - * @return hwp파일 + * @return 단속확인서 hwp파일 */ public ModelAndView makeCrdnConfirmFileFromHwpFormat(String[] crdnIds) { Map result = null; @@ -341,7 +344,7 @@ public class Sprt01Controller extends ApplicationController { } /** 채권신고서를 한글 파일로 작성한다. - * @return hwp파일 + * @return 채권신고서 hwp파일 */ public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String[] crdnIds) { ModelAndView mav = new ModelAndView("jsonView"); @@ -353,7 +356,7 @@ public class Sprt01Controller extends ApplicationController { } /** 납부확인서를 한글 파일로 작성한다. - * @return hwp파일 + * @return 납부확인서 hwp파일 */ public ModelAndView makeRcvmtConfirmFileFromHwpFormat(String[] crdnIds) { ModelAndView mav = new ModelAndView("jsonView"); @@ -365,4 +368,45 @@ public class Sprt01Controller extends ApplicationController { return mav; } + + /**사전통지서 출력 화면을 연다. + * + * @return /fims/sprt/sprt01140 + */ + public ModelAndView printAdvntceMain(String... crdnIds) { + ModelAndView mav = new ModelAndView("fims/sprt/sprt01140-info"); + mav.addObject("pageName", "sprt01140-info"); + mav.addObject("crdnIds", toJson(crdnIds)); + + return mav; + } + + /** 사전통지서를 PDF 파일로 작성한다. + * @return 사전통지서 PDF파일 + */ + public ModelAndView makeAdvntcePdf(String[] crdnIds) { + ModelAndView mav = new ModelAndView("jsonView"); + + PrintOption printOption = new PrintOption(); + + Map result = sprt01Service.makePdfFile("info", "advntce", printOption, crdnIds); + mav.addAllObjects(result); + + return mav; + } + + + /** 사전통지 정보로 txt파일,이미지파일을 생성하고 압축파일로 반환한다. + * @return 사전통지서 압축파일 + */ + public ModelAndView makeAdvntceOutsourcing(String[] crdnIds) { + ModelAndView mav = new ModelAndView("jsonView"); + + PrintOption printOption = new PrintOption(); + + Map result = sprt01Service.makeOutsourcingFile("advntce", printOption, crdnIds); + mav.addAllObjects(result); + + return mav; + } } diff --git a/src/main/java/cokr/xit/fims/task/web/CmnController.java b/src/main/java/cokr/xit/fims/task/web/CmnController.java index efae6a11..68da5962 100644 --- a/src/main/java/cokr/xit/fims/task/web/CmnController.java +++ b/src/main/java/cokr/xit/fims/task/web/CmnController.java @@ -404,6 +404,24 @@ public class CmnController { return super.makeRcvmtConfirmFileFromHwpFormat(crdnIds); } + @Override + @RequestMapping(name="사전통지서 출력 화면", value=METHOD_URL.printAdvntceMain) + public ModelAndView printAdvntceMain(String... crdnIds) { + return super.printAdvntceMain(crdnIds); + } + + @Override + @RequestMapping(name="사전통지서 pdf 파일 생성", value=METHOD_URL.makeAdvntcePdf) + public ModelAndView makeAdvntcePdf(String... crdnIds) { + return super.makeAdvntcePdf(crdnIds); + } + + @Override + @RequestMapping(name="사전통지서 외주 파일 생성", value=METHOD_URL.makeAdvntceOutsourcing) + public ModelAndView makeAdvntceOutsourcing(String... crdnIds) { + return super.makeAdvntceOutsourcing(crdnIds); + } + } @Controller diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01010-main.jsp index f21d2ba4..9753c0ba 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01010-main.jsp @@ -479,6 +479,7 @@ integrationSearch.fnPrintBill = () => { } +//납부확인서 integrationSearch.fnPrintRcvmtConfirm = () => { var downDataset = integrationSearchControl.downdataset; @@ -514,6 +515,61 @@ integrationSearch.fnPrintRcvmtConfirm = () => { } +//사전통지서 +integrationSearch.fnPrintAdvntce = () => { + + var upDataset = integrationSearchControl.updataset; + + if(upDataset.length <= 0){ + dialog.alert("출력할 자료가 없습니다."); + return; + } + + var upArr = upDataset.getDataset(); + + var crdnIds = Object.keys(Object.groupBy(upArr, ({ CRDN_ID }) => CRDN_ID)); + + var url = wctx.url("/sprt/sprt01/140/info.do"); + + var dialogId = "printAdvntceDialog"; + + ajax.get({ + url : url + , data : { crdnIds : crdnIds.join(",") } + , success : resp => { + dialog.open({ + id : dialogId + , title : "종합조회-사전통지서" + , size : "xl" + , content : resp + , init : () => { + + $("#"+dialogId).find("input[name='dialogId']").val(dialogId); + var found = $("#"+dialogId).find("template")[0].innerHTML; + var trs = upDataset.inStrings(found, null); + $("#"+dialogId).find("tbody").html(trs.join()); + + + var parentRes = new Object(); + var childReq = pageObject.childReq.pop(); + + for(var reqKey in childReq) { + if(integrationSearch.provide[reqKey]){ + parentRes[reqKey] = integrationSearch.provide[reqKey]; + } else { + parentRes[reqKey] = function(){}; + } + } + + pageObject.parentRes.push(parentRes); + } + , onClose : () => { } + }); + } + }); + +} + //개별총정보 dialog integrationSearch.getInfo = (taskSeCd, crdnId) => { if (crdnId == undefined || crdnId == null || crdnId == "") { @@ -592,6 +648,8 @@ integrationSearch.setEvent = () => { $("#btnDownPrintRcvmtConfirm--${pageName}").on("click", function(){ integrationSearch.fnPrintRcvmtConfirm(); }); + $("#btnUpPrintAdvntce--${pageName}").on("click", function(){ integrationSearch.fnPrintAdvntce(); }); + //$("#btn").on("click", function(){ }); diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01012-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01012-info.jsp index 4bb700ee..092b3a65 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01012-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01012-info.jsp @@ -53,7 +53,7 @@ title="엑셀 저장"> 엑셀 - diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp new file mode 100644 index 00000000..ac22a3fd --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp @@ -0,0 +1,147 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> +<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> + +출력대상-사전통지서 + +
+
+
+
+
+ + +
+
+
+ +
+ +
+ +
+ + +
+ + +
+
+ + \ No newline at end of file