當前位置: 首頁>>代碼示例>>Java>>正文


Java JSONObject.getBooleanValue方法代碼示例

本文整理匯總了Java中com.alibaba.fastjson.JSONObject.getBooleanValue方法的典型用法代碼示例。如果您正苦於以下問題:Java JSONObject.getBooleanValue方法的具體用法?Java JSONObject.getBooleanValue怎麽用?Java JSONObject.getBooleanValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.alibaba.fastjson.JSONObject的用法示例。


在下文中一共展示了JSONObject.getBooleanValue方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: report

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
/**
 * 報工
 * 
 */
public boolean report() {
	HttpPost post = new HttpPost(Api.reportUrl);
	try {
		post.setEntity(new UrlEncodedFormEntity(params, Consts.UTF_8));
		HttpResponse resp = client.execute(post);
		JSONObject jo = JSONObject.parseObject(EntityUtils.toString(resp.getEntity()));
		// 報工成功,返回json結構的報文{"data" : [ {},{}...],"success" : true}
		if (jo.getBooleanValue("success")) {
			return true;
		}
		logger.warn(jo.getString("error"));
	} catch (Exception e) {
		logger.error("報工異常:", e);
	}
	return false;
}
 
開發者ID:ichatter,項目名稱:dcits-report,代碼行數:21,代碼來源:UserService.java

示例2: apply

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
@Override
public void apply(ApiRequest request, ApiResponse response, WebSocketSession session) {
    DrawGuessContext ctx = (DrawGuessContext) session.getAttributes().get("ctx");
    JSONObject obj = JSONObject.parseObject(request.getMsg());
    boolean ready = obj.getBooleanValue(STATUS_NAME);
    String id = obj.getString(ID_NAME);
    DrawPlayerInfo info = ((DrawPlayerInfo) session.getAttributes().get("info"));
    if (ctx.status() != DrawGameStatus.READY) {
        return;
    }
    if (ready && info.status() == DrawUserStatus.WAIT) {
        info.setStatus(DrawUserStatus.READY);
        ctx.addPlayer(info);
    } else if (!ready && info.status() == DrawUserStatus.READY) {
        info.setStatus(DrawUserStatus.WAIT);
        ctx.removePlayer(id);
    }
    response.setCode(DrawCode.USER_READY.getCode()).setData(info);
}
 
開發者ID:csdbianhua,項目名稱:telemarket-skittle-alley,代碼行數:20,代碼來源:ReadyHandler.java

示例3: update

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
@Override
public String update(String index, String type, String id, Object json) {
	String uri = "/"+index+"/"+type+"/"+id;
	String result = base(uri, HttpUtil.METHOD_GET,null);
	JSONObject target = JSON.parseObject(result);
	if(target.getBooleanValue("found")){
		JSONObject body = JSON.parseObject(JSON.toJSONString(json));
		result = base(uri, HttpUtil.METHOD_PUT, body.toJSONString());
	}
	return result;
}
 
開發者ID:dev-share,項目名稱:css-elasticsearch,代碼行數:12,代碼來源:ElasticsearchHttpFactory.java

示例4: queryPayOrder

import com.alibaba.fastjson.JSONObject; //導入方法依賴的package包/類
@RequestMapping(value = "/pay/query")
public String queryPayOrder(@RequestParam String jsonParam) {
    _log.info("selectPayOrder << {}", jsonParam);
    JSONObject retObj = new JSONObject();
    retObj.put("code", "0000");
    if(StringUtils.isBlank(jsonParam)) {
        retObj.put("code", "0001"); // 參數錯誤
        retObj.put("msg", "缺少參數");
        return retObj.toJSONString();
    }
    JSONObject paramObj = JSON.parseObject(new String(MyBase64.decode(jsonParam)));
    String mchId = paramObj.getString("mchId");
    String payOrderId = paramObj.getString("payOrderId");
    String mchOrderNo = paramObj.getString("mchOrderNo");
    PayOrder payOrder;
    if(StringUtils.isNotBlank(payOrderId)) {
        payOrder = payOrderService.selectPayOrderByMchIdAndPayOrderId(mchId, payOrderId);
    }else {
        payOrder = payOrderService.selectPayOrderByMchIdAndMchOrderNo(mchId, mchOrderNo);
    }
    if(payOrder == null) {
        retObj.put("code", "0002");
        retObj.put("msg", "支付訂單不存在");
        return retObj.toJSONString();
    }

    //
    boolean executeNotify = paramObj.getBooleanValue("executeNotify");
    // 如果選擇回調且支付狀態為支付成功,則回調業務係統
    if(executeNotify && payOrder.getStatus() == PayConstant.PAY_STATUS_SUCCESS) {
        this.doNotify(payOrder);
    }
    retObj.put("result", JSON.toJSON(payOrder));
    _log.info("selectPayOrder >> {}", retObj);
    return retObj.toJSONString();
}
 
開發者ID:ywtnhm,項目名稱:pay-xxpay-master,代碼行數:37,代碼來源:PayOrderServiceController.java


注:本文中的com.alibaba.fastjson.JSONObject.getBooleanValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。