本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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();
}