Java Code Examples for com.alibaba.fastjson.JSONObject#getString()

The following examples show how to use com.alibaba.fastjson.JSONObject#getString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OauthDouban.java    From mblog with GNU General Public License v3.0 6 votes vote down vote up
public OpenOauthBean getUserBeanByCode(String code)
        throws KeyManagementException, NoSuchAlgorithmException, NoSuchProviderException, IOException {
    OpenOauthBean openOauthBean = null;
    JSONObject userInfo = me().getUserInfoByCode(code);

    openOauthBean = new OpenOauthBean();
    String openid = userInfo.getString("uid");
    String accessToken = userInfo.getString("access_token");
    String nickname = userInfo.getString("name");
    String photoUrl = userInfo.getString("large_avatar");

    openOauthBean.setOauthCode(code);
    openOauthBean.setAccessToken(accessToken);
    openOauthBean.setExpireIn("");
    openOauthBean.setOauthUserId(openid);
    openOauthBean.setOauthType(EnumOauthTypeBean.TYPE_DOUBAN.getValue());
    openOauthBean.setUsername("DB" + openid.getBytes().hashCode());
    openOauthBean.setNickname(nickname);
    openOauthBean.setAvatar(photoUrl);

    return openOauthBean;
}
 
Example 2
Source File: AuthTaobaoRequest.java    From JustAuth with MIT License 6 votes vote down vote up
@Override
protected AuthUser getUserInfo(AuthToken authToken) {
    String response = doPostAuthorizationCode(authToken.getAccessCode());
    JSONObject accessTokenObject = JSONObject.parseObject(response);
    if (accessTokenObject.containsKey("error")) {
        throw new AuthException(accessTokenObject.getString("error_description"));
    }
    authToken.setAccessToken(accessTokenObject.getString("access_token"));
    authToken.setRefreshToken(accessTokenObject.getString("refresh_token"));
    authToken.setExpireIn(accessTokenObject.getIntValue("expires_in"));
    authToken.setUid(accessTokenObject.getString("taobao_user_id"));
    authToken.setOpenId(accessTokenObject.getString("taobao_open_uid"));

    String nick = GlobalAuthUtils.urlDecode(accessTokenObject.getString("taobao_user_nick"));
    return AuthUser.builder()
        .rawUserInfo(new JSONObject())
        .uuid(accessTokenObject.getString("taobao_user_id"))
        .username(nick)
        .nickname(nick)
        .gender(AuthUserGender.UNKNOWN)
        .token(authToken)
        .source(source.toString())
        .build();
}
 
Example 3
Source File: VelocityUtils.java    From supplierShop with MIT License 6 votes vote down vote up
/**
 * 获取需要在哪一列上面显示展开按钮
 * 
 * @param genTable 业务表对象
 * @return 展开按钮列序号
 */
public static int getExpandColumn(GenTable genTable)
{
    String options = genTable.getOptions();
    JSONObject paramsObj = JSONObject.parseObject(options);
    String treeName = paramsObj.getString(GenConstants.TREE_NAME);
    int num = 0;
    for (GenTableColumn column : genTable.getColumns())
    {
        if (column.isList())
        {
            num++;
            String columnName = column.getColumnName();
            if (columnName.equals(treeName))
            {
                break;
            }
        }
    }
    return num;
}
 
Example 4
Source File: AVFirebaseMessagingService.java    From java-unified-sdk with Apache License 2.0 6 votes vote down vote up
/**
 * FCM 有两种消息:通知消息与数据消息。
 * 通知消息 -- 就是普通的通知栏消息,应用在后台的时候,通知消息会直接显示在通知栏,默认情况下,
 * 用户点按通知即可打开应用启动器(通知消息附带的参数在 Bundle 内),我们无法处理。
 *
 * 数据消息 -- 类似于其他厂商的「透传消息」。应用在前台的时候,数据消息直接发送到应用内,应用层通过这一接口进行响应。
 *
 * @param remoteMessage
 */
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
  Map<String, String> data = remoteMessage.getData();
  if (null == data) {
    return;
  }
  LOGGER.d("received message from: " + remoteMessage.getFrom() + ", payload: " + data.toString());
  try {
    JSONObject jsonObject = JSON.parseObject(data.get("payload"));
    if (null != jsonObject) {
      String channel = jsonObject.getString("_channel");
      String action = jsonObject.getString("action");

      AndroidNotificationManager androidNotificationManager = AndroidNotificationManager.getInstance();
      androidNotificationManager.processGcmMessage(channel, action, jsonObject.toJSONString());
    }
  } catch (Exception ex) {
    LOGGER.e("failed to parse push data.", ex);
  }
}
 
Example 5
Source File: LoginServiceImpl.java    From SpringBoot-Shiro-Vue-master-20180625 with Apache License 2.0 6 votes vote down vote up
/**
 * 登录表单提交
 *
 * @param jsonObject
 * @return
 */
@Override
public JSONObject authLogin(JSONObject jsonObject) {
    String username = jsonObject.getString("username");
    String password = jsonObject.getString("password");
    JSONObject returnData = new JSONObject();
    Subject currentUser = SecurityUtils.getSubject();
    UsernamePasswordToken token = new UsernamePasswordToken(username, password);
    try {
        currentUser.login(token);
        returnData.put("result", "success");
    } catch (AuthenticationException e) {
        returnData.put("result", "fail");
    }
    return CommonUtil.successJson(returnData);
}
 
Example 6
Source File: RpcClient.java    From chain33-sdk-java with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * @description 通过密码获取seed
 * 
 * @param passwd 密码
 * @return  seed
 */
public String seedGet(String passwd) {
    RpcRequest postData = getPostData(RpcMethod.GET_SEED);
    JSONObject requestParam = new JSONObject();
    requestParam.put("passwd", passwd);
    postData.addJsonParams(requestParam);
    String result = HttpUtil.httpPostBody(getUrl(), postData.toJsonString());
    if (StringUtil.isNotEmpty(result)) {
        JSONObject parseObject = JSONObject.parseObject(result);
        if (messageValidate(parseObject))
            return null;
        JSONObject resultJson = parseObject.getJSONObject("result");
        String seed = resultJson.getString("seed");
        return seed;
    }
    return null;
}
 
Example 7
Source File: ListMsgListener.java    From MicroCommunity with Apache License 2.0 5 votes vote down vote up
@Override
protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {

    MsgDto msgDto = BeanConvertUtil.covertBean(reqJson, MsgDto.class);
    String[] viewObjIds = new String[]{"9999", reqJson.getString("communityId"), reqJson.getString("storeId"), reqJson.getString("userId")};
    msgDto.setViewObjIds(viewObjIds);
    int count = msgInnerServiceSMOImpl.queryMsgsCount(msgDto);

    List<ApiMsgDataVo> msgs = null;

    if (count > 0) {
        msgs = BeanConvertUtil.covertBeanList(msgInnerServiceSMOImpl.queryMsgs(msgDto), ApiMsgDataVo.class);
    } else {
        msgs = new ArrayList<>();
    }

    ApiMsgVo apiMsgVo = new ApiMsgVo();

    apiMsgVo.setTotal(count);
    apiMsgVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row")));
    apiMsgVo.setMsgs(msgs);

    ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiMsgVo), HttpStatus.OK);

    context.setResponseEntity(responseEntity);

}
 
Example 8
Source File: Admin.java    From jcgroup with Apache License 2.0 5 votes vote down vote up
public Admin(int subsystems) throws IOException {
  String content =
      IOUtils.toString(this.getClass().getClassLoader()
          .getResourceAsStream(userConfName));
  JSONObject json = JSON.parseObject(content);
  String name = json.getString(USER_CONF_KEY_NAME);
  String password = json.getString(USER_CONF_KEY_PASSWORD);

  init(name, password, subsystems);
}
 
Example 9
Source File: ParserHelperImpl.java    From tephra with MIT License 5 votes vote down vote up
@Override
public Color getColor(JSONObject object, String key) {
    if (!object.containsKey(key))
        return null;

    String color = object.getString(key);
    int[] ns;
    if (color.charAt(0) == '#') {
        int length = color.length();
        if (length != 4 && length != 7) {
            logger.warn(null, "解析颜色值[{}]失败!", color);

            return null;
        }

        String[] array = new String[3];
        boolean full = length == 7;
        for (int i = 0; i < array.length; i++)
            array[i] = full ? color.substring(2 * i + 1, 2 * i + 3) : (color.substring(i + 1, i + 2) + color.substring(i + 1, i + 2));
        ns = new int[3];
        for (int i = 0; i < ns.length; i++)
            ns[i] = numeric.hexToInt(array[i]);
    } else if (color.indexOf('(') > -1)
        ns = numeric.toInts(color.substring(color.indexOf('(') + 1, color.indexOf(')')));
    else {
        logger.warn(null, "解析颜色值[{}]失败!", color);

        return null;
    }

    return object.containsKey("alpha") ? new Color(ns[0], ns[1], ns[2], numeric.toInt(object.getDoubleValue("alpha") * 255))
            : new Color(ns[0], ns[1], ns[2]);
}
 
Example 10
Source File: TextImpl.java    From tephra with MIT License 5 votes vote down vote up
private String getString(JSONObject text, JSONObject paragraph, JSONObject word, String key) {
    if (word != null && word.containsKey(key))
        return word.getString(key);

    if (paragraph.containsKey(key))
        return paragraph.getString(key);

    if (text.containsKey(key))
        return text.getString(key);

    return null;
}
 
Example 11
Source File: TestController.java    From teaching with Apache License 2.0 5 votes vote down vote up
@PostMapping("/sendUser")
  public Result<String> sendUser(@RequestBody JSONObject jsonObject) {
  	Result<String> result = new Result<String>();
  	String userId = jsonObject.getString("userId");
  	String message = jsonObject.getString("message");
  	JSONObject obj = new JSONObject();
  	obj.put("cmd", "user");
  	obj.put("userId", userId);
obj.put("msgId", "M0001");
obj.put("msgTxt", message);
      webSocket.sendOneMessage(userId, obj.toJSONString());
      result.setResult("单发");
      return result;
  }
 
Example 12
Source File: SysUserController.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 还原被逻辑删除的用户
 *
 * @param jsonObject
 * @return
 */
@RequestMapping(value = "/putRecycleBin", method = RequestMethod.PUT)
public Result putRecycleBin(@RequestBody JSONObject jsonObject, HttpServletRequest request) {
    String userIds = jsonObject.getString("userIds");
    if (StringUtils.isNotBlank(userIds)) {
        SysUser updateUser = new SysUser();
        updateUser.setUpdateBy(JwtUtil.getUserNameByToken(request));
        updateUser.setUpdateTime(new Date());
        sysUserService.revertLogicDeleted(Arrays.asList(userIds.split(",")), updateUser);
    }
    return Result.ok("还原成功");
}
 
Example 13
Source File: EmojiConverter.java    From message_interface with MIT License 4 votes vote down vote up
private boolean setup() {
    if (inited) {
        return true;
    }

    final char[] keys = {'|', '(', ')', '[', ']', '{', '}', '<', '>' , '.', '*', '\\', '^', '$', '+', '-', ',', '?', '='};
    for (char key : keys) {
        patternKeys.add(key);
    }

    try {
        StringBuilder wxEmojis = new StringBuilder();
        File file = ResourceUtils.getFile("classpath:config/emoji_mapping.json"); // new File("e:/emoji_mapping.json"); //
        String content = FileUtils.readFileToString(file, Charset.forName("utf-8"));
        JSONArray pairs = JSONArray.parseArray(content);
        for (int i = 0; i < pairs.size(); ++i) {
            JSONObject item = pairs.getJSONObject(i);
            String nim = item.getString("nim");
            String wx = item.getString("wx");

            // 微信的表情没有停止符,做全匹配比较好
            if (i > 0) {
                wxEmojis.append('|');
            }
            wxEmojis.append(escapePattern(wx));

            // 存入map
            if (nim.startsWith("[")) {
                nim2Wx.put(nim, wx);
            }
            wx2Nim.put(wx, nim);
        }
        wxPattern = Pattern.compile(wxEmojis.toString(), Pattern.UNICODE_CASE);
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }

    inited = true;
    return true;
}
 
Example 14
Source File: WechatHelper.java    From cms with Apache License 2.0 4 votes vote down vote up
public WxAccountFollow getAccountFollow(String accessToken, String openId) throws Exception {


        String url = wechatUrl + "cgi-bin/user/info?access_token=" + accessToken + "&openid=" + openId + "&lang=zh_CN";
        String json = HttpUtils.doGet(url);
        if (logger.isInfoEnabled()) {
            logger.info("\n 结果:" + json);
        }
        JSONObject jsonObject = JSONObject.parseObject(json);

        if (null == jsonObject) {
            throw new Exception("获得用户错误。");
        }
        // logger.info("获取用户信息接口返回结果:" + jsonObject.toString());
        if (jsonObject.containsKey("errcode")) {
            throw new Exception(
                    "信息数据失败!错误码为:" + jsonObject.getIntValue("errcode") + "错误信息为:" + jsonObject.getString("errmsg"));
        }

        WxAccountFollow accountFollow = new WxAccountFollow();

        accountFollow.setOpenId(jsonObject.getString("openid"));// 用户的标识
        accountFollow.setSubscribe(new Integer(jsonObject.getIntValue("subscribe")));// 关注状态(1是关注,0是未关注),未关注时获取不到其余信息
        if (jsonObject.containsKey("subscribe_time")) {
            accountFollow.setSubscribeDate(
                    DateUtils.timestampToDate(jsonObject.getString("subscribe_time"), "yyyy-MM-dd HH:mm:ss"));// 用户关注时间
        }
        if (jsonObject.containsKey("nickname")) {// 昵称
            accountFollow.setNickName(jsonObject.getString("nickname"));
        }
        if (jsonObject.containsKey("sex")) {// 用户的性别(1是男性,2是女性,0是未知)
            accountFollow.setSex(jsonObject.getIntValue("sex"));
        }
        if (jsonObject.containsKey("language")) {// 用户的语言,简体中文为zh_CN
            accountFollow.setLanguage(jsonObject.getString("language"));
        }
        if (jsonObject.containsKey("country")) {// 用户所在国家
            accountFollow.setCountry(jsonObject.getString("country"));
        }
        if (jsonObject.containsKey("province")) {// 用户所在省份
            accountFollow.setProvince(jsonObject.getString("province"));
        }
        if (jsonObject.containsKey("city")) {// 用户所在城市
            accountFollow.setCity(jsonObject.getString("city"));
        }
        if (jsonObject.containsKey("headimgurl")) {// 用户头像
            accountFollow.setAvatar(jsonObject.getString("headimgurl"));
        }
        if (jsonObject.containsKey("remark")) {
            accountFollow.setRemark(jsonObject.getString("remark"));
        }
        accountFollow.setStatus(1);
        accountFollow.setCreateDate(new Date());
        return accountFollow;

    }
 
Example 15
Source File: GetLinesUsersJob.java    From 163-bigdate-note with GNU General Public License v3.0 4 votes vote down vote up
public static String parseLog(String row) throws Exception {

        JSONObject bizData = JSON.parseObject(row);
        return bizData.getString("user_id");
    }
 
Example 16
Source File: FloorServiceSMOImpl.java    From MicroCommunity with Apache License 2.0 4 votes vote down vote up
/**
 * 查询小区楼
 *
 * @param pd 页面数据封装对象
 * @return 返回 ResponseEntity对象包含 http状态 信息 body信息
 */
@Override
public ResponseEntity<String> listFloor(IPageData pd) {
    JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
    if(paramIn.containsKey("row")){
        paramIn.put("rows",paramIn.getString("row"));
    }
    validateListFloor(pd,paramIn);

    int page = Integer.parseInt(paramIn.getString("page"));
    int rows = Integer.parseInt(paramIn.getString("rows"));
    String communityId = paramIn.getString("communityId");

    //小区楼编号
    String floorNum = paramIn.getString("floorNum");


    //校验用户是否有权限
    super.checkUserHasPrivilege(pd, restTemplate, PrivilegeCodeConstant.PRIVILEGE_FLOOR);

    ResponseEntity responseEntity = super.getStoreInfo(pd, restTemplate);
    if (responseEntity.getStatusCode() != HttpStatus.OK) {
        return responseEntity;
    }
    Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeId", "根据用户ID查询商户ID失败,未包含storeId节点");
    Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeTypeCd", "根据用户ID查询商户类型失败,未包含storeTypeCd节点");

    String storeId = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeId");
    String storeTypeCd = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeTypeCd");
    //数据校验是否 商户是否入驻该小区
    super.checkStoreEnterCommunity(pd, storeId, storeTypeCd, communityId, restTemplate);
    String apiUrl = ServiceConstant.SERVICE_API_URL + "/api/floor.queryFloors" + mapToUrlParam(paramIn);

    responseEntity = this.callCenterService(restTemplate, pd, "",
            apiUrl,
            HttpMethod.GET);

    if (responseEntity.getStatusCode() != HttpStatus.OK) {
        return responseEntity;
    }

    JSONObject resultObjs = JSONObject.parseObject(responseEntity.getBody().toString());
    resultObjs.put("row", rows);
    resultObjs.put("page", page);
    return responseEntity;
}
 
Example 17
Source File: GeneratorBindingComponent.java    From MicroCommunity with Apache License 2.0 4 votes vote down vote up
private void genneratorAddHtml(JSONObject data, String componentName) {
    StringBuffer sb = readFile(GeneratorStart.class.getResource("/relationship/add/add.html").getFile());
    String fileContext = sb.toString();

    fileContext = super.replaceBindingTemplateContext(fileContext, data);

    // 处理 th 信息

    StringBuffer thSb = new StringBuffer();

    JSONObject _currentObj = data.getJSONObject("components").getJSONObject(componentName);

    JSONArray columns = _currentObj.getJSONArray("columns");
    for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {
        JSONObject column = columns.getJSONObject(columnIndex);
        if ("none".equals(column.getString("inputType"))) {
            continue;
        }
        String required = column.getBoolean("required") ? "必填" : "选填";
        String inputStr = "";
        if ("select".equals(column.getString("inputType"))) {

            String[] selectValues = column.getString("selectValue").split(",");
            String[] selectValueNames = column.getString("selectValueName").split(",");


            String option = "";
            for (int valueIndex = 0; valueIndex < selectValues.length; valueIndex++) {

                String value = selectValues[valueIndex];

                option += "<option  value=\"" + value + "\">" + selectValueNames[valueIndex] + "</option>\n";

            }

            inputStr = "<select class=\"custom-select\" v-model=\"" + _currentObj.getString("templateCode") + "ViewInfo." + column.getString("code") + "\">\n" +
                    "         <option selected  disabled value=\"\">" + required + ",请选择" + column.getString("cnCode") + "</option>\n" +
                    "         " + option +
                    "  </select>";
        } else if ("textarea".equals(column.getString("inputType"))) {
            inputStr = "<textarea  placeholder=\"" + required + ",请填写" + column.getString("cnCode") + "\" class=\"form-control\"" +
                    " v-model=\"" + _currentObj.getString("templateCode") + "ViewInfo." + column.getString("code") + "\">" +
                    "</textarea>";
        } else {
            inputStr = "           <input v-model=\"" + _currentObj.getString("templateCode") + "ViewInfo." + column.getString("code") + "\" " +
                    "                  type=\"text\" placeholder=\"" + required + ",请填写" + column.getString("cnCode") + "\" class=\"form-control\">\n";
        }
        thSb.append("<div class=\"form-group row\">\n" +
                "         <label class=\"col-sm-2 col-form-label\">" + column.getString("cnCode") + "</label>\n" +
                "         <div class=\"col-sm-10\">\n" +
                inputStr +
                "         </div>\n" +
                "</div>\n");

    }

    fileContext = fileContext.replace("@@addTemplateColumns@@", thSb.toString());


    String writePath = this.getClass().getResource("/").getPath()
            + "out/relationship/component/" + _currentObj.getString("package") + "/" + _currentObj.getString("templateCode") + "View/" + _currentObj.getString("templateCode") + "View.html";
    System.out.printf("writePath: " + writePath);
    writeFile(writePath,
            fileContext);
}
 
Example 18
Source File: LindenIndexRequestParser.java    From linden with Apache License 2.0 4 votes vote down vote up
public static LindenIndexRequest parse(LindenSchema schema, String content) throws IOException{
  LindenIndexRequest request = new LindenIndexRequest();
  JSONObject json = JSONObject.parseObject(content);
  if (json.containsKey(TYPE)) {
    String type = json.getString(TYPE);
    switch (type.toLowerCase()) {
      case INDEX:
        request.setType(IndexRequestType.INDEX);
        request.setDoc(LindenDocumentBuilder.build(schema, json.getJSONObject(CONTENT)));
        request.setId(request.getDoc().getId());
        break;
      case DELETE:
        request.setType(IndexRequestType.DELETE);
        if (json.containsKey(schema.getId())) {
          request.setId(json.getString(schema.getId()));
        } else {
          throw new IOException(json.toJSONString() + " does not has id [" + schema.getId() + "]");
        }
        break;
      case UPDATE:
        request.setType(IndexRequestType.UPDATE);
        request.setDoc(LindenDocumentBuilder.build(schema, json.getJSONObject(CONTENT)));
        request.setId(request.getDoc().getId());
        break;
      case REPLACE:
        request.setType(IndexRequestType.REPLACE);
        request.setDoc(LindenDocumentBuilder.build(schema, json.getJSONObject(CONTENT)));
        request.setId(request.getDoc().getId());
        break;
      // delete one index in multi core linden mode
      case DELETE_INDEX:
        request.setType(IndexRequestType.DELETE_INDEX);
        break;
      // swap the index with current index in hot swap mode
      case SWAP_INDEX:
        request.setType(IndexRequestType.SWAP_INDEX);
        break;
      default:
        throw new IOException("Invalid index type: " + type);
    }
    if (json.containsKey(ROUTE)) {
      JSONArray shardArray = json.getJSONArray(ROUTE);
      request.setRouteParam(new IndexRouteParam());
      for (int i = 0; i < shardArray.size(); ++i) {
        request.getRouteParam().addToShardIds(shardArray.getInteger(i));
      }
    }
    if (json.containsKey(INDEX)) {
      request.setIndexName(json.getString(INDEX));
    }
  } else {
    request.setType(IndexRequestType.INDEX);
    request.setDoc(LindenDocumentBuilder.build(schema, json));
    request.setId(request.getDoc().getId());
  }
  return request;
}
 
Example 19
Source File: RoleListRequest.java    From Almost-Famous with MIT License 4 votes vote down vote up
@Override
public void completed(HttpResponse result) {
    JSONObject obj = getJSONObject(result);
    int code = obj.getInteger("code");
    if (code == ErrorCode.SERVER_SUCCESS.value()) {
        String data = obj.getString("data");
        if (data == null) {
            CreateRoleCmd createRoleCmd = new CreateRoleCmd();
            createRoleCmd.setCmd(RegisterProtocol.CREATE_ROLE_ACTION_REQ);
            createRoleCmd.setUid(roleListCmd.getUid());
            createRoleCmd.setToken(roleListCmd.getToken());
            createRoleCmd.setIndex(roleListCmd.getIndex());
            try {
                new CreateRoleRequest(createRoleCmd).execute();
            } catch (Exception e) {
                log.error("Create role error: ", e);
            }
            return;
        }
        JSONObject dataObj = FastJsonUtils.parseObject(data);
        long rid = dataObj.getLong("rid");
        if (rid > 0) {
            Robot robot = new Robot();
            robot.setUid(roleListCmd.getUid());
            robot.setToken(roleListCmd.getToken());
            robot.setRid(rid);
            robot.setRoleName(dataObj.getString("roleName"));
            robot.setSchool(dataObj.getString("school"));
            robot.setGold(dataObj.getLong("gold"));
            robot.setSilver(dataObj.getLong("silver"));
            robot.setDiamond(dataObj.getLong("diamond"));
            RobotMgr.getInstance().addRobot(robot);

            FamousRobotApplication.pool.execute(robot, roleListCmd.getIndex());


        } else {
            log.error("没有角色信息??");
        }
    }
}
 
Example 20
Source File: PrivilegeServiceSMOImpl.java    From MicroCommunity with Apache License 2.0 3 votes vote down vote up
/**
 * 查询 权限组
 *
 * @param pd
 * @return
 */
@Override
public ResponseEntity<String> listPrivilegeGroup(IPageData pd) {

    Assert.hasLength(pd.getUserId(), "用户未登录请先登录");

    ResponseEntity<String> storeInfo = super.getStoreInfo(pd, restTemplate);

    if (storeInfo.getStatusCode() != HttpStatus.OK) {
        return storeInfo;
    }
    // 商户返回信息
    JSONObject storeInfoObj = JSONObject.parseObject(storeInfo.getBody());

    String storeId = storeInfoObj.getString("storeId");
    String storeTypeCd = storeInfoObj.getString("storeTypeCd");

    //根据商户ID查询 权限组信息


    ResponseEntity<String> privilegeGroup = super.callCenterService(restTemplate, pd, "",
            ServiceConstant.SERVICE_API_URL + "/api/query.store.privilegeGroup?storeId=" + storeId + "&storeTypeCd=" + storeTypeCd, HttpMethod.GET);
    if (privilegeGroup.getStatusCode() != HttpStatus.OK) {
        return privilegeGroup;
    }

    JSONObject privilegeGroupObj = JSONObject.parseObject(privilegeGroup.getBody().toString());

    Assert.jsonObjectHaveKey(privilegeGroupObj, "privilegeGroups", "查询菜单未返回privilegeGroups节点");

    JSONArray privilegeGroups = privilegeGroupObj.getJSONArray("privilegeGroups");

    return new ResponseEntity<String>(privilegeGroups.toJSONString(), HttpStatus.OK);
}