사전통지서 출력 대상 화면 추가

main
이범준 12 months ago
parent 152fbd4547
commit ccf0bdc690

@ -19,7 +19,7 @@ import kr.dogfoot.hwplib.object.HWPFile;
import kr.dogfoot.hwplib.reader.HWPReader; import kr.dogfoot.hwplib.reader.HWPReader;
import kr.dogfoot.hwplib.writer.HWPWriter; import kr.dogfoot.hwplib.writer.HWPWriter;
public class PrintUtil { public class HWPPrintUtil {
private String formatType; private String formatType;
private String formatName; private String formatName;
@ -72,6 +72,7 @@ public class PrintUtil {
return this.attachFormatFilePath; return this.attachFormatFilePath;
} }
public void calcTotalPartFileCount(int totalDataCount) { public void calcTotalPartFileCount(int totalDataCount) {
if(this.formatType.equals("list")) { if(this.formatType.equals("list")) {

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

@ -40,4 +40,8 @@ public interface Sprt01Service {
*/ */
Map<String, String> 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> makeOutsourcingFile(String formatName, PrintOption printOption, String[] crdnIds);
} }

@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.file.service.bean.FileBean;
import cokr.xit.fims.cmmn.hwp.AddUtil; 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.FactionBean;
import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.cmmn.service.bean.StngBean;
import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.Crdn;
@ -77,7 +77,7 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
public Map<String, String> makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds) { public Map<String, String> makeFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... crdnIds) {
Map<String, String> result = new HashMap<>(); Map<String, String> result = new HashMap<>();
PrintUtil printUtil = new PrintUtil(); HWPPrintUtil printUtil = new HWPPrintUtil();
printUtil.setting(formatType, formatName); printUtil.setting(formatType, formatName);
UserInfo userInfo = currentUser(); UserInfo userInfo = currentUser();
@ -218,6 +218,21 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv
return result; return result;
} }
@Override
public Map<String, String> makePdfFile(String formatType, String formatName, PrintOption printOption, String[] crdnIds) {
Map<String, String> result = new HashMap<>();
return result;
}
@Override
public Map<String, String> makeOutsourcingFile(String formatName, PrintOption printOption, String[] crdnIds) {
return null;
}
} }

@ -50,7 +50,10 @@ public class Sprt01Controller extends ApplicationController {
printBillMain = "/120/info.do", printBillMain = "/120/info.do",
makeRequestForDeliveryFileFromHwpFormat = "/120/makeRequestForDeliveryFileFromHwpFormat.do", makeRequestForDeliveryFileFromHwpFormat = "/120/makeRequestForDeliveryFileFromHwpFormat.do",
makeReportOnClaimsFileFromHwpFormat = "/120/makeReportOnClaimsFileFromHwpFormat.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) { public ModelAndView makeCrdnListFileFromHwpFormat(String privateInfoYn, String[] crdnIds) {
Map<String,String> result = null; Map<String,String> result = null;
@ -303,7 +306,7 @@ public class Sprt01Controller extends ApplicationController {
} }
/** . /** .
* @return hwp * @return hwp
*/ */
public ModelAndView makeCrdnConfirmFileFromHwpFormat(String[] crdnIds) { public ModelAndView makeCrdnConfirmFileFromHwpFormat(String[] crdnIds) {
Map<String,String> result = null; Map<String,String> result = null;
@ -341,7 +344,7 @@ public class Sprt01Controller extends ApplicationController {
} }
/** . /** .
* @return hwp * @return hwp
*/ */
public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String[] crdnIds) { public ModelAndView makeReportOnClaimsFileFromHwpFormat(PrintOption printOption, String[] crdnIds) {
ModelAndView mav = new ModelAndView("jsonView"); ModelAndView mav = new ModelAndView("jsonView");
@ -353,7 +356,7 @@ 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("jsonView");
@ -365,4 +368,45 @@ public class Sprt01Controller extends ApplicationController {
return mav; 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<String,String> 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<String,String> result = sprt01Service.makeOutsourcingFile("advntce", printOption, crdnIds);
mav.addAllObjects(result);
return mav;
}
} }

@ -404,6 +404,24 @@ public class CmnController {
return super.makeRcvmtConfirmFileFromHwpFormat(crdnIds); 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 @Controller

@ -479,6 +479,7 @@ integrationSearch.fnPrintBill = () => {
} }
//납부확인서
integrationSearch.fnPrintRcvmtConfirm = () => { integrationSearch.fnPrintRcvmtConfirm = () => {
var downDataset = integrationSearchControl.downdataset; 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 //개별총정보 dialog
integrationSearch.getInfo = (taskSeCd, crdnId) => { integrationSearch.getInfo = (taskSeCd, crdnId) => {
if (crdnId == undefined || crdnId == null || crdnId == "") { if (crdnId == undefined || crdnId == null || crdnId == "") {
@ -592,6 +648,8 @@ integrationSearch.setEvent = () => {
$("#btnDownPrintRcvmtConfirm--${pageName}").on("click", function(){ integrationSearch.fnPrintRcvmtConfirm(); }); $("#btnDownPrintRcvmtConfirm--${pageName}").on("click", function(){ integrationSearch.fnPrintRcvmtConfirm(); });
$("#btnUpPrintAdvntce--${pageName}").on("click", function(){ integrationSearch.fnPrintAdvntce(); });
//$("#btn").on("click", function(){ }); //$("#btn").on("click", function(){ });

@ -53,7 +53,7 @@
title="엑셀 저장"> title="엑셀 저장">
엑셀 엑셀
</button> </button>
<button type="button" id="" class="btn btn-info" <button type="button" id="btnUpPrintAdvntce--${pageName}" class="btn btn-info"
title="사전통지서"> title="사전통지서">
사전통지서 사전통지서
</button> </button>

@ -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"%>
<c:set var="prefixName" scope="request">출력대상-사전통지서</c:set>
<div class="d-flex flex-row justify-content-evenly">
<div class="card p-3">
<div class="row mb-3 justify-content-start">
<div class="col-md-12">
<div class="float-start">
<button type="button" id="btnPrintAdvntcePdf--${pageName}" class="btn btn-info">사전통보서출력(PDF)</button>
<button type="button" id="btnPrintAdvntceOutsourcing--${pageName}" class="btn btn-info">사전통보서출력(외주파일)</button>
</div>
</div>
</div>
<div class="card-datatable text-nowrap mb-3">
<div class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="table-responsive"
style="overflow-x:scroll; height:300px; overflow-y:scroll;" >
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer"
id="table--${pageName}" aria-describedby="DataTables_Table_0_info">
<thead class="sticky-thead" >
<tr id="theadTr--${pageName}">
<th style="width:120px">시군구명</th>
<th style="width:180px">과태료명</th>
<th style="width:120px">차량번호</th>
<th style="width:120px">대체차량번호</th>
<th style="width:200px">단속일시</th>
<th style="width:200px">단속장소</th>
<th style="width:120px">고지번호</th>
<th style="width:120px">수납일자</th>
<th style="width:120px">처리상태</th>
<th style="width:120px">수납금액</th>
<th style="width:120px">잔액</th>
<th style="width:120px">성명</th>
<th style="width:400px">주소</th>
<th style="width:400px">번지</th>
</tr>
</thead>
<tbody id="tbody--${pageName}">
</tbody>
<template id="found--${pageName}">
<tr data-key="{CRDN_ID}" onclick="pageObject['${pageName}'].clickGrid(this);">
<td>{SGG_NM}</td>
<td>{TASK_SE_NM}</td>
<td>{VHRNO}</td>
<td>{RPM_SZR_VHRNO}</td>
<td>{CRDN_YMD_TM}</td>
<td>{CRDN_PLC}</td>
<td>{GOJI_NO}</td>
<td>{RCVMT_YMD}</td>
<td>{CRDN_STTS_NM}</td>
<td>{RCVMT_AMT}</td>
<td>{SUM_AMT}</td>
<td>{RTPYR_NM}</td>
<td>{RTPYR_ADDR}</td>
<td>{RTPYR_DTL_ADDR}</td>
</tr>
</template>
</table>
</div>
</div>
</div>
<form id="frmEdit--${pageName}">
<input type="text" name="dialogId" hidden />
</form>
<span id="tempArea--${pageName}" hidden></span>
</div>
</div>
<script>
pageObject["${pageName}"] = {};
pageObject["${pageName}"].provided = {};
pageObject.childReq = [];
pageObject.childReq.push({
getInfo : function(){ return null; },
});
$(document).ready(function(){
var $P = pageObject["${pageName}"];
$P.crdnIds = ${crdnIds};
if(pageObject.parentRes.length > 0){
$P.provided = pageObject.parentRes.pop();
} else {
$P.provided = pageObject.childReq.pop();
}
//그리드클릭
$P.clickGrid = (element) => {
var key = element.dataset.key;
$("#tbody--${pageName}").setCurrentRow(key);
var info = $P.provided.getInfo(key);
var ff = new FimsFormFields("#frmEdit--${pageName}");
ff.set(info);
}
$P.fnMakeFile = (fileType) => {
if(!customValidate($("#frmEdit--${pageName} input"))) return;
var url = "";
if(fileType == "pdf"){
url = wctx.url("/sprt/sprt01/140/makeAdvntcePdf.do");
} else if(fileType == "outsourcing"){
url = wctx.url("/sprt/sprt01/140/makeAdvntceOutsourcing.do");
}
var formFields = new FimsFormFields("#frmEdit--${pageName}");
var globalVariable = formFields.get();
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);
}
}
});
}
//버튼이벤트
$("#btnPrintAdvntcePdf--${pageName}").on("click", () => $P.fnMakeFile('pdf') );
$("#btnPrintAdvntceOutsourcing--${pageName}").on("click", () => $P.fnMakeFile('outsourcing') );
//첫번째 줄 클릭
$("#tbody--${pageName}").find("tr:eq(0)").click();
});
</script>
Loading…
Cancel
Save