/**
   * 이메일을 전송한다.
   *
   * @param mntrngLog 모니터링 대상정보
   * @return
   */
  private void sendEmail(DbMntrngLog mntrngLog) {
    String subject = null;
    String text = null;
    String errorContents = null;

    SimpleMailMessage msg = new SimpleMailMessage(this.mntrngMessage);
    // 수신자
    msg.setTo(mntrngLog.getMngrEmailAddr());
    // 메일제목
    subject = msg.getSubject();
    subject = EgovStringUtil.replace(subject, "{모니터링종류}", "DB서비스모니터링");
    msg.setSubject(subject);
    // 메일내용
    text = msg.getText();
    text = EgovStringUtil.replace(text, "{모니터링종류}", "DB서비스모니터링");
    errorContents = "데이타소스명 : " + mntrngLog.getDataSourcNm() + "\n";
    errorContents = errorContents + "서버명  : " + mntrngLog.getServerNm() + "\n";
    errorContents = errorContents + "DBMS종류 : " + mntrngLog.getDbmsKindNm() + "\n";
    errorContents = errorContents + "체크SQL : " + mntrngLog.getCeckSql() + "\n";
    errorContents = errorContents + "상태 : " + mntrngLog.getMntrngSttusNm() + "\n";
    errorContents = errorContents + "모니터링시각 : " + mntrngLog.getCreatDt() + "\n";
    errorContents = errorContents + "에러메시지 : " + mntrngLog.getLogInfo() + "\n";
    text = EgovStringUtil.replace(text, "{에러내용}", errorContents);
    msg.setText(text);

    this.mntrngMailSender.send(msg);
  }
  /**
   * 신청된 휴가를 승인처리한다.
   *
   * @param vcatnManage - 휴가관리 model
   * @return String - 리턴 Url
   */
  @RequestMapping(value = "/uss/ion/vct/updtVcatnConfm.do")
  public String updtVcatnManageConfm(
      @ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO,
      @ModelAttribute("vcatnManage") VcatnManage vcatnManage,
      BindingResult bindingResult,
      SessionStatus status,
      ModelMap model)
      throws Exception {

    vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde()));
    vcatnManage.setEndde(EgovStringUtil.removeMinusChar(vcatnManage.getEndde()));
    beanValidator.validate(vcatnManage, bindingResult); // validation 수행

    if (bindingResult.hasErrors()) {
      model.addAttribute("vcatnManageVO", vcatnManageVO);
      return "egovframework/com/uss/ion/vct/EgovVcatnConfm";
    } else {
      LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
      vcatnManage.setSanctnerId(user.getUniqId());
      vcatnManage.setLastUpdusrId(user.getUniqId());

      egovVcatnManageService.updtVcatnManageConfm(vcatnManage);
      return "forward:/uss/ion/vct/EgovVcatnConfmList.do";
    }
  }
  /**
   * 등록된 휴가관리의 상세정보를 조회한다.
   *
   * @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 vcatnManage - 휴가관리 model
  * @return String - 리턴 Url
  */
 @RequestMapping(value = "/uss/ion/vct/deleteVcatnManage.do")
 public String deleteVcatnManage(
     @ModelAttribute("vcatnManage") VcatnManage vcatnManage, SessionStatus status, ModelMap model)
     throws Exception {
   vcatnManage.setBgnde(EgovStringUtil.removeMinusChar(vcatnManage.getBgnde()));
   vcatnManage.setEndde(EgovStringUtil.removeMinusChar(vcatnManage.getEndde()));
   egovVcatnManageService.deleteVcatnManage(vcatnManage);
   status.setComplete();
   model.addAttribute("message", egovMessageSource.getMessage("success.common.delete"));
   return "forward:/uss/ion/vct/EgovVcatnManageList.do";
 }
  /**
   * 휴가승인관리 상세정보를 조회한다.
   *
   * @param vcatnManageVO - 휴가관리 VO
   * @return String - 리턴 Url
   */
  @RequestMapping(value = "/uss/ion/vct/EgovVcatnConfm.do")
  public String selectVcatnConfm(
      @ModelAttribute("vcatnManageVO") VcatnManageVO vcatnManageVO,
      @ModelAttribute("vcatnManage") VcatnManage vcatnManage,
      ModelMap model)
      throws Exception {
    vcatnManageVO.setBgnde(EgovStringUtil.removeMinusChar(vcatnManageVO.getBgnde()));
    vcatnManageVO.setEndde(EgovStringUtil.removeMinusChar(vcatnManageVO.getEndde()));

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

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

    return "egovframework/com/uss/ion/vct/EgovVcatnConfm";
  }
  /**
   * 휴가관리정보를 신규로 등록한다.
   *
   * @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";
      }
    }
  }