공지사항 페이지 작업완료

강석 최 2022-09-20 14:09:20 +09:00
parent 0b7ace50dc
commit b2c5178aa7
16 changed files with 167 additions and 71 deletions

View File

@ -62,7 +62,8 @@ public class BaseController {
}
public void setSession(@AuthenticationPrincipal UserInfo loginUser, HttpSession session){
loginUser.setOrganCdList(organConfigService.selectOrganListWhereUserOgCd(loginUser.getOgCd()));
loginUser.setDownOrganCdList(organConfigService.selectDownOrganListWhereUserOgCd(loginUser.getOgCd()));
loginUser.setUpOrganCdList(organConfigService.selectUpOrganListWhereUserOgCd(loginUser.getOgCd()));
session.setAttribute("menuList", menuMgtService.selectAccessMenuListWhereUserSeq(loginUser.getUserSeq()));
session.setAttribute("commonCode", codeMgtService.getCommonCode());
}

View File

@ -12,7 +12,9 @@ import java.util.List;
@NoArgsConstructor
public class BaseModel {
@Transient
private List<String> organCdList;
private List<String> upOrganCdList;
@Transient
private List<String> downOrganCdList;
@Transient
private Integer pageIndex=1; //요청페이지
@Transient

View File

@ -37,8 +37,8 @@ public class FpiMgtController { // 외사경찰견문관리
planBoard.setWrtUserSeq(loginUser.getUserSeq());
break;
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
planBoard.setOrganCdList(loginUser.getOrganCdList());
mav.addObject("mgtOrganList", loginUser.getOrganCdList());
planBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
break;
}
//결재권한 확인
@ -108,8 +108,8 @@ public class FpiMgtController { // 외사경찰견문관리
planBoard.setWrtOrgan(loginUser.getOgCd());
break;
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
planBoard.setOrganCdList(loginUser.getOrganCdList());
mav.addObject("mgtOrganList", loginUser.getOrganCdList());
planBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
break;
}
//결재권한 확인
@ -166,8 +166,8 @@ public class FpiMgtController { // 외사경찰견문관리
planBoard.setWrtOrgan(loginUser.getOgCd());
break;
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
planBoard.setOrganCdList(loginUser.getOrganCdList());
mav.addObject("mgtOrganList", loginUser.getOrganCdList());
planBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
break;
}
//결재권한 확인

View File

@ -7,5 +7,6 @@ import java.util.List;
@Mapper
public interface OrganConfigMapper {
List<String> selectOrganListWhereUserOgCd(String ogCd);
List<String> selectDownOrganListWhereUserOgCd(String ogCd);
List<String> selectUpOrganListWhereUserOgCd(String ogCd);
}

View File

@ -24,7 +24,12 @@ public class OrganConfigService {
return organConfigRepository.saveAll(organConfigList).size();
}
public List<String> selectOrganListWhereUserOgCd(String ogCd) {
return organConfigMapper.selectOrganListWhereUserOgCd(ogCd);
public List<String> selectDownOrganListWhereUserOgCd(String ogCd) {
return organConfigMapper.selectDownOrganListWhereUserOgCd(ogCd);
}
public List<String> selectUpOrganListWhereUserOgCd(String ogCd) {
List<String> upOrganList = organConfigMapper.selectUpOrganListWhereUserOgCd(ogCd);
upOrganList.add(ogCd);
return upOrganList;
}
}

View File

@ -27,9 +27,10 @@ public class PublicBoardController {
publicBoard.setQueryInfo();
publicBoard.setPublicType("PLB001");
if(loginUser.getUserRole().contains(Role.SUB_ADMIN.getValue())){
publicBoard.setOrganCdList(loginUser.getOrganCdList());
mav.addObject("mgtOrganList", loginUser.getOrganCdList());
publicBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
}
publicBoard.setUpOrganCdList(loginUser.getUpOrganCdList());
mav.addObject("noticeList", publicBoardService.selectContentList(publicBoard));
publicBoard.setContentCnt(publicBoardService.selectContentListCnt(publicBoard));
publicBoard.setPaginationInfo();
@ -94,18 +95,22 @@ public class PublicBoardController {
return publicBoardService.saveContent(publicBoard, deleteFileSeq);
}
@PostMapping("/saveComment")
public Integer saveComment(@AuthenticationPrincipal UserInfo loginUser, PublicComment comment){
public ModelAndView saveComment(@AuthenticationPrincipal UserInfo loginUser, PublicComment comment){
comment.setWrtOrgan(loginUser.getOgCd());
comment.setWrtPart(loginUser.getOfcCd());
comment.setWrtUserSeq(loginUser.getUserSeq());
comment.setWrtUserNm(loginUser.getUserNm());
comment.setWrtDt(LocalDateTime.now());
return publicBoardService.saveComment(comment);
publicBoardService.saveComment(comment);
ModelAndView mav = new ModelAndView("publicBoard/commentDiv");
mav.addObject("comment", comment);
mav.addObject("userSeq", loginUser.getUserSeq());
return mav;
}
@PostMapping("/deleteComment")
@ResponseBody
public void deleteComment(Integer publicKey, Integer commentKey){
publicBoardService.deleteComment(publicKey, commentKey);
public void deleteComment(@RequestBody PublicComment comment){
publicBoardService.deleteComment(comment.getPublicKey(), comment.getCommentKey());
}
}

View File

@ -39,7 +39,7 @@ public class TranslatorController {
Map<String, Object> params = new HashMap<>();
params.put("userSeq", loginUser.getUserSeq());
params.put("menuUrl", "/translator/info");
translator.setOrganCdList(organConfigService.selectOrganListWhereUserOgCd(loginUser.getOgCd()));
translator.setDownOrganCdList(loginUser.getDownOrganCdList());
//엑셀다운
if(translator.getExcel() != null && translator.getExcel().equals("Y")){
String[] headers = { "translator_key", "ogdp1", "tr_lang", "tr_career", "tr_name", "tr_age", "tr_nny", "tr_edu", "tr_cft", "dml_yn", "apt_dt", "tr_phone"};
@ -59,7 +59,7 @@ public class TranslatorController {
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(params).get(0).getAccessAuth();
mav.addObject("mgtOrganList", loginUser.getOrganCdList());
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
mav.addObject("accessAuth", accessAuth);
translator.setQueryInfo();
mav.addObject("translatorList", translatorSevice.selectTranslatorList(translator));

View File

@ -37,9 +37,9 @@
and a.wrt_dt &lt;= #{endDate}::date
</if>
</if>
<if test="organCdList != null">
<if test="downOrganCdList != null">
and a.wrt_organ in
<foreach collection="organCdList" item="organCd" separator="," open="(" close=")">
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
#{organCd}
</foreach>
</if>

View File

@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dbnt.faisp.organMgt.mapper.OrganConfigMapper">
<select id="selectOrganListWhereUserOgCd" resultType="string" parameterType="string">
<select id="selectDownOrganListWhereUserOgCd" resultType="string" parameterType="string">
with recursive organ_list (
organ_cd
) as(
@ -20,5 +20,22 @@
)
select * from organ_list
</select>
<select id="selectUpOrganListWhereUserOgCd" resultType="string" parameterType="string">
with recursive organ_list (
parent_organ
) as(
select
parent_organ
from organ_config
where organ_cd = #{ogCd}
union all
select
a.parent_organ
from organ_config a
inner join organ_list b on a.organ_cd = b.parent_organ
where a.parent_organ is not null
)
select * from organ_list
</select>
</mapper>

View File

@ -15,12 +15,23 @@
<if test='endDate != null and endDate != ""'>
and a.wrt_dt &lt;= #{endDate}::date
</if>
<if test="organCdList != null">
and a.wrt_organ in
<foreach collection="organCdList" item="organCd" separator="," open="(" close=")">
and a.public_key in (
<if test="downOrganCdList != null">
select public_key from public_board where wrt_organ in
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
#{organCd}
</foreach>
</if>
<if test="downOrganCdList != null and upOrganCdList != null">
union all
</if>
<if test="upOrganCdList != null">
select public_key from public_board where organ_chk = 'F' and wrt_organ in
<foreach collection="upOrganCdList" item="organCd" separator="," open="(" close=")">
#{organCd}
</foreach>
</if>
)
</where>
</sql>
<select id="selectContentList" resultType="PublicBoard" parameterType="PublicBoard">

View File

@ -33,7 +33,7 @@
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
where wrt_organ in
<foreach collection="organCdList" item="item" index="index" separator="," open="(" close=")">
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
<if test='trLang != null and trLang != ""'>
@ -91,7 +91,7 @@
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
where wrt_organ in
<foreach collection="organCdList" item="item" index="index" separator="," open="(" close=")">
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
<if test='trLang != null and trLang != ""'>
@ -286,7 +286,7 @@
left outer join code_mgt g on a.tr_edu = g.item_cd
left outer join code_mgt h on a.tr_visa = h.item_cd
where wrt_organ in
<foreach collection="organCdList" item="item" index="index" separator="," open="(" close=")">
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
<if test='trLang != null and trLang != ""'>

View File

@ -124,3 +124,21 @@ function setFileDiv(file, idx){
fileInfo += "</div>";
uploadDiv.append(fileInfo);
}
function fileCheck(flag, files){
let totalSize = 0;
for(const file of files) {
if(!file.isDelete){
totalSize+=file.size;
if(file.size>209715200){
alert("파일당 사이즈는 200MB을 넘길 수 없습니다.")
flag = false;
}
}
}
if(totalSize>524288000){
alert("첨부파일의 용량 합은 500MB를 넘길 수 없습니다.")
flag = false;
}
return flag;
}

View File

@ -126,19 +126,6 @@ function contentCheck(){
alert("시행일자를 입력해주세요.")
flag = false;
}
let totalSize = 0;
for(const file of files) {
if(!file.isDelete){
totalSize+=file.size;
if(file.size>209715200){
alert("파일당 사이즈는 200MB을 넘길 수 없습니다.")
flag = false;
}
}
}
if(totalSize>524288000){
alert("첨부파일의 용량 합은 500MB를 넘길 수 없습니다.")
flag = false;
}
flag = fileCheck(flag, files);
return flag;
}

View File

@ -11,10 +11,18 @@ $(document).on('click', '#commentSaveBtn', function (){
url : "/publicBoard/saveComment",
processData: false,
contentType: false,
dataType:"html",
beforeSend: function (xhr){
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
},
success : function(result) {
success : function(html) {
$("#commentDiv").append(html)
$("#comment").summernote('code', '')
const parentComment = $("#parentComment");
if(parentComment.val()){
parentComment.val('');
$("#commentFormHome").append($("#commentForm"))
}
alert("저장되었습니다.");
contentFade("out");
},
@ -34,16 +42,19 @@ $(document).on('click', '.childCommentBtn', function (){
childCommentDiv.empty().append($("#commentForm"))
})
$(document).on('click', '.deleteCommentBtn', function (){
const publicKey = $(this).parents(".commentRow").find(".publicKey");
const commentKey = $(this).parents(".commentRow").find(".commentKey");
const commentRow = $(this).parents(".commentRow");
const publicKey = Number(commentRow.find(".publicKey").val());
const commentKey = Number(commentRow.find(".commentKey").val());
$.ajax({
type : 'POST',
data : {publicKey: publicKey, commentKey: commentKey},
data : JSON.stringify({publicKey: publicKey, commentKey: commentKey}),
url : "/publicBoard/deleteComment",
contentType: 'application/json',
beforeSend: function (xhr){
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
},
success : function(result) {
commentRow.remove();
alert("삭제되었습니다.");
contentFade("out");
},
@ -132,7 +143,7 @@ function savePublicBoard(formId){
alert("저장되었습니다.");
contentFade("out");
$("#editModal").modal('hide');
getViewModal(result);
getViewModal(result, 'PLB001');
},
error : function(xhr, status) {
alert("저장에 실패하였습니다.")
@ -149,19 +160,6 @@ function contentCheck(formId){
alert("제목을 입력해주세요.")
flag = false;
}
let totalSize = 0;
for(const file of files) {
if(!file.isDelete){
totalSize+=file.size;
if(file.size>209715200){
alert("파일당 사이즈는 200MB을 넘길 수 없습니다.")
flag = false;
}
}
}
if(totalSize>524288000){
alert("첨부파일의 용량 합은 500MB를 넘길 수 없습니다.")
flag = false;
}
flag = fileCheck(flag, files);
return flag;
}

View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<th:block th:if="${comment.parentComment eq null}">
<div class="row justify-content-start commentRow">
<input type="hidden" class="publicKey" th:value="${comment.publicKey}">
<input type="hidden" class="commentKey" th:value="${comment.commentKey}">
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<div class="col-auto" th:if="${commonCode.itemCd eq comment.wrtOrgan}" th:text="${commonCode.itemValue}"></div>
</th:block>
<th:block th:each="commonCode:${session.commonCode.get('OFC')}">
<div class="col-auto" th:if="${commonCode.itemCd eq comment.wrtPart}" th:text="${commonCode.itemValue}"></div>
</th:block>
<div class="col-auto" th:text="${comment.wrtUserNm}"></div>
<div class="col-auto" th:text="|작성일시: ${#temporals.format(comment.wrtDt, 'yyyy-MM-dd HH:mm')}|"></div>
<div class="col-auto">
<button type="button" class="btn btn-sm btn-success childCommentBtn">댓글달기</button>
</div>
<div class="col-auto" th:if="${userSeq eq comment.wrtUserSeq}">
<button type="button" class="btn btn-sm btn-danger deleteCommentBtn">댓글삭제</button>
</div>
<div class="col-12" th:utext="${comment.comment}"></div>
<div class="col-12 childCommentDiv" style="display: none"></div>
<hr>
</div>
</th:block>
<th:block th:unless="${comment.parentComment eq null}">
<div class="row justify-content-start">
<div class="col-auto">
<i class="bi bi-arrow-return-right" ></i>
</div>
<div class="col-auto">
<div class="row justify-content-start commentRow">
<input type="hidden" class="publicKey" th:value="${comment.publicKey}">
<input type="hidden" class="commentKey" th:value="${comment.commentKey}">
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<div class="col-auto" th:if="${commonCode.itemCd eq comment.wrtOrgan}" th:text="${commonCode.itemValue}"></div>
</th:block>
<th:block th:each="commonCode:${session.commonCode.get('OFC')}">
<div class="col-auto" th:if="${commonCode.itemCd eq comment.wrtPart}" th:text="${commonCode.itemValue}"></div>
</th:block>
<div class="col-auto" th:text="${comment.wrtUserNm}"></div>
<div class="col-auto" th:text="|작성일시: ${#temporals.format(comment.wrtDt, 'yyyy-MM-dd HH:mm')}|"></div>
<div class="col-auto" th:if="${userSeq eq comment.wrtUserSeq}">
<button type="button" class="btn btn-sm btn-danger deleteCommentBtn">댓글삭제</button>
</div>
<div class="col-12" th:utext="${comment.comment}"></div>
</div>
</div>
<hr>
</div>
</th:block>

View File

@ -67,7 +67,7 @@
</div>
</div>
<hr>
<div class="col-12">
<div class="col-12" id="commentFormHome">
<form action="#" method="post" id="commentForm">
<div class="row">
<div class="col-11">
@ -81,7 +81,7 @@
</div>
</form>
</div>
<div class="col-12 pt-3" th:unless="${#lists.isEmpty(info.commentList)}">
<div class="col-12 pt-3" id="commentDiv">
<th:block th:each="comment:${info.commentList}">
<div class="row justify-content-start commentRow">
<input type="hidden" class="publicKey" th:value="${comment.publicKey}">
@ -89,7 +89,7 @@
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<div class="col-auto" th:if="${commonCode.itemCd eq comment.wrtOrgan}" th:text="${commonCode.itemValue}"></div>
</th:block>
<th:block th:each="commonCode:${session.commonCode.get('OFG')}">
<th:block th:each="commonCode:${session.commonCode.get('OFC')}">
<div class="col-auto" th:if="${commonCode.itemCd eq comment.wrtPart}" th:text="${commonCode.itemValue}"></div>
</th:block>
<div class="col-auto" th:text="${comment.wrtUserNm}"></div>
@ -111,17 +111,17 @@
</div>
<div class="col-auto">
<div class="row justify-content-start commentRow">
<input type="hidden" class="publicKey" th:value="${comment.publicKey}">
<input type="hidden" class="commentKey" th:value="${comment.commentKey}">
<input type="hidden" class="publicKey" th:value="${childComment.publicKey}">
<input type="hidden" class="commentKey" th:value="${childComment.commentKey}">
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<div class="col-auto" th:if="${commonCode.itemCd eq childComment.wrtOrgan}" th:text="${commonCode.itemValue}"></div>
</th:block>
<th:block th:each="commonCode:${session.commonCode.get('OFG')}">
<th:block th:each="commonCode:${session.commonCode.get('OFC')}">
<div class="col-auto" th:if="${commonCode.itemCd eq childComment.wrtPart}" th:text="${commonCode.itemValue}"></div>
</th:block>
<div class="col-auto" th:text="${childComment.wrtUserNm}"></div>
<div class="col-auto" th:text="|작성일시: ${#temporals.format(childComment.wrtDt, 'yyyy-MM-dd HH:mm')}|"></div>
<div class="col-auto" th:if="${userSeq eq comment.wrtUserSeq}">
<div class="col-auto" th:if="${userSeq eq childComment.wrtUserSeq}">
<button type="button" class="btn btn-sm btn-danger deleteCommentBtn">댓글삭제</button>
</div>
<div class="col-12" th:utext="${childComment.comment}"></div>