添加'其他'+‘poi’的保存本地接口

This commit is contained in:
md 2021-07-06 18:56:07 +08:00
parent 2156a8a371
commit f2a48b9a2a
13 changed files with 204 additions and 38 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

@ -136,7 +136,6 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
return;
}
if (!RegexUtil.isPhone(userphone)) {
Toast.makeText(this, "手机号输入错误", Toast.LENGTH_SHORT).show();
return;

View File

@ -20,16 +20,16 @@ public class Constant {
* 位置权限
*/
public static final String SET_LOCATION_PERMISSION = "请在“设置”中给予“TengXunMap”位置权限,否则当前功能将不可使用";
public static final String SET_LOCATION= "请在“设置”中给予权限否则当前功能将不可使用";
public static final String SET_LOCATION = "请在“设置”中给予权限否则当前功能将不可使用";
public static final String GET_ERR_MESSAGE1 = "设备缺少使用腾讯定位服务需要的基本条件";
public static final String GET_ERR_MESSAGE2 = "manifest 中配置的 key 不正确";
public static final String GET_ERR_MESSAGE3 = "自动加载libtencentloc.so失败";
public static final String BASE_FOLDER = SdkFolderCreate.getSDPath()+"/navinfoOutDoor";
public static final String BASE_FOLDER = SdkFolderCreate.getSDPath() + "/navinfoOutDoor";
// 保存图片的目录
public static final String PICTURE_FOLDER = BASE_FOLDER+"/picture";
public static final String POI_DAO = BASE_FOLDER+"/BaseDao/";
public static final String PICTURE_FOLDER = BASE_FOLDER + "/picture";
public static final String POI_DAO = BASE_FOLDER + "/BaseDao/";
// 申请权限的RequestCode
public static final int PERMISSION_REQUEST_CODE = 0x100;
@ -40,7 +40,6 @@ public class Constant {
public static final String DATA_FILE = "dataFile";
//message word
public static final int TREASURE_FRAGMENT = 100;//抽屉界面的展示和隐藏
public static final int TREASURE_WORD = 0;//poi 对地图页面marker 的一个展示
@ -56,22 +55,22 @@ public class Constant {
public static final int MAIN_CHARGING_STATION = 13;//充电站的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 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 OTHER_WORD = 25;//地图页面marker 的经纬都回传
public static final int CHARGING_STATION_PILE = 26;//跳转到充电桩 传给数据
public static final int CAPACITY_EVALUATION_PAGE = 1;//能力测评的页数
public static final int JOB_SEARCH_WORD = 28;//任务搜索的数据
public static final int GATHER_GET_MAP = 30;//地图点击marker 后弹窗点击开始采集
public static final int HOME_MINE = 32;//点击我的实时监听刷新
public static String USER_ATTESTATION_NAME; //实名认证姓名 银行卡
public static int NUMBER =200; //任务个数
public static String PHOTOGRAPH ="全部"; //任务类型
public static String EXCLUSIVE ="全部";
public static String TYPE ="全部";
public static String USER_ATTESTATION_NAME; //实名认证姓名 银行卡
public static int NUMBER = 200; //任务个数
public static String PHOTOGRAPH = "全部"; //任务类型
public static String EXCLUSIVE = "全部";
public static String TYPE = "全部";
/**
* 用户当前位置
*/

View File

@ -0,0 +1,32 @@
package com.navinfo.outdoor.bean;
public class PoiSaveBean {
private Integer code;
private String message;
private Integer body;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Integer getBody() {
return body;
}
public void setBody(Integer body) {
this.body = body;
}
}

View File

@ -14,6 +14,7 @@ import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.adapter.CapacityEvaluationAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.bean.CapacityMeasureBean;
import com.navinfo.outdoor.bean.TaskExplainInfo;
@ -37,6 +38,7 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
private XRecyclerView capacityEvaluationRecycler;
private CapacityEvaluationAdapter capacityEvaluationAdapter;
public static CapacityEvaluationFragment newInstance(Bundle bundle) {
CapacityEvaluationFragment fragment = new CapacityEvaluationFragment();
fragment.setArguments(bundle);
@ -95,8 +97,8 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
showLoadingDialog();
HttpParams httpParams = new HttpParams();
httpParams.put("fid","1");
httpParams.put("pageNum","1");
httpParams.put("pageSize","2");
httpParams.put("pageNum", "1");
httpParams.put("pageSize","10");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.MSG_LISt)

View File

@ -64,7 +64,7 @@ public class EventPrefectureFragment extends BaseFragment implements View.OnClic
HttpParams httpParams = new HttpParams();
httpParams.put("fid", "1");
httpParams.put("pageNum", "1");
httpParams.put("pageSize", "2");
httpParams.put("pageSize", "10");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.listEvent)

View File

@ -74,7 +74,7 @@ public class MessageFragment extends BaseFragment implements View.OnClickListene
HttpParams httpParams = new HttpParams();
httpParams.put("fid", "1");
httpParams.put("pageNum", "1");
httpParams.put("pageSize", "2");
httpParams.put("pageSize", "10");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.listTask)

View File

@ -34,20 +34,31 @@ import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.bean.Info;
import com.navinfo.outdoor.bean.NameAuthenticationBean;
import com.navinfo.outdoor.bean.PoiBean;
import com.navinfo.outdoor.bean.PoiSaveBean;
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.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.tencent.tencentmap.mapsdk.maps.model.LatLng;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -76,6 +87,10 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
private PoiEntity showPoiEntity;
private LatLng latLng;
private int station_type=0;
private String name;
private ArrayList<Object> otheruploadList;
private String takePhotoPath;
private String takePhotoPath2;
public static OtherFragment newInstance(Bundle bundle) {
OtherFragment fragment = new OtherFragment();
@ -261,7 +276,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
PoiEntity poiEntity = new PoiEntity();
List<Info> infoList = new ArrayList<>();
String name = editTaskName.getText().toString().trim();//名称
//名称
name = editTaskName.getText().toString().trim();
if (name == null || name.equals("")) {
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
return;
@ -316,6 +332,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
}
}).start();
otherSaveByNetWork(poiEntity);
onBackPressed();
} else {
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
@ -334,10 +351,59 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
break;
case R.id.btn_other_uploading:
otherUploadByNet();
break;
}
}
private void otherUploadByNet() {
showLoadingDialog();
otheruploadList = new ArrayList<>();
File otherUploadFile = new File(takePhotoPath);
File otherUploadFile2 = new File(takePhotoPath2);
if (!otherUploadFile.exists() || !otherUploadFile2.exists()){
Toast.makeText(getContext(), "照片不能为空", Toast.LENGTH_SHORT).show();
return;
}
otheruploadList.add(otherUploadFile);
otheruploadList.add(otherUploadFile2);
}
private void otherSaveByNetWork(PoiEntity poiEntity) {
showLoadingDialog();
HttpParams httpParams = new HttpParams();
httpParams.put("type",poiEntity.getStation_type());
httpParams.put("taskId", poiEntity.getTaskId());
httpParams.put("name", name);
httpParams.put("existence", "1");
String encode = Geohash.getInstance().encode(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
httpParams.put("geo", encode);
httpParams.put("memo", poiEntity.getMemo());
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.SUBMIT_OTHER_TASK)
.method(OkGoBuilder.GET)
.cls(PoiSaveBean.class)
.params(httpParams)
.callback(new Callback<PoiSaveBean>() {
@Override
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
dismissLoadingDialog();
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
}
/**
* 防止当页面崩溃后出现数据丢失
*/
@ -412,7 +478,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
}
});
} else {
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a");//照片路径
//照片路径
takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a");
ivPicture.setTag(takePhotoPath);
ivPicture.setImageBitmap(bitmap);//显示图像
@ -433,8 +500,9 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
}
});
} else {
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b");//照片路径
ivPictures.setTag(takePhotoPath);
//照片路径
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b");
ivPictures.setTag(takePhotoPath2);
ivPictures.setImageBitmap(bitmap);//显示图像
}
}

View File

@ -36,15 +36,22 @@ import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
import com.kongzue.dialog.v3.ShareDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.PoiRecycleAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.bean.Info;
import com.navinfo.outdoor.bean.PoiBean;
import com.navinfo.outdoor.bean.PoiSaveBean;
import com.navinfo.outdoor.bean.TaskPrefectureBean;
import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
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.tencent.tencentmap.mapsdk.maps.model.LatLng;
@ -83,6 +90,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
private CheckBox checkBoxRight;
private PoiEntity showPoiEntity;
private LatLng latLng;
private String name;
private String site;
public static PoiFragment newInstance(Bundle bundle) {
PoiFragment fragment = new PoiFragment();
@ -324,14 +333,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
//保存数据库
PoiEntity poiEntity = new PoiEntity();
ArrayList<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称
//名称
name = editNameContent.getText().toString().trim();
if (name == null || name.equals("")) {
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
return;
} else {
poiEntity.setName(name);
}
String site = editSiteContent.getText().toString().trim();
site = editSiteContent.getText().toString().trim();
if (site == null || site.equals("")) {
Toast.makeText(getActivity(), "请输入poi 地址", Toast.LENGTH_SHORT).show();
return;
@ -372,7 +382,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
} else {
infoPhoto.add(new Info(tagName));
}
if (showPoiEntity.getTaskId()!=0){
if (showPoiEntity.getTaskId() != 0) {
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
String tagInternal = (String) ivInternal.getTag();
@ -387,8 +397,10 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
if (tagCard != null) {
infoPhoto.add(new Info(tagCard));
}
if (showPoiEntity.getTaskId()!=0){
poiEntity.setTaskId(showPoiEntity.getTaskId());
if (showPoiEntity != null) {
if (showPoiEntity.getTaskId() != 0) {
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
}
poiEntity.setPhotoInfo(infoPhoto);
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -404,6 +416,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
poiDao.insertPoiEntity(poiEntity);
}
}).start();
poiSaveByNet(poiEntity);
onBackPressed();
} else {
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
@ -455,6 +468,49 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
}
private void poiSaveByNet(PoiEntity poiEntity) {
showLoadingDialog();
HttpParams httpParams = new HttpParams();
if (poiEntity.getTaskId() != 0) {
httpParams.put("taskId", poiEntity.getTaskId());
}
if (name != null && !name.equals("")) {
httpParams.put("name", name);
}
if (site != null && !site.equals("")) {
httpParams.put("address", site);
}
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.getMemo() != null) {
httpParams.put("memo", poiEntity.getMemo());
}
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.SUBMIT_POI_TASK)
.method(OkGoBuilder.GET)
.cls(PoiSaveBean.class)
.params(httpParams)
.callback(new Callback<PoiSaveBean>() {
@Override
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
dismissLoadingDialog();
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
}
/**
* 防止当页面崩溃后出现数据丢失
*/
@ -509,10 +565,10 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
if (tagCard != null && !tagCard.equals("")) {
infoPhoto.add(new Info(tagCard));
}
if (showPoiEntity.getTaskId()!=0){
if (showPoiEntity.getTaskId() != 0) {
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
if (showPoiEntity.getTaskId()!=0){
if (showPoiEntity.getTaskId() != 0) {
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
poiEntity.setPhotoInfo(infoPhoto);

View File

@ -144,11 +144,11 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
public void onClick(String text, int index) {
switch (index){
case 0:
List<PoiEntity> poiEntities = initRoadWord(0);
List<PoiEntity> poiEntities = initRoadWord(1);
staySubmitAdapter.setAllRoad(poiEntities);
break;
case 1:
List<PoiEntity> poiEntitiesList = initRoadWord(1);
List<PoiEntity> poiEntitiesList = initRoadWord(4);
staySubmitAdapter.setAllRoad(poiEntitiesList);
break;
case 2:
@ -156,7 +156,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
staySubmitAdapter.setAllRoad(poiEntities1);
break;
case 3:
List<PoiEntity> poiEntities2 = initRoadWord(3);
List<PoiEntity> poiEntities2 = initRoadWord(5);
staySubmitAdapter.setAllRoad(poiEntities2);
break;
}

View File

@ -99,7 +99,7 @@ public class TaskExplainFragment extends BaseFragment implements View.OnClickLis
HttpParams httpParams = new HttpParams();
httpParams.put("fid", "1");
httpParams.put("pageNum", "1");
httpParams.put("pageSize", "2");
httpParams.put("pageSize", "10");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.listTaskExplain)

View File

@ -151,7 +151,7 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
private void immediatelyPrice() {
showLoadingDialog();
HttpParams httpParams = new HttpParams();
httpParams.put("exchangeMoney", "10");
httpParams.put("exchangeMoney", etAllPrice.getText().toString());
httpParams.put("payType", "1");
OkGoBuilder.getInstance()
.Builder(getActivity())

View File

@ -43,21 +43,31 @@ public class HttpInterface {
public static final String IPm5 = "http://172.23.139.4:8004/userPrice/1/";
//http://172.23.139.4:8004/userPrice/1/getPrice
public static final String GET_PRICE = IPm5 + "getPrice";//总资产
public static final String GET_PRICE = IPm5 + "getPrice";//我的-总资产
//http://172.23.139.4:8004/userPrice/1/userPriceExchange?exchangeMoney=10&payType=1
public static final String USER_PRICE_EXCHANGE = IPm5 + "userPriceExchange";
public static final String USER_PRICE_EXCHANGE = IPm5 + "userPriceExchange";//我的-财务信息-提现
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/5001";//其他-领取任务
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";
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 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";//其他-保存本地
}