查看运单显示车辆轨迹
This commit is contained in:
parent
55372ae79c
commit
9072be42ed
@ -84,7 +84,7 @@ android {
|
|||||||
JPUSH_APPKEY : "fba6f55621c670d8c1fe9191",
|
JPUSH_APPKEY : "fba6f55621c670d8c1fe9191",
|
||||||
//暂时填写默认值即可.
|
//暂时填写默认值即可.
|
||||||
JPUSH_CHANNEL: "developer-n"]
|
JPUSH_CHANNEL: "developer-n"]
|
||||||
buildConfigField("String", "BASE_URL", "\"http://app.test.dahehuoyun.com/api/\"")
|
buildConfigField("String", "BASE_URL", "\"https://app.test.dahehuoyun.com/api/\"")
|
||||||
buildConfigField "boolean", "isTest", "true"
|
buildConfigField "boolean", "isTest", "true"
|
||||||
//APP名称,可以在androidMainfest中引用
|
//APP名称,可以在androidMainfest中引用
|
||||||
resValue "string", "appName", "货主端测试"
|
resValue "string", "appName", "货主端测试"
|
||||||
|
130
app/src/main/java/com/oneclouds/cargo/bean/OrderRouterBean.java
Normal file
130
app/src/main/java/com/oneclouds/cargo/bean/OrderRouterBean.java
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
package com.oneclouds.cargo.bean;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName OrderRouterBean
|
||||||
|
* @Author john
|
||||||
|
* @Date 2024/9/23 16:28
|
||||||
|
* @Description TODO
|
||||||
|
*/
|
||||||
|
public class OrderRouterBean {
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private DataDTO data;
|
||||||
|
private String msg;
|
||||||
|
private int res;
|
||||||
|
private boolean success;
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataDTO getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(DataDTO data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRes() {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRes(int res) {
|
||||||
|
this.res = res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccess(boolean success) {
|
||||||
|
this.success = success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DataDTO {
|
||||||
|
private String endLat;
|
||||||
|
private String endLon;
|
||||||
|
private String startLat;
|
||||||
|
private String startLon;
|
||||||
|
|
||||||
|
private ArrayList<PositionDao> vo;
|
||||||
|
|
||||||
|
|
||||||
|
public ArrayList<PositionDao> getVo() {
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVo(ArrayList<PositionDao> vo) {
|
||||||
|
this.vo = vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndLat() {
|
||||||
|
return endLat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndLat(String endLat) {
|
||||||
|
this.endLat = endLat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndLon() {
|
||||||
|
return endLon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndLon(String endLon) {
|
||||||
|
this.endLon = endLon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartLat() {
|
||||||
|
return startLat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartLat(String startLat) {
|
||||||
|
this.startLat = startLat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartLon() {
|
||||||
|
return startLon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartLon(String startLon) {
|
||||||
|
this.startLon = startLon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class PositionDao{
|
||||||
|
private String name;
|
||||||
|
private ArrayList<ArrayList<String>> path;
|
||||||
|
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<ArrayList<String>> getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath(ArrayList<ArrayList<String>> path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -82,6 +82,19 @@ public class WaybillRequest {
|
|||||||
Request re = OkHttpUtil.posts(new OkDate(UrlManager.getWaybillGetExecuteWatbill(), "post", MapUtil.mapJson(map)),getToken(con),con);
|
Request re = OkHttpUtil.posts(new OkDate(UrlManager.getWaybillGetExecuteWatbill(), "post", MapUtil.mapJson(map)),getToken(con),con);
|
||||||
RequestTest.test(1,WAYBILL_GET_EXECUTE_WATBILL,re,con,hd);
|
RequestTest.test(1,WAYBILL_GET_EXECUTE_WATBILL,re,con,hd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取运单车辆 司机轨迹
|
||||||
|
* @param waybillId
|
||||||
|
*/
|
||||||
|
public void getCarRouter(int waybillId){
|
||||||
|
Map<String,Object> map=new HashMap<>();
|
||||||
|
// map.put("waybillId","2535");
|
||||||
|
// map.put("waybillId",waybillId);
|
||||||
|
Request re = OkHttpUtil.posts(new OkDate(UrlManager.getCarRouter()+"?waybillId="+waybillId, "post", MapUtil.mapJson(map)),getToken(con),con);
|
||||||
|
RequestTest.test(1,"CAR_ROUTER",re,con,hd);
|
||||||
|
}
|
||||||
|
|
||||||
//货源详情
|
//货源详情
|
||||||
public void orderDetailAll(int id){
|
public void orderDetailAll(int id){
|
||||||
Map<String,Object> map=new HashMap<>();
|
Map<String,Object> map=new HashMap<>();
|
||||||
|
@ -68,7 +68,7 @@ public class UrlManager {
|
|||||||
//地址信息保存
|
//地址信息保存
|
||||||
private static final String ADDRESS_SAVE = "/app/shipper/address/save";
|
private static final String ADDRESS_SAVE = "/app/shipper/address/save";
|
||||||
private static final String CAR_LOCAION = "waybill/getCarPositioning?carNumber=";
|
private static final String CAR_LOCAION = "waybill/getCarPositioning?carNumber=";
|
||||||
// private static final String COMPANY_SAVE = "/app/shipper/auth/companyInfo";
|
// private static final String COMPANY_SAVE = "/app/shipper/auth/companyInfo";
|
||||||
private static final String COMPANY_SAVE = "/shipper/web/auth/authInfo";
|
private static final String COMPANY_SAVE = "/shipper/web/auth/authInfo";
|
||||||
|
|
||||||
/*--货主认证--*/
|
/*--货主认证--*/
|
||||||
@ -102,6 +102,7 @@ public class UrlManager {
|
|||||||
private static final String WAYBILL_EVALUATION_V3 = "/app/shipper/waybill/evaluationV3";
|
private static final String WAYBILL_EVALUATION_V3 = "/app/shipper/waybill/evaluationV3";
|
||||||
//运单详情
|
//运单详情
|
||||||
private static final String WAYBILL_GET_EXECUTE_WATBILL = "/app/shipper/waybill/getExecuteWaybill";
|
private static final String WAYBILL_GET_EXECUTE_WATBILL = "/app/shipper/waybill/getExecuteWaybill";
|
||||||
|
private static final String CAR_ROUTER = "waybill/getLoc";
|
||||||
//获取双轨迹
|
//获取双轨迹
|
||||||
private static final String WAYBILL_GET_LOC = "/app/shipper/waybill/getLoc";
|
private static final String WAYBILL_GET_LOC = "/app/shipper/waybill/getLoc";
|
||||||
//货源详情
|
//货源详情
|
||||||
@ -388,6 +389,10 @@ public class UrlManager {
|
|||||||
return BASE_URL + WAYBILL_GET_EXECUTE_WATBILL;
|
return BASE_URL + WAYBILL_GET_EXECUTE_WATBILL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getCarRouter() {
|
||||||
|
return BASE_URL + CAR_ROUTER;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getWaybillGetLoc() {
|
public static String getWaybillGetLoc() {
|
||||||
return BASE_URL + WAYBILL_GET_LOC;
|
return BASE_URL + WAYBILL_GET_LOC;
|
||||||
}
|
}
|
||||||
|
@ -41,5 +41,8 @@ public interface Api {
|
|||||||
@POST(BASE_URL+"waybill/getCarPositioning")
|
@POST(BASE_URL+"waybill/getCarPositioning")
|
||||||
Observable<CommonResponseBean<CarLocaBean>> getCarPositioning(@Query("carNumber") String carNumber);
|
Observable<CommonResponseBean<CarLocaBean>> getCarPositioning(@Query("carNumber") String carNumber);
|
||||||
// Observable<CommonResponseBean<CarLocaBean>> getCarPositioning(@Body CarLocaBean carLocaBean);
|
// Observable<CommonResponseBean<CarLocaBean>> getCarPositioning(@Body CarLocaBean carLocaBean);
|
||||||
|
|
||||||
|
@POST(BASE_URL+"waybill/getLoc")
|
||||||
|
Observable<CommonResponseBean<CarLocaBean>> getCarRouter(@Query("waybillId") String waybillId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.oneclouds.cargo.ui.home;
|
package com.oneclouds.cargo.ui.home;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@ -46,10 +47,14 @@ import com.oneclouds.cargo.R;
|
|||||||
import com.oneclouds.cargo.bean.BaseBean;
|
import com.oneclouds.cargo.bean.BaseBean;
|
||||||
import com.oneclouds.cargo.bean.EvaluateBean;
|
import com.oneclouds.cargo.bean.EvaluateBean;
|
||||||
import com.oneclouds.cargo.bean.OrderDetailsBean;
|
import com.oneclouds.cargo.bean.OrderDetailsBean;
|
||||||
|
import com.oneclouds.cargo.bean.OrderRouterBean;
|
||||||
import com.oneclouds.cargo.bean.UserBean;
|
import com.oneclouds.cargo.bean.UserBean;
|
||||||
import com.oneclouds.cargo.request.AddressRequest;
|
import com.oneclouds.cargo.request.AddressRequest;
|
||||||
import com.oneclouds.cargo.request.WaybillRequest;
|
import com.oneclouds.cargo.request.WaybillRequest;
|
||||||
import com.oneclouds.cargo.request.bean.CarLocaBean;
|
import com.oneclouds.cargo.request.bean.CarLocaBean;
|
||||||
|
import com.oneclouds.cargo.request.net.BaseObserver;
|
||||||
|
import com.oneclouds.cargo.request.net.DataManager;
|
||||||
|
import com.oneclouds.cargo.request.net.RxHttpCallBack;
|
||||||
import com.oneclouds.cargo.ui.parts.TypeParts;
|
import com.oneclouds.cargo.ui.parts.TypeParts;
|
||||||
import com.oneclouds.cargo.util.SPUtil;
|
import com.oneclouds.cargo.util.SPUtil;
|
||||||
import com.oneclouds.cargo.util.StringUtil;
|
import com.oneclouds.cargo.util.StringUtil;
|
||||||
@ -94,6 +99,7 @@ public class OrderDetailsActivity extends BaseActivity {
|
|||||||
//是否处于展开状态
|
//是否处于展开状态
|
||||||
private boolean key = false;
|
private boolean key = false;
|
||||||
private int id = 0;
|
private int id = 0;
|
||||||
|
private ArrayList<LatLng> carPoints = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void msgMethod(Message m) {
|
public void msgMethod(Message m) {
|
||||||
@ -138,15 +144,15 @@ public class OrderDetailsActivity extends BaseActivity {
|
|||||||
Type type = new TypeToken<CommonResponseBean<CarLocaBean>>() {
|
Type type = new TypeToken<CommonResponseBean<CarLocaBean>>() {
|
||||||
}.getType();
|
}.getType();
|
||||||
CommonResponseBean<CarLocaBean> getcarlocation = gson.fromJson(CacheGroup.cacheList.get("getcarlocation"), type);
|
CommonResponseBean<CarLocaBean> getcarlocation = gson.fromJson(CacheGroup.cacheList.get("getcarlocation"), type);
|
||||||
if (getcarlocation!=null&& getcarlocation.getData()!=null){
|
if (getcarlocation != null && getcarlocation.getData() != null) {
|
||||||
CarLocaBean data = getcarlocation.getData();
|
CarLocaBean data = getcarlocation.getData();
|
||||||
double lat =new BigDecimal(data.getLat()).setScale(5, RoundingMode.HALF_UP)
|
double lat = new BigDecimal(data.getLat()).setScale(5, RoundingMode.HALF_UP)
|
||||||
.divide(new BigDecimal(600000), RoundingMode.HALF_UP).doubleValue();
|
.divide(new BigDecimal(600000), RoundingMode.HALF_UP).doubleValue();
|
||||||
|
|
||||||
double lon =new BigDecimal(data.getLon()).setScale(5, RoundingMode.HALF_UP)
|
double lon = new BigDecimal(data.getLon()).setScale(5, RoundingMode.HALF_UP)
|
||||||
.divide(new BigDecimal(600000), RoundingMode.HALF_UP).doubleValue();
|
.divide(new BigDecimal(600000), RoundingMode.HALF_UP).doubleValue();
|
||||||
//gws84转高德经纬度
|
//gws84转高德经纬度
|
||||||
CoordinateConverter converter =new CoordinateConverter(con);
|
CoordinateConverter converter = new CoordinateConverter(con);
|
||||||
converter.from(CoordinateConverter.CoordType.GPS);
|
converter.from(CoordinateConverter.CoordType.GPS);
|
||||||
converter.coord(new LatLng(lat, lon));
|
converter.coord(new LatLng(lat, lon));
|
||||||
LatLng desLatLng = converter.convert();
|
LatLng desLatLng = converter.convert();
|
||||||
@ -156,6 +162,61 @@ public class OrderDetailsActivity extends BaseActivity {
|
|||||||
aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(desLatLng, 6));
|
aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(desLatLng, 6));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//车辆轨迹
|
||||||
|
if (CacheGroup.cacheList.get("CAR_ROUTER") != null) {
|
||||||
|
OrderRouterBean bb = gson.fromJson(CacheGroup.cacheList.get("CAR_ROUTER"), OrderRouterBean.class);
|
||||||
|
if (bb.getCode() == 200) {
|
||||||
|
new Thread(() -> {
|
||||||
|
carPoints.clear();
|
||||||
|
ArrayList<ArrayList<String>> path = bb.getData().getVo().get(1).getPath();
|
||||||
|
for (int i = 0; i < path.size(); i++) {
|
||||||
|
if (path.get(i).size() > 1) {
|
||||||
|
double lon = Double.parseDouble(path.get(i).get(0));
|
||||||
|
double lat = Double.parseDouble(path.get(i).get(1));
|
||||||
|
//gws84转高德经纬度
|
||||||
|
// CoordinateConverter converter = new CoordinateConverter(con);
|
||||||
|
// converter.from(CoordinateConverter.CoordType.GPS);
|
||||||
|
// converter.coord(new LatLng(lat, lon));
|
||||||
|
// LatLng convert = converter.convert();
|
||||||
|
// carPoints.add(convert);
|
||||||
|
carPoints.add(new LatLng(lat, lon));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
//绘制起始位置和目的地marker
|
||||||
|
aMap.addMarker(new MarkerOptions()
|
||||||
|
.icon(BitmapDescriptorFactory.fromResource(R.mipmap.qi))
|
||||||
|
.position(new LatLng(Double.parseDouble(bb.getData().getStartLat()),
|
||||||
|
Double.parseDouble(bb.getData().getStartLon()))));
|
||||||
|
|
||||||
|
|
||||||
|
aMap.addMarker(new MarkerOptions()
|
||||||
|
.icon(BitmapDescriptorFactory.fromResource(R.mipmap.zhong))
|
||||||
|
.position(new LatLng(Double.parseDouble(bb.getData().getEndLat()),
|
||||||
|
Double.parseDouble(bb.getData().getEndLon()))));
|
||||||
|
|
||||||
|
aMap.addPolyline((new PolylineOptions())
|
||||||
|
.addAll(carPoints)
|
||||||
|
//线的宽度
|
||||||
|
.width(10)
|
||||||
|
.color(getResources().getColor(R.color.teal_200)));
|
||||||
|
LatLngBounds.Builder builder = LatLngBounds.builder();
|
||||||
|
for (int i = 0; i < carPoints.size(); i++) {
|
||||||
|
builder.include(carPoints.get(i));
|
||||||
|
}
|
||||||
|
//显示全部marker,第二个参数是四周留空宽度
|
||||||
|
aMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(builder.build(), 100, 100, 0, 400));
|
||||||
|
|
||||||
|
});
|
||||||
|
}).start();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(con, bb.getMsg(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
CacheGroup.cacheList.remove("CAR_ROUTER");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
break;
|
break;
|
||||||
@ -191,7 +252,17 @@ public class OrderDetailsActivity extends BaseActivity {
|
|||||||
ub = gson.fromJson(userdata, UserBean.class);
|
ub = gson.fromJson(userdata, UserBean.class);
|
||||||
}
|
}
|
||||||
addressRequest = new AddressRequest(con, hd);
|
addressRequest = new AddressRequest(con, hd);
|
||||||
|
// DataManager.getInstance().getCarRouter("2535")
|
||||||
|
// .compose(DataManager.setThread())
|
||||||
|
// .subscribe(new BaseObserver(con, new RxHttpCallBack<CommonResponseBean<CarLocaBean>>() {
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(CommonResponseBean<CommonResponseBean<CarLocaBean>> t) {
|
||||||
|
// super.onSuccess(t);
|
||||||
|
// }
|
||||||
|
// }));
|
||||||
|
|
||||||
wr = new WaybillRequest(con, hd);
|
wr = new WaybillRequest(con, hd);
|
||||||
|
wr.getCarRouter(id);
|
||||||
wr.orderDetail(id);
|
wr.orderDetail(id);
|
||||||
wr.orderEvaluate(id);
|
wr.orderEvaluate(id);
|
||||||
}
|
}
|
||||||
@ -201,7 +272,7 @@ public class OrderDetailsActivity extends BaseActivity {
|
|||||||
public void initView(Object obj) {
|
public void initView(Object obj) {
|
||||||
super.initView(obj);
|
super.initView(obj);
|
||||||
String waybillStatus = sob.getData().getWaybillStatus();
|
String waybillStatus = sob.getData().getWaybillStatus();
|
||||||
if (waybillStatus.equals("已装货")||waybillStatus.equals("待调度")){
|
if (waybillStatus.equals("已装货") || waybillStatus.equals("待调度")) {
|
||||||
addressRequest.getCarLoca(sob.getData().getCarNumber());
|
addressRequest.getCarLoca(sob.getData().getCarNumber());
|
||||||
}
|
}
|
||||||
// addressRequest.getCarLoca("冀AAH822");
|
// addressRequest.getCarLoca("冀AAH822");
|
||||||
@ -325,7 +396,7 @@ public class OrderDetailsActivity extends BaseActivity {
|
|||||||
initZX(upkey, v, position, o, 1);
|
initZX(upkey, v, position, o, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
initSearch();
|
// initSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initZX(boolean key, View v, int position, Object o, int type) {
|
public void initZX(boolean key, View v, int position, Object o, int type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user