|
|
@@ -3,6 +3,7 @@ package com.uas.appworks.OA.platform.activity;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
+import android.util.Log;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
@@ -15,6 +16,7 @@ import com.core.utils.CommonUtil;
|
|
|
import com.core.utils.ToastUtil;
|
|
|
import com.me.network.app.http.HttpClient;
|
|
|
import com.me.network.app.http.Method;
|
|
|
+import com.me.network.app.http.rx.Result2Listener;
|
|
|
import com.me.network.app.http.rx.ResultListener;
|
|
|
import com.me.network.app.http.rx.ResultSubscriber;
|
|
|
import com.modular.apputils.widget.SpaceItemDecoration;
|
|
|
@@ -66,31 +68,39 @@ public class BusinessTravelActivity extends BaseActivity {
|
|
|
|
|
|
|
|
|
public void loadData(int page) {
|
|
|
- if (!mRefreshLayout.isRefreshing()) {
|
|
|
- progressDialog.show();
|
|
|
- }
|
|
|
- httpClient.Api().send(new HttpClient.Builder()
|
|
|
- .url("mobile/getBussinessTrip.action")
|
|
|
- .add("emcode", CommonUtil.getEmcode())
|
|
|
- .header("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(BaseConfig.getContext(), "sessionId"))
|
|
|
- .method(Method.GET)
|
|
|
- .build(), new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
- @Override
|
|
|
- public void onResponse(Object o) {
|
|
|
- try {
|
|
|
- if (o != null) {
|
|
|
- handlerData(o.toString());
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- if (e != null) {
|
|
|
- LogUtil.i("e=" + e.getMessage());
|
|
|
- ToastUtil.showToast(ct, e.getMessage());
|
|
|
- }
|
|
|
+ if (!mRefreshLayout.isRefreshing()) {
|
|
|
+ progressDialog.show();
|
|
|
+ }
|
|
|
+ httpClient.Api().send(new HttpClient.Builder()
|
|
|
+ .url("mobile/getBussinessTrip.action")
|
|
|
+ .add("emcode", CommonUtil.getEmcode())
|
|
|
+ .header("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(BaseConfig.getContext(), "sessionId"))
|
|
|
+ .method(Method.POST)
|
|
|
+ .build(), new ResultSubscriber<>(new Result2Listener<Object>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object o) {
|
|
|
+ try {
|
|
|
+ if (o != null) {
|
|
|
+ LogUtil.d("businesstravelresult", o.toString());
|
|
|
+ handlerData(o.toString());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ if (e != null) {
|
|
|
+ LogUtil.i("e=" + e.getMessage());
|
|
|
+ ToastUtil.showToast(ct, e.getMessage());
|
|
|
}
|
|
|
- mRefreshLayout.stopRefresh();
|
|
|
- progressDialog.dismiss();
|
|
|
}
|
|
|
- }));
|
|
|
+ mRefreshLayout.stopRefresh();
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFailure(Object t) {
|
|
|
+ mRefreshLayout.stopRefresh();
|
|
|
+ progressDialog.dismiss();
|
|
|
+ LogUtil.d("businesstravelerror", t.toString());
|
|
|
+ }
|
|
|
+ }));
|
|
|
}
|
|
|
|
|
|
private void handlerData(String message) throws Exception {
|
|
|
@@ -113,8 +123,8 @@ public class BusinessTravelActivity extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
private void setAdapter(List<BusinessTravel> models) {
|
|
|
- if (BaseConfig.isDebug()){
|
|
|
- if (ListUtils.isEmpty(models)){
|
|
|
+ if (BaseConfig.isDebug()) {
|
|
|
+ if (ListUtils.isEmpty(models)) {
|
|
|
|
|
|
}
|
|
|
}
|