한글파일 다운로드 처리 방식 수정

main
이범준 9 months ago
parent e3be084feb
commit 15c142fd4e

@ -3,6 +3,8 @@ package cokr.xit.fims.cmmn.hwp.format;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor; import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.fims.cmmn.hwp.HWPFormatWriter; import cokr.xit.fims.cmmn.hwp.HWPFormatWriter;
@ -21,8 +23,8 @@ public class ReportOnClaims implements HWPFormatWriter {
@Override @Override
public void setting(HWPPrintUtil hwpPrintUtil) { public void setting(HWPPrintUtil hwpPrintUtil) {
hwpPrintUtil.setFormatName("채권신고서"); hwpPrintUtil.setFormatName("reportOnClaims");
hwpPrintUtil.setFormatKorName("reportOnClaims"); hwpPrintUtil.setFormatKorName("채권신고서");
hwpPrintUtil.setFormatType("list"); hwpPrintUtil.setFormatType("list");
hwpPrintUtil.setRecordPerPartFile(7); hwpPrintUtil.setRecordPerPartFile(7);
@ -33,8 +35,8 @@ public class ReportOnClaims implements HWPFormatWriter {
@Override @Override
public void setting(HWPPrintUtil hwpPrintUtil, int recordCnt) { public void setting(HWPPrintUtil hwpPrintUtil, int recordCnt) {
hwpPrintUtil.setFormatName("채권신고서"); hwpPrintUtil.setFormatName("reportOnClaims");
hwpPrintUtil.setFormatKorName("reportOnClaims"); hwpPrintUtil.setFormatKorName("채권신고서");
hwpPrintUtil.setFormatType("list"); hwpPrintUtil.setFormatType("list");
hwpPrintUtil.setRecordPerPartFile(recordCnt); hwpPrintUtil.setRecordPerPartFile(recordCnt);
@ -47,6 +49,7 @@ public class ReportOnClaims implements HWPFormatWriter {
public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, PrintOption printOption, public void writeGlobalInfo(HWPFile baseFile, List<DataObject> dataObjectList, PrintOption printOption,
HWPPrintUtil hwpPrintUtil) { HWPPrintUtil hwpPrintUtil) {
Map<String,String> globalVariable = hwpPrintUtil.getGlobalVariable(printOption); Map<String,String> globalVariable = hwpPrintUtil.getGlobalVariable(printOption);
ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile); ClickHereEditor baseFileEditor = new ClickHereEditor(baseFile);
@ -56,10 +59,10 @@ public class ReportOnClaims implements HWPFormatWriter {
baseFileEditor.set("팩스", globalVariable.get("deptFxno")); baseFileEditor.set("팩스", globalVariable.get("deptFxno"));
baseFileEditor.set("담당자", hwpPrintUtil.getPrintRequestUserInfo().getName()); baseFileEditor.set("담당자", hwpPrintUtil.getPrintRequestUserInfo().getName());
baseFileEditor.set("사건번호", globalVariable.get("caseNo")); baseFileEditor.set("사건번호", EgovStringUtil.null2void(globalVariable.get("caseNo")));
baseFileEditor.set("체납자성명", globalVariable.get("rtpyrNm")); baseFileEditor.set("체납자성명", EgovStringUtil.null2void(globalVariable.get("rtpyrNm")));
baseFileEditor.set("체납자번호", globalVariable.get("rtpyrNo")); baseFileEditor.set("체납자번호", EgovStringUtil.null2void(globalVariable.get("rtpyrNo")));
baseFileEditor.set("체납자주소", globalVariable.get("rtpyrFullAddr")); baseFileEditor.set("체납자주소", EgovStringUtil.null2void(globalVariable.get("rtpyrFullAddr")));
int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum(); int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();

@ -3,6 +3,8 @@ package cokr.xit.fims.cmmn.hwp.format;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.hwp.ClickHereEditor; import cokr.xit.fims.cmmn.hwp.ClickHereEditor;
import cokr.xit.fims.cmmn.hwp.HWPFormatWriter; import cokr.xit.fims.cmmn.hwp.HWPFormatWriter;
@ -21,8 +23,8 @@ public class RequestForDelivery implements HWPFormatWriter {
@Override @Override
public void setting(HWPPrintUtil hwpPrintUtil) { public void setting(HWPPrintUtil hwpPrintUtil) {
hwpPrintUtil.setFormatName("교부청구서"); hwpPrintUtil.setFormatName("requestForDelivery");
hwpPrintUtil.setFormatKorName("requestForDelivery"); hwpPrintUtil.setFormatKorName("교부청구서");
hwpPrintUtil.setFormatType("list"); hwpPrintUtil.setFormatType("list");
hwpPrintUtil.setRecordPerPartFile(7); hwpPrintUtil.setRecordPerPartFile(7);
@ -33,8 +35,8 @@ public class RequestForDelivery implements HWPFormatWriter {
@Override @Override
public void setting(HWPPrintUtil hwpPrintUtil, int recordCnt) { public void setting(HWPPrintUtil hwpPrintUtil, int recordCnt) {
hwpPrintUtil.setFormatName("교부청구서"); hwpPrintUtil.setFormatName("requestForDelivery");
hwpPrintUtil.setFormatKorName("requestForDelivery"); hwpPrintUtil.setFormatKorName("교부청구서");
hwpPrintUtil.setFormatType("list"); hwpPrintUtil.setFormatType("list");
hwpPrintUtil.setRecordPerPartFile(recordCnt); hwpPrintUtil.setRecordPerPartFile(recordCnt);
@ -51,13 +53,13 @@ public class RequestForDelivery implements HWPFormatWriter {
Map<String,String> globalVariable = hwpPrintUtil.getGlobalVariable(printOption); Map<String,String> globalVariable = hwpPrintUtil.getGlobalVariable(printOption);
baseFileEditor.set("문서번호", globalVariable.get("docNo")); baseFileEditor.set("문서번호", EgovStringUtil.null2void(globalVariable.get("docNo")));
baseFileEditor.set("사건번호", globalVariable.get("caseNo")); baseFileEditor.set("사건번호", EgovStringUtil.null2void(globalVariable.get("caseNo")));
baseFileEditor.set("수신", globalVariable.get("receiver")); baseFileEditor.set("수신", EgovStringUtil.null2void(globalVariable.get("receiver")));
baseFileEditor.set("체납자성명", globalVariable.get("rtpyrNm")); baseFileEditor.set("체납자성명", EgovStringUtil.null2void(globalVariable.get("rtpyrNm")));
baseFileEditor.set("체납자번호", globalVariable.get("rtpyrNo")); baseFileEditor.set("체납자번호", EgovStringUtil.null2void(globalVariable.get("rtpyrNo")));
baseFileEditor.set("차량번호", globalVariable.get("vhrno")); baseFileEditor.set("차량번호", EgovStringUtil.null2void(globalVariable.get("vhrno")));
baseFileEditor.set("주소", globalVariable.get("rtpyrFullAddr")); baseFileEditor.set("주소", EgovStringUtil.null2void(globalVariable.get("rtpyrFullAddr")));
int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum(); int sumOfList = dataObjectList.stream().mapToInt(item -> item.number("SUM_AMT").intValue()).sum();

@ -38,7 +38,8 @@ public interface IntegrationSearchService {
* <li>fileName: </li> * <li>fileName: </li>
* </ul> * </ul>
*/ */
Map<String, String> makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds); Map<String, Object> makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds);
// Map<String, String> makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds);
Map<String, String> makePdfFile(String formatType, String formatName, PrintOption printOption, String[] crdnIds); Map<String, String> makePdfFile(String formatType, String formatName, PrintOption printOption, String[] crdnIds);

@ -117,8 +117,8 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
} }
@Override @Override
public Map<String, String> makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds) { public Map<String, Object> makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds) {
Map<String, String> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
HWPPrintUtil printUtil = new HWPPrintUtil(); HWPPrintUtil printUtil = new HWPPrintUtil();
UserInfo userInfo = currentUser(); UserInfo userInfo = currentUser();
@ -268,12 +268,19 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
HWPFile attachFile = HWPReader.fromFile(attachPath); HWPFile attachFile = HWPReader.fromFile(attachPath);
AddUtil.appendToLast(attachFile, baseFile); AddUtil.appendToLast(attachFile, baseFile);
} }
HWPWriter.toFile(baseFile, basePath); 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"; String downlaodFileName = printUtil.getFormatKorName()+"_"+printUtil.getPrintRequestDt()+".hwp";
result.put("fileName", downlaodFileName); result.put("filename", downlaodFileName);
result.put("filePath", partFileList.get(0)); String filePath = partFileList.get(0);
result.put("filePath", filePath);
result.put("file", new File(filePath));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

@ -415,14 +415,12 @@ public class Sprt01Controller extends ApplicationController {
* @return hwp * @return hwp
*/ */
public ModelAndView makeCrdnListFileFromHwpFormat(String privateInfoYn, String[] crdnIds) { public ModelAndView makeCrdnListFileFromHwpFormat(String privateInfoYn, String[] crdnIds) {
Map<String,String> result = null;
PrintOption printOption = new PrintOption(); PrintOption printOption = new PrintOption();
printOption.setPrivateInfoYn(privateInfoYn); printOption.setPrivateInfoYn(privateInfoYn);
result = integrationSearchService.makeFileFromHwpFormat("list", "crdnList", printOption ,crdnIds); Map<String,Object> result = integrationSearchService.makeFileFromHwpFormat("list", "crdnList", printOption ,crdnIds);
ModelAndView mav = new ModelAndView("jsonView"); ModelAndView mav = new ModelAndView("downloadView");
mav.addAllObjects(result); mav.addAllObjects(result);
return mav; return mav;
} }
@ -431,13 +429,12 @@ public class Sprt01Controller extends ApplicationController {
* @return hwp * @return hwp
*/ */
public ModelAndView makeCrdnConfirmFileFromHwpFormat(String[] crdnIds) { public ModelAndView makeCrdnConfirmFileFromHwpFormat(String[] crdnIds) {
Map<String,String> result = null;
PrintOption printOption = new PrintOption(); PrintOption printOption = new PrintOption();
result = integrationSearchService.makeFileFromHwpFormat("info", "crdnConfirm", printOption, crdnIds); Map<String,Object> result = integrationSearchService.makeFileFromHwpFormat("info", "crdnConfirm", printOption, crdnIds);
ModelAndView mav = new ModelAndView("jsonView"); ModelAndView mav = new ModelAndView("downloadView");
mav.addAllObjects(result); mav.addAllObjects(result);
return mav; return mav;
} }
@ -457,10 +454,24 @@ public class Sprt01Controller extends ApplicationController {
/** . /** .
* @return hwp * @return hwp
*/ */
public ModelAndView makeRequestForDeliveryFileFromHwpFormat(PrintOption printOption, String[] crdnIds) { public ModelAndView makeRequestForDeliveryFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String[] crdnIds) {
ModelAndView mav = new ModelAndView("jsonView"); ModelAndView mav = new ModelAndView("downloadView");
Map<String, String> globalVariable = new HashMap<String,String>();
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<String,String> result = integrationSearchService.makeFileFromHwpFormat("list", "requestForDelivery", printOption, crdnIds); Map<String,Object> result = integrationSearchService.makeFileFromHwpFormat("list", "requestForDelivery", printOption, crdnIds);
mav.addAllObjects(result); mav.addAllObjects(result);
return mav; return mav;
} }
@ -468,10 +479,23 @@ public class Sprt01Controller extends ApplicationController {
/** . /** .
* @return hwp * @return hwp
*/ */
public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String[] crdnIds) { public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String[] crdnIds) {
ModelAndView mav = new ModelAndView("jsonView"); ModelAndView mav = new ModelAndView("downloadView");
Map<String, String> globalVariable = new HashMap<String,String>();
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<String,String> result = integrationSearchService.makeFileFromHwpFormat("list", "reportOnClaims", printOption, crdnIds);
Map<String,Object> result = integrationSearchService.makeFileFromHwpFormat("list", "reportOnClaims", printOption, crdnIds);
mav.addAllObjects(result); mav.addAllObjects(result);
return mav; return mav;
@ -481,11 +505,11 @@ public class Sprt01Controller extends ApplicationController {
* @return hwp * @return hwp
*/ */
public ModelAndView makeRcvmtConfirmFileFromHwpFormat(String[] crdnIds) { public ModelAndView makeRcvmtConfirmFileFromHwpFormat(String[] crdnIds) {
ModelAndView mav = new ModelAndView("jsonView"); ModelAndView mav = new ModelAndView("downloadView");
PrintOption printOption = new PrintOption(); PrintOption printOption = new PrintOption();
printOption.setGlobalVariable(new HashMap<String,String>());
Map<String,String> result = integrationSearchService.makeFileFromHwpFormat("info", "rcvmtConfirm", printOption, crdnIds); Map<String,Object> result = integrationSearchService.makeFileFromHwpFormat("info", "rcvmtConfirm", printOption, crdnIds);
mav.addAllObjects(result); mav.addAllObjects(result);
return mav; return mav;

@ -404,14 +404,14 @@ public class CmnController {
@Override @Override
@RequestMapping(name="교부청구서 한글 파일 생성", value=METHOD_URL.makeRequestForDeliveryFileFromHwpFormat) @RequestMapping(name="교부청구서 한글 파일 생성", value=METHOD_URL.makeRequestForDeliveryFileFromHwpFormat)
public ModelAndView makeRequestForDeliveryFileFromHwpFormat(PrintOption printOption, String... crdnIds) { public ModelAndView makeRequestForDeliveryFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String... crdnIds) {
return super.makeRequestForDeliveryFileFromHwpFormat(printOption, crdnIds); return super.makeRequestForDeliveryFileFromHwpFormat(printOption, globalVariableInfo, crdnIds);
} }
@Override @Override
@RequestMapping(name="채권신고서 한글 파일 생성", value=METHOD_URL.makeReportOnClaimsFileFromHwpFormat) @RequestMapping(name="채권신고서 한글 파일 생성", value=METHOD_URL.makeReportOnClaimsFileFromHwpFormat)
public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String... crdnIds) { public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String globalVariableInfo, String... crdnIds) {
return super.makeReportOnClaimsFileFromHwpFormat(printOption, crdnIds); return super.makeReportOnClaimsFileFromHwpFormat(printOption, globalVariableInfo, crdnIds);
} }
@Override @Override

@ -567,25 +567,11 @@ $(document).ready(function() {
var crdnIds = Object.keys(Object.groupBy(downArr, ({ CRDN_ID }) => CRDN_ID)); var crdnIds = Object.keys(Object.groupBy(downArr, ({ CRDN_ID }) => CRDN_ID));
var url = wctx.url("/sprt/sprt01/130/makeRcvmtConfirmFileFromHwpFormat.do"); var url = wctx.url("/sprt/sprt01/130/makeRcvmtConfirmFileFromHwpFormat.do");
var parameter = toQuery({
ajax.post({ crdnIds : crdnIds.join(",")
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);
}
}
}); });
document.location.href = url + "?" + parameter;
} }
//사전통지서 //사전통지서

@ -103,21 +103,13 @@ $(document).ready(function(){
privateInfoYn = "N"; privateInfoYn = "N";
} }
ajax.post({ var url = wctx.url("/sprt/sprt01/110/makeCrdnListFileFromHwpFormat.do");
url : wctx.url("/sprt/sprt01/110/makeCrdnListFileFromHwpFormat.do"), var parameter = toQuery({
data : {
crdnIds : $P.crdnIds.join(","), crdnIds : $P.crdnIds.join(","),
privateInfoYn : privateInfoYn 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);
}
}); });
document.location.href = url + "?" + parameter;
} }
$P.fnMakeCrdnConfirmFile = () => { $P.fnMakeCrdnConfirmFile = () => {

@ -288,23 +288,14 @@ $(document).ready(function(){
} }
$P.fnMakeFile = (url, globalVariable) => { $P.fnMakeFile = (url, globalVariable) => {
var globalVariableInfo = JSON.stringify(globalVariable);
ajax.post({ var parameter = toQuery({
url : url, crdnIds : $P.crdnIds.join(","),
data : { globalVariableInfo : globalVariableInfo
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);
}
}
}); });
document.location.href = url + "?" + parameter;
} }
//버튼이벤트 //버튼이벤트

Loading…
Cancel
Save