upload traffic info
This commit is contained in:
@@ -16,6 +16,7 @@ import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.RoadTrafficSegment;
|
||||
import com.mogo.module.common.entity.RoadTrafficStatus;
|
||||
import com.mogo.module.common.entity.UploadTrafficEntity;
|
||||
import com.mogo.module.share.net.TrafficModelData;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
@@ -73,6 +74,8 @@ public class GaoDeAimlessProvider implements IProvider {
|
||||
* @param info
|
||||
*/
|
||||
private void UploadInfo(MogoCongestionInfo info) {
|
||||
UploadTrafficEntity uploadTrafficEntity = new UploadTrafficEntity();
|
||||
List<RoadTrafficStatus> roadTrafficStatusList = new ArrayList<>();
|
||||
RoadTrafficStatus mStatusBean = new RoadTrafficStatus();
|
||||
mStatusBean.setLength(info.getLength());
|
||||
mStatusBean.setRoadName(info.getRoadName());
|
||||
@@ -89,7 +92,9 @@ public class GaoDeAimlessProvider implements IProvider {
|
||||
}
|
||||
mStatusBean.setRoadTrafficSegmentList(mlist);
|
||||
}
|
||||
mTanluModelData.UploadCongestionInfo(mStatusBean);
|
||||
roadTrafficStatusList.add(mStatusBean);
|
||||
uploadTrafficEntity.setRoadTrafficStatuses(roadTrafficStatusList);
|
||||
mTanluModelData.uploadTrafficInfo(uploadTrafficEntity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.share.manager
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearchListener
|
||||
import com.mogo.map.search.traffic.MogoTrafficResult
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.entity.RoadTrafficStatus
|
||||
import com.mogo.module.common.entity.UploadTrafficEntity
|
||||
import com.mogo.module.share.TanluServiceManager
|
||||
@@ -17,6 +18,8 @@ class TrafficUploadManager : IMogoTrafficSearchListener {
|
||||
const val TAG = "TrafficUploadManager"
|
||||
const val TRAFFIC_SEARCH_AREA = 500
|
||||
|
||||
const val TRACK_UPLOAD_INVOKE = "Mogoer_Upload_Traffic_Invoke"
|
||||
|
||||
val trafficUpload by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
TrafficUploadManager()
|
||||
}
|
||||
@@ -35,12 +38,14 @@ class TrafficUploadManager : IMogoTrafficSearchListener {
|
||||
override fun onTrafficSearchError(errorMsg: String?) {
|
||||
errorMsg?.let {
|
||||
Logger.d(TAG, "onTrafficSearchError errorMsg : $errorMsg , So drop this verity and track")
|
||||
//todo 打点
|
||||
val map = hashMapOf<String, Any>("upload" to 2) //调用高德接口失败
|
||||
MogoApisHandler.getInstance().apis.analyticsApi.track(TRACK_UPLOAD_INVOKE, map)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTrafficSearchInfo(trafficResult: MogoTrafficResult?) {
|
||||
//todo Upload 打点
|
||||
val map = hashMapOf<String, Any>("upload" to 1) //调用高德接口成功
|
||||
MogoApisHandler.getInstance().apis.analyticsApi.track(TRACK_UPLOAD_INVOKE, map)
|
||||
trafficResult?.let { trafficResult ->
|
||||
val uploadTrafficEntity = UploadTrafficEntity()
|
||||
val roadTrafficStatusList: MutableList<RoadTrafficStatus> = ArrayList()
|
||||
|
||||
@@ -32,27 +32,18 @@ public class TrafficModelData {
|
||||
mTrafficApiService = network.create(TrafficApiService.class, HttpConstant.getTMCHost());
|
||||
}
|
||||
|
||||
public void uploadTrafficInfo(UploadTrafficEntity uploadTrafficEntity) {
|
||||
Map<String, Object> params = new ParamsProvider.Builder(getApp().getApplicationContext())
|
||||
.append("sn", Utils.getSn())
|
||||
.append("data", GsonUtil.jsonFromObject(uploadTrafficEntity))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 拥堵信息上报
|
||||
*
|
||||
* @param info 高的返回的拥堵信息对象
|
||||
* @param uploadTrafficEntity 高的返回的拥堵信息对象
|
||||
* @param
|
||||
*/
|
||||
public void UploadCongestionInfo(RoadTrafficStatus info) {
|
||||
public void uploadTrafficInfo(UploadTrafficEntity uploadTrafficEntity) {
|
||||
|
||||
final ParamsProvider.Builder builder = new ParamsProvider.Builder( getApp().getApplicationContext());
|
||||
//TODO 添加参数
|
||||
Map<String, Object> parameters = builder.build();
|
||||
parameters.put("sn", Utils.getSn());
|
||||
parameters.put("data",GsonUtil.jsonFromObject(info));
|
||||
parameters.put("data",GsonUtil.jsonFromObject(uploadTrafficEntity));
|
||||
mTrafficApiService.UploadCongestionInfo(parameters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
||||
Reference in New Issue
Block a user