use of okhttp3.FormBody in project Gradle-demo by Arisono.
the class testUASApi method selectDetailData.
/**
* 表单详细数据接口
* mobile/common/getformandgriddata.action?caller=Workovertime&id=12865
*/
public static void selectDetailData() {
String url = baseurl + "mobile/common/getformandgriddata.action";
RequestBody formBody = new FormBody.Builder().add("master", master).add("id", "12865").add("caller", "Workovertime").add("sessionId", sessionId).build();
Request request = new Request.Builder().url(url).header("cookie", "JSESSIONID=" + sessionId).addHeader("sessionUser", emcode).addHeader("content-type", "text/html;charset:utf-8").post(formBody).build();
OkhttpUtils.client.newCall(request).enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) throws IOException {
OkhttpUtils.println(OkhttpUtils.getResponseString(response));
;
}
@Override
public void onFailure(Call call, IOException e) {
OkhttpUtils.onFailurePrintln(e);
}
});
}
use of okhttp3.FormBody in project Gradle-demo by Arisono.
the class testUASApi method loginIM.
/**
* 登录IM系统
*
* @param phone
* @param password
*/
public static void loginIM(String phone, String password) {
OkhttpUtils.println(phone);
OkhttpUtils.println(password);
String url = "http://113.105.74.140:8092/user/login";
RequestBody formBody = new FormBody.Builder().add("latitude", "22.540691").add("longitude", "113.95332").add("model", "vivo X6SPlus D").add("osVersion", "5.1.1").add("password", password).add("serial", "869897023236739").add("telephone", phone).build();
Request request = new Request.Builder().url(url).addHeader("content-type", "text/html;charset:utf-8").post(formBody).build();
OkhttpUtils.client.newCall(request).enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) throws IOException {
String json = OkhttpUtils.getResponseString(response);
OkhttpUtils.println("IM平台登录:" + json);
}
@Override
public void onFailure(Call call, IOException e) {
OkhttpUtils.onFailurePrintln(e);
}
});
}
use of okhttp3.FormBody in project Gradle-demo by Arisono.
the class testUASApi method upateFormData.
/**
* 动态表单 更新接口
*/
public static void upateFormData() {
String url = baseurl + "mobile/commonUpdate.action";
RequestBody formBody = new FormBody.Builder().add("master", master).add("gridStore", "null").add("formStore", "{\"va_holidaytype\":\"按小时\",\"va_vacationtype\":\"事假\",\"va_status\":\"在录入\",\"va_emcode\":\"sunquan\",\"va_emname\":\"龚鹏明\",\"va_department\":\"测试111\",\"va_position\":\"测试\",\"va_mankind\":\"副总及以上\",\"va_alldays\":\"12\",\"va_alltimes\":\"25\",\"va_startime\":\"2016-11-28 13:39:00\",\"va_remark\":\"测试\",\"va_recordor\":\"刘佳\",\"va_date\":\"2016-11-28 13:39:00\",\"va_endtime\":\"2016-12-28 13:39:00\"}").add("caller", "Ask4Leave").add("sessionId", sessionId).build();
Request request = new Request.Builder().url(url).header("cookie", "JSESSIONID=" + sessionId).addHeader("sessionUser", emcode).addHeader("content-type", "text/html;charset:utf-8").post(formBody).build();
OkhttpUtils.client.newCall(request).enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) throws IOException {
OkhttpUtils.println(OkhttpUtils.getResponseString(response));
}
@Override
public void onFailure(Call call, IOException e) {
OkhttpUtils.onFailurePrintln(e);
}
});
}
use of okhttp3.FormBody in project Gradle-demo by Arisono.
the class testUASApi method loadPostParams.
/**
* 测试接口参数
*/
public static void loadPostParams() {
RequestBody formBody = new FormBody.Builder().add("data", "[{\"bi_inqty\":\"0.0\",\"bi_prodid\":\"0\",\"bi_piid\":\"50707678\",\"bi_location\":\"\",\"bi_inoutno\":\"MG161200001\",\"bi_prodcode\":\"\",\"bi_whcode\":\"CK005\",\"bi_barcode\":\"7690867143120700426\"},{\"bi_inqty\":\"0.0\",\"bi_prodid\":\"0\",\"bi_piid\":\"50707678\",\"bi_location\":\"\",\"bi_inoutno\":\"MG161200001\",\"bi_prodcode\":\"\",\"bi_whcode\":\"CK005\",\"bi_barcode\":\"7690867143120700429\"},{\"bi_inqty\":\"0.0\",\"bi_prodid\":\"0\",\"bi_piid\":\"50707678\",\"bi_location\":\"\",\"bi_inoutno\":\"MG161200001\",\"bi_prodcode\":\"\",\"bi_whcode\":\"CK005\",\"bi_barcode\":\"7690867143120700430\"}]").build();
// String json_1 = "{'type':'dfdf','data','你好1'}";
// String json_2 = "{'type':'dfdf','data','你好2'}";
// String json_3 = "{'type':'dfdf','data','你好3'}";
Request request = new Request.Builder().addHeader("content-type", "application/json;charset:utf-8").url("http://192.168.253.200:8080/spring-mvc-showcase/http/paramBody3").put(formBody).build();
OkhttpUtils.client.newCall(request).enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) throws IOException {
String json = OkhttpUtils.getResponseString(response);
OkhttpUtils.println("load:" + json);
}
@Override
public void onFailure(Call call, IOException e) {
OkhttpUtils.onFailurePrintln(e);
}
});
}
use of okhttp3.FormBody in project Gradle-demo by Arisono.
the class testUASApi method addMobileMac.
public static void addMobileMac(String method) {
// master=USOFTSYS, emcode=U0316, sessionUser=U0316, sessionId=29DB60DE6E40D859B9169FE5013A8520, macAddress=3c:b6:b7:64:a7:ea
String url = baseurl + "mobile/addMobileMac.action";
RequestBody formBody = new FormBody.Builder().add("master", master).add("emcode", emcode).add("macAddress", "3c:b6:b7:64:a7:ea").add("sessionId", sessionId).build();
Request request = new Request.Builder().url(url).header("cookie", "JSESSIONID=" + sessionId).addHeader("sessionUser", emcode).addHeader("content-type", "text/html;charset:utf-8").post(formBody).build();
OkhttpUtils.client.newCall(request).enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) throws IOException {
OkhttpUtils.println(OkhttpUtils.getResponseString(response), OkhttpUtils.typeMiddle, method);
getStringCode("getStringCode");
return;
}
@Override
public void onFailure(Call call, IOException e) {
OkhttpUtils.onFailurePrintln(e);
}
});
}
Aggregations