Пример #1
0
  /**
   * 처리 내용 : 차주정보 수정 페이지로 이동 및 정보 표시 처리 날짜 : 2015.01.08
   *
   * @param pageVO
   * @param carOwnerVO
   * @param model
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  @RequestMapping("/edit.do")
  public String carOwnEditForm(
      @ModelAttribute("pageVO") BasePageVO pageVO,
      @ModelAttribute("userInfoVO") CarOwnerVO carOwnerVO,
      ModelMap model,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    BaseSessInfo info = SessionUtility.getLoginForAdmin(request);

    if (info == null) {
      return "redirect:/cms/login.do";
    }

    try {
      carOwnerVO = carOwnerService.selectData(carOwnerVO, info.getUserId());

    } catch (DataAccessException e) {
      logger.error("/cms/carown/edit.do, selectData Error...");
    } catch (Exception e) {
      logger.error("/cms/carown/edit.do, selectData Error...");
    }

    carOwnerVO.setTel_no(ComCrypto.decode(cryptoService, carOwnerVO.getTel_no()));
    model.addAttribute("carOwnerVO", carOwnerVO);
    model.addAttribute("pageVO", pageVO);

    return "cms/carown/edit";
  }
Пример #2
0
  /**
   * 처리 내용 : 차주정보 리스트를 화면에 출력 처리 날짜 : 2015.01.08
   *
   * @param searchVO
   * @param model
   * @param request
   * @param response
   * @return
   * @throws Exception
   */
  @RequestMapping("/list.do")
  public String carOwnListForm(
      @ModelAttribute("pageVO") BasePageVO pageVO,
      ModelMap model,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    BaseSessInfo info = SessionUtility.getLoginForAdmin(request);

    if (info == null) {
      return "redirect:/cms/login.do";
    }

    pageVO.setPageUnit(propertiesService.getInt("pageUnit"));
    pageVO.setPageSize(propertiesService.getInt("pageSize"));

    PaginationInfo paginationInfo = new PaginationInfo();
    paginationInfo.setCurrentPageNo(pageVO.getPageIndex());
    paginationInfo.setRecordCountPerPage(pageVO.getPageUnit());
    paginationInfo.setPageSize(pageVO.getPageSize());

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

    List<CarOwnerVO> lstData = null;
    try {
      lstData = carOwnerService.selectListData(pageVO, info.getUserId());

      for (int i = 0; i < lstData.size(); i++) {
        CarOwnerVO vo = new CarOwnerVO();
        vo = lstData.get(i);
        vo.setTel_no(ComCrypto.decode(cryptoService, lstData.get(i).getTel_no()));
        lstData.set(i, vo);

        int totCnt = carOwnerService.selectListCount(pageVO);
        paginationInfo.setTotalRecordCount(totCnt);
      }
    } catch (DataAccessException e) {
      logger.error("/cms/sms/list.do, selectListData | selectListCount Error...");
    } catch (Exception e) {
      logger.error("/cms/sms/list.do, selectListData | selectListCount Error...");
    }

    if (lstData == null) lstData = new ArrayList<CarOwnerVO>();

    model.addAttribute("resultList", lstData);
    model.addAttribute("pageVO", pageVO);
    model.addAttribute("paginationInfo", paginationInfo);

    return "cms/carown/list";
  }
Пример #3
0
  /**
   * 처리 내용 : 차주정보 수정에 대한 데이터 처리 처리 날짜 : 2015.01.08
   *
   * @param mapParams
   * @param request
   * @param response
   * @throws Exception
   */
  @RequestMapping("/edit_action.do")
  public void carOwnEditAction(
      @RequestParam Map<String, Object> mapParams,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    BaseSessInfo info = SessionUtility.getLoginForAdmin(request);

    if (info == null) {
      ComUtils.responseJson(request, response, ResultVO.create(BaseResVO.ERR_SESSION_NOT_EXIST));
      return;
    }

    CarOwnerVO dataVO = new CarOwnerVO();
    ResultVO resVO = new ResultVO();

    int nRet = 0;
    String sUserTelno =
        ComStr.toStr(mapParams.get("own_tel01"))
            + "-"
            + ComStr.toStr(mapParams.get("own_tel02"))
            + "-"
            + ComStr.toStr(mapParams.get("own_tel03"));

    dataVO.setOwn_car_no(ComStr.toStr(mapParams.get("own_car_no")));
    dataVO.setOwn_name(ComStr.toStr(mapParams.get("own_name")));
    dataVO.setTel_no(ComCrypto.encode(cryptoService, sUserTelno));

    try {
      nRet = carOwnerService.updateData(dataVO, info.getUserId());

      if (nRet > 0) {
        resVO.setRetCode(ResultVO.RET_OK, messageSource);

      } else {
        resVO.setRetCode(ResultVO.ERR_UPDATE_FAIL, messageSource);
      }

    } catch (DataAccessException e) {
      logger.error("/cms/carown/edit_action.do, Update Error...");
      resVO.setRetCode(ResultVO.ERR_APP_WEBCOMMON, messageSource);
    } catch (Exception e) {
      logger.error("/cms/carown/edit_action.do, Update Error...");
      resVO.setRetCode(ResultVO.ERR_APP_WEBCOMMON, messageSource);
    }

    ComUtils.responseJson(request, response, resVO);
  }
Пример #4
0
  /**
   * 처리 내용 : 차주정보 등록에 대한 데이터 처리 처리 날짜 : 2015.01.08
   *
   * @param mapParams
   * @param request
   * @param response
   * @throws Exception
   */
  @RequestMapping("/reg_action.do")
  public void carOwnRegAction(
      @RequestParam Map<String, Object> mapParams,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    BaseSessInfo info = SessionUtility.getLoginForAdmin(request);

    if (info == null) {
      ComUtils.responseJson(request, response, ResultVO.create(BaseResVO.ERR_SESSION_NOT_EXIST));
      return;
    }

    CarOwnerVO dataVO = new CarOwnerVO();
    ResultVO resVO = new ResultVO();

    String sOwnCarNo = ComStr.toStr(mapParams.get("own_car_no"));
    String sOwnName = ComStr.toStr(mapParams.get("own_name"));
    String sOwnTelno =
        ComStr.toStr(mapParams.get("own_tel01"))
            + "-"
            + ComStr.toStr(mapParams.get("own_tel02"))
            + "-"
            + ComStr.toStr(mapParams.get("own_tel03"));

    dataVO.setOwn_car_no(sOwnCarNo);
    dataVO.setOwn_name(sOwnName);
    dataVO.setTel_no(ComCrypto.encode(cryptoService, sOwnTelno));

    try {
      carOwnerService.insertData(dataVO, info.getUserId());
      resVO.setRetCode(ResultVO.RET_OK, messageSource);

    } catch (DataAccessException e) {
      if (DbUtils.getErrorCode(e) == DbUtils.ERR_DB_DUPLICATE_KEY) {
        resVO.setRetCode(ResultVO.ERR_DB_DUPLICATE_KEY, messageSource);
      } else {
        resVO.setRetCode(ResultVO.ERR_INSERT_FAIL, messageSource);
      }

      logger.debug("/cms/carown/reg_action.do, Insert Error...");
    } catch (Exception e) {
      resVO.setRetCode(ResultVO.ERR_INSERT_FAIL, messageSource);
      logger.debug("/cms/carown/reg_action.do, Insert Error...");
    }
    ComUtils.responseJson(request, response, resVO);
  }