This commit is contained in:
wangcongtao
2020-06-08 16:47:42 +08:00
parent 257f2fbf40
commit 592ed900a6
16 changed files with 194 additions and 94 deletions

View File

@@ -16,6 +16,7 @@ import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerNoveltyInfo;
import com.mogo.module.common.entity.MarkerOnlineCar;
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.MarkerShareMusic;
import com.mogo.module.common.entity.MarkerShowEntity;
@@ -110,6 +111,20 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
if ( !result ) {
return false;
}
Map< String, Object > properties = new HashMap<>();
if ( marker.getObject() instanceof MarkerShowEntity ) {
properties.put( "sn", getCarSnFromMarker( marker ) );
if ( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerExploreWay ) {
MarkerExploreWay exploreWay = ( MarkerExploreWay ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj();
properties.put( "dbid", exploreWay.getInfoId() );
properties.put( "type", exploreWay.getPoiType() );
} else if ( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerOnlineCar ) {
properties.put( "type", "10000" );
}
}
MarkerServiceHandler.getMogoAnalytics().track( "v2x_road_click", properties );
} catch ( Exception e ) {
e.printStackTrace();
}
@@ -479,12 +494,38 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
if ( markerCardResult == null ) {
return;
}
JSONArray array = new JSONArray();
List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay();
JSONArray array = new JSONArray();
int size = 0;
size = exploreWayList == null ? 0 : exploreWayList.size();
fillPoiTypeTrackBody( array, ModuleNames.CARD_TYPE_ROAD_CONDITION, size );
final Map< String, Integer > typeCounterMap = new HashMap<>();
for ( int i = 0; i < size; i++ ) {
MarkerExploreWay exploreWay = exploreWayList.get( i );
String poiType = exploreWay.getPoiType();
int counter = 0;
if ( !typeCounterMap.containsKey( poiType ) ) {
counter = 0;
} else {
counter = typeCounterMap.get( poiType );
}
typeCounterMap.put( poiType, counter + 1 );
}
if ( !typeCounterMap.isEmpty() ) {
for ( Map.Entry< String, Integer > entry : typeCounterMap.entrySet() ) {
if ( entry == null || entry.getKey() == null ) {
continue;
}
JSONObject object = new JSONObject();
try {
object.put( "type", entry.getKey() );
object.put( "num", entry.getValue() );
array.put( object );
} catch ( JSONException e ) {
e.printStackTrace();
}
}
}
try {
if ( array.length() == 0 ) {
@@ -492,7 +533,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
final Map< String, Object > properties = new HashMap<>();
properties.put( "data", array.toString() );
MarkerServiceHandler.getMogoAnalytics().track( "Launcher_Data_Get", properties );
MarkerServiceHandler.getMogoAnalytics().track( "v2x_data_get", properties );
} catch ( Exception e ) {
e.printStackTrace();
}
@@ -650,6 +691,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
int limit,
int radius ) {
if ( latLng == null ) {
return;
}
if ( ignoreOnlineCarRequest() ) {
removeCarMarkers();
return;
@@ -668,14 +713,31 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
return;
}
int size = onlineCarList == null ? 0 : onlineCarList.size();
trackData( size );
runOnTargetThread( () -> {
drawOnlineCarMarkers( onlineCarList, Integer.MAX_VALUE );
} );
}
@Override
public void onFail() {
private void trackData( int size ) {
JSONArray array = new JSONArray();
JSONObject object = new JSONObject();
try {
object.put( "type", "10000" );
object.put( "num", size );
array.put( object );
} catch ( JSONException e ) {
e.printStackTrace();
}
if ( array.length() == 0 ) {
return;
}
final Map< String, Object > properties = new HashMap<>();
properties.put( "data", array.toString() );
MarkerServiceHandler.getMogoAnalytics().track( "v2x_data_get", properties );
}
} );
}

View File

@@ -10,5 +10,5 @@ public interface RefreshCallback <T> {
void onSuccess(T o);
void onFail();
default void onFail(){}
}

View File

@@ -101,55 +101,6 @@ public class RefreshModel {
}
}
/**
* 查询在线车辆
*
* @param latLng 经纬度
* @param radius 半径
* @param onlyFocus 是否仅查询已关注的好友
* @param onlySameCity 是否仅查询注册城市相同的同城用户
* @param callback
*/
public void queryOnLineCar( MogoLatLng latLng,
int radius,
boolean onlyFocus,
boolean onlySameCity,
final RefreshCallback callback ) {
if ( mRefreshApiService != null ) {
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
final RefreshBody refreshBody = new RefreshBody();
refreshBody.limit = 100;
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
refreshBody.radius = radius;
refreshBody.onlyFocus = onlyFocus;
refreshBody.onlySameCity = onlySameCity;
refreshBody.dataType.add( ServiceConst.CARD_TYPE_USER_DATA );
query.put( "data", GsonUtil.jsonFromObject( refreshBody ) );
mRefreshApiService.refreshData( query )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( mContext ) ) {
@Override
public void onSuccess( BaseData o ) {
super.onSuccess( o );
if ( callback != null ) {
callback.onSuccess( o );
}
}
@Override
public void onError( String message, int code ) {
super.onError( message, code );
if ( callback != null ) {
callback.onFail();
}
}
} );
}
}
/**
* 查询车辆 及路线
*
@@ -171,6 +122,7 @@ public class RefreshModel {
if ( limit > 0 ) {
refreshBody.limit = limit;
}
refreshBody.radius = radius;
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
refreshBody.onlyFocus = onlyFocus;
refreshBody.onlySameCity = onlySameCity;