高德轨迹显示异常处理

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

View File

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