/**
   * 설문문항 목록을 조회한다.
   *
   * @param searchVO
   * @param qustnrQestnManageVO
   * @param commandMap
   * @param model
   * @return "egovframework/com/uss/olp/qqm/EgovQustnrQestnManageList"
   * @throws Exception
   */
  @IncludedInfo(name = "질문관리", order = 630, gid = 50)
  @RequestMapping(value = "/uss/olp/qqm/EgovQustnrQestnManageList.do")
  public String egovQustnrQestnManageList(
      @ModelAttribute("searchVO") ComDefaultVO searchVO,
      @ModelAttribute("qustnrQestnManageVO") QustnrQestnManageVO qustnrQestnManageVO,
      Map commandMap,
      ModelMap model)
      throws Exception {
    // 0. Spring Security 사용자권한 처리
    Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
    if (!isAuthenticated) {
      model.addAttribute("message", egovMessageSource.getMessage("fail.common.login"));
      return "egovframework/com/uat/uia/EgovLoginUsr";
    }

    // 로그인 객체 선언
    LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();

    String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd");
    String sSearchMode =
        commandMap.get("searchMode") == null ? "" : (String) commandMap.get("searchMode");

    if (sCmd.equals("del")) {
      egovQustnrQestnManageService.deleteQustnrQestnManage(qustnrQestnManageVO);
    }

    // 설문지정보에서 넘어오면 자동검색 설정
    if (sSearchMode.equals("Y")) {
      searchVO.setSearchCondition("QESTNR_ID");
      searchVO.setSearchKeyword(qustnrQestnManageVO.getQestnrId());
    }

    /** EgovPropertyService.sample */
    searchVO.setPageUnit(propertiesService.getInt("pageUnit"));
    searchVO.setPageSize(propertiesService.getInt("pageSize"));

    /** pageing */
    PaginationInfo paginationInfo = new PaginationInfo();
    paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
    paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
    paginationInfo.setPageSize(searchVO.getPageSize());

    searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
    searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
    searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());

    List sampleList = egovQustnrQestnManageService.selectQustnrQestnManageList(searchVO);
    model.addAttribute("resultList", sampleList);

    int totCnt = (Integer) egovQustnrQestnManageService.selectQustnrQestnManageListCnt(searchVO);
    paginationInfo.setTotalRecordCount(totCnt);
    model.addAttribute("paginationInfo", paginationInfo);

    return "egovframework/com/uss/olp/qqm/EgovQustnrQestnManageList";
  }
  /**
   * 설문템플릿 목록을 조회한다.
   *
   * @param searchVO
   * @param commandMap
   * @param qustnrTmplatManageVO
   * @param model
   * @return "/uss/olp/qtm/EgovQustnrTmplatManageList"
   * @throws Exception
   */
  @RequestMapping(value = "/uss/olp/qtm/EgovQustnrTmplatManageList.do")
  public String EgovQustnrTmplatManageList(
      @ModelAttribute("searchVO") ComDefaultVO searchVO,
      Map commandMap,
      QustnrTmplatManageVO qustnrTmplatManageVO,
      ModelMap model)
      throws Exception {

    String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd");

    if (sCmd.equals("del")) {
      egovQustnrTmplatManageService.deleteQustnrTmplatManage(qustnrTmplatManageVO);
    }

    /** EgovPropertyService.sample */
    searchVO.setPageUnit(propertiesService.getInt("pageUnit"));
    searchVO.setPageSize(propertiesService.getInt("pageSize"));

    /** pageing */
    PaginationInfo paginationInfo = new PaginationInfo();
    paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
    paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
    paginationInfo.setPageSize(searchVO.getPageSize());

    searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
    searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
    searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());

    // List sampleList = egovQustnrTmplatManageService.selectQustnrTmplatManageList(searchVO);
    model.addAttribute(
        "resultList", egovQustnrTmplatManageService.selectQustnrTmplatManageList(searchVO));

    model.addAttribute(
        "searchKeyword",
        commandMap.get("searchKeyword") == null ? "" : (String) commandMap.get("searchKeyword"));
    model.addAttribute(
        "searchCondition",
        commandMap.get("searchCondition") == null
            ? ""
            : (String) commandMap.get("searchCondition"));

    int totCnt = (Integer) egovQustnrTmplatManageService.selectQustnrTmplatManageListCnt(searchVO);
    paginationInfo.setTotalRecordCount(totCnt);
    model.addAttribute("paginationInfo", paginationInfo);

    return "/uss/olp/qtm/EgovQustnrTmplatManageList";
  }
  /**
   * 설문문항 팝업 록을 조회한다.
   *
   * @param searchVO
   * @param qustnrQestnManageVO
   * @param commandMap
   * @param model
   * @return "egovframework/com/uss/olp/qqm/EgovQustnrQestnManageListPopup"
   * @throws Exception
   */
  @RequestMapping(value = "/uss/olp/qqm/EgovQustnrQestnManageListPopup.do")
  public String egovQustnrQestnManageListPopup(
      @ModelAttribute("searchVO") ComDefaultVO searchVO,
      @ModelAttribute("qustnrQestnManageVO") QustnrQestnManageVO qustnrQestnManageVO,
      Map commandMap,
      ModelMap model)
      throws Exception {

    String sSearchMode =
        commandMap.get("searchMode") == null ? "" : (String) commandMap.get("searchMode");

    // 설문지정보에서 넘어오면 자동검색 설정
    if (sSearchMode.equals("Y")) {
      searchVO.setSearchCondition("QESTNR_ID");
      searchVO.setSearchKeyword(qustnrQestnManageVO.getQestnrId());
    }

    /** EgovPropertyService.sample */
    searchVO.setPageUnit(propertiesService.getInt("pageUnit"));
    searchVO.setPageSize(propertiesService.getInt("pageSize"));

    /** pageing */
    PaginationInfo paginationInfo = new PaginationInfo();
    paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
    paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
    paginationInfo.setPageSize(searchVO.getPageSize());

    searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
    searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
    searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());

    List resultList = egovQustnrQestnManageService.selectQustnrQestnManageList(searchVO);
    model.addAttribute("resultList", resultList);

    int totCnt = (Integer) egovQustnrQestnManageService.selectQustnrQestnManageListCnt(searchVO);
    paginationInfo.setTotalRecordCount(totCnt);
    model.addAttribute("paginationInfo", paginationInfo);

    return "egovframework/com/uss/olp/qqm/EgovQustnrQestnManageListPopup";
  }
  /**
   * 템플릿 메인 페이지 조회
   *
   * @return 메인페이지 정보 Map [key : 항목명]
   * @param request
   * @param model
   * @exception Exception Exception
   */
  @RequestMapping(value = "/cmm/main/mainPage.do")
  public String getMgtMainPage(HttpServletRequest request, ModelMap model) throws Exception {

    // 공지사항 메인 컨텐츠 조회 시작 ---------------------------------
    BoardVO boardVO = new BoardVO();
    boardVO.setPageUnit(5);
    boardVO.setPageSize(10);
    boardVO.setBbsId("BBSMSTR_AAAAAAAAAAAA");

    PaginationInfo paginationInfo = new PaginationInfo();

    paginationInfo.setCurrentPageNo(boardVO.getPageIndex());
    paginationInfo.setRecordCountPerPage(boardVO.getPageUnit());
    paginationInfo.setPageSize(boardVO.getPageSize());

    boardVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
    boardVO.setLastIndex(paginationInfo.getLastRecordIndex());
    boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());

    Map<String, Object> map = bbsMngService.selectBoardArticles(boardVO, "BBSA02");
    model.addAttribute("notiList", map.get("resultList"));

    // 공지사항 메인컨텐츠 조회 끝 -----------------------------------

    // 자유게시판 메인 컨텐츠 조회 시작 ---------------------------------
    boardVO.setPageUnit(9);
    boardVO.setPageSize(10);
    boardVO.setBbsId("BBSMSTR_BBBBBBBBBBBB");

    paginationInfo.setCurrentPageNo(boardVO.getPageIndex());
    paginationInfo.setRecordCountPerPage(boardVO.getPageUnit());
    paginationInfo.setPageSize(boardVO.getPageSize());

    boardVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
    boardVO.setLastIndex(paginationInfo.getLastRecordIndex());
    boardVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());

    model.addAttribute(
        "bbsList", bbsMngService.selectBoardArticles(boardVO, "BBSA02").get("resultList"));

    // 자유게시판 메인컨텐츠 조회 끝 -----------------------------------

    // FAQ 메인 컨텐츠 조회 시작 ---------------------------------
    /** EgovPropertyService.SiteList */
    FaqManageDefaultVO searchVO = new FaqManageDefaultVO();
    searchVO.setPageUnit(3);
    searchVO.setPageSize(10);

    /** pageing */
    paginationInfo.setCurrentPageNo(searchVO.getPageIndex());
    paginationInfo.setRecordCountPerPage(searchVO.getPageUnit());
    paginationInfo.setPageSize(searchVO.getPageSize());

    searchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
    searchVO.setLastIndex(paginationInfo.getLastRecordIndex());
    searchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());

    model.addAttribute("faqList", faqManageService.selectFaqList(searchVO));

    // FAQ 메인 컨텐츠 조회 끝 -----------------------------------

    // 설문참여 메인 컨텐츠 조회 시작 -----------------------------------
    ComDefaultVO qVO = new ComDefaultVO();
    qVO.setPageUnit(1);
    qVO.setPageSize(10);

    /** pageing */
    paginationInfo.setCurrentPageNo(qVO.getPageIndex());
    paginationInfo.setRecordCountPerPage(qVO.getPageUnit());
    paginationInfo.setPageSize(qVO.getPageSize());

    qVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
    qVO.setLastIndex(paginationInfo.getLastRecordIndex());
    qVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());

    model.addAttribute(
        "qriList", egovQustnrRespondInfoService.selectQustnrRespondInfoManageList(qVO));

    // 설문참여 메인 컨텐츠 조회 끝 -----------------------------------

    return "main/EgovMainView";
  }