/**
   * 공통상세코드를 등록한다.
   *
   * @param loginVO
   * @param cmmnDetailCode
   * @param cmmnCode
   * @param bindingResult
   * @param model
   * @return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeRegist"
   * @throws Exception
   */
  @RequestMapping(value = "/sym/ccm/cde/EgovCcmCmmnDetailCodeRegist.do")
  public String insertCmmnDetailCode(
      @ModelAttribute("loginVO") LoginVO loginVO,
      @ModelAttribute("cmmnDetailCode") CmmnDetailCode cmmnDetailCode,
      @ModelAttribute("cmmnCode") CmmnCode cmmnCode,
      BindingResult bindingResult,
      @RequestParam Map<?, ?> commandMap,
      ModelMap model)
      throws Exception {

    String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd");
    if (cmmnDetailCode.getCodeId() == null
        || cmmnDetailCode.getCodeId().equals("")
        || cmmnDetailCode.getCode() == null
        || cmmnDetailCode.getCode().equals("")
        || sCmd.equals("")) {

      CmmnClCodeVO searchClCodeVO;
      searchClCodeVO = new CmmnClCodeVO();
      searchClCodeVO.setRecordCountPerPage(999999);
      searchClCodeVO.setFirstIndex(0);
      searchClCodeVO.setSearchCondition("CodeList");
      List<?> CmmnClCodeList = cmmnClCodeManageService.selectCmmnClCodeList(searchClCodeVO);
      model.addAttribute("cmmnClCodeList", CmmnClCodeList);

      CmmnCodeVO searchCodeVO;
      searchCodeVO = new CmmnCodeVO();
      searchCodeVO.setRecordCountPerPage(999999);
      searchCodeVO.setFirstIndex(0);
      searchCodeVO.setSearchCondition("clCode");
      if (cmmnCode.getClCode().equals("")) {
        EgovMap emp = (EgovMap) CmmnClCodeList.get(0);
        cmmnCode.setClCode(emp.get("clCode").toString());
      }
      searchCodeVO.setSearchKeyword(cmmnCode.getClCode());

      List<?> CmmnCodeList = cmmnCodeManageService.selectCmmnCodeList(searchCodeVO);
      model.addAttribute("cmmnCodeList", CmmnCodeList);

      return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeRegist";
    } else if (sCmd.equals("Regist")) {

      beanValidator.validate(cmmnDetailCode, bindingResult);
      if (bindingResult.hasErrors()) {
        CmmnClCodeVO searchClCodeVO;
        searchClCodeVO = new CmmnClCodeVO();
        searchClCodeVO.setRecordCountPerPage(999999);
        searchClCodeVO.setFirstIndex(0);
        List<?> CmmnClCodeList = cmmnClCodeManageService.selectCmmnClCodeList(searchClCodeVO);
        model.addAttribute("cmmnClCodeList", CmmnClCodeList);

        CmmnCodeVO searchCodeVO;
        searchCodeVO = new CmmnCodeVO();
        searchCodeVO.setRecordCountPerPage(999999);
        searchCodeVO.setFirstIndex(0);
        searchCodeVO.setSearchCondition("clCode");
        if (cmmnCode.getClCode().equals("")) {
          EgovMap emp = (EgovMap) CmmnClCodeList.get(0);
          cmmnCode.setClCode(emp.get("clCode").toString());
        }
        searchCodeVO.setSearchKeyword(cmmnCode.getClCode());

        List<?> CmmnCodeList = cmmnCodeManageService.selectCmmnCodeList(searchCodeVO);
        model.addAttribute("cmmnCodeList", CmmnCodeList);

        return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeRegist";
      }

      CmmnDetailCode vo = cmmnDetailCodeManageService.selectCmmnDetailCodeDetail(cmmnDetailCode);
      if (vo != null) {
        model.addAttribute("message", "이미 등록된 코드가 존재합니다.");

        CmmnClCodeVO searchClCodeVO;
        searchClCodeVO = new CmmnClCodeVO();
        searchClCodeVO.setRecordCountPerPage(999999);
        searchClCodeVO.setFirstIndex(0);
        List<?> CmmnClCodeList = cmmnClCodeManageService.selectCmmnClCodeList(searchClCodeVO);
        model.addAttribute("cmmnClCodeList", CmmnClCodeList);

        CmmnCodeVO searchCodeVO;
        searchCodeVO = new CmmnCodeVO();
        searchCodeVO.setRecordCountPerPage(999999);
        searchCodeVO.setFirstIndex(0);
        searchCodeVO.setSearchCondition("clCode");
        if (cmmnCode.getClCode().equals("")) {
          EgovMap emp = (EgovMap) CmmnClCodeList.get(0);
          cmmnCode.setClCode(emp.get("clCode").toString());
        }
        searchCodeVO.setSearchKeyword(cmmnCode.getClCode());

        List<?> CmmnCodeList = cmmnCodeManageService.selectCmmnCodeList(searchCodeVO);
        model.addAttribute("cmmnCodeList", CmmnCodeList);

        return "egovframework/com/sym/ccm/cde/EgovCcmCmmnDetailCodeRegist";
      }
      cmmnDetailCode.setFrstRegisterId(loginVO.getUniqId());
      cmmnDetailCodeManageService.insertCmmnDetailCode(cmmnDetailCode);
      return "forward:/sym/ccm/cde/EgovCcmCmmnDetailCodeList.do";
    } else {
      return "forward:/sym/ccm/cde/EgovCcmCmmnDetailCodeList.do";
    }
  }
예제 #2
0
  /**
   * DB서비스 모니터링를 수행한다.
   *
   * @param
   * @return
   * @throws Exception
   */
  public int monitorDb() throws Exception {
    int batchResult = 0;

    // 모니터링 대상 정보 읽어들이기~~~
    List<EgovMap> targetList = null;
    DbMntrngVO dbMntrngVO = new DbMntrngVO();
    // 모니터링 대상 검색 조건 초기화
    dbMntrngVO.getSearchVO().setPageIndex(1);
    dbMntrngVO.getSearchVO().setFirstIndex(0);
    dbMntrngVO.getSearchVO().setRecordPerPage(RECORD_COUNT_PER_PAGE);
    targetList = dbMntrngService.selectDbMntrngList(dbMntrngVO);
    if (LOG.isDebugEnabled()) {
      LOG.debug("조회조건 " + dbMntrngVO);
      LOG.debug("Result 건수 : " + targetList.size());
    }
    // 서비스체크 함수 호출.
    Iterator<EgovMap> iter = targetList.iterator();
    EgovMap target = null;
    DbMntrngResult result = null;
    DbMntrngVO dbMntrng = null;
    DbMntrngLogVO dbMntrngLog = null;
    while (iter.hasNext()) {
      target = iter.next();
      if (LOG.isDebugEnabled()) {
        LOG.debug("Data : " + target);
      }
      dbMntrng = new DbMntrngVO();
      dbMntrng.setDataSourcNm((String) target.get("dataSourcNm"));
      dbMntrng.setServerNm((String) target.get("serverNm"));
      dbMntrng.setDbmsKind((String) target.get("dbmsKind"));
      dbMntrng.setCeckSql((String) target.get("ceckSql"));
      dbMntrng.setMngrNm((String) target.get("mngrNm"));
      dbMntrng.setMngrEmailAddr((String) target.get("mngrEmailAddr"));
      dbMntrng.setMntrngSttus((String) target.get("mntrngSttus"));

      // 서비스 체크 수행.
      result = DbMntrngChecker.check(dataSource, dbMntrng.getDataSourcNm(), dbMntrng.getCeckSql());

      // 대상테이블에 DB에 결과값 저장
      if (result.isNrmltAt()) {
        dbMntrng.setMntrngSttus("01");
      } else {
        dbMntrng.setMntrngSttus("02");
      }
      dbMntrng.setLastUpdusrId("SYSTEM");
      dbMntrngService.updateDbMntrng(dbMntrng);

      // 로그테이블 추가저장.
      dbMntrngLog = new DbMntrngLogVO();
      dbMntrngLog.setLogId(dbMntrngLogIdGnrService.getNextStringId());
      dbMntrngLog.setDataSourcNm(dbMntrng.getDataSourcNm());
      dbMntrngLog.setServerNm(dbMntrng.getServerNm());
      dbMntrngLog.setDbmsKind(dbMntrng.getDbmsKind());
      dbMntrngLog.setCeckSql(dbMntrng.getCeckSql());
      dbMntrngLog.setMngrNm(dbMntrng.getMngrNm());
      dbMntrngLog.setMngrEmailAddr(dbMntrng.getMngrEmailAddr());
      dbMntrngLog.setMntrngSttus(dbMntrng.getMntrngSttus());
      dbMntrngLog.setFrstRegisterId(dbMntrng.getLastUpdusrId());
      if (result.getCause() != null) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("에러메시지: " + result.getCause().getMessage());
        }

        if (result.getCause().getMessage() != null) {
          dbMntrngLog.setLogInfo(result.getCause().getMessage());
        } else {
          dbMntrngLog.setLogInfo("");
        }

      } else {
        dbMntrngLog.setLogInfo("");
      }
      dbMntrngService.insertDbMntrngLog(dbMntrngLog);

      // 모니터링시각을 가져오기위해 로그정보를 가져온다.
      dbMntrngLog = dbMntrngService.selectDbMntrngLog(dbMntrngLog);
      if (LOG.isDebugEnabled()) {
        LOG.debug("DB서비스로그 Data : " + dbMntrngLog);
      }
      // email 전송.
      if (!result.isNrmltAt()) {
        batchResult = -1;
        sendEmail(dbMntrngLog);
      }
    }
    return batchResult;
  }
  /**
   * 연계서비스를 수정한다.
   *
   * @param loginVO
   * @param cntcService
   * @param bindingResult
   * @param commandMap
   * @param model
   * @return "egovframework/com/ssi/syi/iis/EgovCntcServiceModify"
   * @throws Exception
   */
  @RequestMapping(value = "/ssi/syi/iis/updateCntcService.do")
  public String updateCntcService(
      @ModelAttribute("cntcService") CntcService cntcService,
      BindingResult bindingResult,
      @RequestParam Map<?, ?> commandMap,
      ModelMap model)
      throws Exception {
    String sCmd = commandMap.get("cmd") == null ? "" : (String) commandMap.get("cmd");
    if (sCmd.equals("")) {
      // 연계기관 리스트박스 데이터
      CntcInsttVO searchCntcInsttVO;
      searchCntcInsttVO = new CntcInsttVO();
      searchCntcInsttVO.setRecordCountPerPage(999999);
      searchCntcInsttVO.setFirstIndex(0);
      searchCntcInsttVO.setSearchCondition("CodeList");
      List<?> cntcInsttList = cntcInsttService.selectCntcInsttList(searchCntcInsttVO);
      model.addAttribute("cntcInsttList", cntcInsttList);

      // 연계시스템 리스트박스 데이터
      CntcSystemVO searchCntcSystemVO;
      searchCntcSystemVO = new CntcSystemVO();
      searchCntcSystemVO.setRecordCountPerPage(999999);
      searchCntcSystemVO.setFirstIndex(0);
      searchCntcSystemVO.setSearchCondition("CodeList");
      if (cntcService.getInsttId().equals("")) {
        if (cntcInsttList.size() > 0) {
          EgovMap emp = (EgovMap) cntcInsttList.get(0);
          cntcService.setInsttId(emp.get("insttId").toString());
        }
      }
      searchCntcSystemVO.setInsttId(cntcService.getInsttId());
      List<?> cntcSystemList = cntcInsttService.selectCntcSystemList(searchCntcSystemVO);
      model.addAttribute("cntcSystemList", cntcSystemList);

      // 연계메시지 리스트박스 데이터
      CntcMessageVO searchCntcMessageVO;
      searchCntcMessageVO = new CntcMessageVO();
      searchCntcMessageVO.setRecordCountPerPage(999999);
      searchCntcMessageVO.setFirstIndex(0);
      searchCntcMessageVO.setSearchCondition("CodeList");
      List<?> cntcMessageList = cntcMessageService.selectCntcMessageList(searchCntcMessageVO);
      model.addAttribute("cntcMessageList", cntcMessageList);

      CntcService vo = cntcInsttService.selectCntcServiceDetail(cntcService);
      model.addAttribute("cntcService", vo);

      return "egovframework/com/ssi/syi/iis/EgovCntcServiceUpdt";
    } else if (sCmd.equals("Modify")) {
      beanValidator.validate(cntcService, bindingResult);
      if (bindingResult.hasErrors()) {
        // 연계기관 리스트박스 데이터
        CntcInsttVO searchCntcInsttVO;
        searchCntcInsttVO = new CntcInsttVO();
        searchCntcInsttVO.setRecordCountPerPage(999999);
        searchCntcInsttVO.setFirstIndex(0);
        searchCntcInsttVO.setSearchCondition("CodeList");
        List<?> cntcInsttList = cntcInsttService.selectCntcInsttList(searchCntcInsttVO);
        model.addAttribute("cntcInsttList", cntcInsttList);

        // 연계시스템 리스트박스 데이터
        CntcSystemVO searchCntcSystemVO;
        searchCntcSystemVO = new CntcSystemVO();
        searchCntcSystemVO.setRecordCountPerPage(999999);
        searchCntcSystemVO.setFirstIndex(0);
        searchCntcSystemVO.setSearchCondition("CodeList");
        if (cntcService.getInsttId().equals("")) {
          if (cntcInsttList.size() > 0) {
            EgovMap emp = (EgovMap) cntcInsttList.get(0);
            cntcService.setInsttId(emp.get("insttId").toString());
          }
        }
        searchCntcSystemVO.setInsttId(cntcService.getInsttId());
        List<?> cntcSystemList = cntcInsttService.selectCntcSystemList(searchCntcSystemVO);
        model.addAttribute("cntcSystemList", cntcSystemList);

        // 연계메시지 리스트박스 데이터
        CntcMessageVO searchCntcMessageVO;
        searchCntcMessageVO = new CntcMessageVO();
        searchCntcMessageVO.setRecordCountPerPage(999999);
        searchCntcMessageVO.setFirstIndex(0);
        searchCntcMessageVO.setSearchCondition("CodeList");
        List<?> cntcMessageList = cntcMessageService.selectCntcMessageList(searchCntcMessageVO);
        model.addAttribute("cntcMessageList", cntcMessageList);

        CntcService vo = cntcInsttService.selectCntcServiceDetail(cntcService);
        model.addAttribute("cntcService", vo);

        return "egovframework/com/ssi/syi/iis/EgovCntcServiceUpdt";
      }

      // 로그인VO에서  사용자 정보 가져오기
      LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
      String uniqId = loginVO.getUniqId();

      cntcService.setLastUpdusrId(uniqId);
      cntcInsttService.updateCntcService(cntcService);
      return "forward:/ssi/syi/iis/getCntcInsttList.do";
    } else {
      return "forward:/ssi/syi/iis/getCntcInsttList.do";
    }
  }