打印log
log.info("content:" + content);
将字符串转化为JsonString
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
String content = "{\"businessCode\":\"r2\",\"channelCode\":\"MOCK\",\"realName\":\"r1\",\"idCard\":\"r4\",\"userMobile\":\"r5\",\"bankMobile\":\"r5\",\"bankCardNo\":\"r3\",\"bankOfDeposit\":\"浦发银行\",\"purpose\":\"Test收款\",\"amount\":0.01,\"currency\":\"CNY\"}".replace("r1", vars.get("name")).replace("r2", vars.get("businessCode")).replace("r3", vars.get("bankCard")).replace("r4", vars.get("idCard")).replace("r5", vars.get("mobile"));
System.out.println(content);
//String content_json = JSON.parse(content);
JSONObject object = JSON.parseObject(content);
String content_json = object.toString();
给变量赋值
vars.put("bankCard", bankCard);
获取变量的值
vars.get("bankCard", bankCard);
给字符串md5加密
import org.apache.commons.codec.digest.DigestUtils;
String sign = DigestUtils.md5Hex("StringObject");
获取接口返回信息
String response = prev.getResponseDataAsString(); // 获取响应信息
int statusCode = prev.getResponseCode(); // 获取响应code
Stirng urlString = prev.getUrlAsString(); // 获取String url
getResponseMessage(); // 获取响应信息
getRequestHeaders(); // 获取请求头
getMediaType(); // 获取请求信息类型
getBodySizeAsLong(); // 获取Body大小
getDataEncodingWithDefault(); // 获取数据编码格式
isResponseCodeOK(); //判断状态码是否ok