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

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.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<DataObject> dataObjectList, PrintOption printOption,
HWPPrintUtil hwpPrintUtil) {
Map<String,String> 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();

@ -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<String,String> 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();

@ -38,7 +38,8 @@ public interface IntegrationSearchService {
* <li>fileName: </li>
* </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);

@ -117,8 +117,8 @@ public class IntegrationSearchServiceBean extends AbstractServiceBean implements
}
@Override
public Map<String, String> makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds) {
Map<String, String> result = new HashMap<>();
public Map<String, Object> makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds) {
Map<String, Object> 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();

@ -415,14 +415,12 @@ public class Sprt01Controller extends ApplicationController {
* @return hwp
*/
public ModelAndView makeCrdnListFileFromHwpFormat(String privateInfoYn, String[] crdnIds) {
Map<String,String> result = null;
PrintOption printOption = new PrintOption();
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);
return mav;
}
@ -431,13 +429,12 @@ public class Sprt01Controller extends ApplicationController {
* @return hwp
*/
public ModelAndView makeCrdnConfirmFileFromHwpFormat(String[] crdnIds) {
Map<String,String> result = null;
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);
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<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);
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<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);
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<String,String> result = integrationSearchService.makeFileFromHwpFormat("info", "rcvmtConfirm", printOption, crdnIds);
printOption.setGlobalVariable(new HashMap<String,String>());
Map<String,Object> result = integrationSearchService.makeFileFromHwpFormat("info", "rcvmtConfirm", printOption, crdnIds);
mav.addAllObjects(result);
return mav;

@ -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

@ -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;
}
//사전통지서

@ -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 = () => {

@ -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;
}
//버튼이벤트

Loading…
Cancel
Save