diff --git a/src/main/java/nlib/bbs/service/ArticleVO.java b/src/main/java/nlib/bbs/service/ArticleVO.java index bdc5cd13..dd82b9f7 100644 --- a/src/main/java/nlib/bbs/service/ArticleVO.java +++ b/src/main/java/nlib/bbs/service/ArticleVO.java @@ -1,384 +1,395 @@ -package nlib.bbs.service; - -import java.util.List; -import org.apache.commons.lang.StringEscapeUtils; -import com.fasterxml.jackson.annotation.JsonIgnore; -import nlib.cmm.service.PagingVO; -import nlib.util.StringUtil; - -/** - *
- * @Class Name : ArticleVO.java
- * 
- * @Description : 게시물 공통 VO
- * 
- * 
- * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
- *
- * 
- * - * @ ------------ -------- --------------------------- - * @ 수정일 수정자 수정내용 - * @ ------------ -------- --------------------------- - * @ 2021. 09. 13. KNKIM 최초 생성 - * - * - * @author 이씨플라자 * DIGITALSHIP KNKIM - * @since 2021. 09. 13. - * @version 1.0 - * - */ -public class ArticleVO extends PagingVO { - - private String articleId; /* 게시글ID */ - private String mngOrgCd; /* 관리문화원코드 */ - private String mngOrgNm; /* 관리문화원명 */ - @JsonIgnore - private String bdType; /* 게시판유형 */ - @JsonIgnore - private String bdTypeName; /* 게시판유형명 */ - private String title; /* 제목 */ - private String content; /* 내용 */ - - // 공지사항관련 - private String notiYn; /* 공지여부 */ - private String openYn; /* 공개여부 */ - @JsonIgnore - private String postStartDate; /* 게시시작일자 */ - @JsonIgnore - private String postEndDate; /* 게시종료일자 */ - - // FAQ, QNA관련 - private String answer; /* 답변 */ - private String answerYn; /* 답변여부 */ - @JsonIgnore - private String useYn; /* 사용여부 */ - private String questionType; /* 질문유형 */ - private String questionTypeName; /* 질문유형명 */ - private String secretYn; /* 비밀글여부 */ - private String emailRecvYn; /* 답변이미엘수신여부 */ - private String email; /* 이메일 */ - private int viewCnt; /* 조회수 */ - private String bdAttachFileId; /* 첨부파일아이디 */ - private String attachYn; /* 첨부파일존재여부 */ - private List attachFiles; /* 첨부파일목록 */ - private List removedAttachFiles; /* 삭제첨부파일목록 */ - - @JsonIgnore - private String regId; /* 등록자아이디 */ - private String regNm; /* 등록자명 */ - private String regDd; /* 등록일자 */ - @JsonIgnore - private String modId; /* 등록자아이디 */ - private String modDd; /* 등록일자 */ - private int rno; /* 글번호 */ - @JsonIgnore - private String loginedMbInfoId; /* 로그인 사용자 ID */ - private String loginedName; /* 로그인 사용자명 */ - private String myQnaYn; /* 내가한 질문인지 여부 */ - - // 검색관련 - private String searchType; /* 검색대상구분 */ - private String searchKeyword; /* 검색어 */ - private String searchQuestionType; /* 검색FAQ유형 */ - @JsonIgnore - private String searchMbInfoId; /* 로그인한 사용자ID */ - - // 처리결과 관련 - private String resultMessage = null; /* 처리결과메시지 */ - private String resultCode = null; /* 처리결과코드 */ - - public int getAttachFileCnt() { - if(attachFiles == null) return 0; - return attachFiles.size(); - } - - public String getUnescapedContent() { - return StringEscapeUtils.unescapeHtml(content); - } - - // SETTER & GETTER - public String getArticleId() { - return articleId; - } - public void setArticleId(String articleId) { - // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리 - this.articleId = StringUtil.getValidCodeString(articleId); - } - public String getMngOrgCd() { - return mngOrgCd; - } - public void setMngOrgCd(String mngOrgCd) { - // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리 - this.mngOrgCd = StringUtil.getValidCodeString(mngOrgCd); - } - public String getBdType() { - return bdType; - } - public void setBdType(String bdType) { - this.bdType = bdType; - } - public String getUnescapeTitle() { - return StringEscapeUtils.unescapeHtml(title); - } - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - public String getContent() { - return content; - } - public void setContent(String content) { - this.content = content; - } - public String getNotiYn() { - return notiYn; - } - public void setNotiYn(String notiYn) { - this.notiYn = notiYn; - } - public String getOpenYn() { - return openYn; - } - public void setOpenYn(String openYn) { - this.openYn = openYn; - } - public String getPostStartDate() { - return postStartDate; - } - public void setPostStartDate(String postStartDate) { - this.postStartDate = postStartDate; - } - public String getPostEndDate() { - return postEndDate; - } - public void setPostEndDate(String postEndDate) { - this.postEndDate = postEndDate; - } - public int getViewCnt() { - return viewCnt; - } - public void setViewCnt(int viewCnt) { - this.viewCnt = viewCnt; - } - public String getBdAttachFileId() { - return bdAttachFileId; - } - public void setBdAttachFileId(String bdAttachFileId) { - this.bdAttachFileId = bdAttachFileId; - } - public String getRegId() { - return regId; - } - public void setRegId(String regId) { - this.regId = regId; - } - public String getRegDd() { - return regDd; - } - public void setRegDd(String regDd) { - this.regDd = regDd; - } - public String getModId() { - return modId; - } - public void setModId(String modId) { - this.modId = modId; - } - public String getModDd() { - return modDd; - } - public void setModDd(String modDd) { - this.modDd = modDd; - } - public String getRegNm() { - return regNm; - } - public String getRegNmSec() { - if(StringUtil.isEmpty(regNm)) return null; - return StringUtil.maskName(regNm); - } - public void setRegNm(String regNm) { - this.regNm = regNm; - } - public int getRno() { - return rno; - } - public void setRno(int rno) { - this.rno = rno; - } - public String getSearchType() { - return searchType; - } - public void setSearchType(String searchType) { - this.searchType = searchType; - } - public String getSearchKeyword() { - return searchKeyword; - } - public String getEscapeSearchKeyword() { - return StringUtil.getSqlSearchKeyword(searchKeyword); - } - public void setSearchKeyword(String searchKeyword) { - this.searchKeyword = searchKeyword; - } - public String getAttachYn() { - return attachYn; - } - public void setAttachYn(String attachYn) { - this.attachYn = attachYn; - } - public String getMngOrgNm() { - return mngOrgNm; - } - public void setMngOrgNm(String mngOrgNm) { - this.mngOrgNm = mngOrgNm; - } - public String getBdTypeName() { - return bdTypeName; - } - public void setBdTypeName(String bdTypeName) { - this.bdTypeName = bdTypeName; - } - public List getAttachFiles() { - return attachFiles; - } - public void setAttachFiles(List attachFiles) { - if(attachFiles == null || attachFiles.size() < 1) this.attachFiles = null; - this.attachFiles = attachFiles; - } - - public String getAnswerYn() { - return StringUtil.isEmpty(answerYn) ? "N" : answerYn; - } - - public void setAnswerYn(String answerYn) { - this.answerYn = answerYn; - } - - public String getUseYn() { - return useYn; - } - - public void setUseYn(String useYn) { - this.useYn = useYn; - } - - public String getQuestionType() { - return questionType; - } - - public void setQuestionType(String questionType) { - this.questionType = questionType; - } - - public String getQuestionTypeName() { - return questionTypeName; - } - - public void setQuestionTypeName(String questionTypeName) { - this.questionTypeName = questionTypeName; - } - - public String getAnswer() { - return answer; - } - - public void setAnswer(String answer) { - this.answer = answer; - } - - public String getSearchQuestionType() { - return searchQuestionType; - } - - public void setSearchQuestionType(String searchQuestionType) { - this.searchQuestionType = searchQuestionType; - } - - public String getSearchMbInfoId() { - return searchMbInfoId; - } - - public void setSearchMbInfoId(String searchMbInfoId) { - // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리 - this.searchMbInfoId = StringUtil.getValidCodeString(searchMbInfoId); - } - - public String getSecretYn() { - return secretYn; - } - - public void setSecretYn(String secretYn) { - this.secretYn = secretYn; - } - - public String getLoginedMbInfoId() { - return loginedMbInfoId; - } - - public void setLoginedMbInfoId(String loginedMbInfoId) { - // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리 - this.loginedMbInfoId = StringUtil.getValidCodeString(loginedMbInfoId); - } - - public String getMyQnaYn() { - return StringUtil.isEmpty(myQnaYn) ? "N" : myQnaYn; - } - - public void setMyQnaYn(String myQnaYn) { - this.myQnaYn = myQnaYn; - } - - public String getLoginedName() { - return loginedName; - } - - public void setLoginedName(String loginedName) { - this.loginedName = loginedName; - } - - public String getEmailRecvYn() { - return StringUtil.isEmpty(emailRecvYn) ? "N" : emailRecvYn; - } - - public void setEmailRecvYn(String emailRecvYn) { - this.emailRecvYn = emailRecvYn; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getResultMessage() { - return resultMessage; - } - - public void setResultMessage(String resultMessage) { - this.resultMessage = resultMessage; - } - - public String getResultCode() { - return resultCode; - } - - public void setResultCode(String resultCode) { - this.resultCode = resultCode; - } - - public List getRemovedAttachFiles() { - return removedAttachFiles; - } - - public void setRemovedAttachFiles(List removedAttachFiles) { - this.removedAttachFiles = removedAttachFiles; - } - -} +package nlib.bbs.service; + +import java.util.List; +import org.apache.commons.lang.StringEscapeUtils; +import com.fasterxml.jackson.annotation.JsonIgnore; +import nlib.cmm.service.PagingVO; +import nlib.util.StringUtil; + +/** + *
+ * @Class Name : ArticleVO.java
+ * 
+ * @Description : 게시물 공통 VO
+ * 
+ * 
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ * 
+ * + * @ ------------ -------- --------------------------- + * @ 수정일 수정자 수정내용 + * @ ------------ -------- --------------------------- + * @ 2021. 09. 13. KNKIM 최초 생성 + * + * + * @author 이씨플라자 * DIGITALSHIP KNKIM + * @since 2021. 09. 13. + * @version 1.0 + * + */ +public class ArticleVO extends PagingVO { + + private String articleId; /* 게시글ID */ + private String mngOrgCd; /* 관리문화원코드 */ + private String mngOrgNm; /* 관리문화원명 */ + @JsonIgnore + private String bdType; /* 게시판유형 */ + @JsonIgnore + private String bdTypeName; /* 게시판유형명 */ + private String title; /* 제목 */ + private String content; /* 내용 */ + + // 공지사항관련 + private String notiYn; /* 공지여부 */ + private String openYn; /* 공개여부 */ + @JsonIgnore + private String postStartDate; /* 게시시작일자 */ + @JsonIgnore + private String postEndDate; /* 게시종료일자 */ + + // FAQ, QNA관련 + private String answer; /* 답변 */ + private String answerYn; /* 답변여부 */ + @JsonIgnore + private String useYn; /* 사용여부 */ + private String questionType; /* 질문유형 */ + private String questionTypeName; /* 질문유형명 */ + private String secretYn; /* 비밀글여부 */ + private String emailRecvYn; /* 답변이미엘수신여부 */ + private String email; /* 이메일 */ + private int viewCnt; /* 조회수 */ + private String bdAttachFileId; /* 첨부파일아이디 */ + private String attachYn; /* 첨부파일존재여부 */ + private List attachFiles; /* 첨부파일목록 */ + private List removedAttachFiles; /* 삭제첨부파일목록 */ + + @JsonIgnore + private String regId; /* 등록자아이디 */ + private String regNm; /* 등록자명 */ + private String regDd; /* 등록일자 */ + @JsonIgnore + private String modId; /* 등록자아이디 */ + private String modDd; /* 등록일자 */ + private int rno; /* 글번호 */ + @JsonIgnore + private String loginedMbInfoId; /* 로그인 사용자 ID */ + private String loginedName; /* 로그인 사용자명 */ + private String myQnaYn; /* 내가한 질문인지 여부 */ + + // 검색관련 + private String searchType; /* 검색대상구분 */ + private String searchKeyword; /* 검색어 */ + private String searchQuestionType; /* 검색FAQ유형 */ + @JsonIgnore + private String searchMbInfoId; /* 로그인한 사용자ID */ + + // 처리결과 관련 + private String resultMessage = null; /* 처리결과메시지 */ + private String resultCode = null; /* 처리결과코드 */ + + public int getAttachFileCnt() { + if(attachFiles == null) return 0; + return attachFiles.size(); + } + + public String getSanitizedContent() { + return StringUtil.sanitizeHtml(content); + } + + // SETTER & GETTER + public String getArticleId() { + return articleId; + } + public void setArticleId(String articleId) { + // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리 + this.articleId = StringUtil.getValidCodeString(articleId); + } + public String getMngOrgCd() { + return mngOrgCd; + } + public void setMngOrgCd(String mngOrgCd) { + // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리 + this.mngOrgCd = StringUtil.getValidCodeString(mngOrgCd); + } + public String getBdType() { + return bdType; + } + public void setBdType(String bdType) { + this.bdType = bdType; + } + public String getUnescapeTitle() { + return StringEscapeUtils.unescapeHtml(title); + } + public String getTitle() { + return title; + } + + public void setTitle(String title) { + + /* + * 통합자료관관리시스템과 동일하게 게시글 저장 처리를 수행하며, + * 제목의 경우, DB에 일부 특수문자에 대하여 치환되어 저장되고, + * 내용의 경우, HTML 요청된 그대로 저장하되 표출할 때 HTML Sanitizing하여 표출토록 처리하기로 협의됨에 따라 + * 제목 설정시 치환되어 저장토록 함 (2021.12.21, 이규모차장님) + */ + this.title = StringUtil.getRemovedQuotesStr(title); + } + public String getContent() { + return content; + } + public void setContent(String content) { + this.content = content; + } + public String getNotiYn() { + return notiYn; + } + public void setNotiYn(String notiYn) { + this.notiYn = notiYn; + } + public String getOpenYn() { + return openYn; + } + public void setOpenYn(String openYn) { + this.openYn = openYn; + } + public String getPostStartDate() { + return postStartDate; + } + public void setPostStartDate(String postStartDate) { + this.postStartDate = postStartDate; + } + public String getPostEndDate() { + return postEndDate; + } + public void setPostEndDate(String postEndDate) { + this.postEndDate = postEndDate; + } + public int getViewCnt() { + return viewCnt; + } + public void setViewCnt(int viewCnt) { + this.viewCnt = viewCnt; + } + public String getBdAttachFileId() { + return bdAttachFileId; + } + public void setBdAttachFileId(String bdAttachFileId) { + this.bdAttachFileId = bdAttachFileId; + } + public String getRegId() { + return regId; + } + public void setRegId(String regId) { + this.regId = regId; + } + public String getRegDd() { + return regDd; + } + public void setRegDd(String regDd) { + this.regDd = regDd; + } + public String getModId() { + return modId; + } + public void setModId(String modId) { + this.modId = modId; + } + public String getModDd() { + return modDd; + } + public void setModDd(String modDd) { + this.modDd = modDd; + } + public String getRegNm() { + return regNm; + } + public String getRegNmSec() { + if(StringUtil.isEmpty(regNm)) return null; + return StringUtil.maskName(regNm); + } + public void setRegNm(String regNm) { + this.regNm = regNm; + } + public int getRno() { + return rno; + } + public void setRno(int rno) { + this.rno = rno; + } + public String getSearchType() { + return searchType; + } + public void setSearchType(String searchType) { + this.searchType = searchType; + } + public String getSearchKeyword() { + return searchKeyword; + } + public String getEscapeSearchKeyword() { + return StringUtil.getSqlSearchKeyword(searchKeyword); + } + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + public String getAttachYn() { + return attachYn; + } + public void setAttachYn(String attachYn) { + this.attachYn = attachYn; + } + public String getMngOrgNm() { + return mngOrgNm; + } + public void setMngOrgNm(String mngOrgNm) { + this.mngOrgNm = mngOrgNm; + } + public String getBdTypeName() { + return bdTypeName; + } + public void setBdTypeName(String bdTypeName) { + this.bdTypeName = bdTypeName; + } + public List getAttachFiles() { + return attachFiles; + } + public void setAttachFiles(List attachFiles) { + if(attachFiles == null || attachFiles.size() < 1) this.attachFiles = null; + this.attachFiles = attachFiles; + } + + public String getAnswerYn() { + return StringUtil.isEmpty(answerYn) ? "N" : answerYn; + } + + public void setAnswerYn(String answerYn) { + this.answerYn = answerYn; + } + + public String getUseYn() { + return useYn; + } + + public void setUseYn(String useYn) { + this.useYn = useYn; + } + + public String getQuestionType() { + return questionType; + } + + public void setQuestionType(String questionType) { + this.questionType = questionType; + } + + public String getQuestionTypeName() { + return questionTypeName; + } + + public void setQuestionTypeName(String questionTypeName) { + this.questionTypeName = questionTypeName; + } + + public String getAnswer() { + return answer; + } + + public String getSanitizedAnswer() { + return StringUtil.sanitizeHtml(answer); + } + + public void setAnswer(String answer) { + this.answer = answer; + } + + public String getSearchQuestionType() { + return searchQuestionType; + } + + public void setSearchQuestionType(String searchQuestionType) { + this.searchQuestionType = searchQuestionType; + } + + public String getSearchMbInfoId() { + return searchMbInfoId; + } + + public void setSearchMbInfoId(String searchMbInfoId) { + // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리 + this.searchMbInfoId = StringUtil.getValidCodeString(searchMbInfoId); + } + + public String getSecretYn() { + return secretYn; + } + + public void setSecretYn(String secretYn) { + this.secretYn = secretYn; + } + + public String getLoginedMbInfoId() { + return loginedMbInfoId; + } + + public void setLoginedMbInfoId(String loginedMbInfoId) { + // 쿼리 조건으로 사용되는 항목에 대하여 SQL 인젝션으로 처리될만한 문자 강체 치환 처리 + this.loginedMbInfoId = StringUtil.getValidCodeString(loginedMbInfoId); + } + + public String getMyQnaYn() { + return StringUtil.isEmpty(myQnaYn) ? "N" : myQnaYn; + } + + public void setMyQnaYn(String myQnaYn) { + this.myQnaYn = myQnaYn; + } + + public String getLoginedName() { + return loginedName; + } + + public void setLoginedName(String loginedName) { + this.loginedName = loginedName; + } + + public String getEmailRecvYn() { + return StringUtil.isEmpty(emailRecvYn) ? "N" : emailRecvYn; + } + + public void setEmailRecvYn(String emailRecvYn) { + this.emailRecvYn = emailRecvYn; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getResultMessage() { + return resultMessage; + } + + public void setResultMessage(String resultMessage) { + this.resultMessage = resultMessage; + } + + public String getResultCode() { + return resultCode; + } + + public void setResultCode(String resultCode) { + this.resultCode = resultCode; + } + + public List getRemovedAttachFiles() { + return removedAttachFiles; + } + + public void setRemovedAttachFiles(List removedAttachFiles) { + this.removedAttachFiles = removedAttachFiles; + } + +} diff --git a/src/main/java/nlib/bbs/web/FaqController.java b/src/main/java/nlib/bbs/web/FaqController.java index 85b78019..81658842 100644 --- a/src/main/java/nlib/bbs/web/FaqController.java +++ b/src/main/java/nlib/bbs/web/FaqController.java @@ -1,152 +1,158 @@ - -package nlib.bbs.web; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.ResponseEntity; -import org.springframework.security.core.Authentication; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - -import nlib.bbs.service.ArticleVO; -import nlib.bbs.service.BoardService; -import nlib.cmm.NlibCommonController; -import nlib.cmm.service.CodeService; -import nlib.cmm.service.NlibProperty; -import nlib.cmm.service.PagingVO; - -/** - *
- * @Class Name : FaqController.java
- * 
- * @Description : FAQ 컨트롤러 클래스 
- * 
- * 
- * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
- *
- * 
- * - * @ ------------ -------- --------------------------- - * @ 수정일 수정자 수정내용 - * @ ------------ -------- --------------------------- - * @ 2021. 09. 13. KNKIM 최초 생성 - * - * - * @author 이씨플라자 * DIGITALSHIP KNKIM - * @since 2021. 09. 13. - * @version 1.0 - * - */ -@Controller -public class FaqController extends NlibCommonController { - - private static final Logger log = LoggerFactory.getLogger(FaqController.class); - - static final int DEFUALT_PAGE_SIZE = NlibProperty.getInt("list.paging.page.size", 10); - - @Resource(name = "faqService") - private BoardService faqService; - - @Resource(name="codeService") - private CodeService codeService; - - /** - * 목록 화면을 표시한다. - * - * @param req - * @return - */ - @RequestMapping("/bbs/listFaqs.do") - public String listFaqs( - HttpServletRequest req, - @RequestParam Map paramMap, - ArticleVO searchArticleVO, - ModelMap model - ) throws Exception { - - - List> questionTypeList = codeService.listCodes("NLIB_FAQ_TYPE_CD"); - model.addAttribute("questionTypeList", questionTypeList); - model.addAttribute("searchArticle", searchArticleVO); - - return "nlib/bbs/listFaqs"; - } - - /** - * 목록 조회한다. - * - * @param req - * @return - */ - @RequestMapping(value="/bbs/listFaqsAjax.do") - public ResponseEntity listFaqsAjax( - HttpServletRequest req, - Authentication authentication, - @RequestBody ArticleVO searchArticleVO) throws Exception { - - if(searchArticleVO.getPageIndex() < 1) searchArticleVO.setPageIndex(1); - if(searchArticleVO.getPageSize() < 1) searchArticleVO.setPageSize(DEFUALT_PAGE_SIZE); - searchArticleVO.setMngOrgCd(getCurCouncilCd(req)); - - List list = faqService.listArticles(searchArticleVO); - - int totRecordCount = faqService.countArticles(searchArticleVO); - - //------------------------------- - // JSON변환 응답 처리 - //------------------------------- - // JS-GRID 페이징 처리를 포함한 응답값 처리 - // {data: [{...}], - // itemsCount: 255 - // } - HashMap retMap = new HashMap(); - retMap.put("data", list); - retMap.put("itemsCount", totRecordCount); - - PagingVO pageVO = new PagingVO(); - pageVO.setPagingVO(totRecordCount, searchArticleVO.getPageIndex(), searchArticleVO.getPageSize()); - retMap.put("pagingPageIndex" , pageVO.getPageIndex()); - retMap.put("pagingTotRecordCount", pageVO.getTotRecordCount()); - retMap.put("pagingStartPage" , pageVO.getStartPage()); - retMap.put("pagingEndPage" , pageVO.getEndPage()); - retMap.put("pagingLastPage" , pageVO.getLastPage()); - - return makeResponseEntityJson(retMap); - } - - - /** - * 알림 상세 내용 조회한다. - * - * @param req - * @return - */ - @RequestMapping("/bbs/selectFaqArticleAjax.do") - public ResponseEntity selectFaqArticleAjax(HttpServletRequest req, Authentication authentication, @RequestBody ArticleVO searchArticleVO) throws Exception { - - // 읽음처리 및 상세내용 조회 - ArticleVO articleVO = faqService.selectArticle(searchArticleVO); - - //------------------------------- - // JSON변환 응답 처리 - //------------------------------- - // JS-GRID 페이징 처리를 포함한 응답값 처리 - // {data: [{...}], - // itemsCount: 255 - // } - HashMap retMap = new HashMap(); - retMap.put("data", articleVO); - - return makeResponseEntityJson(retMap); - } + +package nlib.bbs.web; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.ResponseEntity; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import nlib.bbs.service.ArticleVO; +import nlib.bbs.service.BoardService; +import nlib.cmm.NlibCommonController; +import nlib.cmm.service.CodeService; +import nlib.cmm.service.NlibProperty; +import nlib.cmm.service.PagingVO; + +/** + *
+ * @Class Name : FaqController.java
+ * 
+ * @Description : FAQ 컨트롤러 클래스 
+ * 
+ * 
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ * 
+ * + * @ ------------ -------- --------------------------- + * @ 수정일 수정자 수정내용 + * @ ------------ -------- --------------------------- + * @ 2021. 09. 13. KNKIM 최초 생성 + * + * + * @author 이씨플라자 * DIGITALSHIP KNKIM + * @since 2021. 09. 13. + * @version 1.0 + * + */ +@Controller +public class FaqController extends NlibCommonController { + + private static final Logger log = LoggerFactory.getLogger(FaqController.class); + + static final int DEFUALT_PAGE_SIZE = NlibProperty.getInt("list.paging.page.size", 10); + + @Resource(name = "faqService") + private BoardService faqService; + + @Resource(name="codeService") + private CodeService codeService; + + /** + * 목록 화면을 표시한다. + * + * @param req + * @return + */ + @RequestMapping("/bbs/listFaqs.do") + public String listFaqs( + HttpServletRequest req, + @RequestParam Map paramMap, + ArticleVO searchArticleVO, + ModelMap model + ) throws Exception { + + + List> questionTypeList = codeService.listCodes("NLIB_FAQ_TYPE_CD"); + model.addAttribute("questionTypeList", questionTypeList); + model.addAttribute("searchArticle", searchArticleVO); + + return "nlib/bbs/listFaqs"; + } + + /** + * 목록 조회한다. + * + * @param req + * @return + */ + @RequestMapping(value="/bbs/listFaqsAjax.do") + public ResponseEntity listFaqsAjax( + HttpServletRequest req, + Authentication authentication, + @RequestBody ArticleVO searchArticleVO) throws Exception { + + if(searchArticleVO.getPageIndex() < 1) searchArticleVO.setPageIndex(1); + if(searchArticleVO.getPageSize() < 1) searchArticleVO.setPageSize(DEFUALT_PAGE_SIZE); + searchArticleVO.setMngOrgCd(getCurCouncilCd(req)); + + List list = faqService.listArticles(searchArticleVO); + + int totRecordCount = faqService.countArticles(searchArticleVO); + + //------------------------------- + // JSON변환 응답 처리 + //------------------------------- + // JS-GRID 페이징 처리를 포함한 응답값 처리 + // {data: [{...}], + // itemsCount: 255 + // } + HashMap retMap = new HashMap(); + retMap.put("data", list); + retMap.put("itemsCount", totRecordCount); + + PagingVO pageVO = new PagingVO(); + pageVO.setPagingVO(totRecordCount, searchArticleVO.getPageIndex(), searchArticleVO.getPageSize()); + retMap.put("pagingPageIndex" , pageVO.getPageIndex()); + retMap.put("pagingTotRecordCount", pageVO.getTotRecordCount()); + retMap.put("pagingStartPage" , pageVO.getStartPage()); + retMap.put("pagingEndPage" , pageVO.getEndPage()); + retMap.put("pagingLastPage" , pageVO.getLastPage()); + + return makeResponseEntityJson(retMap); + } + + + /** + * 알림 상세 내용 조회한다. + * + * @param req + * @return + */ + @RequestMapping("/bbs/selectFaqArticleAjax.do") + public ResponseEntity selectFaqArticleAjax(HttpServletRequest req, Authentication authentication, @RequestBody ArticleVO searchArticleVO) throws Exception { + + // 읽음처리 및 상세내용 조회 + ArticleVO articleVO = faqService.selectArticle(searchArticleVO); + + // AJAX OUT에 XSS처리되지 않은 HTML 전송 차단위한 변경 처리 + if(articleVO != null) { + articleVO.setAnswer(articleVO.getSanitizedAnswer()); + articleVO.setContent(articleVO.getSanitizedContent()); + } + + //------------------------------- + // JSON변환 응답 처리 + //------------------------------- + // JS-GRID 페이징 처리를 포함한 응답값 처리 + // {data: [{...}], + // itemsCount: 255 + // } + HashMap retMap = new HashMap(); + retMap.put("data", articleVO); + + return makeResponseEntityJson(retMap); + } } \ No newline at end of file diff --git a/src/main/java/nlib/util/StringUtil.java b/src/main/java/nlib/util/StringUtil.java index 24959c4d..dd945d76 100644 --- a/src/main/java/nlib/util/StringUtil.java +++ b/src/main/java/nlib/util/StringUtil.java @@ -273,6 +273,45 @@ public class StringUtil extends StringUtils { return str; } + /** + * 게시글 제목 등 허용되지 말아야하는 일부 특수문자에 대한 치환 처리하여 리턴 + * + * @param val + * @return + */ + public static String getRemovedQuotesStr(String val) { + + if (isEmpty(val)) return val; + + StringBuffer strBuff = new StringBuffer(); + for (int j = 0; j < val.length(); j++) { + char c = val.charAt(j); + switch (c) { + case '<': + strBuff.append("<"); + break; + case '>': + strBuff.append(">"); + break; + case '&': + strBuff.append("&"); + break; + case '"': + strBuff.append("""); + break; + case '\'': + strBuff.append("'"); + break; + default: + strBuff.append(c); + break; + } + } + + return strBuff.toString(); + } + + /** * 날짜 문자열(YYYYMMDD)을 받아서 화면 출력용 날짜 형식 문자열(YYYY-MM-DD)로 리턴한다. * @@ -391,7 +430,9 @@ public class StringUtil extends StringUtils { * @param html * @return */ - private static String sanitizeHtml(String html) { + public static String sanitizeHtml(String html) { + + if(isEmpty(html)) return html; PolicyFactory policy = new HtmlPolicyBuilder() .allowAttributes("src", "align", "title").onElements("img") diff --git a/src/main/webapp/WEB-INF/jsp/nlib/bbs/insertQnaForm.jsp b/src/main/webapp/WEB-INF/jsp/nlib/bbs/insertQnaForm.jsp index 0c80c29d..94532f12 100644 --- a/src/main/webapp/WEB-INF/jsp/nlib/bbs/insertQnaForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/nlib/bbs/insertQnaForm.jsp @@ -1,394 +1,394 @@ -<% -/** - *
- * @Class Name : insertQnaForm.jsp
- * 
- * @Description : 묻고답하기 등록화면을 표출한다. 
- * 
- * 
- * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
- *
- * 
- * - * @ ------------ -------- --------------------------- - * @ 수정일 수정자 수정내용 - * @ ------------ -------- --------------------------- - * @ 2021. 7. 13. KNKIM 최초 생성 - * - * - * @author 이씨플라자 * DIGITALSHIP KNKIM - * @since 2021. 7. 13. - * @version 1.0 - * - */ - %> -<%@ page language="java" contentType="text/html; charset=UTF-8" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> -<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %> - - -Q&A - - - 수정 - - - 등록 - - - - - - - - - - - - - - - -
-

Q&A 섹션영역

-
-
-
-
    -
  • HOME
  • -
  • 고객지원
  • -
  • -
-
-

-
-
-
-
-
- -
-
-
-

* 표시는 필수 입력 항목입니다.

-
-
- Q&A 작성 - - - - - - - - -
-
    -
  • -
    제목 *
    -
    - -
    -
  • -
  • -
    - checked /> - -
    -
  • -
  • -
    답변메일 수신여부
    -
    - checked /> - -
    -
  • -
  • -
    내용 *
    -
    - -
    -
  • -
-
-
-
- -
-
    -
  • -
    첨부파일
    -
    -
    -
    - -
    최대 5개까지 (개당 10MB 이내)
    - -
    -
    -
    -
  • -
-
-
- - -
-
-
-
- -
-
-
- - -
- - - - - -
- - +<% +/** + *
+ * @Class Name : insertQnaForm.jsp
+ * 
+ * @Description : 묻고답하기 등록화면을 표출한다. 
+ * 
+ * 
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ * 
+ * + * @ ------------ -------- --------------------------- + * @ 수정일 수정자 수정내용 + * @ ------------ -------- --------------------------- + * @ 2021. 7. 13. KNKIM 최초 생성 + * + * + * @author 이씨플라자 * DIGITALSHIP KNKIM + * @since 2021. 7. 13. + * @version 1.0 + * + */ + %> +<%@ page language="java" contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %> + + +Q&A + + + 수정 + + + 등록 + + + + + + + + + + + + + + + +
+

Q&A 섹션영역

+
+
+
+
    +
  • HOME
  • +
  • 고객지원
  • +
  • +
+
+

+
+
+
+
+
+ +
+
+
+

* 표시는 필수 입력 항목입니다.

+
+
+ Q&A 작성 + + + + + + + + +
+
    +
  • +
    제목 *
    +
    + +
    +
  • +
  • +
    + checked /> + +
    +
  • +
  • +
    답변메일 수신여부
    +
    + checked /> + +
    +
  • +
  • +
    내용 *
    +
    + +
    +
  • +
+
+
+
+ +
+
    +
  • +
    첨부파일
    +
    +
    +
    + +
    최대 5개까지 (개당 10MB 이내)
    + +
    +
    +
    +
  • +
+
+
+ + +
+
+
+
+ +
+
+
+ + +
+ + + + + +
+ + diff --git a/src/main/webapp/WEB-INF/jsp/nlib/bbs/selectAncmntArticle.jsp b/src/main/webapp/WEB-INF/jsp/nlib/bbs/selectAncmntArticle.jsp index 892d80b3..70dcb329 100644 --- a/src/main/webapp/WEB-INF/jsp/nlib/bbs/selectAncmntArticle.jsp +++ b/src/main/webapp/WEB-INF/jsp/nlib/bbs/selectAncmntArticle.jsp @@ -121,7 +121,7 @@ function fn_downloadFile(attachFileId, fileSn) {
- +
    diff --git a/src/main/webapp/WEB-INF/jsp/nlib/bbs/selectQnaArticle.jsp b/src/main/webapp/WEB-INF/jsp/nlib/bbs/selectQnaArticle.jsp index b141ced4..be7e05a3 100644 --- a/src/main/webapp/WEB-INF/jsp/nlib/bbs/selectQnaArticle.jsp +++ b/src/main/webapp/WEB-INF/jsp/nlib/bbs/selectQnaArticle.jsp @@ -145,7 +145,7 @@ function fn_downloadFile(attachFileId, fileSn) {

    - +

    @@ -156,7 +156,7 @@ function fn_downloadFile(attachFileId, fileSn) {
-

+

diff --git a/src/main/webapp/WEB-INF/jsp/nlib/cmm/listNotifications.jsp b/src/main/webapp/WEB-INF/jsp/nlib/cmm/listNotifications.jsp index 2acf7fa7..96e72b95 100644 --- a/src/main/webapp/WEB-INF/jsp/nlib/cmm/listNotifications.jsp +++ b/src/main/webapp/WEB-INF/jsp/nlib/cmm/listNotifications.jsp @@ -1,225 +1,228 @@ -<% -/** - *
- * @Class Name : lisNotifications.jsp
- * 
- * @Description : 알림 목록을 조회한다.
- * 
- * 
- * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
- *
- * 
- * - * @ ------------ -------- --------------------------- - * @ 수정일 수정자 수정내용 - * @ ------------ -------- --------------------------- - * @ 2021. 9. 6. KNKIM 최초 생성 - * - * - * @author 이씨플라자 * DIGITALSHIP KNKIM - * @since 2021. 9. 6. - * @version 1.0 - * - */ - %> -<%@ page language="java" contentType="text/html; charset=UTF-8" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> -<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> -<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %> - -알림 - - - - -
-

알림 섹션영역

-
-
-
-
    -
  • HOME
  • -
  • -
-
-

-
-
-
-
-
-
-
- 0 -
-

- 최근 한달동안 발송된 알림 내역만 보관됩니다.

-
-
- -
-
-
    - -
-
-
    -
    - -
    -
    -
    -
    - -
    - - - -
    - +<% +/** + *
    + * @Class Name : lisNotifications.jsp
    + * 
    + * @Description : 알림 목록을 조회한다.
    + * 
    + * 
    + * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
    + *
    + * 
    + * + * @ ------------ -------- --------------------------- + * @ 수정일 수정자 수정내용 + * @ ------------ -------- --------------------------- + * @ 2021. 9. 6. KNKIM 최초 생성 + * + * + * @author 이씨플라자 * DIGITALSHIP KNKIM + * @since 2021. 9. 6. + * @version 1.0 + * + */ + %> +<%@ page language="java" contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %> + +알림 + + + + +
    +

    알림 섹션영역

    +
    +
    +
    +
      +
    • HOME
    • +
    • +
    +
    +

    +
    +
    +
    +
    +
    +
    +
    + 0 +
    +

    - 최근 한달동안 발송된 알림 내역만 보관됩니다.

    +
    +
    + +
    +
    +
      + +
    +
    +
      +
      + +
      +
      +
      +
      + +
      + + + +
      + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 08830000..a07b2258 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -1,120 +1,123 @@ - - - - nlib - - - encodingFilter - org.springframework.web.filter.CharacterEncodingFilter - - encoding - utf-8 - - - - encodingFilter - *.do - - - - HTMLTagFilter - egovframework.rte.ptl.mvc.filter.HTMLTagFilter - - - HTMLTagFilter - *.do - - - - - springSecurityFilterChain - org.springframework.web.filter.DelegatingFilterProxy - - - springSecurityFilterChain - /* - - - - contextConfigLocation - classpath*:egovframework/spring/context-*.xml - - - - org.springframework.web.context.ContextLoaderListener - - - - - org.springframework.web.context.ContextLoaderListener - - - - action - org.springframework.web.servlet.DispatcherServlet - - contextConfigLocation - /WEB-INF/config/egovframework/springmvc/dispatcher-servlet.xml - - 1 - - - - action - *.do - - - action - *.ajax - - - index.jsp - - - - BASIC - - - - java.lang.Throwable - /common/error-throw.jsp - - - 404 - /common/error404.jsp - - - 500 - /common/error500.jsp - - - - - Protected Resource - /* - OPTIONS - HEAD - TRACE - PUT - DELETE - PATCH - SEARCH - CONNECT - PROPFIND - PROPPATCH - MKCOL - COPY - MOVE - LOCK - UNLOCK - - - - - - - + + + + nlib + + + encodingFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + utf-8 + + + + encodingFilter + *.do + + + + + + + + springSecurityFilterChain + org.springframework.web.filter.DelegatingFilterProxy + + + springSecurityFilterChain + /* + + + + contextConfigLocation + classpath*:egovframework/spring/context-*.xml + + + + org.springframework.web.context.ContextLoaderListener + + + + + org.springframework.web.context.ContextLoaderListener + + + + action + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + /WEB-INF/config/egovframework/springmvc/dispatcher-servlet.xml + + 1 + + + + action + *.do + + + action + *.ajax + + + index.jsp + + + + BASIC + + + + java.lang.Throwable + /common/error-throw.jsp + + + 404 + /common/error404.jsp + + + 500 + /common/error500.jsp + + + + + Protected Resource + /* + OPTIONS + HEAD + TRACE + PUT + DELETE + PATCH + SEARCH + CONNECT + PROPFIND + PROPPATCH + MKCOL + COPY + MOVE + LOCK + UNLOCK + + + + + + +