修改面状任务的网络请求和上报
This commit is contained in:
parent
3675cfb39e
commit
bc5b9db502
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion '29.0.2'
|
||||
ndkVersion '23.0.7123448'
|
||||
// ndkVersion '21.1.6352462'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.navinfo.outdoor"
|
||||
|
@ -45,7 +45,8 @@ public class Constant {
|
||||
|
||||
//message word 值
|
||||
public static final int TREASURE_FRAGMENT = 100;//抽屉界面的展示和隐藏
|
||||
public static final int TREASURE_WORD = 0;//poi 对地图页面marker 的一个展示
|
||||
public static final int TREASURE_WORD = 0;//poi 对地图页面marker 的一个展示 编辑
|
||||
public static final int TREASURE_CHECKED_WORD = 40;//poi 对地图页面marker 的一个展示 确定
|
||||
public static final int CAPACITY_EVALUATION_PAGE = 1;//能力测评的页数
|
||||
public static final int POI_WORD = 2;//地图页面marker 的经纬都回传
|
||||
public static final int FILTER_LIST = 4;//筛选列表所有数据地图显示
|
||||
@ -56,13 +57,16 @@ public class Constant {
|
||||
public static final int MAIN_HEADER = 9; // 控制主界面各个header
|
||||
public static final int MAIN_REMOVE = 10; // 控制主界面各个header移除
|
||||
public static final int GATHER_GET_RETURN = 11;//参加领取的返回
|
||||
public static final int MAIN_CHARGING_STATION = 13;//充电站的Fragment 对地图页面marker 的一个展示
|
||||
public static final int MAIN_CHARGING_STATION = 13;//充电站的Fragment 对地图页面marker 的一个展示 编辑
|
||||
public static final int MAIN_CHARGING_CHECKED_STATION = 43;//充电站的Fragment 对地图页面marker 的一个展示 确定
|
||||
public static final int CHARGING_STATION_WORD = 15;//地图页面marker 的经纬都回传
|
||||
public static final int CHARGING_STATION = 16;//跳转到充电桩
|
||||
public static final int MAIN_CHARGING_PILE = 18;//充电桩的Fragment 对地图页面marker 的一个展示
|
||||
public static final int MAIN_CHARGING_PILE = 18;//充电桩的Fragment 对地图页面marker 的一个展示 编辑
|
||||
public static final int MAIN_CHARGING_CHECKED_PILE = 49;//充电桩的Fragment 对地图页面marker 的一个展示 确定
|
||||
public static final int CHARGING_PILE_WORD = 20;//地图页面marker 的经纬都回传
|
||||
public static final int CHARGING_PILE_STATION = 22;//将充电桩的数据回传给充电站
|
||||
public static final int MAIN_OTHER = 23;//其他的Fragment 对地图页面marker 的一个展示
|
||||
public static final int MAIN_OTHER = 23;//其他的Fragment 对地图页面marker 的一个展示 编辑
|
||||
public static final int MAIN_CHECKED_OTHER = 24;//其他的Fragment 对地图页面marker 的一个展示 确定
|
||||
public static final int OTHER_WORD = 25;//地图页面marker 的经纬都回传
|
||||
public static final int CHARGING_STATION_PILE = 26;//跳转到充电桩 传给数据
|
||||
public static final int JOB_SEARCH_WORD = 28;//任务搜索的网络数据
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
public class Info {
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Info implements Serializable {
|
||||
/**
|
||||
* photo :
|
||||
* x :
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,8 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
/**
|
||||
*普通任务
|
||||
*/
|
||||
public class ReceivedPoiBean {
|
||||
|
||||
private Integer code;
|
||||
|
@ -0,0 +1,42 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
/**
|
||||
* 面状任务-结束领取
|
||||
* 面妆任务-立即采集
|
||||
* 面妆任务-结束采集
|
||||
*/
|
||||
public class UnPolygonTaskBean {
|
||||
/**
|
||||
* code : 200
|
||||
* message : 成功
|
||||
* body : 1
|
||||
*/
|
||||
|
||||
private int code;
|
||||
private String message;
|
||||
private int body;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(int body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
@ -152,10 +152,17 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
checkBoxLife.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHARGING_PILE;
|
||||
obtain.obj = isChecked;
|
||||
EventBus.getDefault().post(obtain);
|
||||
if (isChecked){
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHARGING_PILE;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}else {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHARGING_CHECKED_PILE;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
}
|
||||
});
|
||||
checkBoxRight.setVisibility(View.GONE);
|
||||
|
@ -50,6 +50,7 @@ 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.PhotoPathUtil;
|
||||
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
@ -90,7 +91,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private String phone = null;
|
||||
private Spinner spinnerType;
|
||||
String[] ctype = new String[]{"全部", "poi", "充电站", "POI录像", "道路录像"};//1."全部"2 "POI"3 "充电站"4 "POI录像"5 "道路录像",
|
||||
String[] spinner = new String[]{"存在","不存在","无法验证"};
|
||||
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||
private ArrayAdapter<String> adapter;
|
||||
private LinearLayout linearChargingPile;
|
||||
private RecyclerView recyclerStation;
|
||||
@ -200,10 +201,18 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
checkBoxLife.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHARGING_STATION;
|
||||
obtain.obj = isChecked;
|
||||
EventBus.getDefault().post(obtain);
|
||||
if (isChecked) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHARGING_STATION;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHARGING_CHECKED_STATION;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
checkBoxRight.setVisibility(View.GONE);
|
||||
@ -332,84 +341,82 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private void initShowPoi() {
|
||||
// 添加信息:
|
||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||
if (showPoiEntity != null) {
|
||||
String name = showPoiEntity.getName();//名称
|
||||
if (name != null &&!name.equals("")) {
|
||||
editNameContent.setText(name + "");
|
||||
}
|
||||
String address = showPoiEntity.getAddress();//地址
|
||||
if (address != null&&! address.equals("")) {
|
||||
editSiteContent.setText(address);
|
||||
}
|
||||
String x = showPoiEntity.getX();
|
||||
String y = showPoiEntity.getY();
|
||||
if (x != null && y != null) {
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(Double.parseDouble(y));
|
||||
latLng.setLongitude(Double.parseDouble(x));
|
||||
}
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null&&!describe.equals("")) {
|
||||
editDescribe.setText(describe);
|
||||
}
|
||||
int station_type = showPoiEntity.getStation_type();
|
||||
spinnerType.setSelection(station_type,true);
|
||||
String telPhone = showPoiEntity.getTelPhone();
|
||||
if (telPhone != null&&!telPhone.equals("")) {
|
||||
phoneData.add(showPoiEntity.getTelPhone());
|
||||
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
||||
poiRecycleAdapter.setList(poiBeans);
|
||||
}
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
if (showPoiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||
String[] split = photo.split("/");
|
||||
if (split[split.length - 1].startsWith("a")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||
ivPanorama.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("b")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivName);
|
||||
ivName.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("c")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||
ivInternal.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("d")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||
ivElse.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("e")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivScutcheon);
|
||||
ivScutcheon.setTag(photo);
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<ChargingPileEntity> chargingPile = chargingPileDao.getChargingPile();
|
||||
for (int i = 0; i < chargingPile.size(); i++) {
|
||||
ChargingPileEntity chargingPileEntity = chargingPile.get(i);
|
||||
if (showPoiEntity.getTaskId() == chargingPileEntity.getFid()) {
|
||||
chargingPileEntities.add(chargingPileEntity);
|
||||
}
|
||||
}
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
chargingPileAdapter.setChargingPileEntities(chargingPileEntities);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).start();
|
||||
|
||||
} else {
|
||||
poiBeans.add(new PoiBean("电话*", phone, R.drawable.icon_add_bg));
|
||||
poiRecycleAdapter.setList(poiBeans);
|
||||
String name = showPoiEntity.getName();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
editNameContent.setText(name + "");
|
||||
}
|
||||
String address = showPoiEntity.getAddress();//地址
|
||||
if (address != null && !address.equals("")) {
|
||||
editSiteContent.setText(address);
|
||||
}
|
||||
String x = showPoiEntity.getX();
|
||||
String y = showPoiEntity.getY();
|
||||
if (x != null && y != null) {
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(Double.parseDouble(y));
|
||||
latLng.setLongitude(Double.parseDouble(x));
|
||||
}
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
editDescribe.setText(describe);
|
||||
}
|
||||
int station_type = showPoiEntity.getStation_type();
|
||||
spinnerType.setSelection(station_type, true);
|
||||
String telPhone = showPoiEntity.getTelPhone();
|
||||
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));
|
||||
}
|
||||
poiRecycleAdapter.setList(poiBeans);
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
if (showPoiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||
String[] split = photo.split("/");
|
||||
if (split[split.length - 1].startsWith("a")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||
ivPanorama.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("b")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivName);
|
||||
ivName.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("c")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||
ivInternal.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("d")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||
ivElse.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("e")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivScutcheon);
|
||||
ivScutcheon.setTag(photo);
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<ChargingPileEntity> chargingPile = chargingPileDao.getChargingPile();
|
||||
for (int i = 0; i < chargingPile.size(); i++) {
|
||||
ChargingPileEntity chargingPileEntity = chargingPile.get(i);
|
||||
if (showPoiEntity.getTaskId() == chargingPileEntity.getFid()) {
|
||||
chargingPileEntities.add(chargingPileEntity);
|
||||
}
|
||||
}
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
chargingPileAdapter.setChargingPileEntities(chargingPileEntities);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).start();
|
||||
if (showPoiEntity.getTaskId()!=0){
|
||||
initPile();
|
||||
}
|
||||
initPile();
|
||||
}
|
||||
|
||||
private void initPile() {
|
||||
@ -497,7 +504,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//保存数据库:
|
||||
PoiEntity poiEntity = new PoiEntity();
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
List<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
@ -517,6 +524,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude,latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
@ -578,11 +587,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
} else {
|
||||
aBoolean = false;
|
||||
}
|
||||
if (showPoiEntity!=null){
|
||||
if (showPoiEntity.getTaskId()!=0){
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
@ -594,13 +598,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<PoiEntity> allPoi = poiDao.getAllPoi();
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setTaskId(allPoi.size() + 1);
|
||||
}
|
||||
});
|
||||
poiDao.insertPoiEntity(poiEntity);
|
||||
}
|
||||
}).start();
|
||||
@ -661,7 +658,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
|
||||
private String initShowStation() {
|
||||
PoiEntity poiEntity = new PoiEntity();
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
List<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
@ -683,27 +680,27 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
poiEntity.setTelPhone(phoneData.get(0));
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama != null&&!tagPanorama.equals("")) {
|
||||
if (tagPanorama != null && !tagPanorama.equals("")) {
|
||||
infoPhoto.add(new Info(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
if (tagName != null&&!tagName.equals("")) {
|
||||
if (tagName != null && !tagName.equals("")) {
|
||||
infoPhoto.add(new Info(tagName));
|
||||
}
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
if (tagInternal != null&&!tagInternal.equals("")) {
|
||||
if (tagInternal != null && !tagInternal.equals("")) {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
if (tagElse != null&&!tagElse.equals("")) {
|
||||
if (tagElse != null && !tagElse.equals("")) {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||
if (tagScutcheon != null&&!tagScutcheon.equals("")) {
|
||||
if (tagScutcheon != null && !tagScutcheon.equals("")) {
|
||||
infoPhoto.add(new Info(tagScutcheon));
|
||||
}
|
||||
if (showPoiEntity!=null){
|
||||
if (showPoiEntity.getTaskId()!=0){
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
@ -717,18 +714,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
poiEntity.setType(2);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
/* new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<PoiEntity> allPoi = poiDao.getAllPoi();
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setTaskId(allPoi.size() + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();*/
|
||||
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||
return newPoiEntity;
|
||||
}
|
||||
@ -752,7 +737,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
SharedPreferences.Editor edit = poi.edit();
|
||||
//根据要保存的数据的类型,调用对应的put方法,
|
||||
|
||||
PoiEntity poiEntity = new PoiEntity();
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
List<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
@ -774,27 +759,27 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
poiEntity.setTelPhone(phoneData.get(0));
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama != null&&!tagPanorama.equals("")) {
|
||||
if (tagPanorama != null && !tagPanorama.equals("")) {
|
||||
infoPhoto.add(new Info(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
if (tagName != null&&!tagName.equals("")) {
|
||||
if (tagName != null && !tagName.equals("")) {
|
||||
infoPhoto.add(new Info(tagName));
|
||||
}
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
if (tagInternal != null&&!tagInternal.equals("")) {
|
||||
if (tagInternal != null && !tagInternal.equals("")) {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
if (tagElse != null&&!tagElse.equals("")) {
|
||||
if (tagElse != null && !tagElse.equals("")) {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||
if (tagScutcheon != null&&!tagScutcheon.equals("")) {
|
||||
if (tagScutcheon != null && !tagScutcheon.equals("")) {
|
||||
infoPhoto.add(new Info(tagScutcheon));
|
||||
}
|
||||
if (showPoiEntity!=null){
|
||||
if (showPoiEntity.getTaskId()!=0){
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
@ -808,18 +793,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
poiEntity.setType(2);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
/* new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<PoiEntity> allPoi = poiDao.getAllPoi();
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setTaskId(allPoi.size() + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();*/
|
||||
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||
//以键值对的形式添加新值。
|
||||
edit.putString("poiEntity", newPoiEntity);
|
||||
|
@ -176,10 +176,12 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.JOB_SEARCH_WORD) {
|
||||
if (data.what == Constant.JOB_SEARCH_POI_WORD) {
|
||||
allPoi = (List<PoiEntity>) data.obj;
|
||||
} else if (data.what == Constant.JOB_SEARCH_WORD) {
|
||||
poiEntities.clear();
|
||||
JobSearchBean jobSearchBean = (JobSearchBean) data.obj;
|
||||
if (jobSearchBean!=null){
|
||||
if (jobSearchBean != null) {
|
||||
List<JobSearchBean.BodyBean.ListBean> list = jobSearchBean.getBody().getList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
PoiEntity poiEntity = new PoiEntity();
|
||||
@ -203,13 +205,11 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
poiEntities.add(poiEntity);
|
||||
}
|
||||
}
|
||||
if (allPoi!=null){
|
||||
if (allPoi != null) {
|
||||
poiEntities.addAll(allPoi);
|
||||
}
|
||||
filterAdapter.setAllPoi(poiEntities);
|
||||
|
||||
} else if (data.what == Constant.JOB_SEARCH_POI_WORD) {
|
||||
allPoi = (List<PoiEntity>) data.obj;
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,15 +222,47 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
clNumber = findViewById(R.id.cl_number);
|
||||
clNumber.setOnClickListener(this::onClick);
|
||||
tvNumber = findViewById(R.id.tv_number);
|
||||
tvNumber.setText(Constant.NUMBER+"");
|
||||
clPhotograph = findViewById(R.id.cl_photograph);
|
||||
clPhotograph.setOnClickListener(this::onClick);
|
||||
tvPhotograph = findViewById(R.id.tv_photograph);
|
||||
if (Constant.LIMIT_TTPE == -1) {//"全部", "普通任务", "专属任务"
|
||||
tvPhotograph.setText("全部");
|
||||
} else if (Constant.LIMIT_TTPE == 0) {
|
||||
tvPhotograph.setText("普通任务");
|
||||
} else if (Constant.LIMIT_TTPE == 1) {
|
||||
tvPhotograph.setText("专属任务");
|
||||
}
|
||||
clExclusive = findViewById(R.id.cl_exclusive);
|
||||
clExclusive.setOnClickListener(this::onClick);
|
||||
tvExclusive = findViewById(R.id.tv_exclusive);
|
||||
if (Constant.TASK_TYPE == -1) {//"全部", "poi", "充电站", "POI录像", "道路录像", "其他", "面状任务"
|
||||
tvExclusive.setText("全部");
|
||||
} else if (Constant.TASK_TYPE == 1) {
|
||||
tvExclusive.setText("poi");
|
||||
} else if (Constant.TASK_TYPE == 2) {
|
||||
tvExclusive.setText("充电站");
|
||||
} else if (Constant.TASK_TYPE == 3) {
|
||||
tvExclusive.setText("POI录像");
|
||||
} else if (Constant.TASK_TYPE == 4) {
|
||||
tvExclusive.setText("道路录像");
|
||||
} else if (Constant.TASK_TYPE == 5) {
|
||||
tvExclusive.setText("其他");
|
||||
} else if (Constant.TASK_TYPE == 6) {
|
||||
tvExclusive.setText("面状任务");
|
||||
}
|
||||
clType = findViewById(R.id.cl_type);
|
||||
clType.setOnClickListener(this::onClick);
|
||||
tvType = findViewById(R.id.tv_type);
|
||||
if (Constant.TASK_STASTUS == -1) {
|
||||
tvType.setText("全部");
|
||||
} else if (Constant.TASK_STASTUS == 1) {
|
||||
tvType.setText("已领取");
|
||||
} else if (Constant.TASK_STASTUS == 2) {
|
||||
tvType.setText("待提交");
|
||||
} else if (Constant.TASK_STASTUS == 3) {
|
||||
tvType.setText("未领取");
|
||||
}
|
||||
btnFilter = findViewById(R.id.btn_filter);
|
||||
btnFilter.setOnClickListener(this::onClick);
|
||||
recyclerFilter = findViewById(R.id.recycler_filter);
|
||||
@ -258,12 +290,12 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() {
|
||||
@Override
|
||||
public void item(PoiEntity poiEntity, boolean aBoolean) {
|
||||
if (aBoolean) {
|
||||
if (aBoolean) {//本地
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.GATHER_GET;
|
||||
obtain.obj = poiEntity;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
} else {//服务
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.FILTER_LIST_ITEM;
|
||||
obtain.obj = poiEntity;
|
||||
|
@ -7,11 +7,15 @@ import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
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.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;
|
||||
@ -24,6 +28,8 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 领取采集的fragment
|
||||
*/
|
||||
@ -34,17 +40,20 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
private PoiDao poiDao;
|
||||
private PoiEntity poiListEntity;
|
||||
private int aSave;
|
||||
private PoiEntity polygonEntity;
|
||||
|
||||
public static GatherGetFragment newInstance(Bundle bundle) {
|
||||
GatherGetFragment fragment = new GatherGetFragment();
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getFocus();
|
||||
}
|
||||
|
||||
//主界面获取焦点
|
||||
private void getFocus() {
|
||||
getView().setFocusableInTouchMode(true);
|
||||
@ -64,10 +73,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.fragment_gather_get;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
@ -87,152 +98,319 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
btnFinishGather = findViewById(R.id.btn_finish_gather);//结束采集
|
||||
btnFinishGather.setOnClickListener(this::onClick);
|
||||
Bundle arguments = getArguments();
|
||||
if (arguments != null) {
|
||||
if (arguments != null) {//poiEntity
|
||||
poiEntity = (PoiEntity) arguments.getSerializable("poiEntity");
|
||||
aSave = arguments.getInt("aSave", 0);
|
||||
if (aSave == 1) {//普通任务
|
||||
if (poiEntity != null) {
|
||||
tvTitle.setText(poiEntity.getName());
|
||||
if (poiEntity.getPrecision() == null) {
|
||||
tvMoney.setText("¥" + 0);
|
||||
} else {
|
||||
tvMoney.setText("¥" + poiEntity.getPrecision());
|
||||
}
|
||||
tvTime.setText("到期时间:" + poiEntity.getCreateTime());
|
||||
tvDescribe.setText("任务描述:" + poiEntity.getDescribe());
|
||||
if (poiEntity.getDist() != null) {
|
||||
tvDistance.setText("距离:" + format5(Double.valueOf(poiEntity.getDist()) / 1000) + "km");
|
||||
}
|
||||
if (poiEntity != null) {
|
||||
tvTitle.setText(poiEntity.getName());
|
||||
if (poiEntity.getPrecision() == null) {
|
||||
tvMoney.setText("¥" + 0);
|
||||
} else {
|
||||
tvMoney.setText("¥" + poiEntity.getPrecision());
|
||||
}
|
||||
int taskStatus = poiEntity.getTaskStatus();
|
||||
switch (taskStatus) {
|
||||
case 0://未领取
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
btnGetTask.setVisibility(View.VISIBLE);
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
break;
|
||||
case 1://已领取
|
||||
btnCancelGet.setVisibility(View.VISIBLE);
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
break;
|
||||
case 2://已保存
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case 3://已提交
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnGather.setVisibility(View.GONE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
} else if (aSave == 2) {//面妆任务
|
||||
if (poiEntity != null) {
|
||||
tvTitle.setText(poiEntity.getName());
|
||||
if (poiEntity.getPrecision() == null) {
|
||||
tvMoney.setText("¥" + 0);
|
||||
} else {
|
||||
tvMoney.setText("¥" + poiEntity.getPrecision());
|
||||
}
|
||||
tvTime.setText("到期时间:" + poiEntity.getCreateTime());
|
||||
tvDescribe.setText("任务描述:" + poiEntity.getDescribe());
|
||||
if (poiEntity.getDist() != null) {
|
||||
tvDistance.setText("距离:" + format5(Double.valueOf(poiEntity.getDist())/1000) + "km");
|
||||
}
|
||||
}
|
||||
int taskStatus = poiEntity.getTaskStatus();
|
||||
switch (taskStatus) {
|
||||
case 0://未领取
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
btnGetTask.setVisibility(View.VISIBLE);
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
break;
|
||||
|
||||
case 1://已领取
|
||||
btnCancelGet.setVisibility(View.VISIBLE);
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
break;
|
||||
|
||||
case 2://已保存
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
|
||||
case 3://已提交
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnGather.setVisibility(View.GONE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
break;
|
||||
|
||||
tvTime.setText("到期时间:" + poiEntity.getCreateTime());
|
||||
tvDescribe.setText("任务描述:" + poiEntity.getDescribe());
|
||||
if (poiEntity.getDist() != null) {
|
||||
tvDistance.setText("距离:" + format5(Double.valueOf(poiEntity.getDist()) / 1000) + "km");
|
||||
}
|
||||
}
|
||||
int taskStatus = poiEntity.getTaskStatus();
|
||||
switch (taskStatus) {
|
||||
case 0://未领取
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
btnGetTask.setVisibility(View.VISIBLE);
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
break;
|
||||
case 1://已领取
|
||||
btnCancelGet.setVisibility(View.VISIBLE);
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
break;
|
||||
case 2://已保存
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case 3://已提交
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnGather.setVisibility(View.GONE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.btn_cancel_get://结束领取
|
||||
poiEntity.setTaskStatus(0);
|
||||
btnGetTask.setVisibility(View.VISIBLE);
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (poiListEntity!=null){
|
||||
poiDao.deletePoiEntity(poiListEntity);
|
||||
}else {
|
||||
poiDao.deletePoiEntity(poiEntity);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
break;
|
||||
case R.id.btn_get_task://领取任务
|
||||
poiEntity.setTaskStatus(1);
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnCancelGet.setVisibility(View.VISIBLE);
|
||||
//网络请求:
|
||||
if (poiEntity != null) {
|
||||
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);
|
||||
int type = poiEntity.getType();
|
||||
if (type == 6) {
|
||||
initUnPolygonTask(HttpInterface.UNRECEIVED_POLYGON_TASK, poiEntity.getTaskId());
|
||||
} else {
|
||||
poiEntity.setTaskStatus(0);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (poiListEntity != null) {
|
||||
poiDao.deletePoiEntity(poiListEntity);
|
||||
} else {
|
||||
poiDao.deletePoiEntity(poiEntity);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case R.id.btn_gather://立即采集
|
||||
if (poiEntity != null) {
|
||||
case R.id.btn_get_task://领取任务
|
||||
if (poiEntity != null) {
|
||||
int type = poiEntity.getType();
|
||||
if (type == 6) {
|
||||
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() + "", true);
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK + "/" + poiEntity.getTaskId() + "", false);
|
||||
} else if (poiEntity.getType() == 5) {//其他
|
||||
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK + "/" + poiEntity.getTaskId() + "", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case R.id.btn_gather://立即采集
|
||||
if (poiEntity!=null){
|
||||
int type = poiEntity.getType();
|
||||
if (type==6){
|
||||
int taskStatus = poiEntity.getTaskStatus();
|
||||
if (taskStatus != 1) {
|
||||
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(),true);
|
||||
}else {
|
||||
initCompleteTask(HttpInterface.COMPLETE, poiEntity.getTaskId());
|
||||
}
|
||||
|
||||
}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);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case R.id.btn_finish_gather://结束采集
|
||||
btnFinishGather.setVisibility(View.VISIBLE);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (poiListEntity!=null){
|
||||
poiDao.deletePoiEntity(poiListEntity);
|
||||
}else {
|
||||
poiDao.deletePoiEntity(poiEntity);
|
||||
}
|
||||
if (poiEntity!=null){
|
||||
int type = poiEntity.getType();
|
||||
if (type==6){
|
||||
initSubmitPolygonTask(HttpInterface.SUBMIT_POLYGON_TASK, poiEntity.getTaskId());
|
||||
}else {
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (poiListEntity != null) {
|
||||
poiDao.deletePoiEntity(poiListEntity);
|
||||
} else {
|
||||
poiDao.deletePoiEntity(poiEntity);
|
||||
}
|
||||
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url 面妆任务领取任务
|
||||
*/
|
||||
private void initPolygonTask(String url, int taskId ,boolean aBoolean) {
|
||||
if (taskId == 0) {
|
||||
Toast.makeText(getContext(), "无此任务", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url + "/" + taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(PolygonTaskBean.class)
|
||||
.callback(new Callback<PolygonTaskBean>() {
|
||||
@Override
|
||||
public void onSuccess(PolygonTaskBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
PolygonTaskBean.BodyBean listBean = response.getBody();
|
||||
PoiEntity polygonEntity = new PoiEntity();
|
||||
polygonEntity.setTaskId(listBean.getId());
|
||||
polygonEntity.setName(listBean.getName());
|
||||
polygonEntity.setType(Integer.valueOf(listBean.getType()));
|
||||
String geo = listBean.getGeo();
|
||||
polygonEntity.setGeoWkt(geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
LatLng latLng = GeometryTools.createLatLng(geo);
|
||||
poiListEntity.setX(latLng.longitude + "");
|
||||
poiListEntity.setY(latLng.latitude + "");
|
||||
} else if (geometry.getGeometryType().equals("LineString")) {//线
|
||||
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
|
||||
poiListEntity.setX(latLineString.get(0).longitude + "");
|
||||
poiListEntity.setY(latLineString.get(0).latitude + "");
|
||||
} else if (geometry.getGeometryType().equals("Polygon")) {//面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
|
||||
poiListEntity.setX(latPolygon.get(0).longitude + "");
|
||||
poiListEntity.setY(latPolygon.get(0).latitude + "");
|
||||
}
|
||||
polygonEntity.setTaskStatus(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.insertPoiEntity(polygonEntity);
|
||||
}
|
||||
}).start();
|
||||
btnGetTask.setVisibility(View.GONE);
|
||||
btnCancelGet.setVisibility(View.VISIBLE);
|
||||
if (aBoolean){
|
||||
initCompleteTask(HttpInterface.COMPLETE, poiEntity.getTaskId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url 面妆任务结束领取 ,结束采集
|
||||
*/
|
||||
private void initUnPolygonTask(String url, int taskId) {
|
||||
if (taskId == 0) {
|
||||
Toast.makeText(getContext(), "无此任务", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url + "/" + taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(UnPolygonTaskBean.class)
|
||||
.callback(new Callback<UnPolygonTaskBean>() {
|
||||
@Override
|
||||
public void onSuccess(UnPolygonTaskBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiEntity = poiDao.getPoiEntity(taskId);
|
||||
poiDao.deletePoiEntity(poiEntity);
|
||||
}
|
||||
}).start();
|
||||
btnGetTask.setVisibility(View.VISIBLE);
|
||||
btnCancelGet.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url 面妆任务立即采集
|
||||
*/
|
||||
private void initCompleteTask(String url, int taskId) {
|
||||
if (taskId == 0) {
|
||||
Toast.makeText(getContext(), "无此任务", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url + "/" + taskId)
|
||||
.method(OkGoBuilder.GET)
|
||||
.cls(UnPolygonTaskBean.class)
|
||||
.callback(new Callback<UnPolygonTaskBean>() {
|
||||
@Override
|
||||
public void onSuccess(UnPolygonTaskBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
btnGather.setVisibility(View.GONE);
|
||||
btnFinishGather.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url 面妆任务 结束采集
|
||||
*/
|
||||
private void initSubmitPolygonTask(String url, int taskId) {
|
||||
if (taskId == 0) {
|
||||
Toast.makeText(getContext(), "无此任务", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(url)
|
||||
.method(OkGoBuilder.GET)
|
||||
.params(new HttpParams("id", String.valueOf(taskId)))
|
||||
.cls(UnPolygonTaskBean.class)
|
||||
.callback(new Callback<UnPolygonTaskBean>() {
|
||||
@Override
|
||||
public void onSuccess(UnPolygonTaskBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiEntity = poiDao.getPoiEntity(taskId);
|
||||
poiDao.deletePoiEntity(poiEntity);
|
||||
}
|
||||
}).start();
|
||||
btnGather.setVisibility(View.VISIBLE);
|
||||
btnFinishGather.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + e.getMessage());
|
||||
}
|
||||
}).build();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param url 不同任务类型对应的url
|
||||
*/
|
||||
@ -248,31 +426,37 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
public void onSuccess(ReceivedPoiBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
ReceivedPoiBean.BodyBean listBean = response.getBody();
|
||||
poiListEntity = new PoiEntity();
|
||||
PoiEntity poiListEntity = new PoiEntity();
|
||||
poiListEntity.setTaskId(listBean.getId());
|
||||
poiListEntity.setName(listBean.getName());
|
||||
poiListEntity.setAddress(listBean.getAddress());
|
||||
poiListEntity.setTelPhone(listBean.getTelephone() + "");
|
||||
poiListEntity.setType(Integer.valueOf(listBean.getType()));
|
||||
String geo = listBean.getGeo();
|
||||
poiListEntity.setGeoWkt(geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
LatLng latLng = GeometryTools.createLatLng(geo);
|
||||
poiListEntity.setX(latLng.longitude + "");
|
||||
poiListEntity.setY(latLng.latitude + "");
|
||||
} else if (geometry.getGeometryType().equals("LineString")) {//线
|
||||
} else if (geometry.getGeometryType().equals("Polygon")) {}//面
|
||||
|
||||
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
|
||||
poiListEntity.setX(latLineString.get(0).longitude + "");
|
||||
poiListEntity.setY(latLineString.get(0).latitude + "");
|
||||
} else if (geometry.getGeometryType().equals("Polygon")) {//面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
|
||||
poiListEntity.setX(latPolygon.get(0).longitude + "");
|
||||
poiListEntity.setY(latPolygon.get(0).latitude + "");
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.insertPoiEntity(poiListEntity);
|
||||
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
btnFinishGather.setVisibility(View.VISIBLE);
|
||||
if (isSaver&&aSave==1) {
|
||||
if (isSaver && aSave == 1) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.GATHER_GET_MAP;
|
||||
obtain.obj = poiListEntity;
|
||||
@ -282,8 +466,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -291,6 +475,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
}).build();
|
||||
}
|
||||
|
||||
public static String format5(double value) {
|
||||
return String.format("%.2f", value).toString();
|
||||
}
|
||||
|
@ -94,7 +94,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
private ArrayList<File> otheruploadList;
|
||||
private String takePhotoPath;
|
||||
private String takePhotoPath2;
|
||||
private PoiEntity poiEntity;
|
||||
|
||||
public static OtherFragment newInstance(Bundle bundle) {
|
||||
OtherFragment fragment = new OtherFragment();
|
||||
@ -183,10 +182,18 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
checkPot.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_OTHER;
|
||||
obtain.obj = isChecked;
|
||||
EventBus.getDefault().post(obtain);
|
||||
if (isChecked){
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_OTHER;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}else {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHECKED_OTHER;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
editTaskName = findViewById(R.id.et_task_name);
|
||||
@ -300,9 +307,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//保存数据库:
|
||||
poiEntity = new PoiEntity();
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
List<Info> infoList = new ArrayList<>();
|
||||
|
||||
String name = editTaskName.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
||||
@ -315,6 +321,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude,latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
@ -339,11 +347,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
} else {
|
||||
infoList.add(new Info(tagPictures));
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
poiEntity.setStation_type(station_type);
|
||||
poiEntity.setPhotoInfo(infoList);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@ -380,8 +383,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
|
||||
break;
|
||||
case R.id.btn_other_uploading:
|
||||
|
||||
otherUploadByNet(poiEntity);
|
||||
otherUploadByNet(showPoiEntity);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -409,7 +411,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
public void onSuccess(Response<NameAuthenticationBean> response) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -430,8 +431,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
httpParams.put("taskId", poiEntity.getTaskId());
|
||||
httpParams.put("name", poiEntity.getName());
|
||||
httpParams.put("existence", "1");
|
||||
String encode = Geohash.getInstance().encode(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
httpParams.put("geo", encode);
|
||||
httpParams.put("geo", poiEntity.getGeoWkt());
|
||||
httpParams.put("memo", poiEntity.getMemo());
|
||||
|
||||
OkGoBuilder.getInstance()
|
||||
@ -468,7 +468,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
//获取Editor对象
|
||||
SharedPreferences.Editor edit = poi.edit();
|
||||
//根据要保存的数据的类型,调用对应的put方法,
|
||||
PoiEntity poiEntity = new PoiEntity();
|
||||
PoiEntity poiEntity =showPoiEntity;
|
||||
ArrayList<Info> arrayList = new ArrayList<>();
|
||||
String name = editTaskName.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
|
@ -98,7 +98,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private CheckBox checkBoxRight;
|
||||
private PoiEntity showPoiEntity;
|
||||
private LatLng latLng;
|
||||
String[] spinner = new String[]{"存在","不存在","无法验证"};
|
||||
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||
private RelativeLayout linearExist;
|
||||
private Spinner spinnerExist;
|
||||
private ArrayList<File> poiUploadList;
|
||||
@ -108,7 +108,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private String takePhotoPath4;
|
||||
private String takePhotoPath3;
|
||||
private String takePhotoPath1;
|
||||
private PoiEntity poiEntity;
|
||||
|
||||
public static PoiFragment newInstance(Bundle bundle) {
|
||||
PoiFragment fragment = new PoiFragment();
|
||||
@ -173,10 +172,18 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
checkBoxLife.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_WORD;
|
||||
obtain.obj = isChecked;
|
||||
EventBus.getDefault().post(obtain);
|
||||
if (isChecked) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_WORD;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_CHECKED_WORD;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
checkBoxRight.setVisibility(View.GONE);
|
||||
@ -270,54 +277,54 @@ 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 + "");
|
||||
}
|
||||
String address = showPoiEntity.getAddress();//地址
|
||||
if (address != null && !address.equals("")) {
|
||||
editSiteContent.setText(address);
|
||||
}
|
||||
String x = showPoiEntity.getX();
|
||||
String y = showPoiEntity.getY();
|
||||
if (x != null && y != null) {
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(Double.parseDouble(y));
|
||||
latLng.setLongitude(Double.parseDouble(x));
|
||||
}
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
editDescribe.setText(describe);
|
||||
}
|
||||
String telPhone = showPoiEntity.getTelPhone();
|
||||
if (telPhone != null && !telPhone.equals("")) {
|
||||
phoneData.add(showPoiEntity.getTelPhone());
|
||||
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
||||
poiRecycleAdapter.setList(poiBeans);
|
||||
String name = showPoiEntity.getName();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
editNameContent.setText(name + "");
|
||||
}
|
||||
String address = showPoiEntity.getAddress();//地址
|
||||
if (address != null && !address.equals("")) {
|
||||
editSiteContent.setText(address);
|
||||
}
|
||||
String x = showPoiEntity.getX();
|
||||
String y = showPoiEntity.getY();
|
||||
if (x != null && y != null) {
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(Double.parseDouble(y));
|
||||
latLng.setLongitude(Double.parseDouble(x));
|
||||
}
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
editDescribe.setText(describe);
|
||||
}
|
||||
String telPhone = showPoiEntity.getTelPhone();
|
||||
if (telPhone != null && !telPhone.equals("")) {
|
||||
phoneData.add(showPoiEntity.getTelPhone());
|
||||
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
||||
|
||||
}
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
if (showPoiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||
String[] split = photo.split("/");
|
||||
if (split[split.length - 1].startsWith("a")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||
ivPanorama.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("b")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivName);
|
||||
ivName.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("c")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||
ivInternal.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("d")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivCard);
|
||||
ivCard.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("e")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||
ivElse.setTag(photo);
|
||||
}
|
||||
} else {
|
||||
poiBeans.add(new PoiBean("电话*", "", R.drawable.icon_add_bg));
|
||||
}
|
||||
poiRecycleAdapter.setList(poiBeans);
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
if (showPoiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||
String[] split = photo.split("/");
|
||||
if (split[split.length - 1].startsWith("a")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||
ivPanorama.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("b")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivName);
|
||||
ivName.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("c")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||
ivInternal.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("d")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivCard);
|
||||
ivCard.setTag(photo);
|
||||
} else if (split[split.length - 1].startsWith("e")) {
|
||||
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||
ivElse.setTag(photo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -372,7 +379,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//保存数据库:
|
||||
poiEntity = new PoiEntity();
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
ArrayList<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
@ -392,6 +399,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude,latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
@ -435,11 +444,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (tagCard != null) {
|
||||
infoPhoto.add(new Info(tagCard));
|
||||
}
|
||||
if (showPoiEntity!=null){
|
||||
if (showPoiEntity.getTaskId()!=0){
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
@ -455,7 +459,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
poiDao.insertPoiEntity(poiEntity);
|
||||
}
|
||||
}).start();
|
||||
poiSaveByNet(poiEntity);
|
||||
//poiSaveByNet(poiEntity);
|
||||
onBackPressed();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
@ -478,7 +482,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
obtain.what = Constant.TREASURE_FRAGMENT;
|
||||
obtain.obj = false;
|
||||
EventBus.getDefault().post(obtain);
|
||||
poiUploadByNetWork(poiEntity);
|
||||
poiUploadByNetWork(showPoiEntity);
|
||||
break;
|
||||
case R.id.tv_examine:
|
||||
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
|
||||
@ -561,9 +565,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
httpParams.put("address", poiEntity.getAddress());
|
||||
}
|
||||
httpParams.put("existence", "1");
|
||||
if (poiEntity.getY() != null && poiEntity.getX() != null) {
|
||||
String encode = Geohash.getInstance().encode(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
httpParams.put("geo", encode);
|
||||
if (poiEntity.getGeoWkt() !=null &&!poiEntity.getGeoWkt().equals("")) {
|
||||
httpParams.put("geo", poiEntity.getGeoWkt());
|
||||
}
|
||||
if (poiEntity.getMemo() != null) {
|
||||
httpParams.put("memo", poiEntity.getMemo());
|
||||
@ -604,7 +607,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
SharedPreferences.Editor edit = poi.edit();
|
||||
//根据要保存的数据的类型,调用对应的put方法,
|
||||
|
||||
PoiEntity poiEntity = new PoiEntity();
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
ArrayList<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name != null && !name.equals("")) {
|
||||
@ -645,8 +648,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (tagCard != null && !tagCard.equals("")) {
|
||||
infoPhoto.add(new Info(tagCard));
|
||||
}
|
||||
if (showPoiEntity!=null){
|
||||
if (showPoiEntity.getTaskId()!=0){
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ import com.tencent.map.geolocation.TencentLocation;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.MapView;
|
||||
import com.tencent.tencentmap.mapsdk.maps.Projection;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
|
||||
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
|
||||
@ -102,7 +103,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
private ImageView ivRefish;
|
||||
private SlidingUpPanelLayout sliding_layout;
|
||||
private FragmentTransaction fragmentTransaction;
|
||||
private Marker marker;
|
||||
private Marker markerPoi;
|
||||
private CheckBox cbFootType;
|
||||
private ImageView ivFilter;
|
||||
private Point screenPosition; //marker的屏幕坐标
|
||||
@ -233,6 +234,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
JobSearchBean.BodyBean.ListBean listBean = (JobSearchBean.BodyBean.ListBean) marker.getTag();
|
||||
PoiEntity poiListEntity = new PoiEntity();
|
||||
poiListEntity.setTaskId(listBean.getId());
|
||||
poiListEntity.setGeoWkt(listBean.getGeo());
|
||||
poiListEntity.setName(listBean.getName());
|
||||
poiListEntity.setAddress(listBean.getAddress());
|
||||
poiListEntity.setTelPhone(listBean.getTelephone() + "");
|
||||
@ -253,6 +255,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
JobSearchBean.BodyBean.ListBean listBean = (JobSearchBean.BodyBean.ListBean) marker.getTag();
|
||||
PoiEntity poiListEntity = new PoiEntity();
|
||||
poiListEntity.setTaskId(listBean.getId());
|
||||
poiListEntity.setGeoWkt(listBean.getGeo());
|
||||
poiListEntity.setName(listBean.getName());
|
||||
poiListEntity.setAddress(listBean.getAddress());
|
||||
poiListEntity.setTelPhone(listBean.getTelephone() + "");
|
||||
@ -278,8 +281,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
|
||||
private void initList(TencentLocation tencentLocation) {
|
||||
int task_type=Constant.TASK_TYPE;
|
||||
int limit_type=Constant.LIMIT_TTPE;
|
||||
int task_type = Constant.TASK_TYPE;
|
||||
int limit_type = Constant.LIMIT_TTPE;
|
||||
int taskStatus = Constant.TASK_STASTUS;
|
||||
if (taskStatus == 1 || taskStatus == 2) {
|
||||
Message obtain = Message.obtain();
|
||||
@ -305,8 +308,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
.params("date", date)
|
||||
.params("pageSize", Constant.NUMBER)
|
||||
.params("pageNum", "1")
|
||||
.params("type",task_type)
|
||||
.params("isExclusive",limit_type)
|
||||
.params("type", task_type)
|
||||
.params("isExclusive", limit_type)
|
||||
// .client(new OkHttpClient())
|
||||
.execute(new DialogCallback<JobSearchBean>(JobSearchBean.class) {
|
||||
@Override
|
||||
@ -447,8 +450,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
EventBus.getDefault().post(obtain);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -464,12 +465,14 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
showAllPoi.clear();
|
||||
showAllPoi.addAll(allTaskStatus);
|
||||
for (int i = 0; i < allTaskStatus.size(); i++) {
|
||||
LatLng position = new LatLng(Double.valueOf(allTaskStatus.get(i).getY()), Double.valueOf(allTaskStatus.get(i).getX()));
|
||||
Marker marker = tencentMap.addMarker(new MarkerOptions(position));
|
||||
marker.setClickable(true);
|
||||
marker.setTitle("本地");//1:本地
|
||||
marker.setTag(allTaskStatus.get(i));
|
||||
removablesLocality.add(marker);
|
||||
if (allTaskStatus.get(i).getX() != null && allTaskStatus.get(i).getY() != null) {
|
||||
LatLng position = new LatLng(Double.valueOf(allTaskStatus.get(i).getY()), Double.valueOf(allTaskStatus.get(i).getX()));
|
||||
Marker marker = tencentMap.addMarker(new MarkerOptions(position));
|
||||
marker.setClickable(true);
|
||||
marker.setTitle("本地");//1:本地
|
||||
marker.setTag(allTaskStatus.get(i));
|
||||
removablesLocality.add(marker);
|
||||
}
|
||||
}
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||
@ -659,20 +662,36 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
List<PoiEntity> poiEntities = (List<PoiEntity>) data.obj;
|
||||
initFilterMarker(poiEntities);
|
||||
} else if (data.what == Constant.TREASURE_WORD) { // POI采集-移动位置
|
||||
initPoiMarker(Boolean.valueOf((Boolean) data.obj), Constant.POI_WORD);
|
||||
initPoiMarker((LatLng) data.obj);
|
||||
} else if (data.what == Constant.TREASURE_CHECKED_WORD) {//poi采集 -确定位置
|
||||
if((boolean)data.obj){
|
||||
initCheckedMarker(Constant.POI_WORD);
|
||||
}
|
||||
} else if (data.what == Constant.MAIN_CHARGING_STATION) {//充电站采集-移动位置
|
||||
initPoiMarker(Boolean.valueOf((Boolean) data.obj), Constant.CHARGING_STATION_WORD);
|
||||
initPoiMarker((LatLng) data.obj);
|
||||
} else if (data.what == Constant.MAIN_CHARGING_CHECKED_STATION) {//充电站采集 -确定位置
|
||||
if((boolean)data.obj){
|
||||
initCheckedMarker(Constant.CHARGING_STATION_WORD);
|
||||
}
|
||||
} else if (data.what == Constant.MAIN_CHARGING_PILE) {//充电桩采集-移动位置
|
||||
initPoiMarker(Boolean.valueOf((Boolean) data.obj), Constant.CHARGING_PILE_WORD);
|
||||
initPoiMarker((LatLng) data.obj);
|
||||
} else if (data.what == Constant.MAIN_CHARGING_CHECKED_PILE) {//充电桩采集-确定位置
|
||||
if((boolean)data.obj){
|
||||
initCheckedMarker(Constant.CHARGING_PILE_WORD);
|
||||
}
|
||||
} else if (data.what == Constant.MAIN_OTHER) {//其他采集-移动位置
|
||||
initPoiMarker(Boolean.valueOf((Boolean) data.obj), Constant.OTHER_WORD);
|
||||
initPoiMarker((LatLng) data.obj);
|
||||
} else if (data.what == Constant.MAIN_CHECKED_OTHER) {//其他采集-确定位置
|
||||
if((boolean)data.obj){
|
||||
initCheckedMarker(Constant.OTHER_WORD);
|
||||
}
|
||||
} else if (data.what == Constant.TREASURE_FRAGMENT) {
|
||||
if ((boolean) data.obj == true) {
|
||||
frameLayout.setVisibility(View.GONE);
|
||||
sliding_layout.setPanelHeight(0);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
|
||||
if (marker != null) {
|
||||
marker.remove();
|
||||
if (markerPoi != null) {
|
||||
markerPoi.remove();
|
||||
}
|
||||
}
|
||||
} else if (data.what == Constant.MAIN_BUTTON_VISIABLE) {
|
||||
@ -726,6 +745,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 控制主界面各个按钮的显示状态
|
||||
*/
|
||||
@ -750,45 +770,39 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
|
||||
|
||||
private void initPoiMarker(Boolean t, int aInt) {
|
||||
if (t == true) {
|
||||
//移动地图
|
||||
CameraUpdate cameraSigma =
|
||||
CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
Constant.markerLatlng, //中心点坐标,地图目标经纬度
|
||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
|
||||
tencentMap.getCameraPosition().bearing)); //目标旋转角 0~360° (正北方为0)
|
||||
tencentMap.animateCamera(cameraSigma, new TencentMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
screenPosition = tencentMap.getProjection().toScreenLocation(Constant.markerLatlng);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
//创建Marker对象之前,设置属性
|
||||
LatLng position = Constant.markerLatlng;
|
||||
marker = tencentMap.addMarker(new MarkerOptions(position));
|
||||
marker.setFixingPoint(screenPosition.x, screenPosition.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (screenPosition != null) {
|
||||
private void initPoiMarker(LatLng latLng) {
|
||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
latLng, //中心点坐标,地图目标经纬度
|
||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
|
||||
tencentMap.getCameraPosition().bearing)); //目标旋转角 0~360° (正北方为0)
|
||||
tencentMap.animateCamera(cameraSigma, new TencentMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
screenPosition = tencentMap.getProjection().toScreenLocation(latLng);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
LatLng latLng = tencentMap.getProjection().fromScreenLocation(screenPosition);
|
||||
marker.setPosition(latLng);
|
||||
marker.setFixingPointEnable(false);
|
||||
Constant.markerLatlng = latLng;
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = aInt;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
|
||||
//创建Marker对象之前,设置属性
|
||||
markerPoi.setFixingPoint(screenPosition.x, screenPosition.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initCheckedMarker(int poiWord) {
|
||||
if (screenPosition != null) {
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
LatLng latLng = tencentMap.getProjection().fromScreenLocation(screenPosition);
|
||||
markerPoi.setPosition(latLng);
|
||||
markerPoi.setFixingPointEnable(false);
|
||||
Constant.markerLatlng = latLng;
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = poiWord;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
}
|
||||
|
||||
@ -796,7 +810,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
* 设置定位图标样式
|
||||
*/
|
||||
private void setLocMarkerStyle() {
|
||||
locationStyle= new MyLocationStyle();
|
||||
locationStyle = new MyLocationStyle();
|
||||
locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER);
|
||||
//创建图标
|
||||
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(R.drawable.location));
|
||||
@ -871,6 +885,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
treasureMap.onDestroy();
|
||||
markerPoi.remove();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@ -913,12 +928,19 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_road, "道路"));
|
||||
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_chongdianzhuang, "充电站"));
|
||||
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_qingbao, "其他"));
|
||||
Bundle bundle = new Bundle();
|
||||
PoiEntity poiEntity = new PoiEntity();
|
||||
LatLng mapCenterPoint = getMapCenterPoint();
|
||||
poiEntity.setX(mapCenterPoint.longitude + "");
|
||||
poiEntity.setY(mapCenterPoint.latitude + "");
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
ShareDialog.show((AppCompatActivity) getActivity(), itemList, new ShareDialog.OnItemClickListener() {
|
||||
@Override
|
||||
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
PoiFragment poiFragment = PoiFragment.newInstance(new Bundle());
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint));
|
||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||
showSlidingFragment(poiFragment);
|
||||
break;
|
||||
case 1:
|
||||
@ -930,11 +952,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
showSlidingFragment(roadFragment);
|
||||
break;
|
||||
case 3:
|
||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(new Bundle());
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint));
|
||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||
showSlidingFragment(chargingStationFragment);
|
||||
break;
|
||||
case 4:
|
||||
OtherFragment otherFragment = OtherFragment.newInstance(new Bundle());
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint));
|
||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||
showSlidingFragment(otherFragment);
|
||||
break;
|
||||
}
|
||||
@ -945,8 +969,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
case R.id.iv_filter:
|
||||
initThread();
|
||||
initList(Constant.currentLocation);
|
||||
Bundle bundle = new Bundle();
|
||||
FilterFragment filterFragment = FilterFragment.newInstance(bundle);
|
||||
FilterFragment filterFragment = FilterFragment.newInstance(new Bundle());
|
||||
showSlidingFragment(filterFragment);
|
||||
break;
|
||||
case R.id.iv_message:
|
||||
@ -1063,7 +1086,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public LatLng getMapCenterPoint() {
|
||||
public LatLng getMapCenter() {
|
||||
// int left = treasureMap.getLeft();
|
||||
// int top = treasureMap.getTop();
|
||||
// int right = treasureMap.getRight();
|
||||
@ -1076,4 +1099,23 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
return tencentMap.getCameraPosition().target;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取屏幕中心点位置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public LatLng getMapCenterPoint() {
|
||||
int left = treasureMap.getLeft();
|
||||
int top = treasureMap.getTop();
|
||||
int right = treasureMap.getRight();
|
||||
int bottom = treasureMap.getBottom();
|
||||
// 获得屏幕点击的位置
|
||||
int x = (int) (treasureMap.getX() + (right - left) / 2);
|
||||
int y = (int) (treasureMap.getY() + (bottom - top) / 2);
|
||||
Projection projection = tencentMap.getProjection();
|
||||
LatLng pt = projection.fromScreenLocation(new Point(x, y));
|
||||
return pt;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -58,23 +58,29 @@ public class HttpInterface {
|
||||
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 IPm10 = "http://172.23.139.4:8003/ctask/1/receivedCtask/8608";
|
||||
|
||||
public static final String RECEIVED_POI_TASK = IPm7 + "receivedPoitask/1";//poi-领取任务
|
||||
|
||||
|
||||
public static final String IPm8 = "http://172.23.139.4:8003/poitask/1/";
|
||||
//172.23.139.4:8003/poitask/1/submitPoitask?taskId=5001&name=测试修改名称&address=测试修改地址&existence=1&geo=1rn7exd5uhxy&memo=测试备注
|
||||
|
||||
public static final String SUBMIT_POI_TASK = IPm8+"submitPoitask";//poi-保存本地
|
||||
public static final String SUBMIT_POI_TASK = IPm8 + "submitPoitask";//poi-保存本地
|
||||
|
||||
public static final String IPm9 = "http://172.23.139.4:8003/othertask/1/";
|
||||
|
||||
//172.23.139.4:8003/othertask/1/submitOhtertask?taskId=5001&name=测试修改名称&address=测试修改地址&existence=1&geo=1rn7exd5uhxy&memo=测试备注
|
||||
public static final String SUBMIT_OTHER_TASK = IPm9+"submitOthertask";//其他-保存本地
|
||||
|
||||
//172.23.139.4:8003/ctask/1/receivedCtask/8608
|
||||
public static final String RECEIVED_CTASK = IPm10+"receivedCtask/8608";//充电站-领取任务
|
||||
public static final String SUBMIT_OTHER_TASK = IPm9 + "submitOthertask";//其他-保存本地
|
||||
|
||||
/*172.23.139.4:8003/polygonTask/1/receivedPolygontask/8602
|
||||
172.23.139.4:8003/polygonTask/1/unReceivedPolygontask/8602
|
||||
172.23.139.4:8003/polygonTask/1/complete/8602
|
||||
172.23.139.4:8003/polygonTask/1/submitPolygontask?id=8602*/
|
||||
public static final String IPm10="http://172.23.139.4:8003/polygonTask/1/";
|
||||
|
||||
public static final String RECEIVED_POLYGON_TASK=IPm10+"receivedPolygontask"; //任务领取
|
||||
public static final String UNRECEIVED_POLYGON_TASK=IPm10+"unReceivedPolygontask";//结束领取
|
||||
public static final String COMPLETE=IPm10+"complete";//任务采集
|
||||
public static final String SUBMIT_POLYGON_TASK=IPm10+"submitPolygontask";//结束采集
|
||||
|
||||
|
||||
}
|
||||
|
@ -25,10 +25,14 @@ public interface PoiDao {
|
||||
@Query("SELECT * FROM poi where type=:type")
|
||||
List<PoiEntity> getAllPoiType(int type);
|
||||
|
||||
|
||||
@Query("SELECT * FROM poi WHERE (:taskStatus =-1 or taskStatus=:taskStatus1) and (:type=-1 or type=:type1) and (:isExclusive=-1 or isExclusive=:isExclusive1) ")
|
||||
// @Query("SELECT * FROM poi WHERE taskStatus=:taskStatus and type=:type and (:isExclusive=-1 or isExclusive=:isExclusive) ")
|
||||
List<PoiEntity> getAllTaskStatus(int taskStatus, int taskStatus1, int type, int type1, int isExclusive, int isExclusive1);
|
||||
|
||||
|
||||
@Query("SELECT * FROM poi where taskId=:taskId")
|
||||
PoiEntity getPoiEntity(int taskId);
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
@ -70,6 +74,14 @@ public interface PoiDao {
|
||||
void deleteFormName(int taskStatus);
|
||||
|
||||
|
||||
/**
|
||||
* 根据条件删除
|
||||
*
|
||||
* @param taskId
|
||||
*/
|
||||
@Query("DELETE FROM poi where taskId=:taskId")
|
||||
void deleteFormTaskID(int taskId);
|
||||
|
||||
/**
|
||||
* 全部删除
|
||||
*/
|
||||
|
@ -30,6 +30,15 @@ public class PoiEntity implements Serializable {
|
||||
private String photo;//照片信息
|
||||
private String extend;//添加字段
|
||||
private boolean checked;
|
||||
private String geoWkt; // 数据的wkt
|
||||
|
||||
public String getGeoWkt() {
|
||||
return geoWkt;
|
||||
}
|
||||
|
||||
public void setGeoWkt(String geoWkt) {
|
||||
this.geoWkt = geoWkt;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return checked;
|
||||
|
Loading…
x
Reference in New Issue
Block a user