高德轨迹显示异常处理

This commit is contained in:
lijia 2024-10-14 10:56:05 +08:00
parent d9ec95fbc8
commit 6d2656a1f7
2 changed files with 38 additions and 32 deletions

View File

@ -30,22 +30,22 @@ import java.util.TimerTask;
public class TrackService extends Service {
private Context con;
private TrackInputBean tib=new TrackInputBean();
private TrackInputBean tib = new TrackInputBean();
private LocationGDUtil l;
private int timeSum=1000*60*3;
private String snn="";
private Gson gson=new Gson();
private int timeSum = 1000 * 60 * 3;
private String snn = "";
private Gson gson = new Gson();
private HuoYuanRequset hyr;
private Handler hd=new Handler(msg -> {
switch (msg.what){
private Handler hd = new Handler(msg -> {
switch (msg.what) {
case RequsetCodeConstants.SUCCESS:
if(CacheGroup.cacheList.get("genzong")!=null){
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get("genzong"),BaseBean.class);
if(bb.getCode()==200){
Log.e("--轨迹上传--","成功");
}else{
Log.e("--轨迹上传失败:--",bb.getMsg());
if (CacheGroup.cacheList.get("genzong") != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get("genzong"), BaseBean.class);
if (bb.getCode() == 200) {
Log.e("--轨迹上传--", "成功");
} else {
Log.e("--轨迹上传失败:--", bb.getMsg());
}
CacheGroup.cacheList.remove("genzong");
}
@ -59,32 +59,34 @@ public class TrackService extends Service {
@Nullable
@Override
public IBinder onBind(Intent intent) {return null; }
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
con=this;
hyr=new HuoYuanRequset(con,hd);
Log.e("开始循环上传等待100ms","-----");
con = this;
hyr = new HuoYuanRequset(con, hd);
Log.e("开始循环上传等待100ms", "-----");
new Timer().schedule(new TimerTask() {
@Override
public void run() {
snn=SPUtil.getSP(con,"order","ShippingNoteNumber");
if(!snn.equals("")) {
snn = SPUtil.getSP(con, "order", "ShippingNoteNumber");
if (!snn.equals("")) {
l = new LocationGDUtil(con, hd);
l.onCreate();
}else{
} else {
onDestroy();
}
}
},100,timeSum);
}, 100, timeSum);
}
//开始
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.e("服务开启","-----");
Log.e("服务开启", "-----");
return START_STICKY;
}
@ -94,16 +96,19 @@ public class TrackService extends Service {
super.onDestroy();
}
public void genzong(){
//经度
tib.setLatitude(l.getLatitude()+"");
//纬度
tib.setLongitude(l.getLongitude()+"");
Log.e("经度",l.getLatitude()+"");
Log.e("维度",l.getLongitude()+"");
//单号
tib.setShippingNoteNumber(snn);
hyr.trackTracking(tib);
public void genzong() {
if (l == null || l.getLatitude() == 0d) {
return;
}
//经度
tib.setLatitude(l.getLatitude() + "");
//纬度
tib.setLongitude(l.getLongitude() + "");
Log.e("经度", l.getLatitude() + "");
Log.e("维度", l.getLongitude() + "");
//单号
tib.setShippingNoteNumber(snn);
hyr.trackTracking(tib);
}
}

View File

@ -694,7 +694,8 @@ public class HomeFragment extends BaseFragment {
qr.getBankCardList();
}
ur.getDriverExpire();
hyr.startOrder(curWaybillId==-1 ? 0 : curWaybillId);
// hyr.startOrder(curWaybillId==-1 ? 0 : curWaybillId);
hyr.startOrder(0);
ur.driverAuthData();
}
// oldTime= Calendar.getInstance().getTimeInMillis();