use of retrofit2.Callback 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 retrofit2.Callback in project Gradle-demo by Arisono.
the class testUASApi method api_getWorkDate.
/**
* 获取班次
*/
public static void api_getWorkDate() {
String url = baseurl + "mobile/getWorkDate.action";
RequestBody formBody = new FormBody.Builder().add("date", "20170214").add("master", master).add("emcode", emcode).build();
OkhttpUtils.println(url);
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 {
String json = OkhttpUtils.getResponseString(response);
OkhttpUtils.println("班次接口:" + json);
}
@Override
public void onFailure(Call call, IOException e) {
OkhttpUtils.onFailurePrintln(e);
}
});
}
use of retrofit2.Callback 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 retrofit2.Callback in project Gradle-demo by Arisono.
the class testUASApi method loadUrlNoParams.
/**
* 加载一般url
*
* @param url
*/
public static void loadUrlNoParams(String url) {
Request request = new Request.Builder().url(url).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 retrofit2.Callback in project Gradle-demo by Arisono.
the class testUASApi method loginIM.
/**
* 登录IM系统
*
* @param phone
* @param password
*/
public static void loginIM(String phone, String 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);
}
});
}
Aggregations