From 4eb6eacdea56231e0f3c8d93e1f0036141f8d46b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Fri, 17 Jan 2020 18:55:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=86=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E8=BD=A6=E8=BE=86=E6=9F=A5=E8=AF=A2=E7=9A=84=E5=A2=9E=E9=87=8F?= =?UTF-8?q?=E7=BB=98=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/entity/MarkerCardResult.java | 12 +++++- .../module/service/MarkerServiceHandler.java | 43 +++++++++++-------- 2 files changed, 37 insertions(+), 18 deletions(-) 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);