diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java index d147275d40..1a8e044cf8 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java @@ -7,6 +7,7 @@ import java.util.List; @SuppressWarnings("unused") public class MarkerCardResult implements Serializable { + private List dataType; // 要查询的类型 private List carChat; private List exploreWay; private List onlineCar; @@ -53,10 +54,19 @@ public class MarkerCardResult implements Serializable { this.noveltyInfo = noveltyInfo; } + public List getDataType() { + return dataType; + } + + public void setDataType(List dataType) { + this.dataType = dataType; + } + @Override public String toString() { return "MarkerCardResult{" + - "carChat=" + carChat + + "dataType=" + dataType + + ", carChat=" + carChat + ", exploreWay=" + exploreWay + ", onlineCar=" + onlineCar + ", shareMusic=" + shareMusic + diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java index 3235099c5f..c5b79ad681 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java @@ -265,14 +265,23 @@ public class MarkerServiceHandler { */ public static void drawMapMarker(MarkerResponse response) { lastMarker = null; - getMarkerManager().removeMarkers(); JSONArray array = new JSONArray(); // 解析不同的Marker类型,然后对应的进行绘制 if (response != null && response.getResult() != null) { + MarkerCardResult markerCardResult = response.getResult(); + // 语音触发的在线车辆搜索,采用增量的形式绘制 + if (markerCardResult.getDataType() != null && + markerCardResult.getDataType().size() == 1 && + markerCardResult.getDataType().contains(ServiceConst.CARD_TYPE_USER_DATA)) { + } else { + // 清空所有地图上绘制的Marker + getMarkerManager().removeMarkers(); + } + List carChatList = markerCardResult.getCarChat(); List onlineCarList = markerCardResult.getOnlineCar(); List exploreWayList = markerCardResult.getExploreWay(); @@ -379,26 +388,26 @@ public class MarkerServiceHandler { break; } } - fillNumberTrackEventBody(array,2, num_gas_station); - fillNumberTrackEventBody(array,6, num_road_closed); - fillNumberTrackEventBody(array,5, num_traffic_check); - fillNumberTrackEventBody(array,7, num_shop_discount); - fillNumberTrackEventBody(array,8, num_fours_shop); + fillNumberTrackEventBody(array, 2, num_gas_station); + fillNumberTrackEventBody(array, 6, num_road_closed); + fillNumberTrackEventBody(array, 5, num_traffic_check); + fillNumberTrackEventBody(array, 7, num_shop_discount); + fillNumberTrackEventBody(array, 8, num_fours_shop); } analyticData(array); } } - private static void fillNumberTrackEventBody(JSONArray arr, int type, int size){ - JSONObject object = new JSONObject( ); + private static void fillNumberTrackEventBody(JSONArray arr, int type, int size) { + JSONObject object = new JSONObject(); try { - object.put( "type", type ); - object.put( "num", size); - if ( arr != null ) { - arr.put( object ); + object.put("type", type); + object.put("num", size); + if (arr != null) { + arr.put(object); } - } catch ( JSONException e ) { + } catch (JSONException e) { e.printStackTrace(); } } @@ -406,11 +415,11 @@ public class MarkerServiceHandler { /** * 统计地图内数据获取 * - * @param array 埋点数据 + * @param array 埋点数据 */ private static void analyticData(JSONArray array) { try { - if ( array == null || array.length() == 0 ) { + if (array == null || array.length() == 0) { return; } final Map properties = new HashMap<>(); @@ -432,8 +441,8 @@ public class MarkerServiceHandler { MogoMarkerOptions options = new MogoMarkerOptions() .owner(markerShowEntity.getMarkerType()) - .alpha( 0.7f ) - .object( markerShowEntity ) + .alpha(0.7f) + .object(markerShowEntity) .latitude(markerShowEntity.getMarkerLocation().getLat()) .longitude(markerShowEntity.getMarkerLocation().getLon()); options.icon(markerView);