接口联调,筛选,poi和其他保存的接口

This commit is contained in:
wds 2021-07-12 18:57:43 +08:00
parent 308373e9f4
commit 4d6212e6d0
12 changed files with 299 additions and 235 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
ndkVersion '23.0.7123448'
// ndkVersion '23.0.7123448'
defaultConfig {
applicationId "com.navinfo.outdoor"

View File

@ -1,6 +1,7 @@
package com.navinfo.outdoor.adapter;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -62,12 +63,25 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
}else {
holder.tvDistance.setText("距离:" +0);
}
//0.未领取 1.已领取2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功)4已上传结束采集,
if (poiEntity.getTaskStatus() == 0) {
holder.tvGit.setVisibility(View.GONE);
holder.tvSubmit.setVisibility(View.GONE);
holder.tvTaskStatus.setVisibility(View.GONE);
holder.tvTaskStatus.setText("未领取");
} else if (poiEntity.getTaskStatus() == 1) {
holder.tvSubmit.setVisibility(View.GONE);
holder.tvGit.setVisibility(View.VISIBLE);
holder.tvTaskStatus.setVisibility(View.VISIBLE);
holder.tvTaskStatus.setText("已领取");
holder.tvTaskStatus.setTextColor(Color.parseColor("#FFC107"));
}else if (poiEntity.getTaskStatus()==2){
holder.tvTaskStatus.setVisibility(View.VISIBLE);
holder.tvTaskStatus.setText("未保存");
holder.tvTaskStatus.setTextColor(Color.parseColor("#1CEF7B"));
}else if (poiEntity.getTaskStatus()==3){
holder.tvTaskStatus.setVisibility(View.VISIBLE);
holder.tvTaskStatus.setText("已保存");
holder.tvTaskStatus.setTextColor(Color.parseColor("#00BCD4"));
}else if (poiEntity.getTaskStatus()==4){
holder.tvTaskStatus.setVisibility(View.VISIBLE);
holder.tvTaskStatus.setText("已上传");
}
if (poiEntity.getType() == 1) {
holder.tvForm.setText("poi");
@ -110,7 +124,7 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView tvName, tvForm, tvTaskId, tvMoney, tvDistance, tvGit, tvSubmit;
TextView tvName, tvForm, tvTaskId, tvMoney, tvDistance, tvTaskStatus;
public ViewHolder(@NonNull View itemView) {
super(itemView);
@ -119,8 +133,7 @@ public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder
tvTaskId = itemView.findViewById(R.id.tv_task_id);
tvMoney = itemView.findViewById(R.id.tv_money);
tvDistance = itemView.findViewById(R.id.tv_distance);
tvGit = itemView.findViewById(R.id.tv_git);
tvSubmit = itemView.findViewById(R.id.tv_submit);
tvTaskStatus = itemView.findViewById(R.id.tv_task_status);
}
}

View File

@ -414,8 +414,8 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
});
break;
case R.id.cl_type:
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"全部", "已领取", "待提交", "未领取"}, new OnMenuItemClickListener() {
case R.id.cl_type://任务状态 0.未领取 1.已领取2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功)4已上传结束采集,
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"全部", "未领取", "已领取", "未保存","已保存"}, new OnMenuItemClickListener() {
@Override
public void onClick(String text, int index) {
tvType.setText(text);
@ -424,12 +424,15 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
Constant.TASK_STASTUS = -1;
break;
case 1:
Constant.TASK_STASTUS = 1;
Constant.TASK_STASTUS = 0;
break;
case 2:
Constant.TASK_STASTUS = 2;
Constant.TASK_STASTUS = 1;
break;
case 3:
Constant.TASK_STASTUS = 2;
break;
case 4:
Constant.TASK_STASTUS = 3;
break;
}

View File

@ -22,6 +22,7 @@ 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.InsertAndUpdateUtils;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
@ -42,6 +43,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
private PoiEntity poiEntity;
private PoiDao poiDao;
private ChargingPileDao chargingPileDao;
public static GatherGetFragment newInstance(Bundle bundle) {
GatherGetFragment fragment = new GatherGetFragment();
fragment.setArguments(bundle);
@ -157,7 +159,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
new Thread(new Runnable() {
@Override
public void run() {
poiDao.deletePoiEntity(poiEntity);
}
}).start();
}
@ -174,10 +176,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
//网络请求
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);
} else if (poiEntity.getType() == 2) {//充电站的领取类型
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), false);
} else if (poiEntity.getType() == 5) {//其他的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), false);
}
}
}
@ -197,10 +199,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
} else {
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);
} else if (poiEntity.getType() == 2) {//充电站的领取类型
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), true);
} else if (poiEntity.getType() == 5) {//其他的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), true);
}
btnFinishGather.setVisibility(View.VISIBLE);
btnGather.setVisibility(View.GONE);
@ -218,7 +220,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
new Thread(new Runnable() {
@Override
public void run() {
poiDao.deletePoiEntity(poiEntity);
}
}).start();
@ -251,6 +253,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
chargingListEntity.setAddress(listBean.getAddress());
chargingListEntity.setTelPhone(listBean.getTelephone() + "");
chargingListEntity.setType(Integer.valueOf(listBean.getType()));
chargingListEntity.setTaskStatus(1);
chargingListEntity.setIsLocalData(1);
String geo = listBean.getGeo();
chargingListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
@ -511,6 +515,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setTelPhone(listBean.getTelephone() + "");
poiListEntity.setType(Integer.valueOf(listBean.getType()));
poiListEntity.setTaskStatus(1);
poiListEntity.setIsLocalData(1);
String geo = listBean.getGeo();
poiListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
@ -530,7 +536,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
new Thread(new Runnable() {
@Override
public void run() {
poiDao.insertPoiEntity(poiListEntity);
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
@ -551,6 +558,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
public void onError(Throwable e, int id) {
dismissLoadingDialog();
Log.d("TAG", "onError: " + e.getMessage());
Toast.makeText(getContext(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
}
}).build();
}

View File

@ -49,6 +49,7 @@ 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.InsertAndUpdateUtils;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
@ -364,16 +365,16 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
new Thread(new Runnable() {
@Override
public void run() {
poiDao.insertPoiEntity(poiEntity);
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
otherSaveByNetWork(poiEntity);
}
});
}
}).start();
// onBackPressed();
} else {
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
@ -401,28 +402,22 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
if (tagPictures != null) {
otherUploadList.add(new File(tagPictures));
}
if (body!=0){
otherUploadByNet(body, otherUploadList);
}else {
new Thread(new Runnable() {
@Override
public void run() {
if (showPoiEntity.getId()!=0){
PoiEntity poiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
int taskStatus = poiEntity.getTaskStatus();
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (taskStatus == 2) {//保存本地未提交
Toast.makeText(getActivity(), "请保存本地", Toast.LENGTH_SHORT).show();
} else if (taskStatus == 3) {//保存本地已提交
otherUploadByNet(body, otherUploadList);
}
otherUploadByNet(poiDaoPoiEntity.getBodyId(), otherUploadList);
}
});
}else {
Toast.makeText(getActivity(), "请保存本地", Toast.LENGTH_SHORT).show();
}
}
}).start();
}
break;
}
}
@ -446,13 +441,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
dismissLoadingDialog();
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
// new Thread(new Runnable() {
// @Override
// public void run() {
// PoiEntity poiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
// poiDao.deletePoiEntity(poiEntity);
// }
// }).start();
}
@Override
@ -486,17 +474,22 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
@Override
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
dismissLoadingDialog();
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
body = poiSaveBean.getBody();
poiEntity.setTaskStatus(3);
poiEntity.setBodyId(body);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
poiDao.insertPoiEntity(poiEntity);
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onSuccess: " + poiSaveBean.getBody());
}
});
}
}).start();
// Log.d("TAG", " 其他其他其他其他" + poiSaveBean.getBody());
}
@Override

View File

@ -56,6 +56,7 @@ 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.InsertAndUpdateUtils;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
@ -73,7 +74,12 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import static android.app.Activity.RESULT_OK;
@ -280,6 +286,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
private void initShowPoi() {
// 添加信息
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
if (showPoiEntity != null) {
String name = showPoiEntity.getName();//名称
if (name != null && !name.equals("")) {
editNameContent.setText(name + "");
@ -303,7 +310,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
if (telPhone != null && !telPhone.equals("")) {
phoneData.add(showPoiEntity.getTelPhone());
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
} else {
poiBeans.add(new PoiBean("电话*", "", R.drawable.icon_add_bg));
}
@ -330,10 +336,12 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
ivElse.setTag(photo);
}
}
}
} else {
poiBeans.add(new PoiBean("电话*", "", R.drawable.icon_add_bg));
poiRecycleAdapter.setList(poiBeans);
}
}
@ -459,10 +467,16 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
new Thread(new Runnable() {
@Override
public void run() {
poiDao.insertPoiEntity(poiEntity);
//
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiSaveByNet(poiEntity);
}
});
}
}).start();
poiSaveByNet(poiEntity);
// onBackPressed();
} else {
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
@ -507,7 +521,23 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
if (tagCard != null) {
poiPicList.add(new File(tagCard));
}
if (body!=null){
poiUploadByNetWork(body, poiPicList);
}else {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiUploadByNetWork(poiDaoPoiEntity.getBodyId(), poiPicList);
}
});
}
}).start();
}
break;
case R.id.tv_examine:
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
@ -532,7 +562,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentElse, 105);
break;
}
}
@ -555,7 +584,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
dismissLoadingDialog();
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onSuccess: " + otherUploadPicBeanResponse.toString() + "sssssssssssss");
}
@Override
@ -588,9 +616,23 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
dismissLoadingDialog();
body = poiSaveBean.getBody();
poiEntity.setBodyId(body);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onSuccess: " + poiSaveBean.getBody());
}
});
}
}).start();
}
@Override
public void onError(Throwable e, int id) {
@ -613,7 +655,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
//获取Editor对象
SharedPreferences.Editor edit = poi.edit();
//根据要保存的数据的类型调用对应的put方法,
PoiEntity poiEntity = showPoiEntity;
ArrayList<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称
@ -660,7 +701,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
}
poiEntity.setPhotoInfo(infoPhoto);
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
@ -702,7 +742,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
ivPanorama.setTag(takePhotoPath1);
ivPanorama.setImageBitmap(bitmap);//显示图像
}
} else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
@ -722,9 +761,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b");
ivName.setTag(takePhotoPath2);
ivName.setImageBitmap(bitmap);//显示图像
}
} else if (requestCode == 103 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像

View File

@ -284,7 +284,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) {
if (taskStatus == 1 || taskStatus == 2 || taskStatus == 3 || taskStatus == 4) {
Message obtain = Message.obtain();
obtain.what = Constant.JOB_SEARCH_WORD;
obtain.obj = null;
@ -460,14 +460,6 @@ 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 == 3) {
showAllPoi.clear();
Message obtain = Message.obtain();
obtain.what = Constant.JOB_SEARCH_POI_WORD;
obtain.obj = showAllPoi;
EventBus.getDefault().post(obtain);
return;
}
new Thread(new Runnable() {
@Override
public void run() {
@ -671,7 +663,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
fragmentTransaction = supportFragmentManager.beginTransaction();
Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity);
bundle.putInt("aInt", 1);
gatherGetFragment = GatherGetFragment.newInstance(bundle);
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
fragmentTransaction.commit();
@ -708,6 +699,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
PoiEntity poiEntity = (PoiEntity) data.obj;
Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity);
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
switch (poiEntity.getType()) {
case 1:
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
@ -813,7 +805,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
removablesLocality.get(i).remove();
}
removablesLocality.clear();
initThread();// 查询本地数据库
initList(Constant.currentLocation);//网络数据
}
@ -866,6 +857,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
});
}
private void initPileMarker(LatLng latLng) {
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
latLng, //中心点坐标地图目标经纬度
@ -904,7 +896,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
/**
*
* 设置定位图标样式
*/
private void setLocMarkerStyle() {
@ -982,8 +973,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
@Override
public void onDestroy() {
super.onDestroy();
if (treasureMap!=null) {
treasureMap.onDestroy();
if (markerPoi != null) {
markerPoi.remove();
}
if (markerPoi != null) {
markerPoi.remove();
@ -1041,25 +1033,32 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
switch (index) {
case 0:
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint));
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_have_bg);
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiDescriptor));
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
showSlidingFragment(poiFragment);
break;
case 1:
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiVideoDescriptor));
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(new Bundle());
showSlidingFragment(poiVideoFragment);
break;
case 2:
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_have_bg);
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(roadDescriptor));
RoadFragment roadFragment = RoadFragment.newInstance(new Bundle());
showSlidingFragment(roadFragment);
break;
case 3:
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint));
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_have_bg);
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(chargeDescriptor));
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
showSlidingFragment(chargingStationFragment);
break;
case 4:
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint));
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bg);
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(otherDescriptor));
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(otherFragment);
break;

View File

@ -52,13 +52,13 @@ public class HttpInterface {
public static final String IPm6 = "http://172.23.139.4:8003/othertask/1/";
//172.23.139.4:8003/othertask/1/receivedOthertask/5001
public static final String RECEIVED_OTHER_TASK = IPm6 + "receivedOthertask/5001";//其他-领取任务
public static final String RECEIVED_OTHER_TASK = IPm6 + "receivedOthertask";//其他-领取任务
public static final String IPm7 = "http://172.23.139.4:8003/poitask/1/";
//172.23.139.4:8003/poitask/1/receivedPoitask/1
public static final String RECEIVED_POI_TASK = IPm7 + "receivedPoitask/1";//poi-领取任务
public static final String RECEIVED_POI_TASK = IPm7 + "receivedPoitask";//poi-领取任务
public static final String IPm8 = "http://172.23.139.4:8003/poitask/1/";

View File

@ -0,0 +1,29 @@
package com.navinfo.outdoor.room;
import android.content.Context;
import androidx.room.Database;
/**
* 数据库插入
*/
public class InsertAndUpdateUtils {
private static InsertAndUpdateUtils instance;
public static InsertAndUpdateUtils getInstance() {
if (instance == null) {
instance = new InsertAndUpdateUtils();
}
return instance;
}
public long[] insertOrUpdate(Context mContext,PoiEntity... entities) {
long[] ids = PoiDatabase.getInstance(mContext).getPoiDao().insertPoiEntity(entities);
if (ids!=null) {
for (int i = 0; i < entities.length&&i<ids.length; i++) {
entities[i].setId(ids[i]);
}
}
return ids;
}
}

View File

@ -32,14 +32,17 @@ public interface PoiDao {
@Query("SELECT * FROM poi where id=:id")
PoiEntity getPoiEntity(int id);
PoiEntity getPoiEntity(long id);
@Query("SELECT * FROM poi where taskId=:taskId")
PoiEntity getTaskIdPoiEntity(int taskId);
/**
* 添加
*
* @param poiEntities
*/
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertPoiEntity(PoiEntity... poiEntities);
long[] insertPoiEntity(PoiEntity... poiEntities);
/**
* 更新
@ -82,9 +85,6 @@ public interface PoiDao {
@Query("DELETE FROM poi where taskId=:taskId")
void deleteFormTaskID(int taskId);
@Query("DELETE FROM poi where id =:id")
void deleteFormID(int id);
/**
* 全部删除
*/

View File

@ -16,7 +16,7 @@ import java.util.List;
@Entity(tableName = "poi")
public class PoiEntity implements Serializable {
@PrimaryKey(autoGenerate = true) // 设置主键并且自动生长
private int id;
private long id;
private int pid; //采集id 保存本地或提交数据时时返回
private int taskId;//任务id
private int userId;//用户id
@ -31,16 +31,6 @@ public class PoiEntity implements Serializable {
private String extend;//添加字段
private boolean checked;
private String geoWkt; // 数据的wkt
private int bodyId;//保存本地的bodyId
public int getBodyId() {
return bodyId;
}
public void setBodyId(int bodyId) {
this.bodyId = bodyId;
}
public String getGeoWkt() {
return geoWkt;
}
@ -78,6 +68,15 @@ public class PoiEntity implements Serializable {
private int station_type;//1."全部"2 "POI"3 "充电站"4 "POI录像"5 "道路录像", "门牌:6 公交:7 情报:8
private int isLocalData;//是否是本地数据 0,服务 1,本地
private int isExclusive;//任务类型 0.普通任务1.专属任务
private int bodyId;//保存本地的bodyId
public int getBodyId() {
return bodyId;
}
public void setBodyId(int bodyId) {
this.bodyId = bodyId;
}
public int getIsExclusive() {
return isExclusive;
@ -127,11 +126,11 @@ public class PoiEntity implements Serializable {
this.taskStatus = taskStatus;
}
public int getId() {
public long getId() {
return id;
}
public void setId(int id) {
public void setId(long id) {
this.id = id;
}

View File

@ -14,7 +14,7 @@
android:text="测试彼此"
android:textColor="#333"
android:textSize="18sp"
android:maxLength="15"
android:maxLength="10"
android:lines="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -33,30 +33,13 @@
app:layout_constraintStart_toEndOf="@+id/tv_name"
app:layout_constraintTop_toTopOf="@+id/tv_name" />
<TextView
android:id="@+id/tv_git"
android:id="@+id/tv_task_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="已领取"
android:padding="5dp"
android:textColor="#FFC107"
android:background="@drawable/underline"
android:textSize="15sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/tv_form"
app:layout_constraintStart_toEndOf="@+id/tv_form"
app:layout_constraintTop_toTopOf="@+id/tv_form" />
<TextView
android:id="@+id/tv_submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="待提交"
android:padding="5dp"
android:textColor="#1CEF7B"
android:background="@drawable/underline"
android:textSize="15sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/tv_form"
app:layout_constraintStart_toEndOf="@+id/tv_form"
app:layout_constraintTop_toTopOf="@+id/tv_form" />