알림 개발 - 중간백업

This commit is contained in:
KNKIM 2021-09-06 18:09:12 +09:00
parent 31523be6d5
commit 0bb42e589c
10 changed files with 1705 additions and 0 deletions

View File

@ -0,0 +1,836 @@
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.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
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 org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.servlet.support.RequestContextUtils;
import nlib.bbs.service.BoardService;
import nlib.cmm.NlibCommonController;
import nlib.cmm.crypto.AriaCrypto;
import nlib.cmm.crypto.NlibPasswordEncoder;
import nlib.cmm.service.CodeService;
import nlib.cmm.service.NlibProperty;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
import nlib.user.service.NlibLoginVO;
import nlib.util.StringUtil;
@Controller
public class AncmntController extends NlibCommonController
{
// private static final Logger log = LoggerFactory.getLogger(AncmntController.class);
//
// static final String DEFUALT_PAGE_SIZE = NlibProperty.getProperty("list.paging.page.size");
//
// @Resource(name = "boardService")
// private BoardService boardService;
//
// @Resource(name = "nlibPasswordEncoder")
// private NlibPasswordEncoder nlibPasswordEncoder;
//
// @Resource(name = "ariaCrypto")
// private AriaCrypto ariaCrypto;
//
// @Resource(name = "codeService")
// private CodeService codeService;
//
//
// @Autowired
// private AuthenticationManager authenticationManager;
//
// /**
// * 공지사항 목록 화면을 표출한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/board/listNotices.do")
// public String listNotices(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
// String articleType = paramMap.get("articleType");
// String message = paramMap.get("message");
//
// log.debug("listNotices > pageIndex = " + pageIndex);
// log.debug("listNotices > pageSize = " + pageSize);
// log.debug("listNotices > searchKeyword = " + searchKeyword);
// log.debug("listNotices > articleType = " + articleType);
// log.debug("listNotices > message = " + message);
//
// // 페이징 사이즈 코드 목록 조회
// List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
//
// // 공지사항 유형 코드 목록 조회
// List<HashMap<String,String>> articleTypeCodes = codeService.listCodes("ARTICLE_TYPE");
//
// // 반환 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
// model.addAttribute("pageSizeCodes", pageSizeCodes);
// model.addAttribute("articleTypeCodes", articleTypeCodes);
// model.addAttribute("articleType" , articleType);
// model.addAttribute("message" , message);
//
// return "nlib/board/listNotices";
// }
//
// /**
// * 공지사항 목록 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping(value="/board/listNoticesAjax.do")
// public ResponseEntity<String> listNoticesAjax(HttpServletRequest req,
// Authentication authentication, @RequestBody Map<String, String> paramMap) throws Exception {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
// String articleType = paramMap.get("articleType");
//
// log.debug("listNoticesAjax > pageIndex = " + pageIndex);
// log.debug("listNoticesAjax > pageSize = " + pageSize);
// log.debug("listNoticesAjax > searchKeyword = " + searchKeyword);
// log.debug("listNoticesAjax > articleType = " + articleType);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.addInfoItem("searchKeyword", searchKeyword);
// reqVO.addInfoItem("articleType", articleType);
//
// // 요청
// DataApiResVO resVO = boardService.listNotices(reqVO);
//
// //-------------------------------
// // JSON변환 응답 처리
// //-------------------------------
// // JS-GRID 페이징 처리를 포함한 응답값 처리
// // {data: [{...}],
// // itemsCount: 255
// // }
// HashMap<String, Object> retMap = new HashMap<String, Object>();
// retMap.put("data", resVO.getList());
// retMap.put("itemsCount", resVO.getRecordTotCount());
//
// return makeResponseEntityJson(retMap);
// }
//
// /**
// * 공지사항 상세 내용 조회한다.
// * @param req
// * @return
// */
// @RequestMapping("/board/selectNotice.do")
// public String selectNotice(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
//
// // 목록 이동시 전달할 매개변수
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = paramMap.get("pageIndex");
// String pageSize = paramMap.get("pageSize");
// String articleType = paramMap.get("articleType");
// String message = paramMap.get("message");
//
// // 게시물 번호
// String articleNo = paramMap.get("articleNo");
//
// log.debug("selectNotice > pageIndex = " + pageIndex);
// log.debug("selectNotice > pageSize = " + pageSize);
// log.debug("selectNotice > searchKeyword = " + searchKeyword);
// log.debug("selectNotice > articleNo = " + articleNo);
// log.debug("selectNotice > message = " + message);
// log.debug("selectNotice > articleType = " + articleType);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.addInfoItem("boardNo", "QNA"); // 게시판ID
// reqVO.addInfoItem("articleNo", articleNo); // 게시물번호
//
// // 요청
// DataApiResVO resVO = boardService.selectNotice(reqVO);
//
// // 반환 정보
// model.addAttribute("articleNo" , articleNo);
// model.addAttribute("article" , resVO.getInfo()); // 게시물 상세
// model.addAttribute("preArticle" , resVO.getList().get(0)); // 이전글 정보
// model.addAttribute("nextArticle" , resVO.getList().get(1)); // 다음글 정보
// model.addAttribute("message" , message);
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
// model.addAttribute("articleType" , articleType);
//
// return "nlib/board/selectNotice";
// }
//
// /**
// * FAQ 목록 화면을 표출한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/board/listFAQs.do")
// public String listFAQs(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
// String message = paramMap.get("message");
// String faqType = paramMap.get("faqType");
//
// log.debug("listFAQs > pageIndex = " + pageIndex);
// log.debug("listFAQs > pageSize = " + pageSize);
// log.debug("listFAQs > searchKeyword = " + searchKeyword);
// log.debug("listFAQs > message = " + message);
// log.debug("listFAQs > faqType = " + faqType);
//
// DataApiReqVO reqVOforCode = new DataApiReqVO();
// reqVOforCode.setAuthKey(createAuthKey(req, authentication));
// reqVOforCode.setPageIndex(0);
// reqVOforCode.setPageSize(0);
//
//
// // 페이징 사이즈 코드 목록 조회
// List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
//
// // 유형 코드 목록 조회
// List<HashMap<String,String>> articleTypeCodes = codeService.listCodes("FAQ_TYPE");
//
// // 반환 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
// model.addAttribute("pageSizeCodes", pageSizeCodes);
// model.addAttribute("faqTypeCodes" , articleTypeCodes);
// model.addAttribute("message" , message);
// model.addAttribute("faqType" , faqType);
// model.addAttribute("faqType" , faqType);
//
// return "nlib/board/listFAQs";
// }
//
//
// /**
// * FAQ 목록 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping(value="/board/listFAQsAjax.do")
// public ResponseEntity<String> listFAQsAjax(HttpServletRequest req,
// Authentication authentication, @RequestBody Map<String, String> paramMap) throws Exception {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
// String faqType = paramMap.get("faqType");
//
// log.debug("listFAQsAjax > pageIndex = " + pageIndex);
// log.debug("listFAQsAjax > pageSize = " + pageSize);
// log.debug("listFAQsAjax > searchKeyword = " + searchKeyword);
// log.debug("listFAQsAjax > faqType = " + faqType);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.addInfoItem("searchKeyword", searchKeyword);
// reqVO.addInfoItem("faqType", faqType);
//
// // 요청
// DataApiResVO resVO = boardService.listFAQs(reqVO);
//
// //-------------------------------
// // JSON변환 응답 처리
// //-------------------------------
// // JS-GRID 페이징 처리를 포함한 응답값 처리
// // {data: [{...}],
// // itemsCount: 255
// // }
// HashMap<String, Object> retMap = new HashMap<String, Object>();
// retMap.put("data", resVO.getList());
// retMap.put("itemsCount", resVO.getRecordTotCount());
//
// return makeResponseEntityJson(retMap);
// }
//
//
// /**
// * 묻고답하기 상세 내용 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/board/selectFAQAjax.do")
// public ResponseEntity<String> selectFAQAjax(HttpServletRequest req, Authentication authentication, @RequestBody Map<String, String> paramMap) throws Exception {
//
// // 게시물 번호
// String articleNo = paramMap.get("articleNo");
//
// log.debug("selectQnA > articleNo = " + articleNo);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.addInfoItem("boardNo", "FAQ"); // 게시판ID
// reqVO.addInfoItem("articleNo", articleNo); // 게시물번호
//
// // 요청
// DataApiResVO resVO = boardService.selectFAQ(reqVO);
//
// // 반환 정보
// return makeResponseEntityJson(resVO.getInfo());
// }
//
// /**
// * 묻고답하기 목록 화면을 표출한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/board/listQnAs.do")
// public String listQnAs(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
// String message = paramMap.get("message");
//
// log.debug("listQnAs > pageIndex = " + pageIndex);
// log.debug("listQnAs > pageSize = " + pageSize);
// log.debug("listQnAs > searchKeyword = " + searchKeyword);
// log.debug("listQnAs > message = " + message);
//
// // 페이징 사이즈 코드 목록 조회
// List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
//
// // 반환 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
// model.addAttribute("pageSizeCodes", pageSizeCodes);
// model.addAttribute("message" , message);
//
// return "nlib/board/listQnAs";
// }
//
// /**
// * 묻고답하기 목록 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping(value="/board/listQnAsAjax.do")
// public ResponseEntity<String> listQnAsAjax(HttpServletRequest req,
// Authentication authentication, @RequestBody Map<String, String> paramMap) throws Exception {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
//
// log.debug("listQnAsAjax > pageIndex = " + pageIndex);
// log.debug("listQnAsAjax > pageSize = " + pageSize);
// log.debug("listQnAsAjax > searchKeyword = " + searchKeyword);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.addInfoItem("searchKeyword", searchKeyword);
//
// // 요청
// DataApiResVO resVO = boardService.listQnAs(reqVO);
//
// //-------------------------------
// // JSON변환 응답 처리
// //-------------------------------
// // JS-GRID 페이징 처리를 포함한 응답값 처리
// // {data: [{...}],
// // itemsCount: 255
// // }
// HashMap<String, Object> retMap = new HashMap<String, Object>();
// retMap.put("data", resVO.getList());
// retMap.put("itemsCount", resVO.getRecordTotCount());
//
// return makeResponseEntityJson(retMap);
// }
//
//
// /**
// * 묻고답하기 상세 내용 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/board/selectQnA.do")
// public String selectQnA(HttpServletRequest req
// , Authentication authentication
// , @RequestParam Map<String, String> paramMap
// , ModelMap model) throws Exception {
//
// addParamFromInputFlash(paramMap, req);
//
// // 목록 이동시 전달할 매개변수
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = paramMap.get("pageIndex");
// String pageSize = paramMap.get("pageSize");
// String message = paramMap.get("message");
//
// // 게시물 번호
// String articleNo = paramMap.get("articleNo");
//
// log.debug("selectQnA > pageIndex = " + pageIndex);
// log.debug("selectQnA > pageSize = " + pageSize);
// log.debug("selectQnA > searchKeyword = " + searchKeyword);
// log.debug("selectQnA > articleNo = " + articleNo);
// log.debug("selectQnA > message = " + message);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.addInfoItem("boardNo", "QNA"); // 게시판ID
// reqVO.addInfoItem("articleNo", articleNo); // 게시물번호
//
// // 요청
// DataApiResVO resVO = boardService.selectQnA(reqVO);
//
// // 반환 정보
// model.addAttribute("articleNo" , articleNo);
// model.addAttribute("article" , resVO.getInfo()); // 게시물 상세
// model.addAttribute("preArticle" , resVO.getList().get(0)); // 이전글 정보
// model.addAttribute("nextArticle" , resVO.getList().get(1)); // 다음글 정보
// model.addAttribute("message" , message);
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
//
// return "nlib/board/selectQnA";
// }
//
// /**
// * 묻고답하기 글작성화면을 표출한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/board/insertQnAForm.do")
// public String insertQnAForm(HttpServletRequest req, Authentication authentication
// , @RequestParam Map<String, String> paramMap
// , ModelMap model) throws Exception {
//
// // 입력 매개변수 출력 설정
// addParamsToModel(paramMap, model);
//
// NlibLoginVO loginVO = getNlibLoginVO(authentication);
// if(StringUtil.isEmpty(paramMap.get("regUserName"))) model.addAttribute("regUserName", loginVO.getName());
// if(StringUtil.isEmpty(paramMap.get("email"))) model.addAttribute("regUserName", loginVO.getEmail());
//
// return "nlib/board/insertQnAForm";
// }
//
// /**
// * 묻고답하기 등록 처리한다.
// *
// * @param req
// * @param authentication
// * @param paramMap
// * @param model
// * @return
// */
// @RequestMapping("/board/insertQnA.do")
// public String insertQnA(HttpServletRequest req
// , Authentication authentication
// , @RequestParam Map<String, String> paramMap
// , RedirectAttributes redirectAttrs
// , ModelMap model) throws Exception {
//
// NlibLoginVO loginVO = getNlibLoginVO(authentication);
//
// log.debug("paramMap > " + paramMap);
//
// String message = null;
// String authKey = createAuthKey(req, authentication);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(authKey);
// reqVO.addInfoItem("boardNo" , "QNA");
// reqVO.addInfoItem("title" , paramMap.get("title"));
// reqVO.addInfoItem("regUserName" , paramMap.get("regUserName"));
// reqVO.addInfoItem("email" , paramMap.get("email"));
// reqVO.addInfoItem("contentQeust", paramMap.get("contentQeust"));
//
// String fileListJsonStr = paramMap.get("fileList");
// if(fileListJsonStr.startsWith("\"")) fileListJsonStr = fileListJsonStr.substring(1);
// if(fileListJsonStr.endsWith("\"")) fileListJsonStr = fileListJsonStr.substring(0, fileListJsonStr.length()-1);
// fileListJsonStr = fileListJsonStr.replaceAll("\\\\", "");
//
// log.debug("fileList : " + fileListJsonStr);
//
// /*
// ObjectMapper mapper = new ObjectMapper();
// List<Map<String, Object>> fileList = null;
// try {
// fileList = mapper.readValue(fileListJsonStr, new TypeReference<List<Map<String, Object>>>() {
// });
//
// for (Map<String, Object> map : fileList) {
// MapUtils.debugPrint(System.out, "map", map);
// }
//
// } catch (JsonMappingException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (JsonProcessingException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
//
// log.debug("fileMap =" + fileList);
// */
// reqVO.addInfoItem("fileList", fileListJsonStr);
//
// // 요청
// DataApiResVO resVO = boardService.insertQnA(reqVO);
//
// // 처리결과 확인
// if(!resVO.isSuccess()) {
// message = resVO.getResultMessage();
// redirectAttrs.addFlashAttribute("message", message);
// addParamsToRedirect(paramMap, redirectAttrs, null, "pageIndex,pageSize,searchKeyword");
// addParamsToRedirect(paramMap, redirectAttrs, null,
// "title,articlePassword,"
// + "regDate, regUserName, "
// + "email, contentQeust");
//
// return "redirect:/board/insertQnAForm.do";
// }
//
// redirectAttrs.addFlashAttribute("pageSize", paramMap.get("pageSize"));
// redirectAttrs.addFlashAttribute("message", "성공적으로 등록되었습니다.");
//
// return "redirect:/board/listQnAs.do";
// }
//
// @RequestMapping("/board/verifyWriter.do")
// public String verifyWriter(HttpServletRequest req) throws Exception {
// return "nlib/board/verifyWriter";
// }
//
// /**
// * 묻고답하기 수정 화면 표출한다.
// *
// * @param req
// * @param authentication
// * @param paramMap
// * @param model
// * @return
// */
// @RequestMapping("/board/updateQnAForm.do")
// public String updateQnAForm(HttpServletRequest req
// , Authentication authentication
// , @RequestParam Map<String, String> paramMap
// , ModelMap model
// , RedirectAttributes redirectAttrs
// ) throws Exception {
//
// // 목록 이동시 전달할 매개변수
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = paramMap.get("pageIndex");
// String pageSize = paramMap.get("pageSize");
//
// // 게시물 번호
// String articleNo = paramMap.get("articleNo");
// String articlePassword = paramMap.get("articlePassword");
//
// log.debug("updateQnAForm > pageIndex = " + pageIndex);
// log.debug("updateQnAForm > pageSize = " + pageSize);
// log.debug("updateQnAForm > searchKeyword = " + searchKeyword);
// log.debug("updateQnAForm > articleNo = " + articleNo);
// log.debug("updateQnAForm > articlePassword = " + articlePassword);
//
// if(StringUtil.isEmpty(articlePassword)) {
// redirectAttrs.addFlashAttribute("message", "비밀빈호가 올바르지 않습니다.(U1)");
//
// addParamsToRedirect(paramMap, redirectAttrs, null, "pageIndex,pageSize,searchKeyword,articleNo");
// return "redirect:/board/selectQnA.do";
// }
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.addInfoItem("boardNo", "QNA"); // 게시판ID
// reqVO.addInfoItem("articleNo", articleNo); // 게시물번호
//
// // 요청
// DataApiResVO resVO = boardService.selectQnA(reqVO);
//
// // 비밀번호 확인
// HashMap<String, Object> article = resVO.getInfo();
// String shaArticlePassword = nlibPasswordEncoder.encode(articlePassword);
// log.debug("updateQnAForm > 입력받은 비밀번호를 SHA256 암호화한 값 : " + shaArticlePassword);
//
// if(!shaArticlePassword.equals(article.get("articlePassword"))) {
// redirectAttrs.addFlashAttribute("message", "비밀번호가 올바르지 않습니다.(U2)");
// addParamsToRedirect(paramMap, redirectAttrs, null, "pageIndex,pageSize,searchKeyword,articleNo");
// return "redirect:/board/selectQnA.do";
// }
//
// // 반환 정보
// model.addAttribute("articleNo" , articleNo);
// model.addAttribute("article" , resVO.getInfo());
//
// //-------------------------------
// // 게시글 비밀번호 처리
// //-------------------------------
// // 비밀번호 : SHA-256 암호화 처리되어 DB에 저장되며,
// // 화면에 표출될 때는 Aria로 articleNo를 Salt값으로 하여 재암호화처리하고 BASE64로 다시 한번 인코딩하여 표출함
// String encArticlePassword = StringUtil.encodeBase64(ariaCrypto.encode(shaArticlePassword));
// model.addAttribute("encArticlePassword", encArticlePassword);
//
// // 검색 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
//
// return "nlib/board/updateQnAForm";
// }
//
// /**
// * 묻고답하기 수정 처리한다.
// *
// * @param req
// * @param authentication
// * @param paramMap
// * @param model
// * @return
// */
// @RequestMapping("/board/updateQnA.do")
// public String updateQnA(HttpServletRequest req
// , Authentication authentication
// , @RequestParam Map<String, String> paramMap
// , RedirectAttributes redirectAttrs
// , ModelMap model) throws Exception {
//
// log.debug("paramMap > " + paramMap);
//
// String message = null;
// String authKey = createAuthKey(req, authentication);
//
// // 목록 이동시 전달할 매개변수
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = paramMap.get("pageIndex");
// String pageSize = paramMap.get("pageSize");
//
// // 게시물 번호
// String articleNo = paramMap.get("articleNo");
//
// //-------------------------------
// // 게시글 비밀번호 처리
// //-------------------------------
// // 비밀번호 : SHA-256 암호화 처리되어 DB에 저장되며,
// // 화면에 표출될 때는 Aria로 articleNo를 Salt값으로 하여 재암호화처리하고 BASE64로 다시 한번 인코딩하여 표출함
// String encArticlePassword = paramMap.get("encArticlePassword");
// String checkArticlePassword = ariaCrypto.decode(StringUtil.decodeBase64(encArticlePassword));
// String articlePassword = paramMap.get("articlePassword");
//
// //-------------------------------
// // 비밀번호 유효 체크
// //-------------------------------
// // 기존 정보 조회
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(authKey);
// reqVO.addInfoItem("articleNo", articleNo);
//
// DataApiResVO resVO = boardService.selectQnA(reqVO);
// String oldArticlePassword = resVO.getInfoItem("articlePassword");
// if(checkArticlePassword == null || !checkArticlePassword.equals(oldArticlePassword)) {
// redirectAttrs.addFlashAttribute("errorCode", "ERR_BRD_UPDTQNA");
// redirectAttrs.addFlashAttribute("errorMessage", "잘못된 접근입니다.");
// return "redirect:/alert/showError.do";
// }
//
// // 글비밀번호가 존재하지 않는 경우, 기존 비밀번호 설정 처리
// if(StringUtil.isEmpty(articlePassword)) {
// articlePassword = checkArticlePassword;
// }
// // 글비밀번호가 입력된 경우, SHA256 암호화 처리하여 설정
// else {
// articlePassword = nlibPasswordEncoder.encode(articlePassword);
// }
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO updateReqVO = new DataApiReqVO();
// updateReqVO.setAuthKey(authKey);
// updateReqVO.addInfoItem("boardNo" , "QNA");
// updateReqVO.addInfoItem("articleNo" , articleNo);
// updateReqVO.addInfoItem("title" , paramMap.get("title"));
// updateReqVO.addInfoItem("regUserName" , paramMap.get("regUserName"));
// updateReqVO.addInfoItem("email" , paramMap.get("email"));
// updateReqVO.addInfoItem("contentQeust", paramMap.get("contentQeust"));
// updateReqVO.addInfoItem("articlePassword", articlePassword); // SHA256 글비밀번호
//
// // 요청
// DataApiResVO updateResVO = boardService.updateQnA(updateReqVO);
//
// // 처리결과 확인
// if(!updateResVO.isSuccess()) {
// message = updateResVO.getResultMessage();
// model.addAttribute("message", message);
// addParamsToModel(paramMap, model, null, "pageIndex,pageSize,searchKeyword,articleNo");
// addParamsToModel(paramMap, model, "article"
// , "articleNo,articleType,"
// + "articleTypeName,title,articlePassword,readCount,"
// + "regDate, reguserName, repStats, "
// + "email, contentQeust, "
// + "contentQuestFile");
//
// return "redirect:/board/updateQnAForm.do";
// }
//
// // 반환 정보
// model.addAttribute("articleNo" , updateResVO.getInfoItem("articleNo")); // 신규등록된 게시물 ID
// model.addAttribute("message" , "성공적으로 수정되었습니다.");
//
// // 검색 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
//
// return "redirect:/board/selectQnA.do";
// }
//
// /**
// * 묻고답하기 삭제한다.
// *
// * @param req
// * @param authentication
// * @param paramMap
// * @param model
// * @return
// */
// @RequestMapping("/board/deleteQnA.do")
// public String deleteQnA(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
//
// String message = null;
//
// // 목록 이동시 전달할 매개변수
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = paramMap.get("pageIndex");
// String pageSize = paramMap.get("pageSize");
//
// // 게시물 번호
// String articleNo = paramMap.get("articleNo");
// String articlePassword = paramMap.get("articlePassword");
//
// log.debug("deleteQnA > pageIndex = " + pageIndex);
// log.debug("deleteQnA > pageSize = " + pageSize);
// log.debug("deleteQnA > searchKeyword = " + searchKeyword);
// log.debug("deleteQnA > articleNo = " + articleNo);
// log.debug("deleteQnA > articlePassword = " + articlePassword);
//
// if(StringUtil.isEmpty(articlePassword)) {
// model.addAttribute("message", "글비밀빈호가 올바르지 않습니다.(D1)");
// addParamsToModel(paramMap, model, null, "pageIndex,pageSize,searchKeyword,articleNo");
// return "redirect:/board/selectQnA.do";
// }
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.addInfoItem("boardNo", "QNA"); // 게시판ID
// reqVO.addInfoItem("articleNo", articleNo); // 게시물번호
//
// // 요청
// DataApiResVO resVO = boardService.selectQnA(reqVO);
//
// // 비밀번호 확인
// HashMap<String, Object> article = resVO.getInfo();
// String shaArticlePassword = nlibPasswordEncoder.encode(articlePassword);
// log.debug("updateQnAForm > 입력받은 비밀번호를 SHA256 암호화한 값 : " + shaArticlePassword);
//
// if(!shaArticlePassword.equals(article.get("articlePassword"))) {
// model.addAttribute("message", "글비밀번호가 올바르지 않습니다.(D2)");
// addParamsToModel(paramMap, model, null, "pageIndex,pageSize,searchKeyword,articleNo");
// return "redirect:/board/selectQnA.do";
// }
//
// // 삭제 처리
// DataApiResVO delResVO = boardService.deleteQnA(reqVO);
//
// // 처리결과 확인
// if(!delResVO.isSuccess()) {
// message = delResVO.getResultMessage();
// model.addAttribute("message", message);
// addParamsToModel(paramMap, model, null, "pageIndex,pageSize,searchKeyword,articleNo");
//
// return "redirect:/board/selectQnA.do";
// }
//
// // 반환 정보
// model.addAttribute("message" , "성공적으로 삭제되었습니다.");
//
// // 검색 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
//
// return "redirect:/board/listQnAs.do";
// }
}

View File

@ -0,0 +1,188 @@
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.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
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 org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.servlet.support.RequestContextUtils;
import nlib.bbs.service.BoardService;
import nlib.cmm.NlibCommonController;
import nlib.cmm.crypto.AriaCrypto;
import nlib.cmm.crypto.NlibPasswordEncoder;
import nlib.cmm.service.CodeService;
import nlib.cmm.service.NlibProperty;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
import nlib.user.service.NlibLoginVO;
import nlib.util.StringUtil;
@Controller
public class FaqController extends NlibCommonController {
// private static final Logger log = LoggerFactory.getLogger(FaqController.class);
//
// static final String DEFUALT_PAGE_SIZE = NlibProperty.getProperty("list.paging.page.size");
//
// @Resource(name = "boardService")
// private BoardService boardService;
//
// @Resource(name = "nlibPasswordEncoder")
// private NlibPasswordEncoder nlibPasswordEncoder;
//
// @Resource(name = "ariaCrypto")
// private AriaCrypto ariaCrypto;
//
// @Resource(name = "codeService")
// private CodeService codeService;
//
//
// @Autowired
// private AuthenticationManager authenticationManager;
//
// /**
// * FAQ 목록 화면을 표출한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/board/listFAQs.do")
// public String listFAQs(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
// String message = paramMap.get("message");
// String faqType = paramMap.get("faqType");
//
// log.debug("listFAQs > pageIndex = " + pageIndex);
// log.debug("listFAQs > pageSize = " + pageSize);
// log.debug("listFAQs > searchKeyword = " + searchKeyword);
// log.debug("listFAQs > message = " + message);
// log.debug("listFAQs > faqType = " + faqType);
//
// DataApiReqVO reqVOforCode = new DataApiReqVO();
// reqVOforCode.setAuthKey(createAuthKey(req, authentication));
// reqVOforCode.setPageIndex(0);
// reqVOforCode.setPageSize(0);
//
//
// // 페이징 사이즈 코드 목록 조회
// List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
//
// // 유형 코드 목록 조회
// List<HashMap<String,String>> articleTypeCodes = codeService.listCodes("FAQ_TYPE");
//
// // 반환 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
// model.addAttribute("pageSizeCodes", pageSizeCodes);
// model.addAttribute("faqTypeCodes" , articleTypeCodes);
// model.addAttribute("message" , message);
// model.addAttribute("faqType" , faqType);
// model.addAttribute("faqType" , faqType);
//
// return "nlib/board/listFAQs";
// }
//
//
// /**
// * FAQ 목록 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping(value="/board/listFAQsAjax.do")
// public ResponseEntity<String> listFAQsAjax(HttpServletRequest req,
// Authentication authentication, @RequestBody Map<String, String> paramMap) throws Exception {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
// String faqType = paramMap.get("faqType");
//
// log.debug("listFAQsAjax > pageIndex = " + pageIndex);
// log.debug("listFAQsAjax > pageSize = " + pageSize);
// log.debug("listFAQsAjax > searchKeyword = " + searchKeyword);
// log.debug("listFAQsAjax > faqType = " + faqType);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.addInfoItem("searchKeyword", searchKeyword);
// reqVO.addInfoItem("faqType", faqType);
//
// // 요청
// DataApiResVO resVO = boardService.listFAQs(reqVO);
//
// //-------------------------------
// // JSON변환 응답 처리
// //-------------------------------
// // JS-GRID 페이징 처리를 포함한 응답값 처리
// // {data: [{...}],
// // itemsCount: 255
// // }
// HashMap<String, Object> retMap = new HashMap<String, Object>();
// retMap.put("data", resVO.getList());
// retMap.put("itemsCount", resVO.getRecordTotCount());
//
// return makeResponseEntityJson(retMap);
// }
//
//
// /**
// * 묻고답하기 상세 내용 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/board/selectFAQAjax.do")
// public ResponseEntity<String> selectFAQAjax(HttpServletRequest req, Authentication authentication, @RequestBody Map<String, String> paramMap) throws Exception {
//
// // 게시물 번호
// String articleNo = paramMap.get("articleNo");
//
// log.debug("selectQnA > articleNo = " + articleNo);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.addInfoItem("boardNo", "FAQ"); // 게시판ID
// reqVO.addInfoItem("articleNo", articleNo); // 게시물번호
//
// // 요청
// DataApiResVO resVO = boardService.selectFAQ(reqVO);
//
// // 반환 정보
// return makeResponseEntityJson(resVO.getInfo());
// }
//
// @RequestMapping("/board/verifyWriter.do")
// public String verifyWriter(HttpServletRequest req) throws Exception {
// return "nlib/board/verifyWriter";
// }
}

View File

@ -0,0 +1,188 @@
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.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
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 org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.servlet.support.RequestContextUtils;
import nlib.bbs.service.BoardService;
import nlib.cmm.NlibCommonController;
import nlib.cmm.crypto.AriaCrypto;
import nlib.cmm.crypto.NlibPasswordEncoder;
import nlib.cmm.service.CodeService;
import nlib.cmm.service.NlibProperty;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
import nlib.user.service.NlibLoginVO;
import nlib.util.StringUtil;
@Controller
public class QnaController extends NlibCommonController
{
// private static final Logger log = LoggerFactory.getLogger(QnaController.class);
//
// static final String DEFUALT_PAGE_SIZE = NlibProperty.getProperty("list.paging.page.size");
//
// @Resource(name = "boardService")
// private BoardService boardService;
//
// @Resource(name = "nlibPasswordEncoder")
// private NlibPasswordEncoder nlibPasswordEncoder;
//
// @Resource(name = "ariaCrypto")
// private AriaCrypto ariaCrypto;
//
// @Resource(name = "codeService")
// private CodeService codeService;
//
//
// @Autowired
// private AuthenticationManager authenticationManager;
//
// /**
// * FAQ 목록 화면을 표출한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/board/listFAQs.do")
// public String listFAQs(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) throws Exception {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
// String message = paramMap.get("message");
// String faqType = paramMap.get("faqType");
//
// log.debug("listFAQs > pageIndex = " + pageIndex);
// log.debug("listFAQs > pageSize = " + pageSize);
// log.debug("listFAQs > searchKeyword = " + searchKeyword);
// log.debug("listFAQs > message = " + message);
// log.debug("listFAQs > faqType = " + faqType);
//
// DataApiReqVO reqVOforCode = new DataApiReqVO();
// reqVOforCode.setAuthKey(createAuthKey(req, authentication));
// reqVOforCode.setPageIndex(0);
// reqVOforCode.setPageSize(0);
//
//
// // 페이징 사이즈 코드 목록 조회
// List<HashMap<String,String>> pageSizeCodes = codeService.listCodes("PAGE_SIZE_OPTION");
//
// // 유형 코드 목록 조회
// List<HashMap<String,String>> articleTypeCodes = codeService.listCodes("FAQ_TYPE");
//
// // 반환 정보
// model.addAttribute("pageIndex" , pageIndex);
// model.addAttribute("pageSize" , pageSize);
// model.addAttribute("searchKeyword", searchKeyword);
// model.addAttribute("pageSizeCodes", pageSizeCodes);
// model.addAttribute("faqTypeCodes" , articleTypeCodes);
// model.addAttribute("message" , message);
// model.addAttribute("faqType" , faqType);
// model.addAttribute("faqType" , faqType);
//
// return "nlib/board/listFAQs";
// }
//
//
// /**
// * FAQ 목록 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping(value="/board/listFAQsAjax.do")
// public ResponseEntity<String> listFAQsAjax(HttpServletRequest req,
// Authentication authentication, @RequestBody Map<String, String> paramMap) throws Exception {
//
// String searchKeyword = paramMap.get("searchKeyword");
// String pageIndex = StringUtil.getString(paramMap.get("pageIndex"), "1");
// String pageSize = StringUtil.getString(paramMap.get("pageSize") , DEFUALT_PAGE_SIZE);
// String faqType = paramMap.get("faqType");
//
// log.debug("listFAQsAjax > pageIndex = " + pageIndex);
// log.debug("listFAQsAjax > pageSize = " + pageSize);
// log.debug("listFAQsAjax > searchKeyword = " + searchKeyword);
// log.debug("listFAQsAjax > faqType = " + faqType);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.setPageIndex(pageIndex);
// reqVO.setPageSize(pageSize);
// reqVO.addInfoItem("searchKeyword", searchKeyword);
// reqVO.addInfoItem("faqType", faqType);
//
// // 요청
// DataApiResVO resVO = boardService.listFAQs(reqVO);
//
// //-------------------------------
// // JSON변환 응답 처리
// //-------------------------------
// // JS-GRID 페이징 처리를 포함한 응답값 처리
// // {data: [{...}],
// // itemsCount: 255
// // }
// HashMap<String, Object> retMap = new HashMap<String, Object>();
// retMap.put("data", resVO.getList());
// retMap.put("itemsCount", resVO.getRecordTotCount());
//
// return makeResponseEntityJson(retMap);
// }
//
//
// /**
// * 묻고답하기 상세 내용 조회한다.
// *
// * @param req
// * @return
// */
// @RequestMapping("/board/selectFAQAjax.do")
// public ResponseEntity<String> selectFAQAjax(HttpServletRequest req, Authentication authentication, @RequestBody Map<String, String> paramMap) throws Exception {
//
// // 게시물 번호
// String articleNo = paramMap.get("articleNo");
//
// log.debug("selectQnA > articleNo = " + articleNo);
//
// //-------------------------------
// // REQ VO 구성
// //-------------------------------
// DataApiReqVO reqVO = new DataApiReqVO();
// reqVO.setAuthKey(createAuthKey(req, authentication));
// reqVO.addInfoItem("boardNo", "FAQ"); // 게시판ID
// reqVO.addInfoItem("articleNo", articleNo); // 게시물번호
//
// // 요청
// DataApiResVO resVO = boardService.selectFAQ(reqVO);
//
// // 반환 정보
// return makeResponseEntityJson(resVO.getInfo());
// }
//
// @RequestMapping("/board/verifyWriter.do")
// public String verifyWriter(HttpServletRequest req) throws Exception {
// return "nlib/board/verifyWriter";
// }
}

View File

@ -0,0 +1,30 @@
package nlib.cmm.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import nlib.user.service.NlibLoginVO;
public interface AlertService
{
/*
* 사용자 알림 목록을 조회한다.
*/
public List<AlertVO> listAlerts(AlertVO alertVO) throws Exception;
// /*
// * 사용자 미확인 신규 알림 건수를 조회한다.
// */
// public HashMap<String, String> selectNewAlertCount(NlibLoginVO nlibLoginVO) throws Exception;
//
// /*
// * 가장 최근 알림건을 읽음 처리하고 내용을 조회한다.
// */
// public HashMap<String, String> selectAlert(NlibLoginVO nlibLoginVO, int nlibAlertId) throws Exception;
}

View File

@ -0,0 +1,85 @@
package nlib.cmm.service;
public class AlertVO extends PagingVO {
private String nlibAlertId; /* 알림ID */
private String title; /* 알림제목 */
private String content; /* 알림내용 */
private String alertType; /* 알림유형 */
private String alertDivCd; /* 알림내용구분코드 */
private String readDd; /* 알림확인일시 */
private String RegId; /* 등록자아이디 */
private String regDd; /* 등록일자 */
private String mbInfoId; /* 알림대상자 회원아이디 */
private String readYn; /* 알림확인여부 */
private int totCnt = 0;
public String getNlibAlertId() {
return nlibAlertId;
}
public void setNlibAlertId(String nlibAlertId) {
this.nlibAlertId = nlibAlertId;
}
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 getAlertType() {
return alertType;
}
public void setAlertType(String alertType) {
this.alertType = alertType;
}
public String getAlertDivCd() {
return alertDivCd;
}
public void setAlertDivCd(String alertDivCd) {
this.alertDivCd = alertDivCd;
}
public String getReadDd() {
return readDd;
}
public void setReadDd(String readDd) {
this.readDd = readDd;
}
public String getRegId() {
return RegId;
}
public void setRegId(String regId) {
RegId = regId;
}
public String getRegDd() {
return regDd;
}
public void setRegDd(String regDd) {
this.regDd = regDd;
}
public String getMbInfoId() {
return mbInfoId;
}
public void setMbInfoId(String mbInfoId) {
this.mbInfoId = mbInfoId;
}
public int getTotCnt() {
return totCnt;
}
public void setTotCnt(int totCnt) {
this.totCnt = totCnt;
}
public String getReadYn() {
return readYn;
}
public void setReadYn(String readYn) {
this.readYn = readYn;
}
}

View File

@ -0,0 +1,29 @@
package nlib.cmm.service;
public class PagingVO {
String pageIndex; /* 페이지 번호 */
String pageSize; /* 페이지 크기 (1페이지당 보여줄 자료건수) */
int totRecordCount; /* 총건수 */
public String getPageIndex() {
return pageIndex;
}
public void setPageIndex(String pageIndex) {
this.pageIndex = pageIndex;
}
public String getPageSize() {
return pageSize;
}
public void setPageSize(String pageSize) {
this.pageSize = pageSize;
}
public int getTotRecordCount() {
return totRecordCount;
}
public void setTotRecordCount(int totRecordCount) {
this.totRecordCount = totRecordCount;
}
}

View File

@ -0,0 +1,51 @@
package nlib.cmm.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import egovframework.com.cmm.service.impl.EgovComAbstractDAO;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import nlib.cmm.service.AlertVO;
import nlib.cmm.service.NlibProperty;
import nlib.user.service.NlibLoginVO;
import nlib.util.StringUtil;
/**
* <pre>
* @Class Name : InformDAO.java
*
* @Description : 이용안내 약관관련 정보 제공 DAO
*
*
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
*
* </pre>
*
* @ ------------ -------- ---------------------------
* @ 수정일 수정자 수정내용
* @ ------------ -------- ---------------------------
* @ 2021. 7. 27. KNKIM 최초 생성
*
*
* @author 이씨플라자 * DIGITALSHIP KNKIM
* @since 2021. 7. 27.
* @version 1.0
*
*/
@Repository("alertDAO")
public class AlertDAO extends EgovComAbstractDAO {
/*
* 사용자 알림 목록을 조회한다.
*/
public List<AlertVO> listAlerts(AlertVO searchAlertVO) throws Exception {
return selectList("AlertDAO.listAlerts", searchAlertVO);
}
}

View File

@ -0,0 +1,51 @@
package nlib.cmm.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import nlib.cmm.service.AlertService;
import nlib.cmm.service.AlertVO;
import nlib.cmm.service.NlibProperty;
import nlib.user.service.NlibLoginVO;
import nlib.util.StringUtil;
@Service("alertService")
public class AlertServiceImpl implements AlertService
{
private static final Logger log = LoggerFactory.getLogger(AlertServiceImpl.class);
@Resource(name="alertDAO")
private AlertDAO alertDAO;
/*
* 사용자 알림 목록을 조회한다.
*/
public List<AlertVO> listAlerts(AlertVO alertVO) throws Exception {
return alertDAO.listAlerts(alertVO);
}
//
// /*
// * 사용자 미확인 신규 알림 건수를 조회한다.
// */
// public int selectNewAlertCount(String mbInfoId) throws Exception {
// return alertDAO.selectNewAlertCount(mbInfoId);
// }
//
// /*
// * 알림건을 읽음 처리하고 내용을 조회한다.
// * 이미 읽은 건의 경우, 내용만 조회한다.
// */
// public HashMap<String, String> selectUserAlert(AlertVO alertVO) throws Exception {
// return alertDAO.selectUserAlert(alertVO);
// }
}

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?><!--Converted at: Wed May 11 15:49:38 KST 2016-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="AlertDAO">
<select id="listAlerts" parameterType="AlertVO" resultType="AlertVO">
<![CDATA[
SELECT
NLIB_ALERT_ID
, MB_INFO_ID
, TITLE
, CONTENT
, ALERT_TYPE
, ALERT_DIV_CD
, ALERT_DIV_CD AS ALERT_DIV_NM
, IF(READ_DD IS NULL, 'N', 'Y') AS READ_YN
, DATE_FORMAT(A.REG_DD, '%Y-%m-%d') AS REG_DD
, COUNT(NLIB_ALERT_ID) OVER(PARTITION BY 1) AS TOT_CNT
FROM TMP_NLIB_ALERT A
WHERE A.MB_INFO_ID = #{mbInfoId}
AND A.REG_DD > DATE_SUB(NOW(), INTERVAL 1 MONTH)
ORDER BY NLIB_ALERT_ID DESC
]]>
</select>
</mapper>

View File

@ -0,0 +1,221 @@
<%
/**
* <pre>
* @Class Name : lisAlerts.jsp
*
* @Description : 알림 목록을 조회한다.
*
*
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
*
* </pre>
*
* @ ------------ -------- ---------------------------
* @ 수정일 수정자 수정내용
* @ ------------ -------- ---------------------------
* @ 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" %>
<c:set var="pageTitle">알림</c:set>
<!DOCTYPE html>
<html lang="ko">
<head>
<title>${pageTitle}</title>
<!-- GRID -->
<link type="text/css" rel="stylesheet" href="/nlib/js/jsgrid/nlib-jsgrid.css" />
<link type="text/css" rel="stylesheet" href="/nlib/js/jsgrid/nlib-jsgrid-theme.css" />
<script src="/nlib/js/jsgrid/nlib-jsgrid.js"></script>
<script type="text/javaScript" language="javascript">
$( document ).ready(function() {
//=======================================================
// 그리드 생성 환경설정
//=======================================================
$("#jsGrid").jsGrid({
pageSize : $("#pageSize").val(),
scrollOffset:0,
controller: {
loadData: function (filter) { // 그리드에 데이터를 가져올 때 실팽되는 함수
var data = $.Deferred();
//======================================
// 요청 정보 구성 : 시작 (각 요청에 맞게 조정)
//======================================
var reqUrl = "${pageContext.request.contextPath}/cmm/listAlertsAjax.do";
var pageIndex = ( filter && filter.pageIndex ? filter.pageIndex : $("#pageIndex").val());
var pageSize = ( filter && filter.pageSize ? filter.pageSize : $("#pageSize").val());
$("#pageIndex").val(pageIndex);
var inputData = {
"pageIndex" : pageIndex
, "pageSize": pageSize};
//--------------------------------------
// 요청 처리
//--------------------------------------
$.ajax({
type: "post",
contentType: "application/json; charset=utf-8",
url: reqUrl,
dataType: "json",
data: JSON.stringify(inputData),
}).done(function(response){
<%
// 그리드 데이터 예시 :
// (1) 페이징 클라이언트에서 수행하는 경우(pageloading = false) : [{ "articleNo": 1, "articleType": "01" }, { "articleNo": 2, "articleType": "02" }]
// (2) 페이징 서버에서 수행하는 경우(pageloading = true) : {data: [{...}], itemsCount: 255}
%>
var jsonObj = JSON.parse(response);
//$("#itemsCount").val(jsonOjb.itemsCount);
console.log(jsonObj.itemsCount);
if(jsonObj.itemsCount == undefined) $("#itemsCount").val("0");
else $("#itemsCount").val(jsonObj.itemsCount);
data.resolve(jsonObj);
});
return data.promise();
} // loadData
},
rowClick: function(args) { // 행 클릭 시, 실행되는 이벤트 함수
// 클릭된 행의 자료 객체
var getData = args.item;
// 추출할 컬럼의 데이터 가져오기
var articleNo = getData["articleNo"];
var selectedRow = $("#jsGrid").find('table tr.jsgrid-selected-row');
// 상세 내용 보기
fn_viewDetail(articleNo, selectedRow);
},
//======================================
// 그리드 컬럼 정의 (각 요청에 맞게 조정)
//======================================
fields: [
{ title:"ID", name: "nlibAlertId" , type: "text", width: 200, align: "left" },
{ title:"구분", name: "alertDivCd" , type: "text", width: 100, align: "center"},
{ title:"제목", name: "title" , type: "text", width: 200, align: "left" },
{ title:"날짜", name: "regDd" , type: "text", width: 100, align: "center"}
]
});
// 검색 버튼 클릭
$("#btnSearch").on("click", function(e) {
fn_searchArticle($("#pageSize").val(), 1);
});
//초기 자료 조회
fn_searchArticle();
}); // document ready
// 선택한 게시글 상세 보기로 이동
function fn_viewDetail(articleNo, selectedRow) {
var $selectedRow = $(selectedRow);
var reqUrl = "${pageContext.request.contextPath}/board/selectFAQAjax.do";
var searchKeyword = document.articleForm.searchKeyword.value;
var pageIndex = $("#pageIndex").val();
var pageSize = $("#pageSize").val();
var faqType = document.articleForm.faqType.value;
var inputData = {
"searchKeyword" : searchKeyword
, "pageIndex" : pageIndex
, "pageSize": pageSize
, "faqType": faqType};
//--------------------------------------
// 요청 처리
//--------------------------------------
$.ajax({
type: "post",
contentType: "application/json; charset=utf-8",
url: reqUrl,
dataType: "json",
data: JSON.stringify(inputData),
}).done(function(response){
var jsonObj = JSON.parse(response);
$("#jsGrid").find('table tr.answer').remove();
//alert("DDDDDDDD remove = " + $("#jsGrid")[0].scrollHeight);
$selectedRow.after("<tr class='answer'><td colspan='3'>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "</td></tr>");
//alert("DDDDDDDD add = " + $("#jsGrid")[0].scrollHeight);
//$("#jsGrid").find('table.jsgrid-table.jsgrid-grid-body').height($("#jsGrid").find('table.jsgrid-table')[0].scrollHeight + 100);
});
$("#jsGrid").closest('.ui-jqgrid-bdiv').width($("#jsGrid").closest('.ui-jqgrid-bdiv').width() + 1);
}
// 그리드 데이터 조회 호출
function fn_searchArticle(pageSize, pageIndex) {
$("#jsGrid").jsGrid("search"
, {'pageSize' : (pageSize ? pageSize : fn_getIntValue("pageSize", ${pageSize}) ),
'pageIndex' : (pageIndex ? pageIndex : fn_getIntValue("pageIndex", 1))
}
);
}
</script>
</head>
<body>
<h1>${pageTitle }</h1>
메시지 : ${message}
&nbsp;<br/>
<form name="articleForm" id="articleForm"
action="${pageContext.request.contextPath}/cmm/listAlerts.do"
method="post">
<!-- 검색조건 -->
<input type="text" name="pageSize" id="pageSize" value="${pageSize }" />
<input type="text" name="itemsCount" id="itemsCount" value="0" />
<input type="text" name="pageIndex" id="pageIndex" title="페이지번호" value="${pageIndex }" size="5" maxlength="5" />
<input type="button" name="btnSearch" id="btnSearch" title="새로고침" value="새로고침" />
<br/>
<div id="jsGrid" name="jsGrid" style="height: 100%"></div>
<input type="text" name="articleNo" id="articleNo" value="" title="선택글번호" readonly />
</form>
</body>
</html>