本文整理汇总了Java中org.nutz.lang.Strings.isBlank方法的典型用法代码示例。如果您正苦于以下问题:Java Strings.isBlank方法的具体用法?Java Strings.isBlank怎么用?Java Strings.isBlank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.nutz.lang.Strings
的用法示例。
在下文中一共展示了Strings.isBlank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: post
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* Post发送Json请求
*
* @param url
* @param json
* @return
*/
public static String post(String url, Json json) {
if (Strings.isBlank(url))
return null;
else if (!Strings.isUrl(url))
return null;
else if (Lang.isEmpty(json))
return null;
else {
Request req = Request.create(url, Request.METHOD.POST);
req.getHeader().set("Content-Type", "application/json;charset=UTF-8");
req.setData(json.toString());
Response resp = Sender.create(req).send();
return resp.getContent();
}
}
示例2: checkSign
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* 校验签名
*
* @param params
* @param key
* @param sign
* @return
*/
public static Boolean checkSign(NutMap params, String key, String sign) {
try {
if (Lang.isEmpty(params)) {
throw new Exception("params参数为空");
} else if (Strings.isBlank(key)) {
throw new Exception("key密钥为空");
} else {
if (Strings.equalsIgnoreCase(Lang.md5(Url.encode(buildParmas(params, new String[]{"sign"})) + key), sign)) {
return true;
} else {
return false;
}
}
} catch (Exception e) {
return false;
}
}
示例3: post
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* Post发送Json请求
*
* @param url
* @param json
* @return
*/
public static String post(String url, String json) {
try {
if (Strings.isBlank(url)) {
throw new Exception("url为空");
} else if (!Strings.isUrl(url)) {
throw new Exception("url格式不正确");
} else if (Lang.isEmpty(json)) {
throw new Exception("json为空");
} else {
Request req = Request.create(url, Request.METHOD.POST);
req.getHeader().set("Content-Type", "application/json;charset=UTF-8");
req.setData(json);
Response resp = Sender.create(req).setTimeout(6000).send();
return resp.getContent();
}
} catch (Exception e) {
return null;
}
}
示例4: postXml
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* Post发送Xml请求
*
* @param url
* @param xml
* @return
*/
public static String postXml(String url, String xml) {
try {
if (Strings.isBlank(url)) {
throw new Exception("url为空");
} else if (!Strings.isUrl(url)) {
throw new Exception("url格式不正确");
} else if (Lang.isEmpty(xml)) {
throw new Exception("xml为空");
} else {
return Http.postXML(url, xml, 10000).getContent();
}
} catch (Exception e) {
return null;
}
}
示例5: get
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* 普通Get请求
*
* @param url
* @return
*/
public static String get(String url) {
if (Strings.isBlank(url))
return null;
else if (!Strings.isUrl(url))
return null;
else
return Http.get(url).getContent();
}
示例6: queryGameList
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* 4.1 获取游戏列表
*
* @param providerId 服务商ID
* @param key 密钥key
* @return
*/
public static List<Game> queryGameList(Integer providerId, String key) {
try {
if (Lang.isEmpty(providerId)) {
throw new Exception("服务商ID为空");
} else if (Strings.isBlank(key)) {
throw new Exception("key为空");
} else {
BaseReq req = new BaseReq();
req.setProviderId(providerId);
req.setTimestamp(Times.getTS());
req.setVersion(Dict.JDG_API_VERSION);
req.setSign(JdgUtil.getSign(Lang.obj2nutmap(req), key));
String json = HttpUtil.post(Dict.JDG_DEV_API_HOST + Dict.JDG_API_ACTION_GAME_QUERYGAMELIST, Json.toJson(req));
if (Strings.isEmpty(json)) {
throw new Exception("返回值异常");
} else {
BaseResp resp = Json.fromJson(BaseResp.class, json);
List<Game> games = resp.getData().getAsList("games", Game.class);
return games;
}
}
} catch (Exception e) {
return null;
}
}
示例7: encode
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* 加密
*
* @param s
* @return
*/
public static String encode(String s) {
try {
if (Strings.isBlank(s)) {
throw new Exception("s加密对象为空");
} else {
return org.nutz.repo.Base64.encodeToString(s.getBytes(Encoding.CHARSET_UTF8), true);
}
} catch (Exception e) {
return null;
}
}
示例8: completeOrder
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* 4.7 完成订单
*
* @param providerId
* @param key
* @param biz
* @return
*/
public static String completeOrder(Integer providerId, String key, CompleteOrder biz) {
try {
if (Lang.isEmpty(providerId)) {
throw new Exception("服务商ID为空");
}
if (Strings.isBlank(key)) {
throw new Exception("密钥为空");
}
if (Strings.isBlank(biz.getOrderNum())) {
throw new Exception("接单狗订单号为空");
}
if (Lang.isEmpty(biz.getOm().getPics())) {
throw new Exception("完成截图为空");
}
BaseReq req = new BaseReq();
req.setProviderId(providerId);
req.setTimestamp(Times.getTS());
req.setVersion(Dict.JDG_API_VERSION);
req.setBizData(Lang.obj2nutmap(biz));
req.setSign(JdgUtil.getSign(Lang.obj2nutmap(req), key));
String json = HttpUtil.post(Dict.JDG_DEV_API_HOST + Dict.JDG_API_ACTION_ORDER_COMPLETEORDER, Json.toJson(req));
if (Strings.isEmpty(json)) {
throw new Exception("返回值异常");
} else {
BaseResp resp = Json.fromJson(BaseResp.class, json);
return resp.getMessage();
}
} catch (Exception e) {
return null;
}
}
示例9: get
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* 普通Get请求
*
* @param url
* @return
*/
public static String get(String url) {
try {
if (Strings.isBlank(url)) {
throw new Exception("url为空");
} else if (!Strings.isUrl(url)) {
throw new Exception("url格式不正确");
} else {
return Http.get(url).getContent();
}
} catch (Exception e) {
return null;
}
}
示例10: checkUser
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* Validate Data
* @param user
* @param create
* @return
*/
protected String checkUser(User user, boolean create) {
if (user == null) {
return "空对象";
}
if (create) {
if (Strings.isBlank(user.getUsername()) || Strings.isBlank(user.getPwd()))
return "用户名/密码不能为空";
} else {
if (Strings.isBlank(user.getPwd()))
return "密码不能为空";
}
// dao.update(User.class,org.nutz.dao.Chain.make("name","admin").add("age",15),Cnd.where("id","=",2));
String passwd = user.getPwd().trim();
if (6 > passwd.length() || passwd.length() > 12) {
return "密码长度必须大于6位小于12位!";
}
user.setPwd(passwd);
if (create) {
int count = dao.count(User.class, Cnd.where("username", "=", user.getUsername()));
if (count != 0) {
if("wendal".equalsIgnoreCase(user.getUsername())){
return "wendal大叔可直接登录的哦!\n账户:wendal\n密码:wendal\n(๑′ᴗ‵๑)";
}
return "用户名已经存在";
}
}
if (user.getUsername() != null)
user.setUsername(user.getUsername().trim());
return null;
}
示例11: acceptOrder
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* 4.4 受理订单
*
* @param providerId
* @param key
* @param biz
* @return
*/
public static PrOrder acceptOrder(Integer providerId, String key, AcceptOrder biz) {
try {
if (Lang.isEmpty(providerId)) {
throw new Exception("服务商ID为空");
}
if (Strings.isBlank(key)) {
throw new Exception("密钥为空");
}
if (Strings.isBlank(biz.getOrderNum())) {
throw new Exception("接单狗订单号为空");
}
BaseReq req = new BaseReq();
req.setProviderId(providerId);
req.setTimestamp(Times.getTS());
req.setVersion(Dict.JDG_API_VERSION);
req.setBizData(Lang.obj2nutmap(biz));
req.setSign(JdgUtil.getSign(Lang.obj2nutmap(req), key));
String json = HttpUtil.post(Dict.JDG_DEV_API_HOST + Dict.JDG_API_ACTION_ORDER_ACCEPTORDER, Json.toJson(req));
if (Strings.isEmpty(json)) {
throw new Exception("返回值异常");
} else {
BaseResp resp = Json.fromJson(BaseResp.class, json);
PrOrder order = resp.getData().getAs("order", PrOrder.class);
return order;
}
} catch (Exception e) {
return null;
}
}
示例12: queryOrderList
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* 4.12 获取受理的订单列表
*
* @param providerId
* @param key
* @param biz
* @return
*/
public static QueryResult queryOrderList(Integer providerId, String key, QueryOrderList biz) {
try {
if (Lang.isEmpty(providerId)) {
throw new Exception("服务商ID为空");
}
if (Strings.isBlank(key)) {
throw new Exception("密钥为空");
}
BaseReq req = new BaseReq();
req.setProviderId(providerId);
req.setTimestamp(Times.getTS());
req.setVersion(Dict.JDG_API_VERSION);
req.setBizData(Lang.obj2nutmap(biz));
req.setSign(JdgUtil.getSign(Lang.obj2nutmap(req), key));
String json = HttpUtil.post(Dict.JDG_DEV_API_HOST + Dict.JDG_API_ACTION_ORDER_QUERYORDERLIST, Json.toJson(req));
if (Strings.isEmpty(json)) {
throw new Exception("返回值异常");
} else {
BaseResp resp = Json.fromJson(BaseResp.class, json);
List<PrOrder> orders = resp.getData().getAsList("orders", PrOrder.class);
Pager pager = resp.getData().getAs("pager", Pager.class);
return new QueryResult(orders, pager);
}
} catch (Exception e) {
return null;
}
}
示例13: queryMargin
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* 4.10 查看剩余保证金
*
* @param providerId
* @param key
* @param biz
* @return
*/
public static Double queryMargin(Integer providerId, String key, QueryMargin biz) {
try {
if (Lang.isEmpty(providerId)) {
throw new Exception("服务商ID为空");
}
if (Strings.isBlank(key)) {
throw new Exception("密钥为空");
}
if (Strings.isBlank(biz.getPayPassword())) {
throw new Exception("支付密码为空");
}
BaseReq req = new BaseReq();
req.setProviderId(providerId);
req.setTimestamp(Times.getTS());
req.setVersion(Dict.JDG_API_VERSION);
biz.setPayPassword(Lang.md5(biz.getPayPassword()));
req.setBizData(Lang.obj2nutmap(biz));
req.setSign(JdgUtil.getSign(Lang.obj2nutmap(req), key));
String json = HttpUtil.post(Dict.JDG_DEV_API_HOST + Dict.JDG_API_ACTION_SYS_QUERYMARGIN, Json.toJson(req));
if (Strings.isEmpty(json)) {
throw new Exception("返回值异常");
} else {
BaseResp resp = Json.fromJson(BaseResp.class, json);
return resp.getData().getDouble("margin", 0.0);
}
} catch (Exception e) {
return null;
}
}
示例14: beginOrder
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* 4.5 开始订单任务
*
* @param providerId
* @param key
* @param biz
* @return
*/
public static String beginOrder(Integer providerId, String key, BeginOrder biz) {
try {
if (Lang.isEmpty(providerId)) {
throw new Exception("服务商ID为空");
}
if (Strings.isBlank(key)) {
throw new Exception("密钥为空");
}
if (Strings.isBlank(biz.getOrderNum())) {
throw new Exception("接单狗订单号为空");
}
if (Lang.isEmpty(biz.getOm().getPics())) {
throw new Exception("上号截图为空");
}
BaseReq req = new BaseReq();
req.setProviderId(providerId);
req.setTimestamp(Times.getTS());
req.setVersion(Dict.JDG_API_VERSION);
req.setBizData(Lang.obj2nutmap(biz));
req.setSign(JdgUtil.getSign(Lang.obj2nutmap(req), key));
String json = HttpUtil.post(Dict.JDG_DEV_API_HOST + Dict.JDG_API_ACTION_ORDER_BEGINORDER, Json.toJson(req));
if (Strings.isEmpty(json)) {
throw new Exception("返回值异常");
} else {
BaseResp resp = Json.fromJson(BaseResp.class, json);
return resp.getMessage();
}
} catch (Exception e) {
return null;
}
}
示例15: getNewOrderList
import org.nutz.lang.Strings; //导入方法依赖的package包/类
/**
* 4.3 获取新订单列表
*
* @param providerId
* @param key
* @param biz
* @return
*/
public static QueryResult getNewOrderList(Integer providerId, String key, GetNewOrderList biz) {
try {
if (Lang.isEmpty(providerId)) {
throw new Exception("服务商ID为空");
}
if (Strings.isBlank(key)) {
throw new Exception("密钥为空");
}
BaseReq req = new BaseReq();
req.setProviderId(providerId);
req.setTimestamp(Times.getTS());
req.setVersion(Dict.JDG_API_VERSION);
req.setBizData(Lang.obj2nutmap(biz));
req.setSign(JdgUtil.getSign(Lang.obj2nutmap(req), key));
String json = HttpUtil.post(Dict.JDG_DEV_API_HOST + Dict.JDG_API_ACTION_ORDER_GETNEWORDERLIST, Json.toJson(req));
if (Strings.isEmpty(json)) {
throw new Exception("返回值异常");
} else {
BaseResp resp = Json.fromJson(BaseResp.class, json);
List<PrOrder> orders = resp.getData().getAsList("orders", PrOrder.class);
Pager pager = resp.getData().getAs("pager", Pager.class);
return new QueryResult(orders, pager);
}
} catch (Exception e) {
return null;
}
}