월간계획 리포팅툴 기능 추가.

master
강석 최 2023-03-16 18:52:42 +09:00
parent b231f439a0
commit 57a806f094
12 changed files with 1147 additions and 1053 deletions

View File

@ -17,6 +17,7 @@ import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
import com.dbnt.faisp.main.userInfo.service.UserAlarmService; import com.dbnt.faisp.main.userInfo.service.UserAlarmService;
import com.dbnt.faisp.main.userInfo.service.UserInfoService; import com.dbnt.faisp.main.userInfo.service.UserInfoService;
import com.dbnt.faisp.util.Utils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -131,22 +132,11 @@ public class BaseController {
session.setAttribute("userSeq", loginUser.getUserSeq()); session.setAttribute("userSeq", loginUser.getUserSeq());
session.setAttribute("userOrgan", loginUser.getOgCd()); session.setAttribute("userOrgan", loginUser.getOgCd());
String belongValue = ""; String belongValue = "";
belongValue += searchCodeValue(loginUser.getOgCd(), codeMap.get("OG")); belongValue += Utils.searchCodeValue(loginUser.getOgCd(), codeMap.get("OG"));
belongValue += searchCodeValue(loginUser.getOfcCd(), codeMap.get(loginUser.getOgCd())); belongValue += Utils.searchCodeValue(loginUser.getOfcCd(), codeMap.get(loginUser.getOgCd()));
belongValue += searchCodeValue(loginUser.getTitleCd(), codeMap.get("JT")); belongValue += Utils.searchCodeValue(loginUser.getTitleCd(), codeMap.get("JT"));
belongValue += loginUser.getUserNm()+"("+loginUser.getUserId()+")"; belongValue += loginUser.getUserNm()+"("+loginUser.getUserId()+")";
session.setAttribute("belongValue", belongValue); session.setAttribute("belongValue", belongValue);
} }
private String searchCodeValue(String itemCd, List<CodeMgt> codeList){
if(itemCd==null){
return "";
}else{
for(CodeMgt code: codeList){
if(itemCd.equals(code.getItemCd())){
return code.getItemValue()+" ";
}
}
}
return "";
}
} }

View File

@ -1,18 +1,22 @@
package com.dbnt.faisp.main.fpiMgt.affairPlan; package com.dbnt.faisp.main.fpiMgt.affairPlan;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService; import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.codeMgt.model.CodeMgt;
import com.dbnt.faisp.main.fpiMgt.affairPlan.model.PlanApprv; import com.dbnt.faisp.main.fpiMgt.affairPlan.model.PlanApprv;
import com.dbnt.faisp.main.fpiMgt.affairPlan.model.PlanBoard; import com.dbnt.faisp.main.fpiMgt.affairPlan.model.PlanBoard;
import com.dbnt.faisp.main.fpiMgt.affairPlan.service.PlanService; import com.dbnt.faisp.main.fpiMgt.affairPlan.service.PlanService;
import com.dbnt.faisp.main.userInfo.model.UserInfo; import com.dbnt.faisp.main.userInfo.model.UserInfo;
import com.dbnt.faisp.util.Utils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpSession;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@ -176,6 +180,7 @@ public class PlanController { // 첩보수집활동 > 외사경찰 견문관리
planBoard = planService.selectPlanBoard(planBoard.getPlanKey()); planBoard = planService.selectPlanBoard(planBoard.getPlanKey());
mav.addObject("plan", planBoard); mav.addObject("plan", planBoard);
mav.addObject("userSeq",loginUser.getUserSeq()); mav.addObject("userSeq",loginUser.getUserSeq());
mav.addObject("lineSeparator", '\n');
//메뉴권한 확인 //메뉴권한 확인
mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getAccessAuth()); mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getAccessAuth());
mav.addObject("apprvAuth", authMgtService.selectApprovalConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getApprovalAuth()); mav.addObject("apprvAuth", authMgtService.selectApprovalConfigList(loginUser.getUserSeq(), "/affairPlan/planMgt").get(0).getApprovalAuth());
@ -201,4 +206,14 @@ public class PlanController { // 첩보수집활동 > 외사경찰 견문관리
apprv.setSaveDt(LocalDateTime.now()); apprv.setSaveDt(LocalDateTime.now());
return planService.planStateChange(apprv); return planService.planStateChange(apprv);
} }
@GetMapping("/planBoardJson")
public PlanBoard planBoardJson(PlanBoard planBoard, HttpSession session){
planBoard = planService.selectPlanBoard(planBoard.getPlanKey());
Map<String, List<CodeMgt>> codeMap = (Map<String, List<CodeMgt>>) session.getAttribute("commonCode");
planBoard.setWrtPart(Utils.searchCodeValue(planBoard.getWrtPart(), codeMap.get(planBoard.getWrtOrgan())));
planBoard.setWrtOrgan(Utils.searchCodeValue(planBoard.getWrtOrgan(), codeMap.get("OG")));
planBoard.setWrtUserGrd(Utils.searchCodeValue(planBoard.getWrtUserGrd(), codeMap.get("JT")));
return planBoard;
}
} }

View File

@ -1083,4 +1083,16 @@ public class Utils {
return ip; return ip;
} }
public static String searchCodeValue(String itemCd, List<CodeMgt> codeList){
if(itemCd==null){
return "";
}else{
for(CodeMgt code: codeList){
if(itemCd.equals(code.getItemCd())){
return code.getItemValue()+" ";
}
}
}
return "";
}
} }

View File

@ -9,6 +9,7 @@ spring.servlet.multipart.max-file-size=200MB
spring.servlet.multipart.max-request-size=500MB spring.servlet.multipart.max-request-size=500MB
site.domain=http://localhost:8080 site.domain=http://localhost:8080
clipReport.print.url=http://118.219.150.34:50570/ClipReport5
#file #file
file.dir.publicBoard=/publicBoard file.dir.publicBoard=/publicBoard

View File

@ -18,6 +18,7 @@ spring.servlet.multipart.max-file-size=200MB
spring.servlet.multipart.max-request-size=500MB spring.servlet.multipart.max-request-size=500MB
site.domain=http://118.219.150.34:50580 site.domain=http://118.219.150.34:50580
clipReport.print.url=http://118.219.150.34:50570/ClipReport5
#file #file
file.dir.publicBoard=/publicBoard file.dir.publicBoard=/publicBoard

View File

@ -18,6 +18,7 @@ spring.servlet.multipart.max-file-size=200MB
spring.servlet.multipart.max-request-size=500MB spring.servlet.multipart.max-request-size=500MB
site.domain=http://118.219.150.34:50580 site.domain=http://118.219.150.34:50580
clipReport.print.url=http://118.219.150.34:50570/ClipReport5
#file #file
file.dir.publicBoard=/publicBoard file.dir.publicBoard=/publicBoard

View File

@ -14,6 +14,7 @@ spring.servlet.multipart.max-file-size=200MB
spring.servlet.multipart.max-request-size=500MB spring.servlet.multipart.max-request-size=500MB
site.domain=10.187.58.12 site.domain=10.187.58.12
clipReport.print.url=http://118.219.150.34:50570/ClipReport5
#file #file
file.dir.publicBoard=/publicBoard file.dir.publicBoard=/publicBoard

View File

@ -14,6 +14,7 @@ spring.servlet.multipart.max-file-size=200MB
spring.servlet.multipart.max-request-size=500MB spring.servlet.multipart.max-request-size=500MB
site.domain=10.187.58.12 site.domain=10.187.58.12
clipReport.print.url=http://118.219.150.34:50570/ClipReport5
#file #file
file.dir.publicBoard=/publicBoard file.dir.publicBoard=/publicBoard

View File

@ -40,8 +40,8 @@ $(document).on('click', '#planAddBtn', function (){
$(document).on('click', '#detailPlanAddBtn', function (){ $(document).on('click', '#detailPlanAddBtn', function (){
const detailPlanDiv = $("#detailPlanDiv"); const detailPlanDiv = $("#detailPlanDiv");
detailPlanDiv.append("<textarea type='text' name='detailPlanInfos'></textarea>"); detailPlanDiv.append("<textarea type='text' class='form-control' name='detailPlanInfos'></textarea>");
const lastAppendTextarea = detailPlanDiv.children()[detailPlanDiv.children().length-1]; /*const lastAppendTextarea = detailPlanDiv.children()[detailPlanDiv.children().length-1];
$(lastAppendTextarea).summernote({ $(lastAppendTextarea).summernote({
lang:'ko-KR', lang:'ko-KR',
height: 120, height: 120,
@ -53,7 +53,7 @@ $(document).on('click', '#detailPlanAddBtn', function (){
['para', ['ul', 'ol', 'paragraph']], ['para', ['ul', 'ol', 'paragraph']],
['table', ['table']] ['table', ['table']]
] ]
}); });*/
}) })
$(document).on('click', '#savePlanBtn', function (){ $(document).on('click', '#savePlanBtn', function (){
@ -101,6 +101,74 @@ $(document).on('click', '.apprvBtn', function (){
} }
}) })
$(document).on('click', '#printBtn', function (){
$.ajax({
url: '/affairPlan/planBoardJson',
type: 'GET',
data: {planKey: $(this).attr('data-plankey')},
dataType:"json",
success: function(data){
const plan = {};
plan.contentTitle = data.contentTitle;
plan.planDt = data.planDt;
plan.wrtOrgan = data.wrtOrgan;
plan.wrtPart = data.wrtPart;
plan.wrtUserGrd = data.wrtUserGrd;
plan.wrtUserNm = data.wrtUserNm;
for(let i=0; i<data.apprvList.length; i++){
const apprv = data.apprvList[i];
switch (apprv.state) {
case "DST003":
plan.sectionApprv = apprv.userNm+"(반려)"
break;
case "DST004":
plan.sectionApprv = apprv.userNm
break;
case "DST005":
plan.headApprv = apprv.userNm+"(반려)"
break;
case "DST006":
plan.headApprv = apprv.userNm
break;
}
}
const planInfoSummery = [];
const planInfoDetail = [];
for(let i=0; i<data.mainInfoList.length; i++){
const info = data.mainInfoList[i];
if(info.planType === "S"){
planInfoSummery.push({planInfo: info.planInfo})
}else if(info.planType === "D"){
planInfoDetail.push({planInfo: info.planInfo})
}
}
plan.planInfoSummery = planInfoSummery;
plan.planInfoDetail = planInfoDetail;
const fileList = [];
for(let i=0; i<data.fileList.length; i++){
fileList.push({origNm: data.fileList[i].origNm+"."+data.fileList[i].fileExtn});
}
plan.fileList = fileList;
var url = $("#printUrl").attr("data-printurl")+"/planBoard.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.plan.value = JSON.stringify(plan);
/*form.plan = '{"contentTitle":"2023년 3월 계획보고서 수정3","planDt":"2023-03-01","wrtOrgan":"서해청 ","wrtPart":"","wrtUserGrd":"경위 ","wrtUserNm":"사용자002","planInfoSummery":[{"planInfo":"계획1"},{"planInfo":"계획2"}],"planInfoDetail":[{"planInfo":"계획1\\r\\n - ㅁㄴㅇㄻㄴㅇㄻㄴㅇㄻㄴㅇㄻㄴㅇㄹ\\r\\n - ㅁㄴㅇㄻㄴㅇㄻㄴㄹㅇ\\r\\n - ㅁㄴㅇㄻㄴㅇㄹ"},{"planInfo":"계획2\\r\\n - ㅂㅈㄷㄱㅂㅈㄷㄱㅂㅈㄷㄱ\\r\\n - ㅂㅈㄷㄱㅂㅈㄷㄱㅂㅈㄷㄱ\\r\\n - ㅂㅈㄷㄱㅂㅈㄷㄱ\\r\\n - ㅂㅈㄷㄱ\\r\\n - ㅂㅈㄷㄱ"}],"fileList":[{"origNm":"IMG_20211114_134753"},{"origNm":"IMG_20211114_144306"},{"origNm":"IMG_20211114_144707"}]}'*/
form.method = "post";
form.submit();
},
error:function(e){
ajaxErrorAction(e);
}
});
})
function getPlanViewModal(planKey){ function getPlanViewModal(planKey){
$.ajax({ $.ajax({
url: '/affairPlan/planViewModal', url: '/affairPlan/planViewModal',
@ -131,7 +199,7 @@ function getPlanEditModal(planKey){
language: "ko", language: "ko",
autoclose: true autoclose: true
}); });
$("[name='detailPlanInfos']").summernote({ /*$("[name='detailPlanInfos']").summernote({
lang:'ko-KR', lang:'ko-KR',
height: 120, height: 120,
disableDragAndDrop: true, disableDragAndDrop: true,
@ -142,7 +210,7 @@ function getPlanEditModal(planKey){
['para', ['ul', 'ol', 'paragraph']], ['para', ['ul', 'ol', 'paragraph']],
['table', ['table']] ['table', ['table']]
] ]
}); });*/
setUploadDiv(); setUploadDiv();
}, },
error:function(e){ error:function(e){

View File

@ -54,11 +54,11 @@
<label for="detailPlanDiv" class="col-sm-2 col-form-label col-form-label-sm text-center">사업개요 및 추진계획</label> <label for="detailPlanDiv" class="col-sm-2 col-form-label col-form-label-sm text-center">사업개요 및 추진계획</label>
<div class="col-sm-10" id="detailPlanDiv"> <div class="col-sm-10" id="detailPlanDiv">
<th:block th:if="${plan.planKey eq null}"> <th:block th:if="${plan.planKey eq null}">
<textarea type='text' name='detailPlanInfos'></textarea> <textarea type='text' class="form-control" name='detailPlanInfos'></textarea>
</th:block> </th:block>
<th:block th:each="infoList:${plan.mainInfoList}"> <th:block th:each="infoList:${plan.mainInfoList}">
<th:block th:if="${infoList.planType eq 'D'}"> <th:block th:if="${infoList.planType eq 'D'}">
<textarea type='text' name='detailPlanInfos' th:utext="${infoList.planInfo}"></textarea> <textarea type='text' class="form-control" name='detailPlanInfos' th:utext="${infoList.planInfo}"></textarea>
</th:block> </th:block>
</th:block> </th:block>
</div> </div>

View File

@ -40,8 +40,7 @@
<div class="row mb-1"> <div class="row mb-1">
<label for="contentTitle" class="col-sm-2 col-form-label-sm text-center">제목</label> <label for="contentTitle" class="col-sm-2 col-form-label-sm text-center">제목</label>
<div class="col-sm-10 form-control-sm"> <div class="col-sm-10 form-control-sm">
<input type="text" class="form-control-sm border-0" id="contentTitle" name="contentTitle" <input type="text" class="form-control-sm border-0" id="contentTitle" name="contentTitle" th:value="${plan.contentTitle}" readonly>
th:value="${plan.contentTitle}" readonly>
</div> </div>
</div> </div>
<hr> <hr>
@ -50,8 +49,7 @@
<div class="col-sm-10 form-control-sm" id="planDiv"> <div class="col-sm-10 form-control-sm" id="planDiv">
<th:block th:each="infoList:${plan.mainInfoList}"> <th:block th:each="infoList:${plan.mainInfoList}">
<th:block th:if="${infoList.planType eq 'S'}"> <th:block th:if="${infoList.planType eq 'S'}">
<input type="text" class="form-control-sm border-0" name="planInfo" th:value="${infoList.planInfo}" <div th:text="${infoList.planInfo}"></div>
readonly>
</th:block> </th:block>
</th:block> </th:block>
</div> </div>
@ -62,7 +60,7 @@
<div class="col-sm-10 form-control-sm" id="detailPlanDiv"> <div class="col-sm-10 form-control-sm" id="detailPlanDiv">
<th:block th:each="infoList:${plan.mainInfoList}"> <th:block th:each="infoList:${plan.mainInfoList}">
<th:block th:if="${infoList.planType eq 'D'}"> <th:block th:if="${infoList.planType eq 'D'}">
<div th:utext="${infoList.planInfo}"></div> <div th:utext="${#strings.replace(infoList.planInfo, lineSeparator, '<br>')}"></div>
</th:block> </th:block>
</th:block> </th:block>
</div> </div>
@ -166,6 +164,12 @@
</div> </div>
</div> </div>
<div class="modal-footer bg-light"> <div class="modal-footer bg-light">
<div class="d-none">
<form id="printForm">
<input type="hidden" name="plan">
</form>
</div>
<button type="button" class="btn btn-secondary" id="printBtn" th:data-plankey="${plan.planKey}">인쇄</button>
<th:block th:unless="${plan.planState eq 'DST004' or plan.planState eq 'DST006'}"><!--승인 상태일때는 수정 불가--> <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'}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용--> <th:block th:if="${userSeq eq plan.wrtUserSeq or accessAuth eq 'ACC003'}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용-->
<button type="button" class="btn btn-warning" id="editPlanBtn">수정</button> <button type="button" class="btn btn-warning" id="editPlanBtn">수정</button>

View File

@ -17,8 +17,8 @@
<link rel="stylesheet" th:href="@{/vendor/datetimepicker/css/datetimepicker.css}"> <link rel="stylesheet" th:href="@{/vendor/datetimepicker/css/datetimepicker.css}">
<!--summernote--> <!--summernote-->
<link rel="stylesheet" th:href="@{/vendor/summernote-0.8.18-dist/summernote-lite.min.css}"> <link rel="stylesheet" th:href="@{/vendor/summernote-0.8.18-dist/summernote-lite.min.css}">
<link rel="stylesheet" th:href="@{/css/common.css}"> <link rel="stylesheet" th:href="@{/css/common.css}">
<link id="printUrl" th:data-printurl="${@environment.getProperty('clipReport.print.url')}">
<!-- 컨텐츠페이지의 CSS 영역이 들어감 --> <!-- 컨텐츠페이지의 CSS 영역이 들어감 -->
<th:block layout:fragment="css"></th:block> <th:block layout:fragment="css"></th:block>