diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/format/ReportOnClaims.java b/src/main/java/cokr/xit/fims/cmmn/hwp/format/ReportOnClaims.java index 0fc4e7ee..2d73d066 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/format/ReportOnClaims.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/format/ReportOnClaims.java @@ -3,6 +3,8 @@ package cokr.xit.fims.cmmn.hwp.format; import java.util.List; import java.util.Map; +import org.egovframe.rte.fdl.string.EgovStringUtil; + import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.hwp.ClickHereEditor; import cokr.xit.fims.cmmn.hwp.HWPFormatWriter; @@ -21,8 +23,8 @@ public class ReportOnClaims implements HWPFormatWriter { @Override public void setting(HWPPrintUtil hwpPrintUtil) { - hwpPrintUtil.setFormatName("채권신고서"); - hwpPrintUtil.setFormatKorName("reportOnClaims"); + hwpPrintUtil.setFormatName("reportOnClaims"); + hwpPrintUtil.setFormatKorName("채권신고서"); hwpPrintUtil.setFormatType("list"); hwpPrintUtil.setRecordPerPartFile(7); @@ -33,8 +35,8 @@ public class ReportOnClaims implements HWPFormatWriter { @Override public void setting(HWPPrintUtil hwpPrintUtil, int recordCnt) { - hwpPrintUtil.setFormatName("채권신고서"); - hwpPrintUtil.setFormatKorName("reportOnClaims"); + hwpPrintUtil.setFormatName("reportOnClaims"); + hwpPrintUtil.setFormatKorName("채권신고서"); hwpPrintUtil.setFormatType("list"); hwpPrintUtil.setRecordPerPartFile(recordCnt); @@ -47,6 +49,7 @@ public class ReportOnClaims implements HWPFormatWriter { public void writeGlobalInfo(HWPFile baseFile, List dataObjectList, PrintOption printOption, HWPPrintUtil hwpPrintUtil) { + Map globalVariable = hwpPrintUtil.getGlobalVariable(printOption); ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile); @@ -56,10 +59,10 @@ public class ReportOnClaims implements HWPFormatWriter { baseFileEditor.set("팩스", globalVariable.get("deptFxno")); baseFileEditor.set("담당자", hwpPrintUtil.getPrintRequestUserInfo().getName()); - baseFileEditor.set("사건번호", globalVariable.get("caseNo")); - baseFileEditor.set("체납자성명", globalVariable.get("rtpyrNm")); - baseFileEditor.set("체납자번호", globalVariable.get("rtpyrNo")); - baseFileEditor.set("체납자주소", globalVariable.get("rtpyrFullAddr")); + baseFileEditor.set("사건번호", EgovStringUtil.null2void(globalVariable.get("caseNo"))); + baseFileEditor.set("체납자성명", EgovStringUtil.null2void(globalVariable.get("rtpyrNm"))); + baseFileEditor.set("체납자번호", EgovStringUtil.null2void(globalVariable.get("rtpyrNo"))); + baseFileEditor.set("체납자주소", EgovStringUtil.null2void(globalVariable.get("rtpyrFullAddr"))); int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum(); diff --git a/src/main/java/cokr/xit/fims/cmmn/hwp/format/RequestForDelivery.java b/src/main/java/cokr/xit/fims/cmmn/hwp/format/RequestForDelivery.java index 300bb874..83aba7a1 100644 --- a/src/main/java/cokr/xit/fims/cmmn/hwp/format/RequestForDelivery.java +++ b/src/main/java/cokr/xit/fims/cmmn/hwp/format/RequestForDelivery.java @@ -3,6 +3,8 @@ package cokr.xit.fims.cmmn.hwp.format; import java.util.List; import java.util.Map; +import org.egovframe.rte.fdl.string.EgovStringUtil; + import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.hwp.ClickHereEditor; import cokr.xit.fims.cmmn.hwp.HWPFormatWriter; @@ -21,8 +23,8 @@ public class RequestForDelivery implements HWPFormatWriter { @Override public void setting(HWPPrintUtil hwpPrintUtil) { - hwpPrintUtil.setFormatName("교부청구서"); - hwpPrintUtil.setFormatKorName("requestForDelivery"); + hwpPrintUtil.setFormatName("requestForDelivery"); + hwpPrintUtil.setFormatKorName("교부청구서"); hwpPrintUtil.setFormatType("list"); hwpPrintUtil.setRecordPerPartFile(7); @@ -33,8 +35,8 @@ public class RequestForDelivery implements HWPFormatWriter { @Override public void setting(HWPPrintUtil hwpPrintUtil, int recordCnt) { - hwpPrintUtil.setFormatName("교부청구서"); - hwpPrintUtil.setFormatKorName("requestForDelivery"); + hwpPrintUtil.setFormatName("requestForDelivery"); + hwpPrintUtil.setFormatKorName("교부청구서"); hwpPrintUtil.setFormatType("list"); hwpPrintUtil.setRecordPerPartFile(recordCnt); @@ -51,13 +53,13 @@ public class RequestForDelivery implements HWPFormatWriter { Map globalVariable = hwpPrintUtil.getGlobalVariable(printOption); - baseFileEditor.set("문서번호", globalVariable.get("docNo")); - baseFileEditor.set("사건번호", globalVariable.get("caseNo")); - baseFileEditor.set("수신", globalVariable.get("receiver")); - baseFileEditor.set("체납자성명", globalVariable.get("rtpyrNm")); - baseFileEditor.set("체납자번호", globalVariable.get("rtpyrNo")); - baseFileEditor.set("차량번호", globalVariable.get("vhrno")); - baseFileEditor.set("주소", globalVariable.get("rtpyrFullAddr")); + baseFileEditor.set("문서번호", EgovStringUtil.null2void(globalVariable.get("docNo"))); + baseFileEditor.set("사건번호", EgovStringUtil.null2void(globalVariable.get("caseNo"))); + baseFileEditor.set("수신", EgovStringUtil.null2void(globalVariable.get("receiver"))); + baseFileEditor.set("체납자성명", EgovStringUtil.null2void(globalVariable.get("rtpyrNm"))); + baseFileEditor.set("체납자번호", EgovStringUtil.null2void(globalVariable.get("rtpyrNo"))); + baseFileEditor.set("차량번호", EgovStringUtil.null2void(globalVariable.get("vhrno"))); + baseFileEditor.set("주소", EgovStringUtil.null2void(globalVariable.get("rtpyrFullAddr"))); int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum(); diff --git a/src/main/java/cokr/xit/fims/sprt/service/IntegrationSearchService.java b/src/main/java/cokr/xit/fims/sprt/service/IntegrationSearchService.java index cbaf75b6..f9b8b28b 100644 --- a/src/main/java/cokr/xit/fims/sprt/service/IntegrationSearchService.java +++ b/src/main/java/cokr/xit/fims/sprt/service/IntegrationSearchService.java @@ -38,7 +38,8 @@ public interface IntegrationSearchService { *
  • fileName: 다운로드 파일명
  • * */ - Map makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds); + Map makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds); +// Map makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds); Map makePdfFile(String formatType, String formatName, PrintOption printOption, String[] crdnIds); 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 773015ca..70f3dd13 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 @@ -117,8 +117,8 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements } @Override - public Map makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds) { - Map result = new HashMap<>(); + public Map makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds) { + Map result = new HashMap<>(); HWPPrintUtil printUtil = new HWPPrintUtil(); UserInfo userInfo = currentUser(); @@ -268,12 +268,19 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements HWPFile attachFile = HWPReader.fromFile(attachPath); AddUtil.appendToLast(attachFile, baseFile); } + HWPWriter.toFile(baseFile, basePath); + + for(int i=2; i <= partFileList.size();i++) { + (new File(partFileList.get(i-1))).delete(); + } } String downlaodFileName = printUtil.getFormatKorName()+"_"+printUtil.getPrintRequestDt()+".hwp"; - result.put("fileName", downlaodFileName); - result.put("filePath", partFileList.get(0)); + result.put("filename", downlaodFileName); + String filePath = partFileList.get(0); + result.put("filePath", filePath); + result.put("file", new File(filePath)); } catch (Exception e) { e.printStackTrace(); 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 4a1e7f88..4fd929bb 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java @@ -415,14 +415,12 @@ public class Sprt01Controller extends ApplicationController { * @return 단속내역서 hwp파일 */ public ModelAndView makeCrdnListFileFromHwpFormat(String privateInfoYn, String[] crdnIds) { - Map result = null; - PrintOption printOption = new PrintOption(); printOption.setPrivateInfoYn(privateInfoYn); - result = integrationSearchService.makeFileFromHwpFormat("list", "crdnList", printOption ,crdnIds); + Map result = integrationSearchService.makeFileFromHwpFormat("list", "crdnList", printOption ,crdnIds); - ModelAndView mav = new ModelAndView("jsonView"); + ModelAndView mav = new ModelAndView("downloadView"); mav.addAllObjects(result); return mav; } @@ -431,13 +429,12 @@ public class Sprt01Controller extends ApplicationController { * @return 단속확인서 hwp파일 */ public ModelAndView makeCrdnConfirmFileFromHwpFormat(String[] crdnIds) { - Map result = null; PrintOption printOption = new PrintOption(); - result = integrationSearchService.makeFileFromHwpFormat("info", "crdnConfirm", printOption, crdnIds); + Map result = integrationSearchService.makeFileFromHwpFormat("info", "crdnConfirm", printOption, crdnIds); - ModelAndView mav = new ModelAndView("jsonView"); + ModelAndView mav = new ModelAndView("downloadView"); mav.addAllObjects(result); return mav; } @@ -457,10 +454,24 @@ public class Sprt01Controller extends ApplicationController { /** 교부청구서를 한글 파일로 작성한다. * @return hwp파일 */ - public ModelAndView makeRequestForDeliveryFileFromHwpFormat(PrintOption printOption, String[] crdnIds) { - ModelAndView mav = new ModelAndView("jsonView"); + public ModelAndView makeRequestForDeliveryFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String[] crdnIds) { + ModelAndView mav = new ModelAndView("downloadView"); + + Map globalVariable = new HashMap(); + + DataObject dataObject = fromJson(globalVariableInfo, DataObject.class); + + globalVariable.put("docNo", dataObject.string("docNo")); + globalVariable.put("caseNo", dataObject.string("caseNo")); + globalVariable.put("receiver", dataObject.string("receiver")); + globalVariable.put("rtpyrNm", dataObject.string("rtpyrNm")); + globalVariable.put("rtpyrNo", dataObject.string("rtpyrNo")); + globalVariable.put("vhrno", dataObject.string("vhrno")); + globalVariable.put("rtpyrFullAddr", dataObject.string("rtpyrFullAddr")); + + printOption.setGlobalVariable(globalVariable); - Map result = integrationSearchService.makeFileFromHwpFormat("list", "requestForDelivery", printOption, crdnIds); + Map result = integrationSearchService.makeFileFromHwpFormat("list", "requestForDelivery", printOption, crdnIds); mav.addAllObjects(result); return mav; } @@ -468,10 +479,23 @@ public class Sprt01Controller extends ApplicationController { /** 채권신고서를 한글 파일로 작성한다. * @return 채권신고서 hwp파일 */ - public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String[] crdnIds) { - ModelAndView mav = new ModelAndView("jsonView"); + public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String[] crdnIds) { + ModelAndView mav = new ModelAndView("downloadView"); + + Map globalVariable = new HashMap(); + System.out.println("json확인"); + System.out.println(globalVariableInfo); + DataObject dataObject = fromJson(globalVariableInfo, DataObject.class); + + globalVariable.put("caseNo", dataObject.string("caseNo")); + globalVariable.put("rtpyrNm", dataObject.string("rtpyrNm")); + globalVariable.put("rtpyrNo", dataObject.string("rtpyrNo")); + globalVariable.put("rtpyrFullAddr", dataObject.string("rtpyrFullAddr")); + + printOption.setGlobalVariable(globalVariable); - Map result = integrationSearchService.makeFileFromHwpFormat("list", "reportOnClaims", printOption, crdnIds); + + Map result = integrationSearchService.makeFileFromHwpFormat("list", "reportOnClaims", printOption, crdnIds); mav.addAllObjects(result); return mav; @@ -481,11 +505,11 @@ public class Sprt01Controller extends ApplicationController { * @return 납부확인서 hwp파일 */ public ModelAndView makeRcvmtConfirmFileFromHwpFormat(String[] crdnIds) { - ModelAndView mav = new ModelAndView("jsonView"); + ModelAndView mav = new ModelAndView("downloadView"); PrintOption printOption = new PrintOption(); - - Map result = integrationSearchService.makeFileFromHwpFormat("info", "rcvmtConfirm", printOption, crdnIds); + printOption.setGlobalVariable(new HashMap()); + Map result = integrationSearchService.makeFileFromHwpFormat("info", "rcvmtConfirm", 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 b737a86d..85c5aff0 100644 --- a/src/main/java/cokr/xit/fims/task/web/CmnController.java +++ b/src/main/java/cokr/xit/fims/task/web/CmnController.java @@ -404,14 +404,14 @@ public class CmnController { @Override @RequestMapping(name="교부청구서 한글 파일 생성", value=METHOD_URL.makeRequestForDeliveryFileFromHwpFormat) - public ModelAndView makeRequestForDeliveryFileFromHwpFormat(PrintOption printOption, String... crdnIds) { - return super.makeRequestForDeliveryFileFromHwpFormat(printOption, crdnIds); + public ModelAndView makeRequestForDeliveryFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String... crdnIds) { + return super.makeRequestForDeliveryFileFromHwpFormat(printOption, globalVariableInfo, crdnIds); } @Override @RequestMapping(name="채권신고서 한글 파일 생성", value=METHOD_URL.makeReportOnClaimsFileFromHwpFormat) - public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String... crdnIds) { - return super.makeReportOnClaimsFileFromHwpFormat(printOption, crdnIds); + public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String... crdnIds) { + return super.makeReportOnClaimsFileFromHwpFormat(printOption, globalVariableInfo, crdnIds); } @Override 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 ebd06ebe..c5aeeeab 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 @@ -567,25 +567,11 @@ $(document).ready(function() { var crdnIds = Object.keys(Object.groupBy(downArr, ({ CRDN_ID }) => CRDN_ID)); var url = wctx.url("/sprt/sprt01/130/makeRcvmtConfirmFileFromHwpFormat.do"); - - ajax.post({ - url : url, - data : { - crdnIds : crdnIds.join(","), - globalVariable : {} - }, - success : (resp) => { - if(resp.filePath != null && resp.filePath != ""){ - var a = document.createElement("a"); - a.href = resp.filePath; - a.download = resp.fileName; - document.getElementById("tempArea--${pageName}").appendChild(a); - a.click(); - document.getElementById("tempArea--${pageName}").removeChild(a); - } - } + var parameter = toQuery({ + crdnIds : crdnIds.join(",") }); + document.location.href = url + "?" + parameter; } //사전통지서 diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01110-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01110-info.jsp index ec8230d2..c9e4e27b 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01110-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01110-info.jsp @@ -103,21 +103,13 @@ $(document).ready(function(){ privateInfoYn = "N"; } - ajax.post({ - url : wctx.url("/sprt/sprt01/110/makeCrdnListFileFromHwpFormat.do"), - data : { - crdnIds : $P.crdnIds.join(","), - privateInfoYn : privateInfoYn - }, - success : resp => { - var a = document.createElement("a"); - a.href = resp.filePath; - a.download = resp.fileName; - document.getElementById("tempArea--${pageName}").appendChild(a); - a.click(); - document.getElementById("tempArea--${pageName}").removeChild(a); - } + var url = wctx.url("/sprt/sprt01/110/makeCrdnListFileFromHwpFormat.do"); + var parameter = toQuery({ + crdnIds : $P.crdnIds.join(","), + privateInfoYn : privateInfoYn }); + + document.location.href = url + "?" + parameter; } $P.fnMakeCrdnConfirmFile = () => { diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01120-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01120-info.jsp index 2994c8c8..fb2a9238 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01120-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01120-info.jsp @@ -288,23 +288,14 @@ $(document).ready(function(){ } $P.fnMakeFile = (url, globalVariable) => { + var globalVariableInfo = JSON.stringify(globalVariable); - ajax.post({ - url : url, - data : { - crdnIds : $P.crdnIds.join(",") - }, - success : (resp) => { - if(resp.filePath != null && resp.filePath != ""){ - var a = document.createElement("a"); - a.href = resp.filePath; - a.download = resp.fileName; - document.getElementById("tempArea--${pageName}").appendChild(a); - a.click(); - document.getElementById("tempArea--${pageName}").removeChild(a); - } - } + var parameter = toQuery({ + crdnIds : $P.crdnIds.join(","), + globalVariableInfo : globalVariableInfo }); + + document.location.href = url + "?" + parameter; } //버튼이벤트