외사경찰견문관리 > 청산보고서 묶음인쇄 기능 추가.

master
강석 최 2023-03-23 10:30:00 +09:00
parent c32ecb1be9
commit 5f05d5663c
10 changed files with 72 additions and 63 deletions

View File

@ -286,7 +286,10 @@ public class ResultController { // 첩보수집활동 > 외사경찰 견문관
}
bundleMap.put("planBoard", planBoardList);
bundleMap.put("affairBoard", affairBoardList);
bundleMap.put("resultBoard", resultService.getPrintTypeResultBoard(resultBoard, codeMap));
resultBoard = resultService.getPrintTypeResultBoard(resultBoard, codeMap);
List<ResultBoard> resultBoardList = new ArrayList<>();
resultBoardList.add(resultBoard);
bundleMap.put("resultBoard", resultBoardList);
return bundleMap;
}

View File

@ -13,7 +13,7 @@ import java.io.Serializable;
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "result_info")
@Table(name = "result_to_plan")
@IdClass(ResultToPlan.ResultToPlanId.class)
public class ResultToPlan {
@Id

View File

@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

View File

@ -1,10 +1,111 @@
$(document).on('click', '#printBtn', function (){
$(document).on('click', '#planPrintBtn', function (){
$.ajax({
url: '/affairPlan/planBoardJson',
type: 'GET',
data: {planKey: $(this).attr('data-plankey')},
dataType:"json",
success: function(data){
const plan = makePlanPrintData(data);
var url = $("#printUrl").attr("data-printurl")+"/singlePrint.jsp";
var title = "계획 보고서 인쇄";
var status = "width=900px,height=800px,scrollbars=yes";
window.open("", title, status);
const form = $("#printForm")[0];
form.target = title;
form.action = url;
form.crfName.value = "planBoard";
form.json.value = JSON.stringify(plan);
form.method = "post";
form.submit();
},
error:function(e){
ajaxErrorAction(e);
}
});
})
$(document).on('click', '#affairPrintBtn', function (){
// window.open(location.origin+"/affair/print?affairKey="+$(this).attr("data-affairkey"));
$.ajax({
url: '/affair/affairBoardJson',
type: 'GET',
data: {affairKey: $(this).attr('data-affairkey')},
dataType:"json",
success: function(data){
var url = $("#printUrl").attr("data-printurl")+"/singlePrint.jsp";
var title = "견문 보고서 인쇄";
var status = "width=900px,height=800px,scrollbars=yes";
window.open("", title, status);
const form = $("#printForm")[0];
form.target = title;
form.action = url;
form.crfName.value = "affairBoard";
form.json.value = JSON.stringify(data);
form.method = "post";
form.submit();
},
error:function(e){
ajaxErrorAction(e);
}
});
})
$(document).on('click', '#resultPrintBtn', function (){
$.ajax({
url: '/affairResult/resultBoardJson',
type: 'GET',
data: {resultKey: $(this).attr('data-resultkey')},
dataType:"json",
success: function(data){
data = makeResultPrintData(data);
var url = $("#printUrl").attr("data-printurl")+"/singlePrint.jsp";
var title = "청산 보고서 인쇄";
var status = "width=900px,height=800px,scrollbars=yes";
window.open("", title, status);
const form = $("#printForm")[0];
form.target = title;
form.action = url;
form.crfName.value = "resultBoard";
form.json.value = JSON.stringify(data);
form.method = "post";
form.submit();
},
error:function(e){
ajaxErrorAction(e);
}
});
})
$(document).on('click', '#bundlePrintBtn', function (){
$.ajax({
url: '/affairResult/resultBundleJson',
type: 'GET',
data: {resultKey: $(this).attr('data-resultkey')},
dataType:"json",
success: function(data){
for(let i=0; i<data.planBoard.length; i++){
data.planBoard[i] = makePlanPrintData(data.planBoard[i]);
}
data.resultBoard[0] = makeResultPrintData(data.resultBoard[0]);
var url = $("#printUrl").attr("data-printurl")+"/singlePrint.jsp";
var title = "청산 보고서 인쇄";
var status = "width=900px,height=800px,scrollbars=yes";
window.open("", title, status);
const form = $("#printForm")[0];
form.target = title;
form.action = url;
form.crfName.value = "bundle";
form.json.value = JSON.stringify(data);
form.method = "post";
form.submit();
},
error:function(e){
ajaxErrorAction(e);
}
});
})
function makePlanPrintData(data){
const plan = {};
plan.contentTitle = data.contentTitle;
plan.planDt = data.planDt;
@ -43,112 +144,16 @@ $(document).on('click', '#printBtn', function (){
fileList.push({origNm: data.fileList[i].origNm+"."+data.fileList[i].fileExtn});
}
plan.fileList = fileList;
var url = $("#printUrl").attr("data-printurl")+"/singlePrint.jsp";
var title = "계획 보고서 인쇄";
var status = "width=900px,height=800px,scrollbars=yes";
window.open("", title, status);
const form = $("#printForm")[0];
form.target = title;
form.action = url;
form.crfName.value = "planBoard";
form.json.value = JSON.stringify(plan);
form.method = "post";
form.submit();
},
error:function(e){
ajaxErrorAction(e);
return plan;
}
});
})
$(document).on('click', '#printBtn', function (){
// window.open(location.origin+"/affair/print?affairKey="+$(this).attr("data-affairkey"));
$.ajax({
url: '/affair/affairBoardJson',
type: 'GET',
data: {affairKey: $(this).attr('data-affairkey')},
dataType:"json",
success: function(data){
var url = $("#printUrl").attr("data-printurl")+"/singlePrint.jsp";
var title = "견문 보고서 인쇄";
var status = "width=900px,height=800px,scrollbars=yes";
window.open("", title, status);
const form = $("#printForm")[0];
form.target = title;
form.action = url;
form.crfName.value = "affairBoard";
form.json.value = JSON.stringify(data);
form.method = "post";
form.submit();
},
error:function(e){
ajaxErrorAction(e);
function makeResultPrintData(resultBoard){
resultBoard.planPrice = priceNumberToKorean(resultBoard.planPrice);
resultBoard.usePrice = priceNumberToKorean(resultBoard.usePrice);
for(let i=0; i<resultBoard.clearInfoList.length; i++){
resultBoard.clearInfoList[i].price = "₩ "+resultBoard.clearInfoList[i].price.toLocaleString('ko-KR')
}
});
})
$(document).on('click', '#printBtn', function (){
$.ajax({
url: '/affairResult/resultBoardJson',
type: 'GET',
data: {resultKey: $(this).attr('data-resultkey')},
dataType:"json",
success: function(data){
data.planPrice = priceNumberToKorean(data.planPrice);
data.usePrice = priceNumberToKorean(data.usePrice);
for(let i=0; i<data.clearInfoList.length; i++){
data.clearInfoList[i].price = "₩ "+data.clearInfoList[i].price.toLocaleString('ko-KR')
return resultBoard;
}
var url = $("#printUrl").attr("data-printurl")+"/singlePrint.jsp";
var title = "청산 보고서 인쇄";
var status = "width=900px,height=800px,scrollbars=yes";
window.open("", title, status);
const form = $("#printForm")[0];
form.target = title;
form.action = url;
form.crfName.value = "resultBoard";
form.json.value = JSON.stringify(data);
form.method = "post";
form.submit();
},
error:function(e){
ajaxErrorAction(e);
}
});
})
$(document).on('click', '#printBundleBtn', function (){
$.ajax({
url: '/affairResult/resultBundleJson',
type: 'GET',
data: {resultKey: $(this).attr('data-resultkey')},
dataType:"json",
success: function(data){
/*data.planPrice = priceNumberToKorean(data.planPrice);
data.usePrice = priceNumberToKorean(data.usePrice);
for(let i=0; i<data.clearInfoList.length; i++){
data.clearInfoList[i].price = "₩ "+data.clearInfoList[i].price.toLocaleString('ko-KR')
}*/
var url = $("#printUrl").attr("data-printurl")+"/singlePrint.jsp";
var title = "청산 보고서 인쇄";
var status = "width=900px,height=800px,scrollbars=yes";
window.open("", title, status);
const form = $("#printForm")[0];
form.target = title;
form.action = url;
form.crfName.value = "bundle";
form.json.value = JSON.stringify(data);
form.method = "post";
form.submit();
},
error:function(e){
ajaxErrorAction(e);
}
});
})
function priceNumberToKorean(price){
const koreanNumber = ['', '일','이','삼','사','오','육','칠','팔','구'];
const tenThousandUnit = ['', '만', '억', '조'];

View File

@ -4,7 +4,7 @@
layout:decorate="~{layout/layout}">
<th:block layout:fragment="script">
<script type="text/javascript" th:src="@{/js/igActivities/fpiMgt/affairMgt.js}"></script>
<script type="text/javascript" th:src="@{/js/igActivities/fpiMgt/print.js}"></script>
<script type="text/javascript" th:src="@{/js/igActivities/fpiMgt/fpiPrint.js}"></script>
</th:block>
<div layout:fragment="content">
<main>

View File

@ -335,7 +335,7 @@
<th:block th:if="${modalType ne 'viewOnly'}">
<div class="modal-footer bg-light">
<th:block th:if="${affair.affairStatus eq 'DST006'}">
<button type="button" class="btn btn-secondary" id="printBtn" th:data-affairkey="${affair.affairKey}">인쇄</button>
<button type="button" class="btn btn-secondary" id="affairPrintBtn" th:data-affairkey="${affair.affairKey}">인쇄</button>
</th:block>
<th:block th:if="${userOrgan eq 'OG001' and accessAuth eq 'ACC003'}">
<!--본청 관리자 상시 수정 허용-->

View File

@ -4,7 +4,7 @@
layout:decorate="~{layout/layout}">
<th:block layout:fragment="script">
<script type="text/javascript" th:src="@{/js/igActivities/fpiMgt/planMgt.js}"></script>
<script type="text/javascript" th:src="@{/js/igActivities/fpiMgt/print.js}"></script>
<script type="text/javascript" th:src="@{/js/igActivities/fpiMgt/fpiPrint.js}"></script>
</th:block>
<div layout:fragment="content">
<main>

View File

@ -166,7 +166,7 @@
<th:block th:if="${modalType ne 'viewOnly'}">
<div class="modal-footer bg-light">
<th:block th:if="${plan.planState eq 'DST006'}">
<button type="button" class="btn btn-secondary" id="printBtn" th:data-plankey="${plan.planKey}">인쇄</button>
<button type="button" class="btn btn-secondary" id="planPrintBtn" th:data-plankey="${plan.planKey}">인쇄</button>
</th:block>
<th:block th:unless="${plan.planState eq 'DST004' or plan.planState eq 'DST006'}"><!--승인 상태일때는 수정 불가-->
<th:block th:if="${userSeq eq plan.wrtUserSeq or accessAuth eq 'ACC003'}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용-->

View File

@ -4,7 +4,7 @@
layout:decorate="~{layout/layout}">
<th:block layout:fragment="script">
<script type="text/javascript" th:src="@{/js/igActivities/fpiMgt/resultMgt.js}"></script>
<script type="text/javascript" th:src="@{/js/igActivities/fpiMgt/print.js}"></script>
<script type="text/javascript" th:src="@{/js/igActivities/fpiMgt/fpiPrint.js}"></script>
</th:block>
<div layout:fragment="content">
<main>

View File

@ -298,8 +298,8 @@
</div>
<div class="modal-footer bg-light">
<th:block th:if="${result.resultState eq 'DST006'}">
<button type="button" class="btn btn-secondary" id="printBundleBtn" th:data-resultkey="${result.resultKey}">묶음인쇄</button>
<button type="button" class="btn btn-secondary" id="printBtn" th:data-resultkey="${result.resultKey}">개별인쇄</button>
<button type="button" class="btn btn-secondary" id="bundlePrintBtn" th:data-resultkey="${result.resultKey}">묶음인쇄</button>
<button type="button" class="btn btn-secondary" id="resultPrintBtn" th:data-resultkey="${result.resultKey}">개별인쇄</button>
</th:block>
<th:block th:unless="${result.resultState eq 'DST004' or result.resultState eq 'DST006'}"><!--승인 상태일때는 수정 불가-->
<th:block th:if="${userSeq eq result.wrtUserSeq or accessAuth eq 'ACC003'}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용-->