/**
   * 신규 게시판 마스터 등록을 위한 등록페이지로 이동한다.
   *
   * @param boardMasterVO
   * @param model
   * @return
   * @throws Exception
   */
  @RequestMapping("/cop/bbs/addBBSMaster.do")
  public String addBBSMaster(
      @ModelAttribute("searchVO") BoardMasterVO boardMasterVO, ModelMap model) throws Exception {
    BoardMaster boardMaster = new BoardMaster();

    ComDefaultCodeVO vo = new ComDefaultCodeVO();

    vo.setCodeId("COM004");

    List<?> codeResult = cmmUseService.selectCmmCodeDetail(vo);

    model.addAttribute("typeList", codeResult);

    vo.setCodeId("COM009");

    codeResult = cmmUseService.selectCmmCodeDetail(vo);

    model.addAttribute("attrbList", codeResult);
    model.addAttribute("boardMaster", boardMaster);

    String flag = propertyService.getString("Globals.addedOptions");
    if (flag != null && flag.trim().equalsIgnoreCase("true")) {
      model.addAttribute("addedOptions", "true");
    }

    return "cop/bbs/EgovBoardMstrRegist";
  }
  /**
   * 게시판 사용을 위한 신규 게시판 속성정보를 생성한다.
   *
   * @param boardMasterVO
   * @param boardMaster
   * @param bindingResult
   * @param status
   * @param model
   * @return
   * @throws Exception
   */
  @RequestMapping("/cop/bbs/insertBdMstrByTrget.do")
  public String insertBdMstrByTrget(
      @ModelAttribute("searchVO") BoardMasterVO boardMasterVO,
      @ModelAttribute("boardMaster") BoardMaster boardMaster,
      BindingResult bindingResult,
      SessionStatus status,
      ModelMap model)
      throws Exception {

    checkAuthority(boardMasterVO); // server-side 권한 확인

    LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
    Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();

    beanValidator.validate(boardMaster, bindingResult);
    if (bindingResult.hasErrors()) {

      ComDefaultCodeVO vo = new ComDefaultCodeVO();

      vo.setCodeId("COM004");

      List<?> codeResult = cmmUseService.selectCmmCodeDetail(vo);

      model.addAttribute("typeList", codeResult);

      vo.setCodeId("COM009");

      codeResult = cmmUseService.selectCmmCodeDetail(vo);

      model.addAttribute("attrbList", codeResult);

      return "cop/bbs/EgovBdMstrRegistByTrget";
    }

    boardMaster.setFrstRegisterId(user.getUniqId());
    boardMaster.setUseAt("Y");
    boardMaster.setBbsUseFlag("Y");

    String registSeCode = "REGC06";

    if ("CLB".equals(EgovStringUtil.cutString(boardMaster.getTrgetId(), 3))) {
      registSeCode = "REGC05";
    }
    boardMaster.setRegistSeCode(registSeCode);

    if (isAuthenticated) {
      bbsAttrbService.insertBBSMastetInf(boardMaster);
      model.addAttribute("S_FLAG", "S");
    }

    return "forward:/cop/bbs/selectBdMstrListByTrget.do";
  }
  /**
   * 기업회원목록을 조회한다. (pageing)
   *
   * @param userSearchVO 검색조건정보
   * @param model 화면모델
   * @return uss/umt/EgovEntrprsMberManage
   * @throws Exception
   */
  @IncludedInfo(name = "기업회원관리", order = 450, gid = 50)
  @RequestMapping(value = "/uss/umt/EgovEntrprsMberManage.do")
  public String selectEntrprsMberList(
      @ModelAttribute("userSearchVO") UserDefaultVO userSearchVO, ModelMap model) throws Exception {
    /** EgovPropertyService.sample */
    userSearchVO.setPageUnit(propertiesService.getInt("pageUnit"));
    userSearchVO.setPageSize(propertiesService.getInt("pageSize"));

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

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

    List entrprsList = entrprsManageService.selectEntrprsMberList(userSearchVO);
    model.addAttribute("resultList", entrprsList);

    int totCnt = entrprsManageService.selectEntrprsMberListTotCnt(userSearchVO);
    paginationInfo.setTotalRecordCount(totCnt);
    model.addAttribute("paginationInfo", paginationInfo);

    // 사용자상태코드를 코드정보로부터 조회
    ComDefaultCodeVO vo = new ComDefaultCodeVO();
    vo.setCodeId("COM013");
    List entrprsMberSttus_result = cmmUseService.selectCmmCodeDetail(vo);
    model.addAttribute("entrprsMberSttus_result", entrprsMberSttus_result); // 기업회원상태코드목록

    return "egovframework/com/uss/umt/EgovEntrprsMberManage";
  }
  /**
   * 설문관리 목록을 상세조회 조회한다.
   *
   * @param searchVO
   * @param qustnrManageVO
   * @param commandMap
   * @param model
   * @return "egovframework/com/uss/olp/qmc/EgovQustnrManageDetail";
   * @throws Exception
   */
  @RequestMapping(value = "/uss/olp/qmc/EgovQustnrManageDetail.do")
  public String egovQustnrManageDetail(
      @ModelAttribute("searchVO") ComDefaultVO searchVO,
      QustnrManageVO qustnrManageVO,
      @CommandMap Map commandMap,
      ModelMap model)
      throws Exception {

    String sLocationUrl = "egovframework/com/uss/olp/qmc/EgovQustnrManageDetail";

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

    if (sCmd.equals("del")) {
      egovQustnrManageService.deleteQustnrManage(qustnrManageVO);
      sLocationUrl = "redirect:/uss/olp/qmc/EgovQustnrManageList.do";
    } else {

      // 공통코드  직업유형 조회
      ComDefaultCodeVO voComCode = new ComDefaultCodeVO();
      voComCode.setCodeId("COM034");
      List listComCode = cmmUseService.selectCmmCodeDetail(voComCode);
      model.addAttribute("comCode034", listComCode);

      List sampleList = egovQustnrManageService.selectQustnrManageDetail(qustnrManageVO);
      model.addAttribute("resultList", sampleList);
    }

    return sLocationUrl;
  }
  /**
   * 설문문항 목록을 상세조회 조회한다.
   *
   * @param searchVO
   * @param qustnrQestnManageVO
   * @param commandMap
   * @param model
   * @return "egovframework/com/uss/olp/qqm/EgovQustnrQestnManageDetail"
   * @throws Exception
   */
  @RequestMapping(value = "/uss/olp/qqm/EgovQustnrQestnManageDetail.do")
  public String egovQustnrQestnManageDetail(
      @ModelAttribute("searchVO") ComDefaultVO searchVO,
      @ModelAttribute("qustnrQestnManageVO") QustnrQestnManageVO qustnrQestnManageVO,
      Map commandMap,
      ModelMap model)
      throws Exception {

    String sLocationUrl = "egovframework/com/uss/olp/qqm/EgovQustnrQestnManageDetail";

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

    if (sCmd.equals("del")) {
      egovQustnrQestnManageService.deleteQustnrQestnManage(qustnrQestnManageVO);
      /** 목록으로갈때 검색조건 유지 */
      sLocationUrl = "redirect:/uss/olp/qqm/EgovQustnrQestnManageList.do?";
      sLocationUrl = sLocationUrl + "searchMode=" + qustnrQestnManageVO.getSearchMode();
      sLocationUrl = sLocationUrl + "&qestnrId=" + qustnrQestnManageVO.getQestnrId();
      sLocationUrl = sLocationUrl + "&qestnrTmplatId=" + qustnrQestnManageVO.getQestnrTmplatId();
    } else {
      // 공통코드 질문유형 조회
      ComDefaultCodeVO voComCode = new ComDefaultCodeVO();
      voComCode.setCodeId("COM018");
      List listComCode = cmmUseService.selectCmmCodeDetail(voComCode);
      model.addAttribute("cmmCode018", listComCode);

      List sampleList =
          egovQustnrQestnManageService.selectQustnrQestnManageDetail(qustnrQestnManageVO);
      model.addAttribute("resultList", sampleList);
    }

    return sLocationUrl;
  }
  /**
   * 등록된 휴가관리의 상세정보를 조회한다.
   *
   * @param vcatnManageVO - 휴가관리 VO
   * @return String - 리턴 Url
   */
  @RequestMapping(value = "/uss/ion/vct/EgovVcatnManageDetail.do")
  public String selectVcatnManage(
      @ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO,
      @ModelAttribute("vcatnManage") VcatnManage vcatnManage,
      @RequestParam Map<?, ?> commandMap,
      ModelMap model)
      throws Exception {
    List<?> vcatnSeCodeList = null;
    String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd"); // 상세정보 구분
    vcatnManageVO.setBgnde(EgovStringUtil.removeMinusChar(vcatnManageVO.getBgnde()));
    vcatnManageVO.setEndde(EgovStringUtil.removeMinusChar(vcatnManageVO.getEndde()));

    // 등록 상세정보
    VcatnManageVO vcatnManageVOTemp = egovVcatnManageService.selectVcatnManage(vcatnManageVO);

    model.addAttribute("vcatnManageVO", vcatnManageVOTemp);
    model.addAttribute("message", egovMessageSource.getMessage("success.common.select"));

    if (sCmd.equals("updt")) {

      ComDefaultCodeVO vo = new ComDefaultCodeVO();
      vo.setCodeId("COM056");
      vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo);

      model.addAttribute("vcatnSeCode", vcatnSeCodeList);
      model.addAttribute("vcatnManage", vcatnManageVOTemp);
      return "egovframework/com/uss/ion/vct/EgovVcatnUpdt";
    } else {
      return "egovframework/com/uss/ion/vct/EgovVcatnDetail";
    }
  }
  /**
   * 승인(탈퇴)요청 확인 처리를 위해 수정페이지로 이동한다.
   *
   * @param historyVO
   * @param status
   * @param model
   * @return
   * @throws Exception
   */
  @SuppressWarnings("unchecked")
  @RequestMapping("/cop/com/forUpdateConfirmRequest.do")
  public String forUpdateConfirmRequest(
      @ModelAttribute("searchVO") ConfirmHistoryVO historyVO, SessionStatus status, ModelMap model)
      throws Exception {

    LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
    Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();

    historyVO.setConfmerId(user.getUniqId());

    if (isAuthenticated) {
      ConfirmHistoryVO vo = confmService.selectSingleConfirmRequest(historyVO);
      model.addAttribute("historyVO", vo);
    }

    ComDefaultCodeVO vo = new ComDefaultCodeVO();

    vo.setCodeId("COM007");

    List codeResult = cmmUseService.selectCmmCodeDetail(vo);

    model.addAttribute("typeList", codeResult);

    return "egovframework/com/cop/com/EgovConfmInfUpdt";
  }
  /**
   * 신규 게시판 마스터 정보를 등록한다.
   *
   * @param boardMasterVO
   * @param boardMaster
   * @param status
   * @return
   * @throws Exception
   */
  @RequestMapping("/cop/bbs/insertBBSMasterInf.do")
  public String insertBBSMasterInf(
      @ModelAttribute("searchVO") BoardMasterVO boardMasterVO,
      @ModelAttribute("boardMaster") BoardMaster boardMaster,
      BindingResult bindingResult,
      SessionStatus status,
      ModelMap model)
      throws Exception {
    LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
    Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();

    beanValidator.validate(boardMaster, bindingResult);
    if (bindingResult.hasErrors()) {

      ComDefaultCodeVO vo = new ComDefaultCodeVO();

      vo.setCodeId("COM004");

      List<?> codeResult = cmmUseService.selectCmmCodeDetail(vo);

      model.addAttribute("typeList", codeResult);

      vo.setCodeId("COM009");

      codeResult = cmmUseService.selectCmmCodeDetail(vo);

      model.addAttribute("attrbList", codeResult);

      return "cop/bbs/EgovBoardMstrRegist";
    }

    if (isAuthenticated) {
      boardMaster.setFrstRegisterId(user.getUniqId());
      boardMaster.setUseAt("Y");
      boardMaster.setTrgetId("SYSTEMDEFAULT_REGIST");
      boardMaster.setPosblAtchFileSize(propertyService.getString("posblAtchFileSize"));

      bbsAttrbService.insertBBSMastetInf(boardMaster);
    }

    return "forward:/cop/bbs/SelectBBSMasterInfs.do";
  }
  /**
   * 설문관리를 등록한다.
   *
   * @param searchVO
   * @param commandMap
   * @param qustnrManageVO
   * @param bindingResult
   * @param model
   * @return "egovframework/com/uss/olp/qmc/EgovQustnrManageRegist"
   * @throws Exception
   */
  @RequestMapping(value = "/uss/olp/qmc/EgovQustnrManageRegist.do")
  public String qustnrManageRegist(
      @ModelAttribute("searchVO") ComDefaultVO searchVO,
      @CommandMap Map commandMap,
      @ModelAttribute("qustnrManageVO") QustnrManageVO qustnrManageVO,
      BindingResult bindingResult,
      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 sLocationUrl = "egovframework/com/uss/olp/qmc/EgovQustnrManageRegist";

    String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd");
    LOGGER.info("cmd => {}", sCmd);

    // 공통코드  직업유형 조회
    ComDefaultCodeVO voComCode = new ComDefaultCodeVO();
    voComCode.setCodeId("COM034");
    List listComCode = cmmUseService.selectCmmCodeDetail(voComCode);
    model.addAttribute("comCode034", listComCode);

    if (sCmd.equals("save")) {

      beanValidator.validate(qustnrManageVO, bindingResult);
      if (bindingResult.hasErrors()) {
        // 설문템플릿 정보 불러오기
        List listQustnrTmplat =
            egovQustnrManageService.selectQustnrTmplatManageList(qustnrManageVO);
        model.addAttribute("listQustnrTmplat", listQustnrTmplat);
        return sLocationUrl;
      }

      // 아이디 설정
      qustnrManageVO.setFrstRegisterId((String) loginVO.getUniqId());
      qustnrManageVO.setLastUpdusrId((String) loginVO.getUniqId());

      egovQustnrManageService.insertQustnrManage(qustnrManageVO);
      sLocationUrl = "redirect:/uss/olp/qmc/EgovQustnrManageList.do";
    } else {
      // 설문템플릿 정보 불러오기
      List listQustnrTmplat = egovQustnrManageService.selectQustnrTmplatManageList(qustnrManageVO);
      model.addAttribute("listQustnrTmplat", listQustnrTmplat);
    }

    return sLocationUrl;
  }
  /**
   * 기업회원가입신청 등록화면으로 이동한다.
   *
   * @param userSearchVO 검색조건정보
   * @param entrprsManageVO 기업회원초기화정보
   * @param commandMap 파라메터전송 commandMap
   * @param model 화면모델
   * @return uss/umt/EgovEntrprsMberSbscrb
   * @throws Exception
   */
  @RequestMapping("/uss/umt/EgovEntrprsMberSbscrbView.do")
  public String sbscrbEntrprsMberView(
      @ModelAttribute("userSearchVO") UserDefaultVO userSearchVO,
      @ModelAttribute("entrprsManageVO") EntrprsManageVO entrprsManageVO,
      Map<String, Object> commandMap,
      Model model)
      throws Exception {
    ComDefaultCodeVO vo = new ComDefaultCodeVO();

    // 패스워드힌트목록을 코드정보로부터 조회
    vo.setCodeId("COM022");
    List passwordHint_result = cmmUseService.selectCmmCodeDetail(vo);
    // 성별구분코드를 코드정보로부터 조회
    vo.setCodeId("COM014");
    List sexdstnCode_result = cmmUseService.selectCmmCodeDetail(vo);
    // 기업구분코드를 코드정보로부터 조회 - COM026
    vo.setCodeId("COM026");
    List entrprsSeCode_result = cmmUseService.selectCmmCodeDetail(vo);
    // 업종코드를 코드정보로부터 조회 - COM027
    vo.setCodeId("COM027");
    List indutyCode_result = cmmUseService.selectCmmCodeDetail(vo);

    model.addAttribute("passwordHint_result", passwordHint_result); // 패스워트힌트목록
    model.addAttribute("sexdstnCode_result", sexdstnCode_result); // 성별구분코드목록
    model.addAttribute("entrprsSeCode_result", entrprsSeCode_result); // 기업구분코드 목록
    model.addAttribute("indutyCode_result", indutyCode_result); // 업종코드목록
    if (!"".equals((String) commandMap.get("realname"))) {
      model.addAttribute("applcntNm", (String) commandMap.get("realname")); // 실명인증된 이름 - 주민번호인증
      model.addAttribute(
          "applcntIhidnum", (String) commandMap.get("ihidnum")); // 실명인증된 주민등록번호 - 주민번호 인증
    }
    if (!"".equals((String) commandMap.get("realName"))) {
      model.addAttribute("applcntNm", (String) commandMap.get("realName")); // 실명인증된 이름 - ipin인증
    }
    // entrprsManageVO.setGroupId("DEFAULT");
    entrprsManageVO.setEntrprsMberSttus("DEFAULT");

    return "egovframework/com/uss/umt/EgovEntrprsMberSbscrb";
  }
  /**
   * 부서업무 정보를 조회한다.
   *
   * @param DeptJobVO
   * @return String
   * @param deptJobVO
   */
  @RequestMapping("/cop/smt/djm/selectDeptJob.do")
  public String selectDeptJob(@ModelAttribute("deptJobVO") DeptJobVO deptJobVO, ModelMap model)
      throws Exception {
    DeptJob deptJob = deptJobService.selectDeptJob(deptJobVO);
    model.addAttribute("deptJob", deptJob);

    /*
     * 공통코드
     * 우선순위 조회
     */
    ComDefaultCodeVO voComCode = new ComDefaultCodeVO();
    voComCode.setCodeId("COM059");
    List<CmmnDetailCode> listComCode = cmmUseService.selectCmmCodeDetail(voComCode);
    model.addAttribute("priort", listComCode);

    return "egovframework/com/cop/smt/djm/EgovDeptJobDetail";
  }
  /**
   * Q&A답변정보를 수정하기 위한 전 처리(공통코드 처리)
   *
   * @param qnaManageVO
   * @param searchVO
   * @param model
   * @return "/uss/olh/qna/EgovQnaCnAnswerUpdt"
   * @throws Exception
   */
  @RequestMapping("/uss/olh/qnm/QnaCnAnswerUpdtView.do")
  public String updateQnaCnAnswerView(
      QnaManageVO qnaManageVO,
      @ModelAttribute("searchVO") QnaManageDefaultVO searchVO,
      ModelMap model)
      throws Exception {

    // 공통코드를 가져오기 위한 Vo
    ComDefaultCodeVO vo = new ComDefaultCodeVO();
    vo.setCodeId("COM028");

    model.addAttribute("resultList", cmmUseService.selectCmmCodeDetail(vo));

    // 변수명은 CoC 에 따라
    model.addAttribute(selectQnaAnswerListDetail(qnaManageVO, searchVO, model));

    return "/uss/olh/qna/EgovQnaCnAnswerUpdt";
  }
  /**
   * 휴가관리 등록 화면으로 이동한다.
   *
   * @return String - 리턴 Url
   */
  @RequestMapping(value = "/uss/ion/vct/EgovVcatnRegist.do")
  public String insertViewVcatnManage(
      @ModelAttribute("vcatnManage") VcatnManage vcatnManage,
      @ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO,
      ModelMap model)
      throws Exception {
    List<?> vcatnSeCodeList = null;
    LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();

    VcatnManageVO vcatnManageVO1 = egovVcatnManageService.selectIndvdlYrycManage(user.getUniqId());
    vcatnManageVO1.setApplcntId(user.getUniqId());
    vcatnManageVO1.setApplcntNm(user.getName());
    vcatnManageVO1.setOrgnztNm(user.getOrgnztNm());

    ComDefaultCodeVO vo = new ComDefaultCodeVO();
    vo.setCodeId("COM056");
    vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo);

    model.addAttribute("vcatnSeCode", vcatnSeCodeList);
    model.addAttribute("vcatnManageVO", vcatnManageVO1);

    return "egovframework/com/uss/ion/vct/EgovVcatnRegist";
  }
  /**
   * 기업회원정보 수정을 위해기업회원정보를 상세조회한다.
   *
   * @param entrprsmberId 상세조회 대상 기업회원아이디
   * @param userSearchVO 조회조건정보
   * @param model 화면모델
   * @return uss/umt/EgovEntrprsMberSelectUpdt
   * @throws Exception
   */
  @RequestMapping("/uss/umt/EgovEntrprsMberSelectUpdtView.do")
  public String updateEntrprsMberView(
      @RequestParam("selectedId") String entrprsmberId,
      @ModelAttribute("searchVO") UserDefaultVO userSearchVO,
      Model model)
      throws Exception {
    EntrprsManageVO entrprsManageVO = new EntrprsManageVO();
    entrprsManageVO = entrprsManageService.selectEntrprsmber(entrprsmberId);
    model.addAttribute("entrprsManageVO", entrprsManageVO);
    model.addAttribute("userSearchVO", userSearchVO);

    ComDefaultCodeVO vo = new ComDefaultCodeVO();
    // 패스워드힌트목록을 코드정보로부터 조회
    vo.setCodeId("COM022");
    List passwordHint_result = cmmUseService.selectCmmCodeDetail(vo);
    // 성별구분코드를 코드정보로부터 조회
    vo.setCodeId("COM014");
    List sexdstnCode_result = cmmUseService.selectCmmCodeDetail(vo);
    // 사용자상태코드를 코드정보로부터 조회
    vo.setCodeId("COM013");
    List entrprsMberSttus_result = cmmUseService.selectCmmCodeDetail(vo);
    // 그룹정보를 조회 - GROUP_ID정보
    vo.setTableNm("COMTNORGNZTINFO");
    List groupId_result = cmmUseService.selectGroupIdDetail(vo);
    // 기업구분코드를 코드정보로부터 조회 - COM026
    vo.setCodeId("COM026");
    List entrprsSeCode_result = cmmUseService.selectCmmCodeDetail(vo);
    // 업종코드를 코드정보로부터 조회 - COM027
    vo.setCodeId("COM027");
    List indutyCode_result = cmmUseService.selectCmmCodeDetail(vo);

    model.addAttribute("passwordHint_result", passwordHint_result); // 패스워트힌트목록
    model.addAttribute("sexdstnCode_result", sexdstnCode_result); // 성별구분코드목록
    model.addAttribute("entrprsMberSttus_result", entrprsMberSttus_result); // 사용자상태코드목록
    model.addAttribute("groupId_result", groupId_result); // 그룹정보 목록
    model.addAttribute("entrprsSeCode_result", entrprsSeCode_result); // 기업구분코드 목록
    model.addAttribute("indutyCode_result", indutyCode_result); // 업종코드목록

    return "egovframework/com/uss/umt/EgovEntrprsMberSelectUpdt";
  }
  /**
   * 설문문항를 등록한다.
   *
   * @param searchVO
   * @param commandMap
   * @param qustnrQestnManageVO
   * @param bindingResult
   * @param model
   * @return "egovframework/com/uss/olp/qqm/EgovQustnrQestnManageRegist"
   * @throws Exception
   */
  @RequestMapping(value = "/uss/olp/qqm/EgovQustnrQestnManageRegist.do")
  public String qustnrQestnManageRegist(
      @ModelAttribute("searchVO") ComDefaultVO searchVO,
      Map commandMap,
      @ModelAttribute("qustnrQestnManageVO") QustnrQestnManageVO qustnrQestnManageVO,
      BindingResult bindingResult,
      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 sLocationUrl = "egovframework/com/uss/olp/qqm/EgovQustnrQestnManageRegist";

    String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd");
    log.info("cmd =>" + sCmd);

    // 공통코드 질문유형 조회
    ComDefaultCodeVO voComCode = new ComDefaultCodeVO();
    voComCode.setCodeId("COM018");
    List listComCode = cmmUseService.selectCmmCodeDetail(voComCode);
    model.addAttribute("cmmCode018", listComCode);

    if (sCmd.equals("save")) {

      // 서버  validate 체크
      beanValidator.validate(qustnrQestnManageVO, bindingResult);
      if (bindingResult.hasErrors()) {
        // 설문제목가져오기
        String sQestnrId =
            commandMap.get("qestnrId") == null ? "" : (String) commandMap.get("qestnrId");
        String sQestnrTmplatId =
            commandMap.get("qestnrTmplatId") == null
                ? ""
                : (String) commandMap.get("qestnrTmplatId");

        log.info("sQestnrId =>" + sQestnrId);
        log.info("sQestnrTmplatId =>" + sQestnrTmplatId);
        if (!sQestnrId.equals("") && !sQestnrTmplatId.equals("")) {

          Map mapQustnrManage = new HashMap();
          mapQustnrManage.put("qestnrId", sQestnrId);
          mapQustnrManage.put("qestnrTmplatId", sQestnrTmplatId);

          model.addAttribute(
              "qestnrInfo",
              (Map) egovQustnrQestnManageService.selectQustnrManageQestnrSj(mapQustnrManage));
        }

        return "egovframework/com/uss/olp/qqm/EgovQustnrQestnManageRegist";
      }

      // 아이디 설정
      qustnrQestnManageVO.setFrstRegisterId((String) loginVO.getUniqId());
      qustnrQestnManageVO.setLastUpdusrId((String) loginVO.getUniqId());
      /** 목록으로갈때 검색조건 유지 */
      egovQustnrQestnManageService.insertQustnrQestnManage(qustnrQestnManageVO);
      sLocationUrl = "redirect:/uss/olp/qqm/EgovQustnrQestnManageList.do?";
      sLocationUrl = sLocationUrl + "searchMode=" + qustnrQestnManageVO.getSearchMode();
      sLocationUrl = sLocationUrl + "&qestnrId=" + qustnrQestnManageVO.getQestnrId();
      sLocationUrl = sLocationUrl + "&qestnrTmplatId=" + qustnrQestnManageVO.getQestnrTmplatId();

    } else {

      // 설문제목가져오기
      String sQestnrId =
          commandMap.get("qestnrId") == null ? "" : (String) commandMap.get("qestnrId");
      String sQestnrTmplatId =
          commandMap.get("qestnrTmplatId") == null ? "" : (String) commandMap.get("qestnrTmplatId");

      log.info("sQestnrId =>" + sQestnrId);
      log.info("sQestnrTmplatId =>" + sQestnrTmplatId);
      if (!sQestnrId.equals("") && !sQestnrTmplatId.equals("")) {

        Map mapQustnrManage = new HashMap();
        mapQustnrManage.put("qestnrId", sQestnrId);
        mapQustnrManage.put("qestnrTmplatId", sQestnrTmplatId);

        model.addAttribute(
            "qestnrInfo",
            (Map) egovQustnrQestnManageService.selectQustnrManageQestnrSj(mapQustnrManage));
      }
    }

    return sLocationUrl;
  }
  /**
   * 휴가관리정보를 신규로 등록한다.
   *
   * @param vcatnManage - 휴가관리 model
   * @return String - 리턴 Url
   */
  @RequestMapping(value = "/uss/ion/vct/insertVcatnManage.do")
  public String insertVcatnManage(
      @ModelAttribute("vcatnManage") VcatnManage vcatnManage,
      @ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO,
      BindingResult bindingResult,
      SessionStatus status,
      @RequestParam Map<?, ?> commandMap,
      ModelMap model)
      throws Exception {
    // 승인권자 소속명, 성명   유지
    model.addAttribute(
        "infSanctnDtNm",
        commandMap.get("sanctnDtNm") == null ? "" : (String) commandMap.get("sanctnDtNm"));
    model.addAttribute(
        "infOrgnztNm",
        commandMap.get("orgnztNm") == null ? "" : (String) commandMap.get("orgnztNm"));

    String sEnddeView =
        commandMap.get("enddeView") == null ? "" : (String) commandMap.get("enddeView"); // 종료일자 구분
    if (!sEnddeView.equals("")) vcatnManage.setEndde(sEnddeView);

    String sTemp = null;
    String sTempMessage = null;
    int iTemp = 0;

    beanValidator.validate(vcatnManage, bindingResult); // validation 수행

    if (bindingResult.hasErrors()) {
      model.addAttribute("vcatnManageVO", vcatnManageVO);
      return "egovframework/com/uss/ion/vct/EgovVcatnRegist";
    } else {
      LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
      if (vcatnManage.getSanctnerId() != null) vcatnManage.setConfmAt("A");
      vcatnManage.setApplcntId(user.getUniqId());
      vcatnManage.setFrstRegisterId(user.getUniqId());

      vcatnManageVO.setApplcntId(user.getUniqId());
      vcatnManageVO.setSearchKeyword(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde()));
      // 시작일자  포함여부
      iTemp = egovVcatnManageService.selectVcatnManageDplctAt(vcatnManageVO);
      vcatnManageVO.setSearchKeyword(EgovStringUtil.removeMinusChar(vcatnManage.getEndde()));
      // 종료일자  포함여부
      iTemp += egovVcatnManageService.selectVcatnManageDplctAt(vcatnManageVO);

      if (iTemp == 0) {
        status.setComplete();
        sTemp = egovVcatnManageService.insertVcatnManage(vcatnManage, vcatnManageVO);

        if (sTemp.equals("01")) {
          sTempMessage = "입력성공";
          model.addAttribute("message", sTempMessage);
          return "forward:/uss/ion/vct/EgovVcatnManageList.do";
        } else {
          if (sTemp.equals("99")) sTempMessage = "휴가일자 지정 오류 - 휴가시작일자/종료일자를 확인하세요.";
          if (sTemp.equals("09")) sTempMessage = "연차사용시 휴가는 당해연도만 가능합니다.";
          if (sTemp.equals("02")) sTempMessage = "연차휴가 등록실패(잔여연차 부족)";
          if (sTemp.equals("03")) sTempMessage = "반차휴가 등록실패(잔여연차 부족)";
          model.addAttribute("errorMessage", sTempMessage);

          VcatnManageVO vcatnManageVO1 =
              egovVcatnManageService.selectIndvdlYrycManage(user.getUniqId());
          vcatnManageVO1.setApplcntId(user.getUniqId());
          vcatnManageVO1.setApplcntNm(user.getName());
          vcatnManageVO1.setOrgnztNm(user.getOrgnztNm());
          vcatnManageVO1.setTempBgnde(EgovDateUtil.formatDate(vcatnManage.getBgnde(), "-"));
          vcatnManageVO1.setTempEndde(EgovDateUtil.formatDate(vcatnManage.getEndde(), "-"));

          model.addAttribute("vcatnManageVO", vcatnManageVO1);
          ComDefaultCodeVO vo = new ComDefaultCodeVO();
          vo.setCodeId("COM056");
          List<?> vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo);
          model.addAttribute("vcatnSeCode", vcatnSeCodeList);

          return "egovframework/com/uss/ion/vct/EgovVcatnRegist";
        }
      } else {

        sTempMessage = "휴가일자가 중복되었습니다. 휴가일자를 확인해 주세요.";
        model.addAttribute("errorMessage", sTempMessage);

        VcatnManageVO vcatnManageVO1 =
            egovVcatnManageService.selectIndvdlYrycManage(user.getUniqId());
        vcatnManageVO1.setApplcntId(user.getUniqId());
        vcatnManageVO1.setApplcntNm(user.getName());
        vcatnManageVO1.setOrgnztNm(user.getOrgnztNm());
        model.addAttribute("vcatnManageVO", vcatnManageVO1);

        ComDefaultCodeVO vo = new ComDefaultCodeVO();
        vo.setCodeId("COM056");
        List<?> vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo);
        model.addAttribute("vcatnSeCode", vcatnSeCodeList);

        return "egovframework/com/uss/ion/vct/EgovVcatnRegist";
      }
    }
  }
  /**
   * 기 등록된 휴가관리정보를 수정한다.
   *
   * @param vcatnManage - 휴가관리 model
   * @return String - 리턴 Url
   */
  @RequestMapping(value = "/uss/ion/vct/updtVcatnManage.do")
  public String updtVcatnManage(
      @ModelAttribute("vcatnManage") VcatnManage vcatnManage,
      @ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO,
      BindingResult bindingResult,
      SessionStatus status,
      ModelMap model)
      throws Exception {
    String sTemp = null;
    String sTempMessage = null;
    int iTemp = 0;
    /*
    		beanValidator.validate(vcatnManage, bindingResult); //validation 수행

        	if (bindingResult.hasErrors()) {
        		model.addAttribute("vcatnManageVO", vcatnManageVO);
    			return "egovframework/com/uss/ion/vct/EgovVcatnUpdt";
    		} else {

    	    	vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde()));
    	    	vcatnManage.setEndde(EgovStringUtil.removeMinusChar(vcatnManage.getEndde()));
    	    	sTempMessage = egovVcatnManageService.updtVcatnManage(vcatnManage, vcatnManageVO);
    	    	return "forward:/uss/ion/vct/EgovVcatnManageList.do";
    		}
    */
    LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
    vcatnManage.setFrstRegisterId(user.getUniqId());
    sTemp = egovVcatnManageService.updtVcatnManage(vcatnManage, vcatnManageVO);
    if (iTemp != 10) {
      status.setComplete();
      // sTemp = egovVcatnManageService.insertVcatnManage(vcatnManage, vcatnManageVO);

      if (sTemp.equals("01")) {
        sTempMessage = "입력성공";
        model.addAttribute("message", sTempMessage);
        return "forward:/uss/ion/vct/EgovVcatnManageList.do";
      } else {
        if (sTemp.equals("99")) sTempMessage = "휴가일자 지정 오류 - 휴가시작일자/종료일자를 확인하세요.";
        if (sTemp.equals("09")) sTempMessage = "연차사용시 휴가는 당해연도만 가능합니다.";
        if (sTemp.equals("02")) sTempMessage = "연차휴가 등록실패(잔여연차 부족)";
        if (sTemp.equals("03")) sTempMessage = "반차휴가 등록실패(잔여연차 부족)";
        model.addAttribute("errorMessage", sTempMessage);

        VcatnManageVO vcatnManageVO1 =
            egovVcatnManageService.selectIndvdlYrycManage(user.getUniqId());
        vcatnManageVO1.setApplcntId(user.getUniqId());
        vcatnManageVO1.setApplcntNm(user.getName());
        vcatnManageVO1.setOrgnztNm(user.getOrgnztNm());
        vcatnManageVO1.setTempBgnde(EgovDateUtil.formatDate(vcatnManage.getBgnde(), "-"));
        vcatnManageVO1.setTempEndde(EgovDateUtil.formatDate(vcatnManage.getEndde(), "-"));

        model.addAttribute("vcatnManageVO", vcatnManageVO1);
        ComDefaultCodeVO vo = new ComDefaultCodeVO();
        vo.setCodeId("COM056");
        List<?> vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo);
        model.addAttribute("vcatnSeCode", vcatnSeCodeList);

        return "egovframework/com/uss/ion/vct/EgovVcatnUpdt";
      }
    } else {

      sTempMessage = "휴가일자가 중복되었습니다. 휴가일자를 확인해 주세요.";
      model.addAttribute("errorMessage", sTempMessage);

      VcatnManageVO vcatnManageVO1 =
          egovVcatnManageService.selectIndvdlYrycManage(user.getUniqId());
      vcatnManageVO1.setApplcntId(user.getUniqId());
      vcatnManageVO1.setApplcntNm(user.getName());
      vcatnManageVO1.setOrgnztNm(user.getOrgnztNm());
      model.addAttribute("vcatnManageVO", vcatnManageVO1);

      ComDefaultCodeVO vo = new ComDefaultCodeVO();
      vo.setCodeId("COM056");
      List<?> vcatnSeCodeList = cmmUseService.selectCmmCodeDetail(vo);
      model.addAttribute("vcatnSeCode", vcatnSeCodeList);

      return "egovframework/com/uss/ion/vct/EgovVcatnUpdt";
    }
  }