修改‘其他’+‘poi’上传的接口和添加充电站的领取任务,保存本地接口
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion '29.0.2'
|
||||
// ndkVersion '21.1.6352462'
|
||||
//ndkVersion '23.0.7123448'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.navinfo.outdoor"
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
public class ChargingStationBean {
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
private Integer body;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(Integer body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
public class OtherUploadPicBean {
|
||||
|
||||
private Integer code;
|
||||
private String message;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -51,6 +51,8 @@ import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
@ -389,10 +391,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
String p = chargingPileEntity.getP();
|
||||
if (p != null) {
|
||||
String[] split = p.split(",");
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(Double.parseDouble(split[0]));
|
||||
latLng.setLongitude(Double.parseDouble(split[1]));
|
||||
latLng = GeometryTools.createLatLng(p);
|
||||
}
|
||||
String memo = chargingPileEntity.getMemo();
|
||||
if (memo != null&&!memo.equals("")) {
|
||||
@ -566,7 +565,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
chargingPileEntity.setP(latLng.latitude+","+latLng.longitude);
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude,latLng.longitude);
|
||||
chargingPileEntity.setP(encode);
|
||||
}
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
|
@ -38,13 +38,19 @@ import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.adapter.ChargingPileAdapter;
|
||||
import com.navinfo.outdoor.adapter.PoiRecycleAdapter;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.bean.ChargingStationBean;
|
||||
import com.navinfo.outdoor.bean.Info;
|
||||
import com.navinfo.outdoor.bean.PoiBean;
|
||||
import com.navinfo.outdoor.bean.PoiSaveBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.ChargingPileDao;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
@ -58,6 +64,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -90,7 +97,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private CheckBox checkBoxRight;
|
||||
private String phone = null;
|
||||
private Spinner spinnerType;
|
||||
String[] ctype = new String[]{"全部", "poi", "充电站", "POI录像", "道路录像"};//1."全部"2 "POI"3 "充电站"4 "POI录像"5 "道路录像",
|
||||
String[] ctype = new String[]{ "充电站", "充换电站", "充电桩组", "换电站"};//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"5 ,
|
||||
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||
private ArrayAdapter<String> adapter;
|
||||
private LinearLayout linearChargingPile;
|
||||
@ -225,20 +232,18 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
station_type = 0;
|
||||
break;
|
||||
case 1:
|
||||
station_type = 1;
|
||||
break;
|
||||
case 2:
|
||||
case 1:
|
||||
station_type = 2;
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
station_type = 3;
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
station_type = 4;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -601,7 +606,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
poiDao.insertPoiEntity(poiEntity);
|
||||
}
|
||||
}).start();
|
||||
onBackPressed();
|
||||
chargingStationSaveByWork(poiEntity);
|
||||
// onBackPressed();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -623,6 +629,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
obtain.what = Constant.TREASURE_FRAGMENT;
|
||||
obtain.obj = false;
|
||||
EventBus.getDefault().post(obtain);
|
||||
ArrayList<File> chargingStationList = new ArrayList<>();
|
||||
|
||||
break;
|
||||
case R.id.tv_examine:
|
||||
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
|
||||
@ -657,6 +665,40 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
}
|
||||
|
||||
private void chargingStationSaveByWork(PoiEntity poiEntity) {
|
||||
showLoadingDialog();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("id",poiEntity.getTaskId());
|
||||
httpParams.put("sptype", poiEntity.getStation_type());
|
||||
httpParams.put("name", poiEntity.getName());
|
||||
httpParams.put("address", poiEntity.getAddress());
|
||||
httpParams.put("telephone", poiEntity.getTelPhone());
|
||||
httpParams.put("memo", poiEntity.getMemo());
|
||||
httpParams.put("geo",poiEntity.getGeoWkt());
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.SUBMIT_CTASK)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(ChargingStationBean.class)
|
||||
.params(httpParams)
|
||||
.callback(new Callback<ChargingStationBean>() {
|
||||
@Override
|
||||
public void onSuccess(ChargingStationBean chargingStationBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
// body = poiSaveBean.getBody();
|
||||
Log.d("TAG", " 其他其他其他其他"+chargingStationBean.getBody());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
}
|
||||
|
||||
private String initShowStation() {
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
List<Info> infoPhoto = new ArrayList<>();
|
||||
|
@ -14,11 +14,14 @@ import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.PolygonTaskBean;
|
||||
import com.navinfo.outdoor.bean.ReceivedBean;
|
||||
import com.navinfo.outdoor.bean.ReceivedPoiBean;
|
||||
import com.navinfo.outdoor.bean.UnPolygonTaskBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.ChargingPileDao;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
@ -41,6 +44,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
private PoiEntity poiListEntity;
|
||||
private int aSave;
|
||||
private PoiEntity polygonEntity;
|
||||
private ChargingPileDao chargingPileDao;
|
||||
|
||||
public static GatherGetFragment newInstance(Bundle bundle) {
|
||||
GatherGetFragment fragment = new GatherGetFragment();
|
||||
@ -84,6 +88,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
super.initView();
|
||||
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
|
||||
poiDao = poiDatabase.getPoiDao();
|
||||
chargingPileDao = poiDatabase.getChargingPileDao();
|
||||
tvTitle = findViewById(R.id.tv_title);
|
||||
tvMoney = findViewById(R.id.tv_money);
|
||||
tvTime = findViewById(R.id.tv_time);
|
||||
@ -170,48 +175,52 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
if (poiEntity != null) {
|
||||
int type = poiEntity.getType();
|
||||
if (type == 6) {
|
||||
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(),false);
|
||||
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), false);
|
||||
} else {
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnCancelGet.setVisibility(View.VISIBLE);
|
||||
//网络请求:
|
||||
if (poiEntity.getType() == 1) {//poi的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK + "/" + poiEntity.getTaskId() + "", false);
|
||||
} else if (poiEntity.getType() == 5) {//其他
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK + "/" + poiEntity.getTaskId() + "", false);
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK , poiEntity.getTaskId(), false);
|
||||
} else if (poiEntity.getType() == 5) {//其他的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK , poiEntity.getTaskId(), false);
|
||||
} else if (poiEntity.getType() == 2) {//充电站的领取类型
|
||||
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(),false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case R.id.btn_gather://立即采集
|
||||
if (poiEntity!=null){
|
||||
if (poiEntity != null) {
|
||||
int type = poiEntity.getType();
|
||||
if (type==6){
|
||||
if (type == 6) {
|
||||
int taskStatus = poiEntity.getTaskStatus();
|
||||
if (taskStatus != 1) {
|
||||
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(),true);
|
||||
}else {
|
||||
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), true);
|
||||
} else {
|
||||
initCompleteTask(HttpInterface.COMPLETE, poiEntity.getTaskId());
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
btnFinishGather.setVisibility(View.VISIBLE);
|
||||
btnGather.setVisibility(View.GONE);
|
||||
if (poiEntity.getType() == 1) {//poi的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK + "/" + poiEntity.getTaskId() + "", true);
|
||||
} else if (poiEntity.getType() == 5) {
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK + "/" + poiEntity.getTaskId() + "", true);
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK , poiEntity.getTaskId(), true);
|
||||
} else if (poiEntity.getType() == 5) {//其他的领取类型
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), true);
|
||||
}else if (poiEntity.getType() == 2){//充电站的领取类型
|
||||
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(),true);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case R.id.btn_finish_gather://结束采集
|
||||
if (poiEntity!=null){
|
||||
if (poiEntity != null) {
|
||||
int type = poiEntity.getType();
|
||||
if (type==6){
|
||||
if (type == 6) {
|
||||
initSubmitPolygonTask(HttpInterface.SUBMIT_POLYGON_TASK, poiEntity.getTaskId());
|
||||
}else {
|
||||
} else {
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
new Thread(new Runnable() {
|
||||
@ -231,10 +240,94 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url 筛选充电站领取任务
|
||||
*/
|
||||
private void chargingTaskByWork(String url,int taskId, boolean isSaver) {
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url+"/"+taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(ReceivedBean.class)
|
||||
.callback(new Callback<ReceivedBean>() {
|
||||
@Override
|
||||
public void onSuccess(ReceivedBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
ReceivedBean.BodyBean listBean = response.getBody();
|
||||
PoiEntity chargingListEntity = new PoiEntity();
|
||||
chargingListEntity.setTaskId(taskId);
|
||||
chargingListEntity.setStation_type(listBean.getSptype());
|
||||
chargingListEntity.setName(listBean.getName());
|
||||
chargingListEntity.setPrecision(listBean.getPrice() + "");
|
||||
chargingListEntity.setAddress(listBean.getAddress());
|
||||
chargingListEntity.setTelPhone(listBean.getTelephone() + "");
|
||||
chargingListEntity.setType(Integer.valueOf(listBean.getType()));
|
||||
String geo = listBean.getGeo();
|
||||
chargingListEntity.setGeoWkt(geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
LatLng latLng = GeometryTools.createLatLng(geo);
|
||||
chargingListEntity.setX(latLng.longitude + "");
|
||||
chargingListEntity.setY(latLng.latitude + "");
|
||||
} else if (geometry.getGeometryType().equals("LineString")) {//线
|
||||
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
|
||||
chargingListEntity.setX(latLineString.get(0).longitude + "");
|
||||
chargingListEntity.setY(latLineString.get(0).latitude + "");
|
||||
} else if (geometry.getGeometryType().equals("Polygon")) {//面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
|
||||
chargingListEntity.setX(latPolygon.get(0).longitude + "");
|
||||
chargingListEntity.setY(latPolygon.get(0).latitude + "");
|
||||
}
|
||||
//充电桩
|
||||
List<ReceivedBean.BodyBean.CsTaskListBean> csTaskList = response.getBody().getCsTaskList();
|
||||
for (int i = 0; i < csTaskList.size(); i++) {
|
||||
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
|
||||
chargingPileEntity.setFid(taskId);
|
||||
chargingPileEntity.setName(csTaskList.get(i).getName());
|
||||
chargingPileEntity.setMemo(csTaskList.get(i).getAddress());
|
||||
chargingPileEntity.setP(csTaskList.get(i).getGeo());
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
chargingPileDao.insertChargingPileEntity(chargingPileEntity);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.insertPoiEntity(chargingListEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
btnFinishGather.setVisibility(View.VISIBLE);
|
||||
if (isSaver && aSave == 1) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.GATHER_GET_MAP;
|
||||
obtain.obj = chargingListEntity;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url 面妆任务领取任务
|
||||
*/
|
||||
private void initPolygonTask(String url, int taskId ,boolean aBoolean) {
|
||||
private void initPolygonTask(String url, int taskId, boolean aBoolean) {
|
||||
if (taskId == 0) {
|
||||
Toast.makeText(getContext(), "无此任务", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
@ -280,7 +373,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
}).start();
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnCancelGet.setVisibility(View.VISIBLE);
|
||||
if (aBoolean){
|
||||
if (aBoolean) {
|
||||
initCompleteTask(HttpInterface.COMPLETE, poiEntity.getTaskId());
|
||||
}
|
||||
|
||||
@ -414,11 +507,11 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
/**
|
||||
* @param url 不同任务类型对应的url
|
||||
*/
|
||||
private void receivedTaskByNet(String url, boolean isSaver) {
|
||||
private void receivedTaskByNet(String url,int taskId ,boolean isSaver) {
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url)
|
||||
.url(url+"/"+taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(ReceivedPoiBean.class)
|
||||
.callback(new Callback<ReceivedPoiBean>() {
|
||||
|
@ -42,6 +42,7 @@ import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.bean.Info;
|
||||
import com.navinfo.outdoor.bean.NameAuthenticationBean;
|
||||
import com.navinfo.outdoor.bean.OtherUploadPicBean;
|
||||
import com.navinfo.outdoor.bean.PoiBean;
|
||||
import com.navinfo.outdoor.bean.PoiSaveBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
@ -91,9 +92,10 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
private RelativeLayout linearExist;
|
||||
private Spinner spinnerExist;
|
||||
|
||||
private ArrayList<File> otheruploadList;
|
||||
|
||||
private String takePhotoPath;
|
||||
private String takePhotoPath2;
|
||||
private int body;
|
||||
|
||||
public static OtherFragment newInstance(Bundle bundle) {
|
||||
OtherFragment fragment = new OtherFragment();
|
||||
@ -365,7 +367,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
}
|
||||
}).start();
|
||||
otherSaveByNetWork(poiEntity);
|
||||
onBackPressed();
|
||||
// onBackPressed();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -383,42 +385,52 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
|
||||
break;
|
||||
case R.id.btn_other_uploading:
|
||||
otherUploadByNet(showPoiEntity);
|
||||
ArrayList<File> otherUploadList = new ArrayList<>();
|
||||
String tagPicture = (String) ivPicture.getTag();
|
||||
if (tagPicture != null) {
|
||||
otherUploadList.add(new File(tagPicture));
|
||||
}
|
||||
String tagPictures = (String) ivPictures.getTag();
|
||||
if (tagPictures != null) {
|
||||
otherUploadList.add(new File(tagPictures));
|
||||
}
|
||||
if (body!=0){
|
||||
otherUploadByNet(body,otherUploadList);
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "请保存本地", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void otherUploadByNet(PoiEntity poiEntity) {
|
||||
showLoadingDialog();
|
||||
otheruploadList = new ArrayList<>();
|
||||
File otherUploadFile = new File(takePhotoPath);
|
||||
File otherUploadFile2 = new File(takePhotoPath2);
|
||||
if (!otherUploadFile.exists() || !otherUploadFile2.exists()) {
|
||||
Toast.makeText(getContext(), "照片不能为空", Toast.LENGTH_SHORT).show();
|
||||
private void otherUploadByNet(int body, List<File> otherUploadList) {
|
||||
if (body == 0 ){
|
||||
Toast.makeText(getActivity(), "没有保存不能上传", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
otheruploadList.add(otherUploadFile);
|
||||
otheruploadList.add(otherUploadFile2);
|
||||
showLoadingDialog();
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<NameAuthenticationBean>post(HttpInterface.USER_AUTH_ADD)
|
||||
.<OtherUploadPicBean>post(HttpInterface.OTHER_TASK_UPLOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", poiEntity.getTaskId())
|
||||
.addFileParams("file", otheruploadList)
|
||||
.params("auditId", body)
|
||||
.addFileParams("file", otherUploadList)
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<NameAuthenticationBean>(NameAuthenticationBean.class) {
|
||||
.execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
|
||||
@Override
|
||||
public void onSuccess(Response<NameAuthenticationBean> response) {
|
||||
public void onSuccess(Response<OtherUploadPicBean> response) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<NameAuthenticationBean> response) {
|
||||
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());
|
||||
Toast.makeText(getActivity(), response.code()+"", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.code());
|
||||
}
|
||||
});
|
||||
|
||||
@ -430,7 +442,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
httpParams.put("type", poiEntity.getStation_type());
|
||||
httpParams.put("taskId", poiEntity.getTaskId());
|
||||
httpParams.put("name", poiEntity.getName());
|
||||
httpParams.put("existence", "1");
|
||||
httpParams.put("existence", poiEntity.getExistence());
|
||||
httpParams.put("geo", poiEntity.getGeoWkt());
|
||||
httpParams.put("memo", poiEntity.getMemo());
|
||||
|
||||
@ -445,6 +457,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
body = poiSaveBean.getBody();
|
||||
Log.d("TAG", " 其他其他其他其他"+poiSaveBean.getBody());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,6 +49,7 @@ import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.bean.Info;
|
||||
import com.navinfo.outdoor.bean.NameAuthenticationBean;
|
||||
import com.navinfo.outdoor.bean.OtherUploadPicBean;
|
||||
import com.navinfo.outdoor.bean.PoiBean;
|
||||
import com.navinfo.outdoor.bean.PoiSaveBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
@ -70,6 +71,7 @@ import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
@ -101,13 +103,14 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||
private RelativeLayout linearExist;
|
||||
private Spinner spinnerExist;
|
||||
private ArrayList<File> poiUploadList;
|
||||
|
||||
//获取的拍照图片
|
||||
private String takePhotoPath2;
|
||||
private String takePhotoPath5;
|
||||
private String takePhotoPath4;
|
||||
private String takePhotoPath3;
|
||||
private String takePhotoPath1;
|
||||
private Integer body;
|
||||
|
||||
public static PoiFragment newInstance(Bundle bundle) {
|
||||
PoiFragment fragment = new PoiFragment();
|
||||
@ -459,8 +462,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
poiDao.insertPoiEntity(poiEntity);
|
||||
}
|
||||
}).start();
|
||||
//poiSaveByNet(poiEntity);
|
||||
onBackPressed();
|
||||
poiSaveByNet(poiEntity);
|
||||
// onBackPressed();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -482,7 +485,29 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
obtain.what = Constant.TREASURE_FRAGMENT;
|
||||
obtain.obj = false;
|
||||
EventBus.getDefault().post(obtain);
|
||||
poiUploadByNetWork(showPoiEntity);
|
||||
ArrayList<File> poiPicList = new ArrayList<>();
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama != null) {
|
||||
poiPicList.add(new File(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
if (tagName!= null) {
|
||||
poiPicList.add(new File(tagName));
|
||||
}
|
||||
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
if (tagInternal != null) {
|
||||
poiPicList.add(new File(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
if (tagElse != null) {
|
||||
poiPicList.add(new File(tagElse));
|
||||
}
|
||||
String tagCard = (String) ivCard.getTag();
|
||||
if (tagCard != null) {
|
||||
poiPicList.add(new File(tagCard));
|
||||
}
|
||||
poiUploadByNetWork(body,poiPicList);
|
||||
break;
|
||||
case R.id.tv_examine:
|
||||
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
|
||||
@ -511,67 +536,47 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
|
||||
private void poiUploadByNetWork(PoiEntity poiEntity) {
|
||||
poiUploadList = new ArrayList<>();
|
||||
File poiUploadFile1 = new File(takePhotoPath1);
|
||||
File poiUploadFile2 = new File(takePhotoPath2);
|
||||
File poiUploadFile3 = new File(takePhotoPath3);
|
||||
File poiUploadFile4 = new File(takePhotoPath4);
|
||||
File poiUploadFile5 = new File(takePhotoPath5);
|
||||
if (!poiUploadFile1.exists()||!poiUploadFile2.exists()||!poiUploadFile3.exists()||!poiUploadFile4.exists()||!poiUploadFile5.exists()){
|
||||
Toast.makeText(getActivity(), "照片不能为空", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
private void poiUploadByNetWork(int body, ArrayList<File> poiPicList) {
|
||||
if (body==0){
|
||||
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
|
||||
Log.e("TAG", "poiUploadByNetWork: "+body+poiPicList);
|
||||
return;
|
||||
}
|
||||
poiUploadList.add(poiUploadFile1);
|
||||
poiUploadList.add(poiUploadFile2);
|
||||
poiUploadList.add(poiUploadFile3);
|
||||
poiUploadList.add(poiUploadFile4);
|
||||
poiUploadList.add(poiUploadFile5);
|
||||
OkGo
|
||||
// 请求方式和请求url
|
||||
.<NameAuthenticationBean>post(HttpInterface.USER_AUTH_ADD)
|
||||
.<OtherUploadPicBean>post(HttpInterface.POI_TASK_UPLOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", poiEntity.getTaskId())
|
||||
.addFileParams("file",poiUploadList)
|
||||
.params("auditId", body)
|
||||
.addFileParams("file",poiPicList)
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<NameAuthenticationBean>(NameAuthenticationBean.class) {
|
||||
.execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
|
||||
@Override
|
||||
public void onSuccess(Response<NameAuthenticationBean> response) {
|
||||
public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + otherUploadPicBeanResponse.toString() + "sssssssssssss");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<NameAuthenticationBean> response) {
|
||||
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());
|
||||
Toast.makeText(getActivity(), response.code()+"", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.code()+"");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void poiSaveByNet(PoiEntity poiEntity) {
|
||||
showLoadingDialog();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
if (poiEntity.getTaskId() != 0) {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("taskId", poiEntity.getTaskId());
|
||||
}
|
||||
if (poiEntity.getName() != null && !poiEntity.getName().equals("")) {
|
||||
httpParams.put("name", poiEntity.getName());
|
||||
}
|
||||
if (poiEntity.getAddress() != null && !poiEntity.getAddress().equals("")) {
|
||||
httpParams.put("address", poiEntity.getAddress());
|
||||
}
|
||||
httpParams.put("existence", "1");
|
||||
if (poiEntity.getGeoWkt() !=null &&!poiEntity.getGeoWkt().equals("")) {
|
||||
httpParams.put("existence", poiEntity.getExistence());
|
||||
httpParams.put("geo", poiEntity.getGeoWkt());
|
||||
}
|
||||
if (poiEntity.getMemo() != null) {
|
||||
httpParams.put("memo", poiEntity.getMemo());
|
||||
}
|
||||
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.SUBMIT_POI_TASK)
|
||||
@ -582,7 +587,10 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
@Override
|
||||
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
|
||||
body = poiSaveBean.getBody();
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: "+poiSaveBean.getBody());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,4 +83,24 @@ public class HttpInterface {
|
||||
public static final String SUBMIT_POLYGON_TASK=IPm10+"submitPolygontask";//结束采集
|
||||
|
||||
|
||||
public static final String IPm11= "http://172.23.139.4:8003/othertask/1/";
|
||||
|
||||
//172.23.139.4:8003/othertask/1/uploadpic
|
||||
public static final String OTHER_TASK_UPLOAD_PIC=IPm11+"uploadpic";//其他-上传
|
||||
|
||||
|
||||
public static final String IPm12= "http://172.23.139.4:8003/ctask/1/";
|
||||
|
||||
//172.23.139.4:8003/ctask/1/receivedCtask/8608
|
||||
public static final String RECEIVED_CTASK=IPm12+"receivedCtask/8608";//充电站-领取任务
|
||||
|
||||
|
||||
//172.23.139.4:8003/ctask/1/submitCtask?id=8608&name=充电站&address=地址&telephone=18812345678|14712345678&geo=1rn7exd5uhxy&memo=测试备注&sptype=1
|
||||
public static final String SUBMIT_CTASK=IPm12+"submitCtask";//充电站-保存本地
|
||||
|
||||
public static final String IPm13= "http://172.23.139.4:8003/poitask/1/";
|
||||
|
||||
//172.23.139.4:8003/poitask/1/uploadpic
|
||||
public static final String POI_TASK_UPLOAD_PIC=IPm13+"uploadpic";//poi-上传
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 928 B |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 888 B |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 844 B |