本文整理汇总了Java中org.nutz.lang.Strings类的典型用法代码示例。如果您正苦于以下问题:Java Strings类的具体用法?Java Strings怎么用?Java Strings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Strings类属于org.nutz.lang包,在下文中一共展示了Strings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkParams
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 校验数据
*
* @param req
* @return
*/
public static String checkParams(CloseOrderReq req) {
if (Strings.isEmpty(req.getMch_id())) {
return "商户号不能为空";
} else if (Strings.isEmpty(req.getNonce_str())) {
return "随机字符串不能为空";
} else if (Strings.isEmpty(req.getSign())) {
return "签名不能为空";
} else if (Strings.isEmpty(req.getOut_trade_no())) {
return "商户订单号不能为空";
} else if (Lang.isEmpty(req.getOut_trade_no())) {
return "商户订单号不能为空";
} else if (Lang.length(req.getOut_trade_no()) > 32) {
return "商户订单号不能超过32位长度";
} else {
return "";
}
}
示例2: orderQuery
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 订单查询
*
* @param req
* @return
*/
public OrderQueryResp orderQuery(OrderQueryReq req) {
try {
String result = this.checkParams(req);
if (Strings.isEmpty(result)) {
String xml = Xmls.mapToXml(Lang.obj2nutmap(req));
String resp = HttpUtil.post("https://qpay.qq.com/cgi-bin/pay/qpay_order_query.cgi", xml);
return Lang.map2Object(Xmls.xmlToMap(resp), OrderQueryResp.class);
} else {
log.error("手Q钱包OrderQueryReq参数校验异常: " + result);
return null;
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
示例3: checkParams
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 校验数据
*
* @param req
* @return
*/
public static String checkParams(OrderQueryReq req) {
if (Strings.isEmpty(req.getMch_id())) {
return "商户号不能为空";
} else if (Strings.isEmpty(req.getNonce_str())) {
return "随机字符串不能为空";
} else if (Strings.isEmpty(req.getSign())) {
return "签名不能为空";
} else if (Strings.isEmpty(req.getOut_trade_no())) {
return "商户订单号不能为空";
} else if (Lang.isEmpty(req.getTransaction_id())&& Strings.isEmpty(req.getOut_trade_no())) {
return "QQ钱包订单号和商户订单号2选1不能同为空";
} else if (Lang.length(req.getOut_trade_no()) > 32) {
return "商户订单号不能超过32位长度";
} else {
return "";
}
}
示例4: unifiedOrder
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 统一下单
*
* @param req
* @return
*/
public UnifiedOrderResp unifiedOrder(UnifiedOrderReq req) {
try {
String result = this.checkParams(req);
if (Strings.isEmpty(result)) {
String xml = Xmls.mapToXml(Lang.obj2nutmap(req));
String resp = HttpUtil.post("https://qpay.qq.com/cgi-bin/pay/qpay_unified_order.cgi", xml);
return Lang.map2Object(Xmls.xmlToMap(resp), UnifiedOrderResp.class);
} else {
log.error("手Q钱包UnifiedOrderReq参数校验异常: " + result);
return null;
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
示例5: checkContact
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 验参客户联系方式
*
* @param contact 客户联系方式
* @return
*/
public static Boolean checkContact(Contact contact) {
try {
if (Strings.isEmpty(contact.getCtPhone())) {
throw new Exception("contact.ctPhone联系电话为空");
}
if (!Strings.isMobile(contact.getCtPhone())) {
throw new Exception("contact.ctPhone联系电话格式错误");
}
if (!Strings.isQQ(contact.getCtQQ())) {
throw new Exception("contact.ctQQ联系QQ格式错误");
}
if (!Strings.isEmail(contact.getCtEmail())) {
throw new Exception("contact.ctEmail联系邮箱格式错误");
}
return true;
} catch (Exception e) {
return false;
}
}
示例6: refund
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 申请退款
*
* @param req
* @return
*/
public RefundResp refund(RefundReq req) {
try {
String result = this.checkParams(req);
if (Strings.isEmpty(result)) {
String xml = Xmls.mapToXml(Lang.obj2nutmap(req));
String resp = HttpUtil.post("https://api.qpay.qq.com/cgi-bin/pay/qpay_refund.cgi", xml);
return Lang.map2Object(Xmls.xmlToMap(resp), RefundResp.class);
} else {
log.error("手Q钱包RefundReq参数校验异常: " + result);
return null;
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
示例7: sign
import org.nutz.lang.Strings; //导入依赖的package包/类
public static String sign(String s, String k, String t, String c) {
try {
if (Strings.isEmpty(s) || Strings.isEmpty(k) || Strings.isEmpty(t) || Strings.isEmpty(c)) {
return null;
} else if (Strings.equalsIgnoreCase(t, "RSA")) {
return AlipaySignature.rsaSign(s, k, c);
} else if (Strings.equalsIgnoreCase(t, "RSA2")) {
return AlipaySignature.rsa256Sign(s, k, c);
} else {
log.error("Alipay verify 加密方式错误, 只支持RSA2、RSA.");
return null;
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
示例8: refundQuery
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 退款查询
*
* @param req
* @return
*/
public RefundQueryResp refundQuery(RefundQueryReq req) {
try {
String result = this.checkParams(req);
if (Strings.isEmpty(result)) {
String xml = Xmls.mapToXml(Lang.obj2nutmap(req));
String resp = HttpUtil.post("https://qpay.qq.com/cgi-bin/pay/qpay_close_order.cgi", xml);
return Lang.map2Object(Xmls.xmlToMap(resp), RefundQueryResp.class);
} else {
log.error("手Q钱包RefundQueryReq参数校验异常: " + result);
return null;
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
示例9: checkParams
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 校验数据
*
* @param req
* @return
*/
public static String checkParams(RefundQueryReq req) {
if (Strings.isEmpty(req.getMch_id())) {
return "商户号不能为空";
} else if (Strings.isEmpty(req.getNonce_str())) {
return "随机字符串不能为空";
} else if (Strings.isEmpty(req.getSign())) {
return "签名不能为空";
} else if (Strings.isEmpty(req.getOut_trade_no())) {
return "商户订单号不能为空";
} else if (Lang.isEmpty(req.getRefund_id())
&& Lang.isEmpty(req.getOut_refund_no())
&& Lang.isEmpty(req.getTransaction_id())
&& Lang.isEmpty(req.getOut_trade_no())) {
return "QQ钱包退款单号、商户退款单号、QQ钱包订单号、商户订单号4选1不能同为空";
} else if (Lang.length(req.getOut_trade_no()) > 32) {
return "商户订单号不能超过32位长度";
} else {
return "";
}
}
示例10: uniorder
import org.nutz.lang.Strings; //导入依赖的package包/类
public UniorderResp uniorder(UniorderReq req) {
try {
String result = this.checkParams(req);
if (Strings.isEmpty(result)) {
String xml = Xmls.mapToXml("jdpay", Lang.obj2nutmap(req));
String resp = HttpUtil.post("https://qpay.qq.com/cgi-bin/pay/qpay_close_order.cgi", xml);
return Lang.map2Object(Xmls.xmlToMap(resp), UniorderResp.class);
} else {
log.error("京东支付统一下单接口UniorderReq参数校验异常: " + result);
return null;
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
示例11: checkParams
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 校验数据
*
* @param req
* @return
*/
public static String checkParams(UniorderReq req) {
if (Strings.isEmpty(req.getMerchant())) {
return "商户号不能为空";
} else if (Strings.isEmpty(req.getSign())) {
return "交易信息签名不能为空";
} else if (Strings.isEmpty(req.getTradeNum())) {
return "交易流水号不能为空";
} else if (Strings.isEmpty(req.getTradeName())) {
return "交易名称不能为空";
} else if (Strings.isEmpty(req.getTradeTime())) {
return "交易时间不能为空";
} else if (Lang.isEmpty(req.getAmount())) {
return "交易金额不能为空";
} else if (Strings.isEmpty(req.getOrderType())) {
return "订单类型不能为空";
} else if (!Strings.equals(req.getOrderType(), "0")
&& !Strings.equals(req.getOrderType(), "1")) {
return "订单类型只能为0-实物,1-虚拟";
} else if (Strings.isEmpty(req.getNotifyUrl())) {
return "异步通知页面地址不能为空";
} else {
return "";
}
}
示例12: tradePrecreate
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 统一收单线下交易预创建(扫码支付)
*
* @param req 参数
* @return 相应结果
*/
public static TradePrecreateResp tradePrecreate(Base req) {
try {
String result = checkParams(req);
if (Strings.isEmpty(result)) {
String r = "https://openapi.alipay.com/gateway.do?" + Util.buildParmas(Lang.obj2nutmap(req));
return Json.fromJson(TradePrecreateResp.class, r);
} else {
log.error("支付宝统一收单线下交易预创建(扫码支付)接口参数校验异常: " + result);
return null;
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
示例13: getSign
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 获取签名
*
* @param req 对象
* @param k 密钥
* @return 签名
*/
public static String getSign(Base req, String k) {
if (Strings.isEmpty(checkParams(req))) {
Map<String, Object> params = Lang.obj2nutmap(req);
String s = Util.buildParmas(params);
if (Strings.equalsIgnoreCase(req.getSign_type(), "RSA2")
|| Strings.equalsIgnoreCase(req.getSign_type(), "RSA")) {
return Signature.sign(s, k, req.getSign_type(), "UTF-8");
} else {
log.error("支付宝统一收单线下交易预创建(扫码支付)接口签名方式只支持RSA、RSA2.");
return null;
}
} else {
return null;
}
}
示例14: tradePay
import org.nutz.lang.Strings; //导入依赖的package包/类
/**
* 统一收单交易支付接口(付款码/声波支付)
*
* @param req 参数
* @return 相应结果
*/
public static TradePayResp tradePay(Base req) {
try {
String result = checkParams(req);
if (Strings.isEmpty(result)) {
String r = "https://openapi.alipay.com/gateway.do?" + Util.buildParmas(Lang.obj2nutmap(req));
return Json.fromJson(TradePayResp.class, r);
} else {
log.error("支付宝统一收单交易支付接口(付款码/声波支付)参数校验异常: " + result);
return null;
}
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
示例15: fetch
import org.nutz.lang.Strings; //导入依赖的package包/类
public static EAccessToken fetch(OAuth2Authentication oAuth2Authentication, OAuth2AccessToken accessToken){
EAccessToken eAccessToken = new EAccessToken();
eAccessToken.setOpenUser(fetch(oAuth2Authentication));
Object details = oAuth2Authentication.getDetails();
if(details instanceof OAuth2AuthenticationDetails){
OAuth2AuthenticationDetails details1 = (OAuth2AuthenticationDetails) details;
eAccessToken.setRemoteAddress(details1.getRemoteAddress());
eAccessToken.setSessionId(details1.getSessionId());
}
eAccessToken.setTokenType(accessToken.getTokenType());
eAccessToken.setTokenValue(accessToken.getValue());
eAccessToken.setExpiresIn(accessToken.getExpiresIn());
if (accessToken.getRefreshToken() != null) {
eAccessToken.setRefreshToken(accessToken.getRefreshToken().getValue());
}
if (accessToken.getScope() != null) {
String scopes = Strings.join2("|", accessToken.getScope().toArray(new String[]{}));
eAccessToken.setScopes(scopes);
}
return eAccessToken;
}