/*
   * 수정 양식 submit
   */
  @RequestMapping(value = "/modify/", method = RequestMethod.POST)
  public ModelAndView modifySubmit(
      HttpSession session, @ModelAttribute UserInfo userInfo, BindingResult result) {
    ModelAndView mav = new ModelAndView();

    modifyValidator.validate(userInfo, result);

    if (!result.hasErrors()) {
      System.out.println(userInfo.toString());
      session.setAttribute("userInfo", userInfo);
      loginService.userUpate(userInfo);
      myblogService.updateUserBlogInfo(
          userInfo.getBlogAddress(),
          userInfo.getName(),
          userInfo.getType(),
          userInfo.getBeforeBlogAddress());
      boardService.updateBlogAddress(
          userInfo.getBlogAddress(),
          userInfo.getName(),
          userInfo.getType(),
          userInfo.getBeforeBlogAddress());
      mav.setView(new RedirectView("/food_blog/"));
    } else {
      System.out.println("수정안됨");
      mav.setView(new RedirectView("/food_blog/modify/"));
    }

    return mav;
  }
示例#2
0
 /**
  * 用户登录
  *
  * @param user
  * @param response
  * @param request
  * @return
  * @throws Exception
  */
 @RequestMapping(value = "/login.bl", method = RequestMethod.POST)
 public ModelAndView login(
     @ModelAttribute("emp") Emp emp, HttpServletResponse response, HttpServletRequest request)
     throws Exception {
   ModelAndView mav = new ModelAndView();
   Emp empInfo = empService.checkEmp(emp);
   if (empInfo == null) {
     mav.addObject(Constants.ALTMSG, "用户名或密码错误");
     mav.setViewName("common/alert_back");
     return mav;
   }
   long expireTimeMillis = System.currentTimeMillis();
   BlCookieUtil.addCookie(
       response,
       Constants.COOKIE_BL_UID,
       CipherUtil.encryptResult(empInfo.getEmpId()),
       Constants.COOKIE_MAX_TIME_HALF_HOUR);
   BlCookieUtil.addCookie(
       response,
       Constants.COOKIE_BL_UNM,
       CipherUtil.encryptResult(empInfo.getEmpNm()),
       Constants.COOKIE_MAX_TIME_HALF_HOUR);
   BlCookieUtil.addCookie(
       response,
       Constants.COOKIE_BL_AUTH,
       CipherUtil.encryptResult(empInfo.getAuthId() + "_" + empInfo.getStoreCode()),
       Constants.COOKIE_MAX_TIME_HALF_HOUR);
   BlCookieUtil.addCookie(
       response,
       Constants.COOKIE_BL_TIME,
       String.valueOf(expireTimeMillis),
       Constants.COOKIE_MAX_TIME_HALF_HOUR);
   mav.setView(new RedirectView("/main.bl"));
   return mav;
 }
示例#3
0
 /**
  * 构建响应对象。
  *
  * @return 返回响应对象。
  */
 public ModelAndView build() {
   ModelAndView mv = new ModelAndView();
   GenericJacksonView view = new GenericJacksonView();
   view.setModelKey("dwzResult");
   mv.setView(view);
   mv.addObject(result);
   return mv;
 }
  /** Find an {@code @ExceptionHandler} method and invoke it to handle the raised exception. */
  @Override
  protected ModelAndView doResolveHandlerMethodException(
      HttpServletRequest request,
      HttpServletResponse response,
      HandlerMethod handlerMethod,
      Exception exception) {

    ServletInvocableHandlerMethod exceptionHandlerMethod =
        getExceptionHandlerMethod(handlerMethod, exception);
    if (exceptionHandlerMethod == null) {
      return null;
    }

    exceptionHandlerMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
    exceptionHandlerMethod.setHandlerMethodReturnValueHandlers(this.returnValueHandlers);

    ServletWebRequest webRequest = new ServletWebRequest(request, response);
    ModelAndViewContainer mavContainer = new ModelAndViewContainer();

    try {
      if (logger.isDebugEnabled()) {
        logger.debug("Invoking @ExceptionHandler method: " + exceptionHandlerMethod);
      }
      Throwable cause = exception.getCause();
      if (cause != null) {
        // Expose cause as provided argument as well
        exceptionHandlerMethod.invokeAndHandle(
            webRequest, mavContainer, exception, cause, handlerMethod);
      } else {
        // Otherwise, just the given exception as-is
        exceptionHandlerMethod.invokeAndHandle(webRequest, mavContainer, exception, handlerMethod);
      }
    } catch (Throwable invocationEx) {
      if (logger.isWarnEnabled()) {
        logger.warn(
            "Failed to invoke @ExceptionHandler method: " + exceptionHandlerMethod, invocationEx);
      }
      return null;
    }

    if (mavContainer.isRequestHandled()) {
      return new ModelAndView();
    } else {
      ModelMap model = mavContainer.getModel();
      HttpStatus status = mavContainer.getStatus();
      ModelAndView mav = new ModelAndView(mavContainer.getViewName(), model, status);
      mav.setViewName(mavContainer.getViewName());
      if (!mavContainer.isViewReference()) {
        mav.setView((View) mavContainer.getView());
      }
      return mav;
    }
  }
示例#5
0
 @RequestMapping("/index.html")
 public ModelAndView index(HttpServletRequest request) {
   ModelAndView mav = new ModelAndView();
   User user = (User) request.getSession().getAttribute("user");
   if (user.isAdmin()) {
     return fillModel(user, courseMapper.getCourseNames());
   } else if (user.getCourses().size() == 1) {
     mav.setView(new RedirectView(user.getCourses().get(0) + "/index.html"));
   } else {
     return fillModel(user, user.getCourses());
   }
   return mav;
 }
 @RequestMapping("/webApi/getSysTime.do")
 public ModelAndView getSysTime() {
   Map<String, Object> map = new HashMap<String, Object>();
   Map<String, Long> tMap = new HashMap<String, Long>();
   tMap.put("t", System.currentTimeMillis());
   map.put("rc", 1000);
   map.put("dt", tMap);
   ModelAndView modelView = new ModelAndView();
   MappingJacksonJsonView view = new MappingJacksonJsonView();
   view.setAttributesMap(map);
   modelView.setView(view);
   return modelView;
 }
  @RequestMapping(value = "/option_compare.isnet")
  public ModelAndView option_compare(
      @RequestParam(value = "product", required = false) int product,
      @RequestParam(value = "fileChk", required = false) int[] file,
      @RequestParam(value = "customer_no1", required = false) String customer_no1,
      @RequestParam(value = "customer_no2", required = false) String customer_no2,
      @RequestParam(value = "customer_no3", required = false) String customer_no3,
      @RequestParam(value = "customer_no4", required = false) String customer_no4) {

    logger.debug("[" + getClass().getSimpleName() + "] [list_02] start");
    logger.info("[" + getClass().getSimpleName() + "] product [" + product + "]");
    logger.info("[" + getClass().getSimpleName() + "] file [" + file.length + "]");
    logger.info("[" + getClass().getSimpleName() + "] customer1 [" + customer_no1 + "]");
    logger.info("[" + getClass().getSimpleName() + "] customer2 [" + customer_no2 + "]");
    logger.info("[" + getClass().getSimpleName() + "] customer3 [" + customer_no3 + "]");
    logger.info("[" + getClass().getSimpleName() + "] customer4 [" + customer_no4 + "]");

    String file_query = " AND OPTION_FILE_NO IN (";
    for (int i = 0; i < file.length; i++) {
      if (i != file.length - 1) file_query += file[i] + ",";
      else file_query += file[i] + ") ";
    }
    logger.info("[" + getClass().getSimpleName() + "] file [" + file_query + "]");

    ModelAndView mav = new ModelAndView();
    mav.setView(mappingJacksonJsonView);

    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("PRODUCT_NO", product);
    paramMap.put("OPTION_FILE_QUERY", file_query);
    paramMap.put("CUSTOMER_NO1", customer_no1);
    paramMap.put("CUSTOMER_NO2", customer_no2);
    paramMap.put("CUSTOMER_NO3", customer_no3);
    paramMap.put("CUSTOMER_NO4", customer_no4);

    try {

      Map<String, Object> resultMap = optionService.getForthOptionList(paramMap);
      mav.addAllObjects(resultMap);

    } catch (Exception e) {
      e.printStackTrace();
      logger.error("[" + getClass().getSimpleName() + "] [list_02] 조회 오류");
      mav.addObject("error_msg", "옵션 조회중  오류가 발생하였습니다.");
      mav.setViewName("error");
    } finally {
      logger.debug("[" + getClass().getSimpleName() + "] [list_02] end");
    }

    return mav;
  }
示例#8
0
 /**
  * Calls a direct method.
  *
  * @return The next view to go to. It is a forward to the entry action of the subflow.
  */
 @RequestMapping("/directCall.do")
 public ModelAndView directCall() {
   logMethod("doCall");
   ModelAndView model = new ModelAndView();
   Stack<StackFrame> context = FlowContextHolder.getContext();
   StackFrame frame = new BaseStackFrame();
   context.push(frame);
   model.setView(
       new InternalResourceView(
           "/common/type/create.do?dataElementCollection="
               + TypeEnumeration.CONTAINER
               + "&currentView=/common/type/manage.do"));
   return model;
 }
  @RequestMapping(value = "/login/logout/", method = RequestMethod.GET)
  public ModelAndView logout(HttpSession session) {
    ModelAndView mav = new ModelAndView();

    UserInfo userInfo = (UserInfo) session.getAttribute("userInfo");

    if (userInfo != null) {
      session.removeAttribute("userInfo");
      session.setAttribute("userInfo", null);
    } else logger.debug("로그인 상태가 아닙니다.");

    mav.setView(new RedirectView("/food_blog/"));

    return mav;
  }
  @RequestMapping(value = "/select_option_03_03.isnet")
  public ModelAndView select_option_03_03(
      @RequestParam(value = "optionApp", required = false) String app) {
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("OPTION_APP_NO", app);

    List<Map<String, Object>> option = optionService.select_option_03_03(paramMap);

    ModelAndView mav = new ModelAndView();
    mav.setView(mappingJacksonJsonView);

    mav.addObject("option", option);
    mav.addObject("optionSize", option.size());

    return mav;
  }
  @RequestMapping(value = "/select_option_03_01.isnet")
  public ModelAndView select_option_03_01(
      @RequestParam(value = "product", required = false) String product) {
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("PRODUCT_NO", product);

    List<Map<String, Object>> optionFile = optionService.select_option_03_01(paramMap);

    ModelAndView mav = new ModelAndView();
    mav.setView(mappingJacksonJsonView);

    mav.addObject("optionFile", optionFile);
    mav.addObject("optionFileSize", optionFile.size());

    return mav;
  }
  protected ModelAndView invokeHandlerMethod(
      HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

    ModelAndView result = null;
    try {
      result = super.invokeHandlerMethod(request, response, handler);
      result.addObject("success", Boolean.valueOf(true));
    } catch (Exception e) {
      e.printStackTrace();
      result = new ModelAndView();
      result.addObject("success", Boolean.valueOf(false));
      result.addObject("errorMessage", e.getMessage());
    }
    if (result.getView() == null) result.setView(new JSONView());

    return result;
  }
  @RequestMapping(value = "/login/", method = RequestMethod.POST)
  public ModelAndView loginSubmit(
      HttpSession session, HttpServletRequest request, @ModelAttribute UserInfo userInfo) {
    ModelAndView mav = new ModelAndView();
    UserInfo loginUserInfo = loginService.login(userInfo);

    if (loginUserInfo.getUserId() != null) {
      session.setAttribute("userInfo", loginUserInfo);

      logger.debug("Login Success!!");
      mav.setView(new RedirectView("/food_blog/blog/"));
    } else {
      logger.debug("Login fail because UserInfo is not exist");
      mav.setViewName("login/loginFail");
    }

    return mav;
  }
  @RequestMapping(value = "/add_comment.isnet")
  public ModelAndView add_comment(
      @RequestParam(value = "option_no", required = false) int option_no,
      @RequestParam(value = "comment_value", required = false) String comment_value,
      @RequestParam(value = "comment_memo", required = false) String comment_memo) {

    logger.debug("[" + getClass().getSimpleName() + "] [add_comment] start");
    logger.debug(
        "[" + getClass().getSimpleName() + "] [add_comment] : app_no [" + option_no + "] end");
    logger.debug(
        "["
            + getClass().getSimpleName()
            + "] [add_comment] : comment_value ["
            + comment_value
            + "] end");
    logger.debug(
        "["
            + getClass().getSimpleName()
            + "] [add_comment] : comment_memo ["
            + comment_memo
            + "] end");

    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("OPTION_NO", option_no);
    paramMap.put("COMMENT_VALUE", comment_value);
    paramMap.put("COMMENT_MEMO", comment_memo);

    ModelAndView mav = new ModelAndView();
    mav.setView(mappingJacksonJsonView);

    try {
      int result_no = optionService.add_comment(paramMap);
      mav.addObject("result_no", result_no);
      mav.addObject("isSuccess", true);

    } catch (Exception e) {
      e.printStackTrace();
      mav.addObject("isSuccess", false);
    }

    logger.debug("[" + getClass().getSimpleName() + "] [add_comment] end");
    return mav;
  }
  /**
   * 회원가입 양식 submit
   *
   * @param userInfo
   */
  @RequestMapping(value = "/join/", method = RequestMethod.POST)
  public ModelAndView joinSubmit(
      @ModelAttribute UserInfo userInfo, BindingResult result, Map<String, BindingResult> model) {
    ModelAndView mav = new ModelAndView();

    loginValidator.validate(userInfo, result);

    model.put(BindingResult.class.getName() + ".loginValidator", result);
    if (!result.hasErrors()) {
      loginService.join(userInfo);
      myblogService.join(userInfo.getBlogAddress(), userInfo.getName());
      mav.setView(new RedirectView("/food_blog/"));
    } else {

      mav.addObject("userInfo", new UserInfo());
      mav.setViewName("login/create");
    }

    return mav;
  }
  /** Find an @{@link ExceptionHandler} method and invoke it to handle the raised exception. */
  @Override
  protected ModelAndView doResolveHandlerMethodException(
      HttpServletRequest request,
      HttpServletResponse response,
      HandlerMethod handlerMethod,
      Exception exception) {

    ServletInvocableHandlerMethod exceptionHandlerMethod =
        getExceptionHandlerMethod(handlerMethod, exception);
    if (exceptionHandlerMethod == null) {
      return null;
    }

    exceptionHandlerMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
    exceptionHandlerMethod.setHandlerMethodReturnValueHandlers(this.returnValueHandlers);

    ServletWebRequest webRequest = new ServletWebRequest(request, response);
    ModelAndViewContainer mavContainer = new ModelAndViewContainer();

    try {
      if (logger.isDebugEnabled()) {
        logger.debug("Invoking @ExceptionHandler method: " + exceptionHandlerMethod);
      }
      exceptionHandlerMethod.invokeAndHandle(webRequest, mavContainer, exception);
    } catch (Exception invocationEx) {
      logger.error(
          "Failed to invoke @ExceptionHandler method: " + exceptionHandlerMethod, invocationEx);
      return null;
    }

    if (mavContainer.isRequestHandled()) {
      return new ModelAndView();
    } else {
      ModelAndView mav = new ModelAndView().addAllObjects(mavContainer.getModel());
      mav.setViewName(mavContainer.getViewName());
      if (!mavContainer.isViewReference()) {
        mav.setView((View) mavContainer.getView());
      }
      return mav;
    }
  }
示例#17
0
 @RequestMapping("/handleupdate")
 public ModelAndView handleUpdate(@Valid User user, BindingResult result) {
   ModelAndView mv = new ModelAndView();
   if (result.hasFieldErrors()) {
     List<FieldError> list1 = result.getFieldErrors();
     List<String> list = new LinkedList<String>();
     Iterator<FieldError> it = list1.iterator();
     while (it.hasNext()) {
       FieldError f = (FieldError) it.next();
       String s = f.getDefaultMessage();
       list.add(s);
     }
     mv.addObject("errors", list);
     mv.setViewName("error");
     return mv;
   } else {
     service.updateUser(user);
     mv.setView(new RedirectView("/"));
     return mv;
   }
 }
  @RequestMapping(value = "edit.htm", method = RequestMethod.POST)
  public ModelAndView submitEdit(@ModelAttribute Holiday holiday, BindingResult result) {
    if (logger.isInfoEnabled()) {
      logger.info(this.getClass().toString() + "-EDIT-");
    }
    ModelAndView mav = new ModelAndView();

    try {
      //			new HolidayValidator().validate(holiday, result);
      mav.setViewName("holidayEdit");
      if (!result.hasErrors()) {
        BuckWaResponse response = yearService.getAll();
        List<Year> years = null;

        if (response.getStatus() == BuckWaConstants.SUCCESS) {
          years = (List) response.getResObj("yearList");

          BuckWaRequest request = new BuckWaRequest();
          request.put("holiday", holiday);
          response = holidayService.update(request);
          if (years != null) {
            mav.addObject("yearList", years);
          }
          if (response.getStatus() == BuckWaConstants.SUCCESS) {
            mav.addObject("successCode", response.getSuccessCode());
            mav.setView(new RedirectView("/PAM/admin/holiday/init.htm"));
          } else {
            mav.addObject("errorCode", response.getErrorCode());
          }
        } else {
          mav.addObject("errorCode", response.getErrorCode());
        }
      }

    } catch (Exception ex) {
      ex.printStackTrace();
      mav.addObject("errorCode", "E001");
    }
    return mav;
  }
  @RequestMapping(value = "/add_file.isnet")
  public ModelAndView add_file(
      @RequestParam(value = "product_no", required = false) int product_no,
      @RequestParam(value = "file_name", required = false) String file_name,
      @RequestParam(value = "file_no", required = false) String file_no) {
    logger.debug("[" + getClass().getSimpleName() + "] [add_file] start");
    logger.info(
        "[" + getClass().getSimpleName() + "] [add_file] : product_no [" + product_no + "]");
    logger.info("[" + getClass().getSimpleName() + "] [add_file] : file_name [" + file_name + "]");
    logger.info("[" + getClass().getSimpleName() + "] [add_file] : file_no [" + file_no + "]");

    ModelAndView mav = new ModelAndView();
    mav.setView(mappingJacksonJsonView);

    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("PRODUCT_NO", product_no);
    paramMap.put("OPTION_FILE_NAME", file_name);

    try {
      int result_no = 0;
      if (file_no.equals("")) {
        result_no = optionService.add_file(paramMap);
      } else {

        result_no = Integer.parseInt(file_no);
        paramMap.put("OPTION_FILE_NO", result_no);
        optionService.update_file(paramMap);
      }
      mav.addObject("isSuccess", true);
      mav.addObject("result_no", result_no);

    } catch (Exception e) {
      e.printStackTrace();
      mav.addObject("isSuccess", false);
    }

    logger.debug("[" + getClass().getSimpleName() + "] [add_file] end");
    return mav;
  }
示例#20
0
  @RequestMapping(value = "/check-user", method = RequestMethod.POST)
  public ModelAndView checkUser(
      Locale locale,
      @Valid @ModelAttribute("user") User user,
      BindingResult bindingResult,
      ModelMap modelMap,
      RedirectAttributes redirectAttributes) {

    ModelAndView modelAndView = new ModelAndView();
    if (!bindingResult.hasErrors()) {
      RedirectView redirectView = new RedirectView("mainpage");
      redirectView.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
      modelAndView.setView(redirectView);

      redirectAttributes.addFlashAttribute(
          "locale",
          messageSource.getMessage("locale", new String[] {locale.getDisplayName(locale)}, locale));
    } else {
      modelAndView.setViewName("login");
    }

    return modelAndView;
  }
示例#21
0
 @RequestMapping("/webApi/isActive.do")
 public ModelAndView isActive(HttpServletRequest req, HttpServletResponse res) {
   String uuid = req.getParameter("uuid");
   String partnerId = req.getParameter("partnerId");
   Map<String, Object> map = new HashMap<String, Object>();
   PartnerService ps = serviceFactory.getBean(partnerId);
   try {
     boolean isActive = ps.isActive(uuid, partnerId);
     map.put("rc", isActive ? WebApiService.SUCCESS : WebApiService.ACTIVE_FAILD);
   } catch (ServiceException e) {
     LOG.error(e.getMessage(), e);
     map.put("rc", e.getCode());
   } catch (Exception e) {
     LOG.error(e.getMessage(), e);
     map.put("rc", WebApiService.UNKNOWN_ERROR);
   }
   ModelAndView modelView = new ModelAndView();
   MappingJacksonJsonView view = new MappingJacksonJsonView();
   view.setAttributesMap(map);
   modelView.setView(view);
   LOG.debug(Json.toJson(map));
   return modelView;
 }
示例#22
0
  @RequestMapping(value = "/webApi/serverList.do", method = RequestMethod.POST)
  public ModelAndView serverList(String servers, String partnerId, long timestamp, String sign) {
    if (StringUtils.isBlank(servers) || StringUtils.isBlank(sign)) {
      throw new ServiceException(ServiceReturnCode.PARAM_ERROR, "参数错误");
    }

    checkSign(servers, partnerId, timestamp, sign);

    List<GameServer> serverList = Json.toList(servers, GameServer.class);

    if (serverMap == null) {
      serverMap = new HashMap<String, List<GameServer>>();
    }

    serverMap.put(partnerId, serverList);

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("rc", 1000);
    ModelAndView modelView = new ModelAndView();
    MappingJacksonJsonView view = new MappingJacksonJsonView();
    view.setAttributesMap(map);
    modelView.setView(view);
    return modelView;
  }
  // 옵션 리스트를 조회합니다.
  @RequestMapping(value = "/option_list_01.isnet")
  public ModelAndView option_list_01(
      @RequestParam(value = "page", defaultValue = "1") int page,
      @RequestParam(value = "rows", defaultValue = "10") int rows,
      @RequestParam(value = "sidx", required = false) String sidx,
      @RequestParam(value = "sord", required = false) String sord,
      @RequestParam(value = "_search", required = false, defaultValue = "false") boolean _search,
      @RequestParam(value = "searchField", required = false) String searchField,
      @RequestParam(value = "searchString", required = false) String searchString,
      @RequestParam(value = "searchOper", required = false) String searchOper,
      @RequestParam(value = "product", required = false) String product,
      @RequestParam(value = "optionfile", required = false) String file,
      @RequestParam(value = "optioonApp", required = false) String app) {

    logger.debug("[" + getClass().getSimpleName() + "] [option_list_01] start");

    logger.info("[" + getClass().getSimpleName() + "] [option_list_01] product [" + product + "]");
    logger.info("[" + getClass().getSimpleName() + "] [option_list_01] file [" + file + "]");
    logger.info("[" + getClass().getSimpleName() + "] [option_list_01] app [" + app + "]");

    logger.info("[" + getClass().getSimpleName() + "] [option_list_01] page [" + page + "]");
    logger.info("[" + getClass().getSimpleName() + "] [option_list_01] rows [" + rows + "]");
    logger.info("[" + getClass().getSimpleName() + "] [option_list_01] sidx [" + sidx + "]");
    logger.info("[" + getClass().getSimpleName() + "] [option_list_01] sord [" + sord + "]");
    logger.info("[" + getClass().getSimpleName() + "] [option_list_01] _search [" + _search + "]");

    // 조건맵
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("PRODUCT_NO", product);
    paramMap.put("OPTION_FILE_NO", product);
    paramMap.put("OPTION_APP_NO", file);

    paramMap.put("PRODUCT_NO", app);
    paramMap.put("PAGE", page);
    paramMap.put("ROWS", rows);
    paramMap.put("SIDX", sidx);
    paramMap.put("SORD", sord);
    paramMap.put("_SEARCH", _search);

    ModelAndView mav = new ModelAndView();
    mav.setView(mappingJacksonJsonView);

    if (_search) {

      logger.info("searchField [" + searchField + "]");
      logger.info("searchString [" + searchString + "]");
      logger.info("searchOper [" + searchOper + "]");

      paramMap.put("SEARCH_FIELD", searchField);
      paramMap.put("SEARCH_STRING", searchString);
      paramMap.put("SEARCH_OPER", searchOper);
    }

    try {
      Map<String, Object> resultMap = optionService.getFullOptionList(paramMap);
      mav.addAllObjects(resultMap);

    } catch (Exception e) {
      e.printStackTrace();
      logger.error("[" + getClass().getSimpleName() + "] [option_list_01] 옵션 리스트 조회 오류");
    }
    logger.debug("[" + getClass().getSimpleName() + "] [option_list_01] end");

    return mav;
  }
  @RequestMapping(value = "/add_option.isnet")
  public ModelAndView add_option(
      @RequestParam(value = "app_no", required = false) String app_no,
      @RequestParam(value = "option_name", required = false) String option_name,
      @RequestParam(value = "option_no", required = false) String option_no,
      @RequestParam(value = "default_value", required = false) String default_value,
      @RequestParam(value = "option_comment", required = false) String option_comment) {

    logger.debug("[" + getClass().getSimpleName() + "] [add_option] start");
    logger.info("[" + getClass().getSimpleName() + "] [add_option]  : app_no [" + app_no + "] end");
    logger.info(
        "["
            + getClass().getSimpleName()
            + "] [add_option]  : option_name ["
            + option_name
            + "] end");
    logger.info(
        "[" + getClass().getSimpleName() + "] [add_option]  : option_no [" + option_no + "] end");
    logger.info(
        "["
            + getClass().getSimpleName()
            + "] [add_option]  : default_value ["
            + default_value
            + "] end");
    logger.info(
        "["
            + getClass().getSimpleName()
            + "] [add_option]  : option_comment ["
            + option_comment
            + "] end");

    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("OPTION_APP_NO", app_no);
    paramMap.put("OPTION_KEY_NAME", option_name);
    paramMap.put("OPTION_DEFAULT_VALUE", default_value);
    paramMap.put("OPTION_COMMENT", option_comment);

    ModelAndView mav = new ModelAndView();
    mav.setView(mappingJacksonJsonView);
    int result_no = 0;
    try {
      if (option_no.equals("")) {
        result_no = optionService.add_option(paramMap);
      } else {

        result_no = Integer.parseInt(option_no);
        paramMap.put("OPTION_NO", result_no);
        optionService.update_option(paramMap);
      }

      mav.addObject("result_no", result_no);
      mav.addObject("isSuccess", true);

    } catch (Exception e) {
      e.printStackTrace();
      mav.addObject("isSuccess", false);
    }

    logger.debug("[" + getClass().getSimpleName() + "] [add_option] end");
    return mav;
  }
示例#25
0
  // TODO 实现获取服务器列表
  @RequestMapping("/webApi/getServerList.do")
  public ModelAndView getServerList(HttpServletRequest req) {
    String partnerId =
        StringUtils.isBlank(req.getParameter("partnerId")) ? "1001" : req.getParameter("partnerId");
    List<GameServer> serverList = null;
    String version = req.getParameter("version");
    VersionServer versionServer = null;

    if (!StringUtils.isBlank(version)) {
      versionServer = versionServerDao.getVersionServer(version);
    }
    serverList = GameServerCache.getInstance().getGameServers(partnerId);
    if (serverList != null && serverList.size() > 0) {

      boolean isSpceImei = false;
      if (req.getParameter("fr") != null
          && activeCodeDao.isBlackImei(req.getParameter("fr"), partnerId)) {
        isSpceImei = true;
      }

      if (req.getParameter("mac") != null
          && activeCodeDao.isBlackImei(req.getParameter("mac"), partnerId)) {
        isSpceImei = true;
      }

      String ip = req.getRemoteAddr();

      if (this.serverStatusDao.isWhiteIp(partnerId, ip)) {
        isSpceImei = true;
      }

      // 处理IMEI白名单
      List<GameServer> serverListForSpecImei = new ArrayList<GameServer>(serverList.size());
      for (GameServer gs : serverList) {

        // IMEI白名单中的GameServer状态都需要为1
        int status = gs.getStatus();
        if (status == 100) {
          if (isSpceImei) {
            status = 1;
          } else {
            continue;
          }
        }

        String ind = gs.getServerId().replaceAll("[a-zA-Z]+", "");
        if (versionServer != null) {
          if (versionServer.getServerId().indexOf(gs.getServerId()) < 0) {
            continue;
          }
        }
        GameServer gameServerForSpecImei = new GameServer();
        gameServerForSpecImei.setServerId(gs.getServerId());
        gameServerForSpecImei.setServerName(ind + "-" + gs.getServerName());
        gameServerForSpecImei.setServerPort(gs.getServerPort());
        gameServerForSpecImei.setStatus(status);
        gameServerForSpecImei.setOpenTime(gs.getOpenTime());
        gameServerForSpecImei.setServerHost(gs.getServerHost());

        serverListForSpecImei.add(gameServerForSpecImei);
      }

      Collections.sort(
          serverListForSpecImei,
          new Comparator<GameServer>() {

            @Override
            public int compare(GameServer o1, GameServer o2) {
              if (o1.getOpenTime() > o2.getOpenTime()) {
                return -1;
              } else if (o1.getOpenTime() < o2.getOpenTime()) {
                return 1;
              }

              return 0;
            }
          });

      // 使用为IMEI白名单定制的ServerList
      serverList = serverListForSpecImei;

    } else {
      serverList = new ArrayList<GameServer>();
      GameServer gs = new GameServer();
      gs.setServerId("d1");
      gs.setServerName("测试服务器-潮哥");
      gs.setStatus(1);
      serverList.add(gs);
    }

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("sl", serverList);
    ModelAndView modelView = new ModelAndView();
    MappingJacksonJsonView view = new MappingJacksonJsonView();
    view.setAttributesMap(map);
    modelView.setView(view);
    return modelView;
  }
示例#26
0
 @SuppressWarnings({"unchecked", "rawtypes"})
 @RequestMapping("/webApi/updateConfigs.do")
 public ModelAndView updateServers() {
   Map<String, Object> map = new HashMap<String, Object>();
   try {
     GameServerCache.getInstance().reload();
     Properties properties = new Properties();
     properties.load(QiHooSdk.class.getResourceAsStream("/sdk.properties"));
     Iterator<Entry<Object, Object>> iterator = properties.entrySet().iterator();
     Set<String> set = new HashSet<String>();
     while (iterator.hasNext()) {
       try {
         Entry<Object, Object> entry = iterator.next();
         String className = StringUtils.split(entry.getKey().toString(), ".")[0];
         if (!set.contains(className)) {
           Class sdkClass = Class.forName("com.lodogame.ldsg.partner.sdk." + className);
           if (sdkClass == null) {
             continue;
           }
           Method instanceMethod = sdkClass.getMethod("instance", new Class[] {});
           Method reloadMethod = sdkClass.getMethod("reload", new Class[] {});
           Object object = instanceMethod.invoke(null, null);
           reloadMethod.invoke(object, null);
           LOG.info(className + " reload!");
           set.add(className);
         }
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   // QiHooSdk.instance().reload();
   // BaiduSdk.instance().reload();
   // UcSdk.instance().reload();
   // LenovoSdk.instance().reload();
   // EasouSdk.instance().reload();
   // PartnerConfig.ins().reload();
   // BaiduZsSdk.instance().reload();
   // AnZhiSdk.instance().reload();
   // AppChinaSdk.instance().reload();
   // AppleSdk.instance().reload();
   // ChangWanSdk.instance().reload();
   // ChinaMobileSdk.instance().reload();
   // DangleSdk.instance().reload();
   // DuokuSdk.instance().reload();
   // HucnSdk.instance().reload();
   // SanqiWanwanSdk.instance().reload();
   // ShiJiaSdk.instance().reload();
   // XiaomiSdk.instance().reload();
   // KuaiBoSdk.instance().reload();
   // AnZhiAdSdk.instance().reload();
   // PPSSdk.instance().reload();
   // KuWoSdk.instance().reload();
   map.put("rc", 1000);
   ModelAndView modelView = new ModelAndView();
   MappingJacksonJsonView view = new MappingJacksonJsonView();
   view.setAttributesMap(map);
   modelView.setView(view);
   return modelView;
 }
示例#27
0
  @RequestMapping("/webApi/login.do")
  public ModelAndView login(HttpServletRequest req, HttpServletResponse res) {
    String token = req.getParameter("token");
    String partnerId = req.getParameter("partnerId");
    String serverId = req.getParameter("serverId");
    String timestamp = req.getParameter("timestamp");
    String sign = req.getParameter("sign");
    String imei = req.getParameter("fr");
    String mac = req.getParameter("mac");
    String idfa = req.getParameter("idfa");

    getRequstParams(req);

    PartnerService ps = serviceFactory.getBean(partnerId);
    LOG.info("渠道:" + partnerId + ":" + ps.getClass().getName());
    Map<String, Object> map = new HashMap<String, Object>();
    try {

      Map<String, String> params = new HashMap<String, String>();
      params.put("imei", imei);
      params.put("mac", mac);
      params.put("idfa", idfa);

      UserToken userToken =
          ps.login(token, partnerId, serverId, Long.parseLong(timestamp), sign, params);
      if (userToken != null) {
        map.put("rc", WebApiService.SUCCESS);
        Map<String, String> data = new HashMap<String, String>();
        data.put("tk", userToken.getToken());
        data.put("uid", userToken.getUserId());
        data.put("puid", userToken.getPartnerUserId());
        data.put("ptk", userToken.getPartnerToken());
        data.put("exti", userToken.getExtInfo());
        Notice notice = webApiService.getNotice(serverId, partnerId);
        if (notice != null && notice.getIsEnable() == 1) {
          data.put("title", notice.getTitle());
          data.put("notice", notice.getContent());
        } else {
          notice = webApiService.getNotice(serverId, "all");
          if (notice != null && notice.getIsEnable() == 1) {
            data.put("title", notice.getTitle());
            data.put("notice", notice.getContent());
          } else {
            notice = webApiService.getNotice("all", "all");
            if (notice != null && notice.getIsEnable() == 1) {
              data.put("title", notice.getTitle());
              data.put("notice", notice.getContent());
            }
          }
        }
        map.put("dt", data);
      } else {
        map.put("rc", WebApiService.UNKNOWN_ERROR);
      }
    } catch (ServiceException e) {
      LOG.error(e.getMessage(), e);
      map.put("rc", e.getCode());
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
      map.put("rc", WebApiService.UNKNOWN_ERROR);
    }
    ModelAndView modelView = new ModelAndView();
    MappingJacksonJsonView view = new MappingJacksonJsonView();
    view.setAttributesMap(map);
    modelView.setView(view);
    LOG.debug("parnterId:" + partnerId + "," + Json.toJson(map));
    return modelView;
  }