|
|
|
|
@ -2,6 +2,7 @@ package com.example.administrator.zhapp.fragment.xfbwxcgl;
|
|
|
|
|
|
|
|
|
|
import android.content.ContentValues;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.widget.AdapterView;
|
|
|
|
|
import android.widget.Button;
|
|
|
|
|
@ -30,9 +31,11 @@ import com.example.administrator.zhapp.fragment.BaseFragment;
|
|
|
|
|
import com.example.administrator.zhapp.utils.GsonUtils;
|
|
|
|
|
import com.example.administrator.zhapp.utils.HttpListener;
|
|
|
|
|
import com.example.administrator.zhapp.utils.HttpResponseListener;
|
|
|
|
|
import com.example.administrator.zhapp.utils.RSAUtils;
|
|
|
|
|
import com.example.administrator.zhapp.utils.SPUtils;
|
|
|
|
|
import com.example.administrator.zhapp.utils.UiUtlis;
|
|
|
|
|
import com.example.administrator.zhapp.weight.WaitDialog;
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
|
import com.orhanobut.logger.Logger;
|
|
|
|
|
import com.yolanda.nohttp.NoHttp;
|
|
|
|
|
import com.yolanda.nohttp.rest.Request;
|
|
|
|
|
@ -99,10 +102,20 @@ public class XxzjhFragment extends BaseFragment {
|
|
|
|
|
@Override
|
|
|
|
|
protected void initView() {
|
|
|
|
|
|
|
|
|
|
lv = (ListView) headView.findViewById(R.id.lv);
|
|
|
|
|
btnXz = (Button) headView.findViewById(R.id.btn_xz);
|
|
|
|
|
btnDel = (Button) headView.findViewById(R.id.btn_delete);
|
|
|
|
|
tvNodata = (TextView) headView.findViewById(R.id.tv_nodata);
|
|
|
|
|
lv = (ListView) view.findViewById(R.id.lv);
|
|
|
|
|
btnXz = (Button) view.findViewById(R.id.btn_xz);
|
|
|
|
|
btnDel = (Button) view.findViewById(R.id.btn_delete);
|
|
|
|
|
tvNodata = (TextView) view.findViewById(R.id.tv_nodata);
|
|
|
|
|
|
|
|
|
|
mActivity = (XxzActivity) getActivity();
|
|
|
|
|
|
|
|
|
|
headView = View.inflate(context, R.layout.xzjh_item, null);
|
|
|
|
|
head = headView.findViewById(R.id.head);
|
|
|
|
|
head.setVisibility(View.VISIBLE);
|
|
|
|
|
TextView textView = (TextView) headView.findViewById(R.id.tv_jhlx);
|
|
|
|
|
textView.setText("到期时间");
|
|
|
|
|
cb = (CheckBox) headView.findViewById(R.id.cb);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btnXz.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
@ -146,13 +159,6 @@ public class XxzjhFragment extends BaseFragment {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lv.setEmptyView(tvNodata);
|
|
|
|
|
mActivity = (XxzActivity) getActivity();
|
|
|
|
|
headView = View.inflate(context, R.layout.xzjh_item, null);
|
|
|
|
|
head = headView.findViewById(R.id.head);
|
|
|
|
|
head.setVisibility(View.VISIBLE);
|
|
|
|
|
TextView textView = (TextView) headView.findViewById(R.id.tv_jhlx);
|
|
|
|
|
textView.setText("到期时间");
|
|
|
|
|
cb = (CheckBox) headView.findViewById(R.id.cb);
|
|
|
|
|
cb.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
@ -201,16 +207,38 @@ public class XxzjhFragment extends BaseFragment {
|
|
|
|
|
private void requestData() {
|
|
|
|
|
Request<String> request = NoHttp.createStringRequest(Contans.IP + Contans.XFDJJHALL);
|
|
|
|
|
request.add("bzbh", UiUtlis.encoder((String) SPUtils.get(context, Contans.BZBH, "")));
|
|
|
|
|
String tokenTemp = (String) SPUtils.get(mActivity, Contans.LOGIN_TOKEN, "");
|
|
|
|
|
if(!TextUtils.isEmpty(tokenTemp)){
|
|
|
|
|
String token = RSAUtils.decryptBASE64StrLocal(tokenTemp);;
|
|
|
|
|
String credential = "Bearer " + token;
|
|
|
|
|
request.addHeader("Authorization", credential);
|
|
|
|
|
showLog(request.url());
|
|
|
|
|
// if(!TextUtils.isEmpty(token)){
|
|
|
|
|
// showLog(credential);
|
|
|
|
|
// showLog(new Gson().toJson(request.headers()));
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
queue.add(0, request, new HttpResponseListener<>(getActivity(), request, callback, true, true, "加载中..."));
|
|
|
|
|
|
|
|
|
|
//NohttpUtils.getInstance().add(getActivity(), 0, request, callback, true, true, "加载中...");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void downData(String jhid, String xctypes) {
|
|
|
|
|
String tokenTemp = (String) SPUtils.get(mActivity, Contans.LOGIN_TOKEN, "");
|
|
|
|
|
if (xctypes.equals("1")) {
|
|
|
|
|
requestCount++;
|
|
|
|
|
Request<String> request = NoHttp.createStringRequest(Contans.IP + Contans.XFDJJHXZ);
|
|
|
|
|
request.add("jhid", UiUtlis.encoder(jhid));
|
|
|
|
|
if(!TextUtils.isEmpty(tokenTemp)){
|
|
|
|
|
String token = RSAUtils.decryptBASE64StrLocal(tokenTemp);;
|
|
|
|
|
String credential = "Bearer " + token;
|
|
|
|
|
request.addHeader("Authorization", credential);
|
|
|
|
|
showLog(request.url());
|
|
|
|
|
// if(!TextUtils.isEmpty(token)){
|
|
|
|
|
// showLog(credential);
|
|
|
|
|
// showLog(new Gson().toJson(request.headers()));
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
queue.add(1, request, new HttpResponseListener<>(getActivity(), request, callback, false, false, ""));
|
|
|
|
|
//NohttpUtils.getInstance().add(getActivity(), 1, request, callback, false, false, "下载计划中...");
|
|
|
|
|
|
|
|
|
|
@ -218,29 +246,80 @@ public class XxzjhFragment extends BaseFragment {
|
|
|
|
|
Request<String> request1 = NoHttp.createStringRequest(Contans.IP + Contans.XFXCMHQC);
|
|
|
|
|
request1.add("jhid", UiUtlis.encoder(jhid));
|
|
|
|
|
request1.add("xftype", 1);
|
|
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(tokenTemp)){
|
|
|
|
|
String token = RSAUtils.decryptBASE64StrLocal(tokenTemp);;
|
|
|
|
|
String credential = "Bearer " + token;
|
|
|
|
|
request1.addHeader("Authorization", credential);
|
|
|
|
|
showLog(request1.url());
|
|
|
|
|
// if(!TextUtils.isEmpty(token)){
|
|
|
|
|
// showLog(credential);
|
|
|
|
|
// showLog(new Gson().toJson(request.headers()));
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
queue.add(2, request1, new HttpResponseListener<>(getActivity(), request1, callback, false, false, "加载中..."));
|
|
|
|
|
//NohttpUtils.getInstance().add(getActivity(), 2, request1, callback, false, false, "下载计划中...");
|
|
|
|
|
|
|
|
|
|
requestCount++;
|
|
|
|
|
Request<String> request2 = NoHttp.createStringRequest(Contans.IP + Contans.XFXCXM);
|
|
|
|
|
request2.add("jhid", UiUtlis.encoder(jhid));
|
|
|
|
|
if(!TextUtils.isEmpty(tokenTemp)){
|
|
|
|
|
String token = RSAUtils.decryptBASE64StrLocal(tokenTemp);;
|
|
|
|
|
String credential = "Bearer " + token;
|
|
|
|
|
request2.addHeader("Authorization", credential);
|
|
|
|
|
showLog(request2.url());
|
|
|
|
|
// if(!TextUtils.isEmpty(token)){
|
|
|
|
|
// showLog(credential);
|
|
|
|
|
// showLog(new Gson().toJson(request.headers()));
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
queue.add(3, request2, new HttpResponseListener<>(getActivity(), request2, callback, false, false, "加载中..."));
|
|
|
|
|
//NohttpUtils.getInstance().add(getActivity(), 3, request2, callback, false, false, "下载计划中");
|
|
|
|
|
} else if (xctypes.equals("2")) {
|
|
|
|
|
requestCount++;
|
|
|
|
|
Request<String> xfba = NoHttp.createStringRequest(Contans.IP + Contans.BAXCJHXZ);
|
|
|
|
|
xfba.add("jhid", UiUtlis.encoder(jhid));
|
|
|
|
|
if(!TextUtils.isEmpty(tokenTemp)){
|
|
|
|
|
String token = RSAUtils.decryptBASE64StrLocal(tokenTemp);;
|
|
|
|
|
String credential = "Bearer " + token;
|
|
|
|
|
xfba.addHeader("Authorization", credential);
|
|
|
|
|
showLog(xfba.url());
|
|
|
|
|
// if(!TextUtils.isEmpty(token)){
|
|
|
|
|
// showLog(credential);
|
|
|
|
|
// showLog(new Gson().toJson(request.headers()));
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
queue.add(4, xfba, new HttpResponseListener<>(getActivity(), xfba, callback, false, false, "加载中..."));
|
|
|
|
|
//NohttpUtils.getInstance().add(getActivity(), 4, xfba, callback, false, false, "下载计划中");
|
|
|
|
|
} else if (xctypes.equals("3")) {
|
|
|
|
|
requestCount++;
|
|
|
|
|
Request<String> lyxc = NoHttp.createStringRequest(Contans.IP + Contans.LYXCXM);
|
|
|
|
|
lyxc.add("jhid", UiUtlis.encoder(jhid));
|
|
|
|
|
if(!TextUtils.isEmpty(tokenTemp)){
|
|
|
|
|
String token = RSAUtils.decryptBASE64StrLocal(tokenTemp);;
|
|
|
|
|
String credential = "Bearer " + token;
|
|
|
|
|
lyxc.addHeader("Authorization", credential);
|
|
|
|
|
showLog(lyxc.url());
|
|
|
|
|
// if(!TextUtils.isEmpty(token)){
|
|
|
|
|
// showLog(credential);
|
|
|
|
|
// showLog(new Gson().toJson(request.headers()));
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
queue.add(5, lyxc, new HttpResponseListener<>(getActivity(), lyxc, callback, false, false, "加载中..."));
|
|
|
|
|
//NohttpUtils.getInstance().add(getActivity(), 5, lyxc, callback, false, false, "下载计划中");
|
|
|
|
|
requestCount++;
|
|
|
|
|
Request<String> lyxcqy = NoHttp.createStringRequest(Contans.IP + Contans.LYXCQY);
|
|
|
|
|
lyxcqy.add("jhid", UiUtlis.encoder(jhid));
|
|
|
|
|
if(!TextUtils.isEmpty(tokenTemp)){
|
|
|
|
|
String token = RSAUtils.decryptBASE64StrLocal(tokenTemp);;
|
|
|
|
|
String credential = "Bearer " + token;
|
|
|
|
|
lyxcqy.addHeader("Authorization", credential);
|
|
|
|
|
showLog(lyxcqy.url());
|
|
|
|
|
// if(!TextUtils.isEmpty(token)){
|
|
|
|
|
// showLog(credential);
|
|
|
|
|
// showLog(new Gson().toJson(request.headers()));
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
queue.add(6, lyxcqy, new HttpResponseListener<>(getActivity(), lyxcqy, callback, false, false, "加载中..."));
|
|
|
|
|
//NohttpUtils.getInstance().add(getActivity(), 6, lyxcqy, callback, false, false, "下载计划中");
|
|
|
|
|
}
|
|
|
|
|
@ -249,12 +328,12 @@ public class XxzjhFragment extends BaseFragment {
|
|
|
|
|
private HttpListener<String> callback = new HttpListener<String>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSucceed(int what, Response<String> response) {
|
|
|
|
|
String josn = "";
|
|
|
|
|
josn = new String(response.get().getBytes(), StandardCharsets.UTF_8);
|
|
|
|
|
String result = response.get();
|
|
|
|
|
showLog(result);
|
|
|
|
|
|
|
|
|
|
switch (what) {
|
|
|
|
|
case 0:
|
|
|
|
|
list = GsonUtils.GsonToBean(response.get(), XfDjjhList.class);
|
|
|
|
|
list = GsonUtils.GsonToBean(result, XfDjjhList.class);
|
|
|
|
|
if (list != null) {
|
|
|
|
|
|
|
|
|
|
if (Integer.parseInt(list.getTotal()) != 0) {
|
|
|
|
|
@ -270,7 +349,7 @@ public class XxzjhFragment extends BaseFragment {
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
rwlist = GsonUtils.GsonToBean(response.get(), XfDjjhRwList.class);
|
|
|
|
|
rwlist = GsonUtils.GsonToBean(result, XfDjjhRwList.class);
|
|
|
|
|
//开启一个线程保存数据
|
|
|
|
|
if (rwlist != null) {
|
|
|
|
|
successCount++;
|
|
|
|
|
@ -287,7 +366,7 @@ public class XxzjhFragment extends BaseFragment {
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
XfXcmhqcList list = GsonUtils.GsonToBean(response.get(), XfXcmhqcList.class);
|
|
|
|
|
XfXcmhqcList list = GsonUtils.GsonToBean(result, XfXcmhqcList.class);
|
|
|
|
|
if (list != null) {
|
|
|
|
|
successCount++;
|
|
|
|
|
if (!list.getTotal().equals("0")) {
|
|
|
|
|
@ -300,7 +379,7 @@ public class XxzjhFragment extends BaseFragment {
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
XfXcxmList list1 = GsonUtils.GsonToBean(response.get(), XfXcxmList.class);
|
|
|
|
|
XfXcxmList list1 = GsonUtils.GsonToBean(result, XfXcxmList.class);
|
|
|
|
|
if (list1 != null) {
|
|
|
|
|
successCount++;
|
|
|
|
|
xcxms = list1.getRows();
|
|
|
|
|
@ -313,7 +392,7 @@ public class XxzjhFragment extends BaseFragment {
|
|
|
|
|
case 4:
|
|
|
|
|
|
|
|
|
|
Logger.v(response.get());
|
|
|
|
|
XfBaxcRwqyList xfbas = GsonUtils.GsonToBean(response.get(), XfBaxcRwqyList.class);
|
|
|
|
|
XfBaxcRwqyList xfbas = GsonUtils.GsonToBean(result, XfBaxcRwqyList.class);
|
|
|
|
|
if (xfbas != null) {
|
|
|
|
|
successCount++;
|
|
|
|
|
xfBaxcRwqies = xfbas.getRows();
|
|
|
|
|
@ -328,7 +407,7 @@ public class XxzjhFragment extends BaseFragment {
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
//楼宇巡查
|
|
|
|
|
LyxcXmList lyxcXmList = GsonUtils.GsonToBean(response.get(), LyxcXmList.class);
|
|
|
|
|
LyxcXmList lyxcXmList = GsonUtils.GsonToBean(result, LyxcXmList.class);
|
|
|
|
|
if (lyxcXmList != null) {
|
|
|
|
|
successCount++;
|
|
|
|
|
if (!lyxcXmList.getTotal().equals("0")) {
|
|
|
|
|
@ -340,7 +419,7 @@ public class XxzjhFragment extends BaseFragment {
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
|
LyxcqyList lyxcqyList = GsonUtils.GsonToBean(response.get(), LyxcqyList.class);
|
|
|
|
|
LyxcqyList lyxcqyList = GsonUtils.GsonToBean(result, LyxcqyList.class);
|
|
|
|
|
if (lyxcqyList != null) {
|
|
|
|
|
successCount++;
|
|
|
|
|
if (lyxcqyList.getTotal() != 0) {
|
|
|
|
|
|