修改面状任务上的bug
This commit is contained in:
parent
8a8117875f
commit
eb90acb1c5
@ -125,7 +125,5 @@ dependencies {
|
||||
implementation 'com.googlecode.mp4parser:isoparser:1.1.21'
|
||||
// Android常用库 https://github.com/l123456789jy/Lazy
|
||||
implementation 'com.github.lazylibrary:lazylibrary:1.0.2'
|
||||
//屏幕的适配百分比
|
||||
//https://www.jianshu.com/p/0c2a8db91bda?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
|
||||
implementation 'com.android.support:percent:27.0.2'
|
||||
|
||||
}
|
@ -14,10 +14,9 @@ import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.adapter.CapacityEvaluationAdapter;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.CapacityMeasureBean;
|
||||
import com.navinfo.outdoor.bean.TaskExplainInfo;
|
||||
|
||||
import com.navinfo.outdoor.bean.TaskPrefectureBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
@ -44,6 +43,7 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.fragment_capacity_evaluation;
|
||||
@ -52,7 +52,7 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
ivEvaluationTaskFinish =findViewById(R.id.iv_evaluation_task_finish);
|
||||
ivEvaluationTaskFinish = findViewById(R.id.iv_evaluation_task_finish);
|
||||
capacityEvaluationRecycler = findViewById(R.id.capacity_evaluation_recycler);
|
||||
ivEvaluationTaskFinish.setOnClickListener(this::onClick);
|
||||
capacityEvaluationRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
@ -80,7 +80,7 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
|
||||
@Override
|
||||
public void onClick(int id) {
|
||||
Intent capacityEvaWeb = new Intent(getActivity(), FragmentManagement.class);
|
||||
capacityEvaWeb.putExtra("tag",14);
|
||||
capacityEvaWeb.putExtra("tag", 14);
|
||||
startActivity(capacityEvaWeb);
|
||||
}
|
||||
});
|
||||
@ -96,16 +96,15 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
|
||||
private void initNewWork() {
|
||||
showLoadingDialog();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("fid","1");
|
||||
httpParams.put("fid", "1");
|
||||
httpParams.put("pageNum", "1");
|
||||
httpParams.put("pageSize","10");
|
||||
httpParams.put("pageSize", "10");
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.MSG_LISt)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(TaskPrefectureBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<TaskPrefectureBean>() {
|
||||
.getRequest(new Callback<TaskPrefectureBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaskPrefectureBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -122,9 +121,9 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
|
||||
* 友盟+
|
||||
* 返回自定义报错信息
|
||||
*/
|
||||
UMCrash.generateCustomLog("网络请求报错-位置:CapacityEvaluationFragment"+e.getMessage(),"UmengException");
|
||||
UMCrash.generateCustomLog("网络请求报错-位置:CapacityEvaluationFragment" + e.getMessage(), "UmengException");
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -88,9 +88,8 @@ public class CapacityEvaluationFragment2 extends BaseFragment implements View.On
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.MSG_LISt)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(TaskPrefectureBean.class)
|
||||
.callback(new Callback<TaskPrefectureBean>() {
|
||||
.getRequest(new Callback<TaskPrefectureBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaskPrefectureBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -104,7 +103,7 @@ public class CapacityEvaluationFragment2 extends BaseFragment implements View.On
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -94,10 +94,9 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.EXAM_CONTENT)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(MeasureBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<MeasureBean>() {
|
||||
.getRequest(new Callback<MeasureBean>() {
|
||||
@Override
|
||||
public void onSuccess(MeasureBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -134,7 +133,7 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,6 @@ import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.adapter.ChargingPileAdapter;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
@ -77,6 +76,7 @@ import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
@ -606,10 +606,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_PHONES)
|
||||
.method(OkGoBuilder.GET)
|
||||
.params(new HttpParams("geo", encode))
|
||||
.cls(GetPhoneBean.class)
|
||||
.callback(new Callback<GetPhoneBean>() {
|
||||
.getRequest(new Callback<GetPhoneBean>() {
|
||||
@Override
|
||||
public void onSuccess(GetPhoneBean getPhoneBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -624,7 +623,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -823,14 +822,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
|
||||
try {
|
||||
okhttp3.Response execute = OkGo
|
||||
// 请求方式和请求url
|
||||
.<PoiUploadBean>post(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", chargingPileEntity.getBodyId())
|
||||
.addFileParams("file", chargingPileFileList)
|
||||
.tag(this)
|
||||
.execute();
|
||||
Response execute = OkGoBuilder.getInstance().url(HttpInterface.CS_TASK_UP_LOAD_PIC).fileList(chargingPileFileList).postFileSynchronization((int) chargingPileEntity.getBodyId());
|
||||
String pileUpLoadResultStr = execute.body().string();
|
||||
PoiUploadBean uploadBeanResult = new Gson().fromJson(pileUpLoadResultStr, PoiUploadBean.class);
|
||||
if (uploadBeanResult != null) {
|
||||
@ -1017,7 +1009,48 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
OkGo
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.C_TASK_UP_LOAD_PIC)
|
||||
.fileList(chargingStationList)
|
||||
.cls(PoiUploadBean.class)
|
||||
.postFileAsynchronous(poiEntity.getBodyId(), new Callback<PoiUploadBean>() {
|
||||
@Override
|
||||
public void onSuccess(PoiUploadBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response == null || response.getCode()!= 200) {
|
||||
Toast.makeText(getActivity(), "上传失败", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (response != null && response.getCode()== 200) {
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.deletePoiEntity(showPoiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getActivity().onBackPressed();//回退
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage()+"", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " +e.getMessage() + "");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* OkGo
|
||||
// 请求方式和请求url
|
||||
.<PoiUploadBean>post(HttpInterface.C_TASK_UP_LOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
@ -1062,7 +1095,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
Toast.makeText(getActivity(), poiUploadBeanResponse.code() + "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + poiUploadBeanResponse.code() + "");
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1086,10 +1119,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.SUBMIT_CTASK)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(ChargingStationBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<ChargingStationBean>() {
|
||||
.getRequest(new Callback<ChargingStationBean>() {
|
||||
@Override
|
||||
public void onSuccess(ChargingStationBean chargingStationBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -1125,7 +1157,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -1400,10 +1432,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
hashMap.put("sign_exist", chargingPileEntity.getSign_exist());
|
||||
httpParams.put("detail", String.valueOf(hashMap));
|
||||
try {
|
||||
okhttp3.Response execute = OkGo.<String>get(HttpInterface.SUBMIT_CSTASK)
|
||||
.params(httpParams)
|
||||
.tag(ChargingStationFragment.this)
|
||||
.execute();
|
||||
Response execute = OkGoBuilder.getInstance().url(HttpInterface.SUBMIT_CSTASK).params(httpParams).getSynchronization();
|
||||
String responseBodyStr = execute.body().string();
|
||||
if (responseBodyStr != null) {
|
||||
Gson gson = new Gson();
|
||||
|
@ -68,10 +68,9 @@ public class EventPrefectureFragment extends BaseFragment implements View.OnClic
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.listEvent)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(TaskPrefectureBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<TaskPrefectureBean>() {
|
||||
.getRequest(new Callback<TaskPrefectureBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaskPrefectureBean taskPrefectureBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -86,7 +85,7 @@ public class EventPrefectureFragment extends BaseFragment implements View.OnClic
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -300,9 +300,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url + "/" + taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(ReceivedBean.class)
|
||||
.callback(new Callback<ReceivedBean>() {
|
||||
.getRequest(new Callback<ReceivedBean>() {
|
||||
@Override
|
||||
public void onSuccess(ReceivedBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -397,7 +396,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
|
||||
}
|
||||
@ -415,9 +414,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url + "/" + taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(PolygonTaskBean.class)
|
||||
.callback(new Callback<PolygonTaskBean>() {
|
||||
.getRequest(new Callback<PolygonTaskBean>() {
|
||||
@Override
|
||||
public void onSuccess(PolygonTaskBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -475,7 +473,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -492,9 +490,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url + "/" + taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(UnPolygonTaskBean.class)
|
||||
.callback(new Callback<UnPolygonTaskBean>() {
|
||||
.getRequest(new Callback<UnPolygonTaskBean>() {
|
||||
@Override
|
||||
public void onSuccess(UnPolygonTaskBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -525,7 +522,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -542,9 +539,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url + "/" + taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(UnPolygonTaskBean.class)
|
||||
.callback(new Callback<UnPolygonTaskBean>() {
|
||||
.getRequest(new Callback<UnPolygonTaskBean>() {
|
||||
@Override
|
||||
public void onSuccess(UnPolygonTaskBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -575,7 +571,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -591,10 +587,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url)
|
||||
.method(OkGoBuilder.GET)
|
||||
.params(new HttpParams("id", String.valueOf(taskId)))
|
||||
.cls(UnPolygonTaskBean.class)
|
||||
.callback(new Callback<UnPolygonTaskBean>() {
|
||||
.getRequest(new Callback<UnPolygonTaskBean>() {
|
||||
@Override
|
||||
public void onSuccess(UnPolygonTaskBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -625,7 +620,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -639,9 +634,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url + "/" + taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(ReceivedPoiBean.class)
|
||||
.callback(new Callback<ReceivedPoiBean>() {
|
||||
.getRequest(new Callback<ReceivedPoiBean>() {
|
||||
@Override
|
||||
public void onSuccess(ReceivedPoiBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -721,7 +715,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
Toast.makeText(getContext(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -748,9 +742,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url + "/" + taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(TaskByNetBean.class)
|
||||
.callback(new Callback<TaskByNetBean>() {
|
||||
.getRequest(new Callback<TaskByNetBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaskByNetBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -833,7 +826,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
Toast.makeText(getContext(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -107,10 +107,9 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_COMMIT_LIST)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(HasSubmitBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<HasSubmitBean>() {
|
||||
.getRequest(new Callback<HasSubmitBean>() {
|
||||
@Override
|
||||
public void onSuccess(HasSubmitBean hasSubmitBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -129,7 +128,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
Toast.makeText(getContext(), "请求失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
}
|
||||
|
||||
private void initChaningSubMitWork() {
|
||||
@ -140,10 +139,9 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_COMMIT_LIST)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(HasSubmitBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<HasSubmitBean>() {
|
||||
.getRequest(new Callback<HasSubmitBean>() {
|
||||
@Override
|
||||
public void onSuccess(HasSubmitBean hasSubmitBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -162,7 +160,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
Toast.makeText(getContext(), "请求失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
}
|
||||
|
||||
private void initRoadSubMitWork() {
|
||||
@ -173,10 +171,9 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_COMMIT_LIST)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(HasSubmitBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<HasSubmitBean>() {
|
||||
.getRequest(new Callback<HasSubmitBean>() {
|
||||
@Override
|
||||
public void onSuccess(HasSubmitBean hasSubmitBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -195,7 +192,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
Toast.makeText(getContext(), "请求失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
}
|
||||
|
||||
private void initPoiVideoSubMitWork() {
|
||||
@ -206,10 +203,9 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_COMMIT_LIST)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(HasSubmitBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<HasSubmitBean>() {
|
||||
.getRequest(new Callback<HasSubmitBean>() {
|
||||
@Override
|
||||
public void onSuccess(HasSubmitBean hasSubmitBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -228,7 +224,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
Toast.makeText(getContext(), "请求失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
}
|
||||
|
||||
private void initPoiSubMitWork() {
|
||||
@ -239,10 +235,9 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_COMMIT_LIST)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(HasSubmitBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<HasSubmitBean>() {
|
||||
.getRequest(new Callback<HasSubmitBean>() {
|
||||
@Override
|
||||
public void onSuccess(HasSubmitBean hasSubmitBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -262,7 +257,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
Toast.makeText(getContext(), "请求失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,10 +64,9 @@ public class IssueFragment extends BaseFragment implements View.OnClickListener
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.listTaskExplain)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(TaskPrefectureBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<TaskPrefectureBean>() {
|
||||
.getRequest(new Callback<TaskPrefectureBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaskPrefectureBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -81,7 +80,7 @@ public class IssueFragment extends BaseFragment implements View.OnClickListener
|
||||
// Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -92,10 +92,9 @@ public class MessageFragment extends BaseFragment implements View.OnClickListene
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.listTask)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(TaskPrefectureBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<TaskPrefectureBean>() {
|
||||
.getRequest(new Callback<TaskPrefectureBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaskPrefectureBean taskPrefectureBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -109,7 +108,7 @@ public class MessageFragment extends BaseFragment implements View.OnClickListene
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
@Override
|
||||
|
@ -105,9 +105,8 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_PRICE)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(GetPriceBean.class)
|
||||
.callback(new Callback<GetPriceBean>() {
|
||||
.getRequest(new Callback<GetPriceBean>() {
|
||||
@Override
|
||||
public void onSuccess(GetPriceBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -123,7 +122,7 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
|
||||
// Toast.makeText(getContext(), "获取失败"+e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -469,41 +469,38 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
return;
|
||||
}
|
||||
showLoadingDialog();
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<PoiUploadBean>post(HttpInterface.OTHER_TASK_UPLOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", body)
|
||||
.addFileParams("file", otherUploadList)
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<PoiUploadBean>(PoiUploadBean.class) {
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.OTHER_TASK_UPLOAD_PIC)
|
||||
.fileList(otherUploadList)
|
||||
.cls(PoiUploadBean.class)
|
||||
.postFileAsynchronous(body, new Callback<PoiUploadBean>() {
|
||||
@Override
|
||||
public void onSuccess(PoiUploadBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void onSuccess(Response<PoiUploadBean> poiUploadBeanResponse) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getActivity().onBackPressed();//回退
|
||||
}
|
||||
});
|
||||
getActivity().onBackPressed();//回退
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<PoiUploadBean> poiUploadBeanResponse) {
|
||||
super.onError(poiUploadBeanResponse);
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), poiUploadBeanResponse.code() + "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + poiUploadBeanResponse.code() + "");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage()+ "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage() + "");
|
||||
}
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -519,10 +516,9 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.SUBMIT_OTHER_TASK)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(PoiSaveBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<PoiSaveBean>() {
|
||||
.getRequest(new Callback<PoiSaveBean>() {
|
||||
@Override
|
||||
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -554,7 +550,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -325,9 +325,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private void initShowPoi() {
|
||||
// 添加信息:
|
||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||
if (showPoiEntity.getTaskStatus()==1||showPoiEntity.getTaskStatus()==5){
|
||||
if (showPoiEntity.getTaskStatus() == 1 || showPoiEntity.getTaskStatus() == 5) {
|
||||
tvExamine.setVisibility(View.GONE);
|
||||
}else {
|
||||
} else {
|
||||
tvExamine.setVisibility(View.VISIBLE);
|
||||
}
|
||||
String name = showPoiEntity.getName();//名称
|
||||
@ -345,7 +345,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
latLng.setLatitude(Double.parseDouble(y));
|
||||
latLng.setLongitude(Double.parseDouble(x));
|
||||
}
|
||||
//得到区号
|
||||
//得到区号
|
||||
initPhone();
|
||||
String memo = showPoiEntity.getMemo();//任务描述
|
||||
if (memo != null && !memo.equals("")) {
|
||||
@ -448,16 +448,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_PHONES)
|
||||
.method(OkGoBuilder.GET)
|
||||
.params(new HttpParams("geo", encode))
|
||||
.cls(GetPhoneBean.class)
|
||||
.callback(new Callback<GetPhoneBean>() {
|
||||
.getRequest(new Callback<GetPhoneBean>() {
|
||||
@Override
|
||||
public void onSuccess(GetPhoneBean getPhoneBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (getPhoneBean.getCode() == 200) {
|
||||
String code = getPhoneBean.getBody().getCode();
|
||||
// Toast.makeText(getActivity(), code+"", Toast.LENGTH_SHORT).show();
|
||||
// Toast.makeText(getActivity(), code+"", Toast.LENGTH_SHORT).show();
|
||||
Constant.CODE = code;
|
||||
}
|
||||
}
|
||||
@ -467,7 +466,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -605,10 +604,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.TASK_NAME)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(TaskNameBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<TaskNameBean>() {
|
||||
.getRequest(new Callback<TaskNameBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaskNameBean taskNameBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -622,7 +620,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -740,41 +738,36 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
return;
|
||||
}
|
||||
showLoadingDialog();
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<OtherUploadPicBean>post(HttpInterface.POI_TASK_UPLOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", body)
|
||||
.addFileParams("file", poiPicList)
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
|
||||
OkGoBuilder.getInstance()
|
||||
.url(HttpInterface.POI_TASK_UPLOAD_PIC)
|
||||
.cls(OtherUploadPicBean.class)
|
||||
.fileList(poiPicList)
|
||||
.postFileAsynchronous(body, new Callback<OtherUploadPicBean>() {
|
||||
@Override
|
||||
public void onSuccess(OtherUploadPicBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getActivity().onBackPressed();//回退
|
||||
}
|
||||
});
|
||||
getActivity().onBackPressed();//回退
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<OtherUploadPicBean> response) {
|
||||
super.onError(response);
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), response.message() + "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.message() + "");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
dismissDialog();
|
||||
|
||||
}
|
||||
@ -792,10 +785,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.SUBMIT_POI_TASK)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(PoiSaveBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<PoiSaveBean>() {
|
||||
.getRequest(new Callback<PoiSaveBean>() {
|
||||
@Override
|
||||
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -827,7 +819,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -1036,8 +1028,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity != null ) {
|
||||
if (poiDaoPoiEntity.getTaskStatus()==5){
|
||||
if (poiDaoPoiEntity != null) {
|
||||
if (poiDaoPoiEntity.getTaskStatus() == 5) {
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
}
|
||||
|
||||
|
@ -112,10 +112,9 @@ public class PoiTaskFragment extends BaseFragment implements View.OnClickListene
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_COMMIT_LIST)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(HasSubmitBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<HasSubmitBean>() {
|
||||
.getRequest(new Callback<HasSubmitBean>() {
|
||||
@Override
|
||||
public void onSuccess(HasSubmitBean hasSubmitBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -132,7 +131,7 @@ public class PoiTaskFragment extends BaseFragment implements View.OnClickListene
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
Toast.makeText(getContext(), "请求失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -441,16 +441,17 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
Toast.makeText(getActivity(), "未压缩完成", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<OtherUploadPicBean>post(HttpInterface.POI_VIDEO_UPLOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", poiVideoBody)
|
||||
.params("file", fileZip)
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", poiVideoBody);
|
||||
httpParams.put("file", fileZip);
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.POI_VIDEO_UPLOAD_PIC)
|
||||
.cls(OtherUploadPicBean.class)
|
||||
.params(httpParams)
|
||||
.postRequest(new Callback<OtherUploadPicBean>() {
|
||||
@Override
|
||||
public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
|
||||
public void onSuccess(OtherUploadPicBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
@ -466,15 +467,13 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<OtherUploadPicBean> response) {
|
||||
super.onError(response);
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传失败", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.message() + "");
|
||||
Log.d("TAG", "onError: " + e.getMessage() + "");
|
||||
}
|
||||
});
|
||||
dismissDialog();
|
||||
@ -491,10 +490,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.INSIDE_API_LIST)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(PoiVideoBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<PoiVideoBean>() {
|
||||
.getRequest(new Callback<PoiVideoBean>() {
|
||||
@Override
|
||||
public void onSuccess(PoiVideoBean poiVideoBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -531,7 +529,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -421,23 +421,23 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
Toast.makeText(getContext(), "未压缩完成", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<OtherUploadPicBean>post(HttpInterface.ROAD_TASK_UPLOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", body)
|
||||
.params("file", fileZip)
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", body);
|
||||
httpParams.put("file", fileZip);
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.ROAD_TASK_UPLOAD_PIC)
|
||||
.params(httpParams)
|
||||
.cls(OtherUploadPicBean.class)
|
||||
.postRequest(new Callback<OtherUploadPicBean>() {
|
||||
@Override
|
||||
public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
|
||||
public void onSuccess(OtherUploadPicBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -447,15 +447,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<OtherUploadPicBean> response) {
|
||||
super.onError(response);
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getContext(), "上传失败", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.code() + "");
|
||||
Log.d("TAG", "onError: " + e.getMessage() + "");
|
||||
}
|
||||
});
|
||||
dismissDialog();
|
||||
@ -472,10 +470,9 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.ROAD_TASK_SUBMIT)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(RoadSaveBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<RoadSaveBean>() {
|
||||
.getRequest(new Callback<RoadSaveBean>() {
|
||||
@Override
|
||||
public void onSuccess(RoadSaveBean roadSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -513,7 +510,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -103,10 +103,9 @@ public class TaskExplainFragment extends BaseFragment implements View.OnClickLis
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.listTaskExplain)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(TaskPrefectureBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<TaskPrefectureBean>() {
|
||||
.getRequest(new Callback<TaskPrefectureBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaskPrefectureBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -120,7 +119,7 @@ public class TaskExplainFragment extends BaseFragment implements View.OnClickLis
|
||||
// Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -97,9 +97,8 @@ public class TaskExplainFragment2 extends BaseFragment implements View.OnClickLi
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.listTaskExplain)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(TaskExplainInfo.class)
|
||||
.callback(new Callback<TaskExplainInfo>() {
|
||||
.getRequest(new Callback<TaskExplainInfo>() {
|
||||
@Override
|
||||
public void onSuccess(TaskExplainInfo response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -113,7 +112,7 @@ public class TaskExplainFragment2 extends BaseFragment implements View.OnClickLi
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -104,10 +104,9 @@ public class TaskPrefectureFragment extends BaseFragment implements View.OnClick
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.listTask)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(TaskPrefectureBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<TaskPrefectureBean>() {
|
||||
.getRequest(new Callback<TaskPrefectureBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaskPrefectureBean taskPrefectureBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -121,7 +120,7 @@ public class TaskPrefectureFragment extends BaseFragment implements View.OnClick
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.kongzue.dialog.v3.ShareDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
@ -46,8 +47,10 @@ import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.JobSearchBean;
|
||||
import com.navinfo.outdoor.bean.RoadExtend;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
@ -318,7 +321,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
int task_type = Constant.TASK_TYPE;
|
||||
int limit_type = Constant.LIMIT_TTPE;
|
||||
int taskStatus = Constant.TASK_STASTUS;
|
||||
if (taskStatus == 1 || taskStatus == 2 || taskStatus == 3 || taskStatus == 4) {
|
||||
if (taskStatus == 1 || taskStatus == 2 || taskStatus == 3) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_WORD;
|
||||
obtain.obj = null;
|
||||
@ -335,6 +338,154 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
OkGo.getInstance().cancelTag(this);
|
||||
showLoadingDialog();
|
||||
// 请求方式和请求url
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("userGeo", userEncode);
|
||||
httpParams.put("centerGeo", centerEncode);
|
||||
httpParams.put("date", date);
|
||||
httpParams.put("pageSize", Constant.NUMBER);
|
||||
httpParams.put("pageNum", "1");
|
||||
httpParams.put("type", task_type);
|
||||
httpParams.put("isExclusive", limit_type);
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.TASK_LIST)
|
||||
.cls(JobSearchBean.class)
|
||||
.params(httpParams)
|
||||
.getRequest(new Callback<JobSearchBean>() {
|
||||
@Override
|
||||
public void onSuccess(JobSearchBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onSuccess: " + response.getBody().toString() + "sssssssssssss");
|
||||
for (int i = 0; i < removables.size(); i++) {
|
||||
removables.get(i).remove();
|
||||
}
|
||||
removables.clear();
|
||||
List<JobSearchBean.BodyBean.ListBean> list = response.getBody().getList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JobSearchBean.BodyBean.ListBean listBean = list.get(i);
|
||||
String geo = list.get(i).getGeo();
|
||||
Log.d("TAG", "onSuccess: " + geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
LatLng latLng = null;
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
} else if (geometry.getGeometryType().equals("LineString")) {//线
|
||||
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
|
||||
// 构造 PolylineOpitons
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
// 折线的颜色为绿色
|
||||
.color(0xff00ff00)
|
||||
// 折线宽度为5像素
|
||||
.width(5)
|
||||
// 还可以添加描边颜色
|
||||
.borderColor(0xffff0000)
|
||||
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
||||
.borderWidth(1);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
polyline.setZIndex(3);
|
||||
removables.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
} else if (geometry.getGeometryType().equals("Polygon")) {//面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
||||
//连接封闭图形的点
|
||||
addAll(latPolygon).
|
||||
//填充颜色为红色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).
|
||||
//边线颜色为黑色
|
||||
strokeColor(0xff000000).
|
||||
//边线宽度15像素
|
||||
strokeWidth(5));
|
||||
polygon.setZIndex(1);
|
||||
removables.add(polygon);
|
||||
if (latPolygon != null && latPolygon.size() > 0) {
|
||||
latLng = latPolygon.get(0);
|
||||
}
|
||||
}
|
||||
switch (Integer.valueOf(list.get(i).getType())) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1);
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiMarker.setZIndex(2);
|
||||
poiMarker.setTag(listBean);
|
||||
removables.add(poiMarker);
|
||||
poiMarker.setClickable(true);
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1);
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
stationMarker.setTag(listBean);
|
||||
removables.add(stationMarker);
|
||||
stationMarker.setClickable(true);
|
||||
stationMarker.setZIndex(2);
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1);
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiVideoMarker.setTag(listBean);
|
||||
removables.add(poiVideoMarker);
|
||||
poiVideoMarker.setClickable(true);
|
||||
poiVideoMarker.setZIndex(2);
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
roadMarker.setTag(listBean);
|
||||
removables.add(roadMarker);
|
||||
roadMarker.setClickable(true);
|
||||
roadMarker.setZIndex(2);
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
otherMarker.setTag(listBean);
|
||||
removables.add(otherMarker);
|
||||
otherMarker.setClickable(true);
|
||||
otherMarker.setZIndex(2);
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
Log.d("面状任务", "onSuccess: " + planarMarker);
|
||||
planarMarker.setTag(listBean);
|
||||
removables.add(planarMarker);
|
||||
planarMarker.setClickable(true);
|
||||
planarMarker.setZIndex(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_WORD;
|
||||
obtain.obj = response;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onError: " + e.getMessage() + "");
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
OkGo.<JobSearchBean>get(HttpInterface.TASK_LIST)
|
||||
.tag(this)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
@ -480,7 +631,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onError: " + response.message() + "");
|
||||
}
|
||||
});
|
||||
});*/
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -516,6 +667,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
int taskStatus = Constant.TASK_STASTUS;
|
||||
int type = Constant.TASK_TYPE;
|
||||
int limit = Constant.LIMIT_TTPE;
|
||||
if (taskStatus==0){
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||
obtain.obj = null;
|
||||
EventBus.getDefault().post(obtain);
|
||||
return;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -89,9 +89,8 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_PRICE)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(GetPriceBean.class)
|
||||
.callback(new Callback<GetPriceBean>() {
|
||||
.getRequest(new Callback<GetPriceBean>() {
|
||||
@Override
|
||||
public void onSuccess(GetPriceBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -118,7 +117,7 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
|
||||
// Toast.makeText(getContext(), "获取失败" + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
@ -158,10 +157,9 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.USER_PRICE_EXCHANGE)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(UserPriceExchangeBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<UserPriceExchangeBean>() {
|
||||
.getRequest(new Callback<UserPriceExchangeBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserPriceExchangeBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -175,7 +173,7 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
|
||||
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
}
|
||||
|
@ -6,41 +6,26 @@ import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.lzy.okgo.request.PostRequest;
|
||||
import com.navinfo.outdoor.bean.PoiUploadBean;
|
||||
import com.umeng.umcrash.UMCrash;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 作用:OKGO帮助类-建造者模式
|
||||
*/
|
||||
|
||||
public class OkGoBuilder<T> {
|
||||
/**
|
||||
* get请求
|
||||
*/
|
||||
public static final int GET = 1;
|
||||
/**
|
||||
* post请求
|
||||
*/
|
||||
public static final int POST = 2;
|
||||
/**
|
||||
* post请求
|
||||
*/
|
||||
public static final int PSOTFILE = 3;
|
||||
|
||||
public static final int PSOTFILEALONE = 4;
|
||||
|
||||
private Activity activity;
|
||||
/**
|
||||
* 请求网址
|
||||
*/
|
||||
private String url;
|
||||
private String file;
|
||||
private String pdf;
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
@ -50,13 +35,7 @@ public class OkGoBuilder<T> {
|
||||
* 实体类
|
||||
*/
|
||||
private Class<T> clazz;
|
||||
/**
|
||||
* 回调
|
||||
*/
|
||||
private Callback<T> callback;
|
||||
|
||||
private int methodType;
|
||||
private ArrayList<File> list;
|
||||
private List<File> files;
|
||||
|
||||
/**
|
||||
* 单列模式
|
||||
@ -99,64 +78,36 @@ public class OkGoBuilder<T> {
|
||||
this.file = file;
|
||||
return this;
|
||||
}
|
||||
public OkGoBuilder pdf(String pdf) {
|
||||
this.pdf = pdf;
|
||||
return this;
|
||||
}
|
||||
public OkGoBuilder method(int methodType) {
|
||||
this.methodType = methodType;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public OkGoBuilder params(HttpParams params) {
|
||||
this.params = params;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OkGoBuilder list(ArrayList<File> list) {
|
||||
this.list = list;
|
||||
public OkGoBuilder fileList(List<File> files) {
|
||||
this.files = files;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public OkGoBuilder json(String json) {
|
||||
this.json = json;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OkGoBuilder cls(Class<T> clazz) {
|
||||
this.clazz = clazz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OkGoBuilder callback(Callback<T> callback) {
|
||||
this.callback = callback;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public OkGoBuilder build() {
|
||||
switch (methodType) {
|
||||
case 1:
|
||||
getRequest();
|
||||
break;
|
||||
case 2:
|
||||
postRequest(json);
|
||||
break;
|
||||
case 3:
|
||||
postRequestFile();
|
||||
break;
|
||||
case 4:
|
||||
postRequestAloneFile();
|
||||
break;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* post请求
|
||||
* post异步请求
|
||||
*/
|
||||
private void postRequest(String json) {
|
||||
public void postRequest(Callback<T> callback) {
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<T>post(url)
|
||||
@ -185,16 +136,83 @@ public class OkGoBuilder<T> {
|
||||
* 友盟+
|
||||
* 使用自定义错误,查看时请在错误列表页面选择【自定义异常】
|
||||
*/
|
||||
UMCrash.generateCustomLog("网络请求报错-位置:OKGOBuilder"+throwable,"UmengException");
|
||||
UMCrash.generateCustomLog("网络请求报错-位置:OKGOBuilder" + throwable, "UmengException");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* get请求
|
||||
* post 文件 同步请求
|
||||
*
|
||||
* @return
|
||||
* @param id
|
||||
*/
|
||||
private void getRequest() {
|
||||
public okhttp3.Response postFileSynchronization(int id) {
|
||||
try {
|
||||
okhttp3.Response execute = OkGo
|
||||
// 请求方式和请求url
|
||||
.<PoiUploadBean>post(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", id)
|
||||
.addFileParams("file", files)
|
||||
.tag(this)
|
||||
.execute();
|
||||
return execute;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* post 文件 异步请求
|
||||
*
|
||||
* @return
|
||||
* @param id
|
||||
* @param callback
|
||||
*/
|
||||
public void postFileAsynchronous(int id, Callback callback) {
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<T>post(url)
|
||||
.params("auditId", id)
|
||||
.addFileParams("file", files)
|
||||
// .upJson(json)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.tag(this)
|
||||
// 设置当前请求的缓存key,建议每个不同功能的请求设置一个
|
||||
// .cacheKey("cacheKey")
|
||||
// 缓存模式,详细请看缓存介绍
|
||||
// .cacheMode(CacheMode.DEFAULT)
|
||||
.execute(new DialogCallback<T>(clazz) {
|
||||
@Override
|
||||
public void onSuccess(Response<T> response) {
|
||||
callback.onSuccess(response.body(), 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<T> response) {
|
||||
super.onError(response);
|
||||
Throwable throwable = response.getException();
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
callback.onError(throwable, 2);
|
||||
/**
|
||||
* 友盟+
|
||||
* 使用自定义错误,查看时请在错误列表页面选择【自定义异常】
|
||||
*/
|
||||
UMCrash.generateCustomLog("网络请求报错-位置:OKGOBuilder" + throwable, "UmengException");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* get异步请求
|
||||
*/
|
||||
public void getRequest(Callback<T> callback) {
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<T>get(url)
|
||||
@ -222,60 +240,21 @@ public class OkGoBuilder<T> {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* post 发送文件
|
||||
* get同步请求
|
||||
* @return
|
||||
*/
|
||||
private void postRequestFile() {
|
||||
PostRequest<T> request = OkGo.<T>post(url)
|
||||
.tag(this)
|
||||
.params("param", json.toString());
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
request.params("file_" + i, list.get(i));
|
||||
}
|
||||
public okhttp3.Response getSynchronization() {
|
||||
try {
|
||||
okhttp3.Response execute = OkGo.<String>get(HttpInterface.SUBMIT_CSTASK)
|
||||
.params(params)
|
||||
.tag(this)
|
||||
.execute();
|
||||
return execute;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (pdf!=null){
|
||||
request.params("pdf", new File(pdf));
|
||||
}
|
||||
request.execute(new DialogCallback<T>(clazz) {
|
||||
@Override
|
||||
public void onSuccess(Response<T> response) {
|
||||
callback.onSuccess(response.body(), 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<T> response) {
|
||||
super.onError(response);
|
||||
Throwable throwable = response.getException();
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
callback.onError(throwable, 2);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void postRequestAloneFile() {
|
||||
PostRequest<T> request = OkGo.<T>post(url).tag(this)
|
||||
.params("param", json.toString());
|
||||
if (file!=null){
|
||||
request.params("file", new File(file));
|
||||
}
|
||||
request.execute(new DialogCallback<T>(clazz) {
|
||||
@Override
|
||||
public void onSuccess(Response<T> response) {
|
||||
callback.onSuccess(response.body(), 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<T> response) {
|
||||
super.onError(response);
|
||||
Throwable throwable = response.getException();
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
callback.onError(throwable, 2);
|
||||
}
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,19 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.lazylibrary.util.ZipUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.hjq.permissions.OnPermissionCallback;
|
||||
import com.hjq.permissions.Permission;
|
||||
import com.hjq.permissions.XXPermissions;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.bean.ChargingPileSaveBean;
|
||||
import com.navinfo.outdoor.bean.Info;
|
||||
import com.navinfo.outdoor.bean.OtherUploadPicBean;
|
||||
import com.navinfo.outdoor.bean.PoiSaveBean;
|
||||
import com.navinfo.outdoor.bean.PoiUploadBean;
|
||||
import com.navinfo.outdoor.fragment.ChargingStationFragment;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
@ -76,7 +68,7 @@ public class PoiSaveUtils {
|
||||
if (saveChargingPileByChargingStation(poiEntity)) {
|
||||
if (savePoiNet(poiEntity) == 200) { // 网络保存成功
|
||||
// 开始上传流程
|
||||
if (saveChargingPileUploadChargingStation(poiEntity)){
|
||||
if (saveChargingPileUploadChargingStation(poiEntity)) {
|
||||
uploadPoiNet(poiEntity);
|
||||
}
|
||||
}
|
||||
@ -182,10 +174,7 @@ public class PoiSaveUtils {
|
||||
return -1;
|
||||
}
|
||||
try {
|
||||
okhttp3.Response execute = OkGo.<String>get(url)
|
||||
.tag(PoiSaveUtils.this)
|
||||
.params(httpParams)
|
||||
.execute();
|
||||
Response execute = OkGoBuilder.getInstance().url(url).params(httpParams).getSynchronization();
|
||||
if (execute.code() != 200) {
|
||||
return execute.code();
|
||||
}
|
||||
@ -245,8 +234,8 @@ public class PoiSaveUtils {
|
||||
}
|
||||
ArrayList<File> photoFile = new ArrayList<>();
|
||||
photoFile.clear();
|
||||
if (poiEntity.getPhotoInfo()!=null) {
|
||||
if (poiEntity.getPhotoInfo().size()>0){
|
||||
if (poiEntity.getPhotoInfo() != null) {
|
||||
if (poiEntity.getPhotoInfo().size() > 0) {
|
||||
for (int i = 0; i < poiEntity.getPhotoInfo().size(); i++) {
|
||||
String photo = poiEntity.getPhotoInfo().get(i).getPhoto();
|
||||
photoFile.add(new File(photo));
|
||||
@ -276,12 +265,7 @@ public class PoiSaveUtils {
|
||||
url = HttpInterface.OTHER_TASK_UPLOAD_PIC;
|
||||
}
|
||||
try {
|
||||
Response execute = OkGo.post(url)
|
||||
.params("auditId", bodyId)
|
||||
.addFileParams("file", photoFile)
|
||||
.tag(PoiSaveUtils.this)
|
||||
.execute();
|
||||
|
||||
Response execute = OkGoBuilder.getInstance().url(url).fileList(photoFile).postFileSynchronization(bodyId);
|
||||
if (execute.code() != 200) {
|
||||
return;
|
||||
}
|
||||
@ -294,10 +278,10 @@ public class PoiSaveUtils {
|
||||
if (otherUploadPicBean.getCode() == 200) {
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().deletePoiEntity(poiEntity);
|
||||
Log.d("TAGss", "uploadPoiNet: 成功");
|
||||
isBoolean=true;
|
||||
isBoolean = true;
|
||||
} else {
|
||||
Log.d("TAGss", "uploadPoiNet: 失败");
|
||||
isBoolean=false;
|
||||
isBoolean = false;
|
||||
return;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
@ -347,7 +331,7 @@ public class PoiSaveUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.d("TAGss", "saveChargingPileByChargingStation"+result);
|
||||
Log.d("TAGss", "saveChargingPileByChargingStation" + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -369,10 +353,7 @@ public class PoiSaveUtils {
|
||||
hashMap.put("sign_exist", chargingPileEntity.getSign_exist());
|
||||
httpParams.put("detail", String.valueOf(hashMap));
|
||||
try {
|
||||
okhttp3.Response execute = OkGo.<String>get(HttpInterface.SUBMIT_CSTASK)
|
||||
.params(httpParams)
|
||||
.tag(PoiSaveUtils.this)
|
||||
.execute();
|
||||
Response execute = OkGoBuilder.getInstance().url(HttpInterface.SUBMIT_CSTASK).params(httpParams).getSynchronization();
|
||||
if (execute.code() != 200) {
|
||||
return execute.code();
|
||||
}
|
||||
@ -386,7 +367,7 @@ public class PoiSaveUtils {
|
||||
if (chargingPileSaveBean.getCode() != 200) {
|
||||
return chargingPileSaveBean.getCode();
|
||||
}
|
||||
Log.d("TAGss", "saveChargingPile2NetWork"+200);
|
||||
Log.d("TAGss", "saveChargingPile2NetWork" + 200);
|
||||
chargingPileEntity.setBodyId(chargingPileSaveBean.getBody());
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(mContext, chargingPileEntity); // 更新当前充电桩的bodyId
|
||||
}
|
||||
@ -404,9 +385,9 @@ public class PoiSaveUtils {
|
||||
if (chargingStationPoiEntity != null) {
|
||||
// 首先批量上传充电桩数据
|
||||
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(mContext).getChargingPileDao().getChargingPileByStationId(chargingStationPoiEntity.getId());
|
||||
if (chargingPileEntityList!=null&&!chargingPileEntityList.isEmpty()) {
|
||||
for (ChargingPileEntity chargingPileEntity: chargingPileEntityList) {
|
||||
if (chargingPileEntity.getBodyId()!=0) {
|
||||
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
|
||||
for (ChargingPileEntity chargingPileEntity : chargingPileEntityList) {
|
||||
if (chargingPileEntity.getBodyId() != 0) {
|
||||
int pileResult = chargingPileUploadNetWork(chargingPileEntity);
|
||||
if (pileResult == 200) {
|
||||
result = result & true;
|
||||
@ -417,34 +398,28 @@ public class PoiSaveUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.d("TAGss", "saveChargingPileUploadChargingStation"+result);
|
||||
Log.d("TAGss", "saveChargingPileUploadChargingStation" + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传充电桩数据到服务器
|
||||
* */
|
||||
private int chargingPileUploadNetWork(ChargingPileEntity chargingPileEntity) {
|
||||
if (chargingPileEntity==null|| chargingPileEntity.getBodyId() == 0) {
|
||||
*/
|
||||
private int chargingPileUploadNetWork(ChargingPileEntity chargingPileEntity) {
|
||||
if (chargingPileEntity == null || chargingPileEntity.getBodyId() == 0) {
|
||||
Toast.makeText(mContext, "没有保存本地", Toast.LENGTH_SHORT).show();
|
||||
return -1;
|
||||
}
|
||||
|
||||
List<File> chargingPileFileList = new ArrayList<>();
|
||||
if (chargingPileEntity.getPhotos()!=null&&!chargingPileEntity.getPhotos().isEmpty()) {
|
||||
for (String photoPath: chargingPileEntity.getPhotos()) {
|
||||
if (chargingPileEntity.getPhotos() != null && !chargingPileEntity.getPhotos().isEmpty()) {
|
||||
for (String photoPath : chargingPileEntity.getPhotos()) {
|
||||
chargingPileFileList.add(new File(photoPath));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
okhttp3.Response execute = OkGo
|
||||
// 请求方式和请求url
|
||||
.<PoiUploadBean>post(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", chargingPileEntity.getBodyId())
|
||||
.addFileParams("file", chargingPileFileList)
|
||||
.tag(this)
|
||||
.execute();
|
||||
Response execute = OkGoBuilder.getInstance().url(HttpInterface.CS_TASK_UP_LOAD_PIC).fileList(chargingPileFileList).postFileSynchronization((int) chargingPileEntity.getBodyId());
|
||||
if (execute.code() != 200) {
|
||||
return execute.code();
|
||||
}
|
||||
@ -456,7 +431,7 @@ public class PoiSaveUtils {
|
||||
Gson gson = new Gson();
|
||||
PoiUploadBean uploadBeanResult = gson.fromJson(pileUpLoadResultStr, PoiUploadBean.class);
|
||||
if (uploadBeanResult.getCode() == 200) {
|
||||
Log.d("TAGss", "chargingPileUploadNetWork"+200);
|
||||
Log.d("TAGss", "chargingPileUploadNetWork" + 200);
|
||||
PoiDatabase.getInstance(mContext).getChargingPileDao().deleteChargingPileEntity(chargingPileEntity);
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_heightPercent="100%"
|
||||
android:background="@drawable/bg"
|
||||
|
||||
tools:context="activity.LoginActivity">
|
||||
|
||||
<TextView
|
||||
|
Loading…
x
Reference in New Issue
Block a user