修改poi录像和道路接口 修改bug

This commit is contained in:
md 2021-07-15 18:18:37 +08:00
parent d94f04b27e
commit 139865fdd9
9 changed files with 252 additions and 141 deletions

View File

@ -37,6 +37,7 @@ import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.bean.ChargingPileSaveBean;
import com.navinfo.outdoor.bean.PoiSaveBean;
import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.HttpInterface;
@ -56,6 +57,7 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import static android.app.Activity.RESULT_OK;
@ -95,6 +97,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
private String takePhotoPath8;
private String takePhotoPath9;
private String takePhotoPath10;
private int taskId;
public static ChargingPileFragment newInstance(Bundle bundle) {
ChargingPileFragment fragment = new ChargingPileFragment();
@ -178,6 +181,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
Toast.makeText(getContext(), "1", Toast.LENGTH_SHORT).show();
checkButton2.setChecked(false);
checkButton3.setChecked(false);
@ -223,15 +227,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
}
});
checkButton6 = findViewById(R.id.check_button6);
checkButton6.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
Toast.makeText(getContext(), "6", Toast.LENGTH_SHORT).show();
}
}
});
spinnerType = findViewById(R.id.spinner_type);
adapterType = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, type);
adapterType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //设置下拉列表框的下拉选项样式
@ -384,6 +379,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
if (station!=null){
PoiEntity poiEntity = new Gson().fromJson(station, PoiEntity.class);
pid = poiEntity.getId();
taskId = poiEntity.getTaskId();
String x = poiEntity.getX();
String y = poiEntity.getY();
if (x != null && y != null) {
@ -739,48 +735,40 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
private void chargingPileByWork(ChargingPileEntity chargingPileEntity) {
showLoadingDialog();
// HttpParams httpParams = new HttpParams();
// httpParams.put("taskId", chargingPileEntity.getTaskId());
// httpParams.put("name", chargingPileEntity.getName());
// httpParams.put("address", chargingPileEntity.getAddress());
// httpParams.put("existence", chargingPileEntity.getExistence());
// httpParams.put("geo", chargingPileEntity.getGeoWkt());
// httpParams.put("memo", chargingPileEntity.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();
// body = poiSaveBean.getBody();
// poiEntity.setBodyId(body);
// poiEntity.setTaskStatus(3);
// new Thread(new Runnable() {
// @Override
// public void run() {
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
// getActivity().runOnUiThread(new Runnable() {
// @Override
// public void run() {
// Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
// Log.d("TAG", "onSuccess: " + poiSaveBean.getBody());
// }
// });
// }
// }).start();
// }
//
// @Override
// public void onError(Throwable e, int id) {
// dismissLoadingDialog();
// Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
// Log.d("TAG", "onError: " + e.getMessage());
// }
// }).build();
HttpParams httpParams = new HttpParams();
httpParams.put("taskId", taskId);
httpParams.put("name", chargingPileEntity.getName());
httpParams.put("existence", chargingPileEntity.getExist());
httpParams.put("geo", chargingPileEntity.getP());
httpParams.put("memo", chargingPileEntity.getMemo());
httpParams.put("ffid", chargingPileEntity.getFid());
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("cp_openType",chargingPileEntity.getCp_openType());
hashMap.put("cp_floor",chargingPileEntity.getCp_floor());
hashMap.put("cp_availableState",chargingPileEntity.getCp_availableState());
hashMap.put("sign_exist",chargingPileEntity.getSign_exist());
httpParams.put("detail", String.valueOf(hashMap));
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.SUBMIT_CSTASK)
.method(OkGoBuilder.GET)
.cls(ChargingPileSaveBean.class)
.params(httpParams)
.callback(new Callback<ChargingPileSaveBean>() {
@Override
public void onSuccess(ChargingPileSaveBean chargingPileSaveBean, int id) {
dismissLoadingDialog();
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onSuccess: " + chargingPileSaveBean.getBody());
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();
}
@Override
@ -893,7 +881,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
int angle1 = PictureUtil.readPictureDegree(takePhotoPath1);
//int angle1 = PictureUtil.readPictureDegree(takePhotoPath1);
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivPanorama.setTag(takePhotoPath1);
ivPanorama.setImageBitmap(bitmap);//显示图像
@ -914,7 +902,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
});
} else {
int angle2 = PictureUtil.readPictureDegree(takePhotoPath2);
//int angle2 = PictureUtil.readPictureDegree(takePhotoPath2);
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
ivCoding.setTag(takePhotoPath2);
ivCoding.setImageBitmap(bitmap);//显示图像

View File

@ -256,6 +256,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
if (name != null && !name.equals("")) {
editTaskName.setText(name + "");
}
body=showPoiEntity.getBodyId();
String x = showPoiEntity.getX();
String y = showPoiEntity.getY();
if (x != null && y != null) {
@ -395,6 +396,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
break;
case R.id.btn_other_uploading:
ArrayList<File> otherUploadList = new ArrayList<>();
String tagPicture = (String) ivPicture.getTag();
if (tagPicture != null) {
@ -425,33 +427,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
}
private void otherUploadByNet(int body, List<File> otherUploadList) {
if (body == 0) {
Toast.makeText(getActivity(), "没有保存不能上传", Toast.LENGTH_SHORT).show();
return;
}
// OkGo
// // 请求方式和请求url
// .<OtherUploadPicBean>post(HttpInterface.OTHER_TASK_UPLOAD_PIC)
// // 请求的 tag, 主要用于取消对应的请求
// .params("auditId", body)
// .addFileParams("file", otherUploadList)
// .tag(this)
// .execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
// @Override
// public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
// dismissLoadingDialog();
// Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
// Log.d("TAG", "onSuccess: " + otherUploadPicBeanResponse.toString() + "sssssssssssss");
// }
//
// @Override
// public void onError(Response<OtherUploadPicBean> response) {
// super.onError(response);
// dismissLoadingDialog();
// Toast.makeText(getActivity(), response.message() + "", Toast.LENGTH_SHORT).show();
// Log.d("TAG", "onError: " + response.message());
// }
// });
if (body == 0) {
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
Log.e("TAG", "poiUploadByNetWork: " + body + otherUploadList);

View File

@ -93,8 +93,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
private Integer poiVideoBody;
private File videoFile;
private Button roadUpload;
private Button btnPoiVideoUpload;
private String videoPath;
private File fileZip;
public static PoiVideoFragment newInstance(Bundle bundle) {
PoiVideoFragment fragment = new PoiVideoFragment();
@ -149,16 +150,16 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
tvPictures = (TextView) findViewById(R.id.tv_pictures);
tvPictures.setOnClickListener(this::onClick);
etRoadName = (EditText) findViewById(R.id.et_poi_video_name);
ivPoiVideoPicture = (ImageView) findViewById(R.id.iv_road_picture);
ivPoiVideoPicture = (ImageView) findViewById(R.id.iv_poi_video_picture);
rbCar = (RadioButton) findViewById(R.id.rb_car);
rbBicycle = (RadioButton) findViewById(R.id.rb_bicycle);
rbWalking = (RadioButton) findViewById(R.id.rb_walking);
rbManual = (RadioButton) findViewById(R.id.rb_manual);
etDesc = (EditText) findViewById(R.id.et_desc);
btnRoadSave = (Button) findViewById(R.id.btn_road_save);
btnRoadSave = (Button) findViewById(R.id.btn_poi_video_save);
btnRoadSave.setOnClickListener(this::onClick);
roadUpload = findViewById(R.id.road_upload);
roadUpload.setOnClickListener(this::onClick);
btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
btnPoiVideoUpload.setOnClickListener(this::onClick);
rgType = (RadioGroup) findViewById(R.id.rg_type);
linearExist = findViewById(R.id.linear_exist);
spinnerExist = findViewById(R.id.spinner_exist);
@ -237,6 +238,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
int type = roadExtend.getType();
showPictureType(type);
}
poiVideoBody=showPoiEntity.getBodyId();
if (showPoiEntity.getName()!=null){
linearExist.setVisibility(View.VISIBLE);
}
@ -296,7 +298,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_road_save:
case R.id.btn_poi_video_save:
XXPermissions.with(getContext())
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
.request(new OnPermissionCallback() {
@ -375,6 +377,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
}).start();
//onBackPressed();
}else {
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
}
}
@ -391,32 +395,60 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
case R.id.tv_pictures:
// 根据用户点击的时间为视频名称赋值
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HHmmss");
String videoFormatName = formatter.format(new Date());
Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER + "/" + videoFormatName + ".mp4");
startActivityForResult(intent, 0x101);
break;
case R.id.road_upload:
case R.id.btn_poi_video_upload:
ArrayList<File> videoFileList = new ArrayList<>();
if (videoFile != null) {
videoFileList.add(videoFile);
File file = new File(videoFile.getPath()+".txt");
videoFileList.add(file);
}
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
ZipUtil.zipFiles(videoFileList, fileZip, null);
poiVideoUpload(poiVideoBody,videoFileList);
ZipUtil.zipFiles(videoFileList, fileZip,null);
if (poiVideoBody!=null){
poiVideoUpload(poiVideoBody,fileZip);
}else {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiVideoDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiVideoUpload(poiVideoDaoPoiEntity.getBodyId(),fileZip);
}
});
}
}).start();
}
break;
}
}
private void poiVideoUpload(Integer poiVideoBody, ArrayList<File> videoFileList) {
private void poiVideoUpload(int poiVideoBody, File fileZip) {
if (poiVideoBody == 0) {
Toast.makeText(getActivity(), "请先保存本地在上传", Toast.LENGTH_SHORT).show();
return;
}
if (fileZip==null){
Toast.makeText(getActivity(), "未压缩完成", Toast.LENGTH_SHORT).show();
return;
}
OkGo
// 请求方式和请求url
.<OtherUploadPicBean>post(HttpInterface.POI_VIDEO_UPLOAD_PIC)
// 请求的 tag, 主要用于取消对应的请求
.params("auditId",poiVideoBody )
.addFileParams("file",videoFileList)
.params("auditId",poiVideoBody)
.params("file",fileZip)
.tag(this)
.execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
@Override
@ -439,11 +471,23 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
private void poiVideoSave(PoiEntity poiEntity) {
showLoadingDialog();
int pictureType = getPictureType();
if (pictureType == -1) {
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
return;
}
HttpParams httpParams = new HttpParams();
httpParams.put("taskId", poiEntity.getTaskId());
httpParams.put("name", poiEntity.getName());
httpParams.put("address", poiEntity.getAddress());
httpParams.put("workType", pictureType);
httpParams.put("memo", poiEntity.getMemo());
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.INSIDE_API_LIST)
.method(OkGoBuilder.GET)
.cls(PoiVideoBean.class)
.params(httpParams)
.callback(new Callback<PoiVideoBean>() {
@Override
public void onSuccess(PoiVideoBean poiVideoBean, int id) {

View File

@ -27,19 +27,25 @@ import androidx.annotation.Nullable;
import com.bumptech.glide.Glide;
import com.github.lazylibrary.util.FileUtils;
import com.github.lazylibrary.util.ZipUtil;
import com.google.gson.Gson;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.PictureActivity;
import com.navinfo.outdoor.activity.PicturesActivity;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.bean.OtherUploadPicBean;
import com.navinfo.outdoor.bean.PoiBean;
import com.navinfo.outdoor.bean.PoiVideoBean;
import com.navinfo.outdoor.bean.RoadExtend;
import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
@ -84,8 +90,11 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
private PoiEntity showPoiEntity;
private ImageView ivRoadFinal;
private RelativeLayout linearExist;
String[] spinner = new String[]{"存在","不存在","无法验证"};
private int body;
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
private Integer body;
private Button roadUpload;
private File videoFile;
private String videoPath;
public static RoadFragment newInstance(Bundle bundle) {
RoadFragment fragment = new RoadFragment();
@ -110,20 +119,20 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
public void onClick(View v) {
Bundle arguments = getArguments();
if (arguments!=null) {
isSliding= arguments.getBoolean("isSliding",true);
Log.d("TAG", "onCreatessss: "+isSliding);
if (arguments != null) {
isSliding = arguments.getBoolean("isSliding", true);
Log.d("TAG", "onCreatessss: " + isSliding);
}
if (isSliding) {
// 监听到返回按钮点击事件
Message obtain = Message.obtain();
obtain.what= Constant.TREASURE_FRAGMENT;
obtain.obj=isSliding;
obtain.what = Constant.TREASURE_FRAGMENT;
obtain.obj = isSliding;
EventBus.getDefault().post(obtain);
Message mainButtonVisiableMsg = Message.obtain();
mainButtonVisiableMsg.what= Constant.MAIN_BUTTON_VISIABLE;
mainButtonVisiableMsg.obj= View.VISIBLE;
mainButtonVisiableMsg.what = Constant.MAIN_BUTTON_VISIABLE;
mainButtonVisiableMsg.obj = View.VISIBLE;
EventBus.getDefault().post(mainButtonVisiableMsg);
}
onBackPressed();
@ -151,6 +160,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
btnRoadSave.setOnClickListener(this::onClick);
rgType = (RadioGroup) findViewById(R.id.rg_type);
linearExist = findViewById(R.id.linear_exist);
roadUpload = findViewById(R.id.road_upload);
roadUpload.setOnClickListener(this::onClick);
Spinner spinnerExist = findViewById(R.id.spinner_exist);
ArrayAdapter<String> adapterExist = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, spinner);
adapterExist.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //设置下拉列表框的下拉选项样式
@ -191,6 +202,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
// disables();
}
private void initShowPoi() {
// 添加信息
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
@ -199,13 +211,14 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if (name != null && !name.equals("")) {
etRoadName.setText(name + "");
}
body=showPoiEntity.getBodyId();
String extend = showPoiEntity.getExtend();
if (extend!=null&& !extend.equals("")){
if (extend != null && !extend.equals("")) {
RoadExtend roadExtend = new Gson().fromJson(extend, RoadExtend.class);
int type= roadExtend.getType();
int type = roadExtend.getType();
showPictureType(type);
}
if (showPoiEntity.getName()!=null){
if (showPoiEntity.getName() != null) {
linearExist.setVisibility(View.VISIBLE);
}
String describe = showPoiEntity.getDescribe();//任务描述
@ -213,7 +226,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
etDesc.setText(describe);
}
String photo = showPoiEntity.getPhoto();
if (photo!=null) {
if (photo != null) {
File videoFile = new File(photo);
if (videoFile.exists()) {
// 使用glide加载视频的第一帧
@ -224,6 +237,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
}
//禁用控件
private void disables() throws JSONException {
etRoadName.setEnabled(false);
@ -296,15 +310,15 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
} else {
poiEntity.setDescribe(desc);
}
if (showPoiEntity!=null){
if (showPoiEntity.getTaskId()!=0){
if (showPoiEntity != null) {
if (showPoiEntity.getTaskId() != 0) {
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
}
if (ivRoadPicture.getTag()!=null) {
if (ivRoadPicture.getTag() != null) {
File videoFile = (File) ivRoadPicture.getTag();
poiEntity.setPhoto(videoFile.getAbsolutePath());
String path = videoFile.getPath()+".txt";
String path = videoFile.getPath() + ".txt";
poiEntity.setPhoto(videoFile.getAbsolutePath());
List<String> strings = FileUtils.readFileToList(path, "utf-8");
ArrayList<LatLng> latLngs = new ArrayList<>();
@ -315,12 +329,12 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
latLng.setLongitude(Double.valueOf(split[3]));
latLngs.add(latLng);
}
if (strings.size()==1){
if (strings.size() == 1) {
LatLng latLng = latLngs.get(0);
latLngs.add(latLng);
}
String lineString = GeometryTools.getLineString(latLngs);
Log.d("TAG", "onGranted: "+lineString);
Log.d("TAG", "onGranted: " + lineString);
poiEntity.setGeoWkt(lineString);
}
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -364,16 +378,89 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String videoFormatName = formatter.format(new Date());
Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER+"/"+videoFormatName+".mp4");
intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER + "/" + videoFormatName + ".mp4");
startActivityForResult(intent, 0x101);
break;
case R.id.road_upload:
ArrayList<File> videoFileList = new ArrayList<>();
if (videoFile != null) {
videoFileList.add(videoFile);
File file = new File(videoFile.getPath() + ".txt");
videoFileList.add(file);
}
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
ZipUtil.zipFiles(videoFileList, fileZip, null);
if (body != null) {
poiVideoUpload(body, fileZip);
} else {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiVideoDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
poiVideoUpload(poiVideoDaoPoiEntity.getBodyId(), fileZip);
}
});
}
}).start();
}
break;
}
}
private void poiVideoUpload(int body, File fileZip) {
if (body == 0) {
Toast.makeText(getActivity(), "请先保存本地在上传", Toast.LENGTH_SHORT).show();
return;
}
if (fileZip==null){
Toast.makeText(getActivity(), "未压缩完成", Toast.LENGTH_SHORT).show();
return;
}
OkGo
// 请求方式和请求url
.<OtherUploadPicBean>post(HttpInterface.POI_VIDEO_UPLOAD_PIC)
// 请求的 tag, 主要用于取消对应的请求
.params("auditId",body)
.params("file",fileZip)
.tag(this)
.execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
@Override
public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
dismissLoadingDialog();
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onSuccess: " + otherUploadPicBeanResponse.toString() + "sssssssssssss");
}
@Override
public void onError(Response<OtherUploadPicBean> response) {
super.onError(response);
dismissLoadingDialog();
Toast.makeText(getActivity(), response.code()+"", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + response.code()+"");
}
});
}
private void poiVideoSave(PoiEntity poiEntity) {
showLoadingDialog();
int pictureType = getPictureType();
if (pictureType == -1) {
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
return;
}
HttpParams httpParams = new HttpParams();
httpParams.put("taskId", poiEntity.getTaskId());
httpParams.put("name", poiEntity.getName());
httpParams.put("address", poiEntity.getAddress());
httpParams.put("workType", pictureType);
httpParams.put("memo", poiEntity.getMemo());
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.INSIDE_API_LIST)
@ -384,7 +471,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
public void onSuccess(PoiVideoBean poiVideoBean, int id) {
dismissLoadingDialog();
body = poiVideoBean.getBody();
body = poiVideoBean.getBody();
poiEntity.setBodyId(body);
poiEntity.setTaskStatus(3);
new Thread(new Runnable() {
@ -416,10 +502,10 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0x101&&resultCode == 0x101) {
if (data!=null&&data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
File videoFile = new File(videoPath);
if (requestCode == 0x101 && resultCode == 0x101) {
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
videoFile = new File(videoPath);
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
ivRoadPicture.setTag(videoFile);
@ -427,6 +513,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
}
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
@ -434,9 +521,9 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
/**
*防止程序崩溃后数据丢失
* 防止程序崩溃后数据丢失
*/
public void initRoadSharePre(){
public void initRoadSharePre() {
//获取SharedPreferences对象方法中两个参数的意思为第一个name
//表示文件名系统将会在/dada/dada/包名/shared_prefs目录下生成
//一个以该参数命名的.xml文件第二个mode表示创建的模式通过查看
@ -463,8 +550,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if (desc != null && !desc.equals("")) {
poiEntity.setDescribe(desc);
}
if (showPoiEntity!=null){
if (showPoiEntity.getTaskId()!=0){
if (showPoiEntity != null) {
if (showPoiEntity.getTaskId() != 0) {
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
}
@ -481,7 +568,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
edit.putString("poiEntity", newPoiEntity);
//提交新值必须执行否则前面的操作都无效
edit.commit();
Log.d("TAG", "initRoadSharePre: "+newPoiEntity);
Log.d("TAG", "initRoadSharePre: " + newPoiEntity);
}
//获取拍照类型
@ -497,8 +584,9 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
return -1;
}
private void showPictureType(int type){
switch (type){
private void showPictureType(int type) {
switch (type) {
case 0:
rbCar.setChecked(true);
break;

View File

@ -54,6 +54,8 @@ public class HttpInterface {
public static final String RECEIVED_CTASK=IPm6+"ctask/1/receivedCtask";//充电站-领取任务
//172.23.139.4:8003/ctask/1/submitCtask?id=8608&name=充电站&address=地址&telephone=18812345678|14712345678&geo=1rn7exd5uhxy&memo=测试备注&sptype=1
public static final String SUBMIT_CTASK=IPm6+"ctask/1/submitCtask";//充电站-保存本地
//172.23.139.4:8003/cstask/1/submitCstask?taskId=0&name=充电站&geo=1rn7exd5uhxy&memo=测试备注&sptype=1&ffid=104&existence=1&detail={"cp_openType":"1,2","cp_floor":1,"cp_availableState":0,"sign_exist":0}
public static final String SUBMIT_CSTASK =IPm6+"cstask/1/submitCstask";//充电桩保存
//172.23.139.4:8003/poitask/1/uploadpic
public static final String POI_TASK_UPLOAD_PIC=IPm6+"poitask/1/uploadpic";//poi-上传
//172.23.139.4:8003/roadtask/1/receivedRoadtask/8569
@ -66,8 +68,10 @@ public class HttpInterface {
public static final String POI_VIDEO_UPLOAD_PIC = IPm6+"poivideotask/1/uploadpic";//poi录像-上传
//http://172.23.139.4:8003/m4/task/1/getPhone?geo=1rn7exd5uhxy
public static final String GET_PHONE = IPm6 + "m4/task/1/getPhone"; //任务搜索
//172.23.139.4:8003/cstask/1/submitCstask?taskId=0&name=充电站&geo=1rn7exd5uhxy&memo=测试备注&sptype=1&ffid=104&existence=1&detail={"cp_openType":"1,2","cp_floor":1,"cp_availableState":0,"sign_exist":0}
public static final String SUBMIT_CSTASK =IPm6+"cstask/1/submitCstask";
// http://172.23.139.4:8003/m4/task/1/getPhone?geo=1rn7exd5uhxy
// public static final String GET_PHONES = IPm6+"m4/task/1/getPhone";//电话区号和电话位数
/**
* 面状任务

View File

@ -24,16 +24,25 @@ public class ChargingPileEntity implements Serializable {
@PrimaryKey(autoGenerate = true) // 设置主键并且自动生长
private int pileId;
private String name;//名称
private String p;//经纬度
private String p;//经纬度 geo加密
private int exist;//是否存在 0不存在1存在
private int cp_floor;//充电桩地面层 地面层是1 地上二层为2向上依次加1地下一层为-1向下依次减1.默认为1
private int sign_exist;//设备标牌是否存在 0不存在1存在
private int cp_availableState;//可以状态 0可以使用有电默认1(不可使用没电)2(维修中)3建设中4规划中
private int cp_availableState;//可用状态 0可以使用有电默认1(不可使用没电)2(维修中)3建设中4规划中
private int cp_openType;// 1.对所有车辆开放 2.对环卫车开放 3.对公交和开放 4.对出租车开放 5.对特种兵车辆开放
private String memo;//备注 默认为空
@TypeConverters(StringTypeConverter.class)
private List<String> photos;//照片组
private long fid;//对应充电站id
public int getCp_openType() {
return cp_openType;
}
public void setCp_openType(int cp_openType) {
this.cp_openType = cp_openType;
}
public int getPileId() {
return pileId;
}

View File

@ -45,6 +45,15 @@ public class PoiEntity implements Serializable {
private int isLocalData;//是否是本地数据 0,服务 1,本地
private int isExclusive;//任务类型 0.普通任务1.专属任务
private int bodyId;//保存本地的bodyId
//private int work_type;//0."车行" 1."自行车" 2."步行" 3."手动"
// public int getWork_type() {
// return work_type;
// }
//
// public void setWork_type(int work_type) {
// this.work_type = work_type;
// }
public String getGeoWkt() {
return geoWkt;

View File

@ -178,16 +178,10 @@
>
<CheckBox
android:id="@+id/check_button5"
android:layout_width="150dp"
android:layout_width="250dp"
android:layout_height="80dp"
android:text="对除环卫,公交,出租,品牌,之外的其他 特种车辆开放"
/>
<CheckBox
android:id="@+id/check_button6"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="对某品牌汽车开放"
/>
</LinearLayout>

View File

@ -136,7 +136,7 @@
</LinearLayout>
<ImageView
android:id="@+id/iv_road_picture"
android:id="@+id/iv_poi_video_picture"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
@ -147,8 +147,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintLeft_toLeftOf="@id/iv_road_picture"
app:layout_constraintTop_toBottomOf="@id/iv_road_picture">
app:layout_constraintLeft_toLeftOf="@id/iv_poi_video_picture"
app:layout_constraintTop_toBottomOf="@id/iv_poi_video_picture">
<RelativeLayout
android:id="@+id/linear_exist"
android:layout_width="match_parent"
@ -224,7 +224,7 @@
app:layout_constraintTop_toBottomOf="@id/ll_desc">
<Button
android:id="@+id/btn_road_save"
android:id="@+id/btn_poi_video_save"
style="@style/user_data_style"
android:layout_width="150dp"
android:layout_height="wrap_content"
@ -232,7 +232,7 @@
android:text="保存本地" />
<Button
android:id="@+id/road_upload"
android:id="@+id/btn_poi_video_upload"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"