Esempio n. 1
0
  @RequestMapping(value = "/queryAllMenus", method = RequestMethod.POST)
  @ResponseBody
  public Object queryAllMenus(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    String parentId = request.getParameter("parentId");

    // 设置参数
    String headUrl = ConfigUtils.getStringValue("api.serverURL");
    String tailUrl = ConfigUtils.getStringValue("admin.manage.permission.menu.queryAll");
    String requestURI = headUrl + tailUrl;
    Map<String, String> bodyParam = new HashMap<String, String>();
    if (StringUtils.hasLength(parentId)) {
      bodyParam.put("parentId", parentId);
    }

    // 调REST接口
    String result = new RestPostClient().callRestRPC(requestURI, bodyParam, request);
    // 设置返回值
    // 1.判断操作结果
    if (result == null) {
      logger.error("调用后台接口返回值为null");
      return "false";
    }
    JsonResult jsonResult = JsonUtil.fromJson(result, JsonResult.class);
    return jsonResult;
  }
Esempio n. 2
0
  /**
   * @Title: updateMenu @Description: 修改菜单信息
   *
   * @param request
   * @param response
   * @return
   * @throws Exception
   * @return: Object
   */
  @RequestMapping(value = "/updateMenu", method = RequestMethod.POST)
  @ResponseBody
  public Object updateMenu(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    String nodeID = request.getParameter("nodeID");
    String menuUrl = request.getParameter("menuUrl");
    String funcName = request.getParameter("menuName");
    String remark = request.getParameter("remark");

    // 设置参数
    String headUrl = ConfigUtils.getStringValue("api.serverURL");
    String tailUrl = ConfigUtils.getStringValue("admin.manage.permission.menu.updateMenu");
    String requestURI = headUrl + tailUrl;
    Map<String, String> bodyParam = new HashMap<String, String>();
    if (StringUtils.hasLength(nodeID)) {
      bodyParam.put("funcId", nodeID);
    }
    if (StringUtils.hasLength(menuUrl)) {
      bodyParam.put("menuUrl", menuUrl);
    }
    if (StringUtils.hasLength(funcName)) {
      bodyParam.put("funcName", funcName);
    }
    if (StringUtils.hasLength(remark)) {
      bodyParam.put("remark", remark);
    }

    // 调REST接口
    String result = new RestPostClient().callRestRPC(requestURI, bodyParam, request);
    // 设置返回值
    // 1.判断操作结果
    if (result == null) {
      logger.error("调用后台接口返回值为null");
      return "false";
    }
    JsonResult jsonResult = JsonUtil.fromJson(result, JsonResult.class);
    return jsonResult;
  }