「修改」

替换了道路事件纠错的调用,不再使用小鹏的广播,而是直接调用API接口
/deva/poiInfoFabulous/car/poi/no/addPoiInfoFabulous/v1
This commit is contained in:
董宏宇
2020-08-03 17:07:04 +08:00
parent 71e653d444
commit 156f5f21a2
9 changed files with 80 additions and 86 deletions

View File

@@ -99,10 +99,10 @@ public abstract class V2XBaseViewHolder<T>
*/
public void triggerReportErr(MarkerExploreWay noveltyInfo) {
try {
RoadConditionUtils.sendDataErrorReceiverInfo(
RoadConditionUtils.sendShareReceiverInfo(
noveltyInfo.getPoiType(),
noveltyInfo.getInfoId(),
"1");
3);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
@@ -120,10 +120,10 @@ public abstract class V2XBaseViewHolder<T>
*/
public void triggerReportTrue(MarkerExploreWay noveltyInfo) {
try {
RoadConditionUtils.sendDataErrorReceiverInfo(
RoadConditionUtils.sendShareReceiverInfo(
noveltyInfo.getPoiType(),
noveltyInfo.getInfoId(),
"2");
2);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),

View File

@@ -109,10 +109,10 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder<V2XEventShowEntity> {
*/
private void roadReportTrue() {
if (mExploreWay != null) {
RoadConditionUtils.sendDataErrorReceiverInfo(
RoadConditionUtils.sendShareReceiverInfo(
mExploreWay.getPoiType(),
mExploreWay.getInfoId(),
"2");
2);
}
delayedCloseWindow();
}
@@ -122,10 +122,10 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder<V2XEventShowEntity> {
*/
private void roadReportErr() {
if (mExploreWay != null) {
RoadConditionUtils.sendDataErrorReceiverInfo(
RoadConditionUtils.sendShareReceiverInfo(
mExploreWay.getPoiType(),
mExploreWay.getInfoId(),
"1");
3);
}
delayedCloseWindow();
}

View File

@@ -1,17 +1,15 @@
package com.mogo.module.v2x.network;
import com.mogo.commons.data.BaseData;
import com.mogo.module.common.entity.MarkerCardResult;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
import com.mogo.module.v2x.entity.net.V2XDemoUserInfoRes;
import com.mogo.module.v2x.entity.net.V2XLiveCarRes;
import com.mogo.module.v2x.entity.net.V2XLivePushVoRes;
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
import com.mogo.module.v2x.entity.panel.ShareEventDescription;
import com.mogo.module.v2x.entity.panel.ShareEventItem;
import com.mogo.module.v2x.entity.panel.SurroundingResponse;
import java.util.Map;
@@ -23,7 +21,6 @@ import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
/**
* @author congtaowang
@@ -113,19 +110,24 @@ public interface V2XApiService {
@POST("/yycp-launcherSnapshot/launcherSnapshot/queryIllegalPark")
Observable<MarkerResponse> queryIllegalPark(@FieldMap Map<String, Object> parameters);
/*
* 我的分享-热心指数等
* */
/**
* 我的分享-热心指数等
*/
@FormUrlEncoded
@POST("/deva/poiInfoFabulous/car/poi/no/queryEnthusiasmIndex/v1")
Observable<ShareEventDescription> getEnthusiasmIndex(@FieldMap Map<String, Object> parames);
/*
* 我的分享-列表
* */
/**
* 我的分享-列表
*/
@FormUrlEncoded
@POST("/deva/car/pathAndPoi/no/queryInfo")
Observable<ShareEventItem> getShareEventList(@FieldMap Map<String, Object> parames);
/**
* 点赞接口
*/
@FormUrlEncoded
@POST("/deva/poiInfoFabulous/car/poi/no/addPoiInfoFabulous/v1")
Observable<BaseData> addPoiInfoFabulous(@FieldMap Map<String, Object> params);
}

View File

@@ -28,6 +28,7 @@ import com.mogo.utils.network.utils.GsonUtil;
import java.util.HashMap;
import java.util.Map;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.RequestBody;
@@ -473,4 +474,49 @@ public class V2XRefreshModel {
});
}
}
/**
* 点赞接口
*/
public void addPoiInfoFabulous(V2XRefreshCallback<BaseData> callback,
String infoId,
String poiType,
int likeOrDislike) {
if (mV2XApiService != null) {
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
String json = new StringBuilder()
.append("{")
.append("\"infoId\":").append(infoId)
.append(",")
.append("\"poiType\":").append(poiType)
.append(",")
.append("\"likeOrdislike\":").append(likeOrDislike)
.append(",")
.append("\"sn\":").append(Utils.getSn())
.append("}").toString();
map.put("data", json);
mV2XApiService.addPoiInfoFabulous(map).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) {
if (TextUtils.isEmpty(message)) {
message = "网络错误,请稍后重试";
}
callback.onFail(message);
}
}
});
}
}
}

View File

@@ -1,13 +1,8 @@
package com.mogo.module.v2x.utils;
import android.content.Intent;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : donghongyu
@@ -17,69 +12,21 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* version: 1.0
*/
public class RoadConditionUtils {
/**
* 向探路模块发送消息正确的确认广播
*
* @param poiType 当前poi信息
*/
public static void sendShareReceiverInfo(String poiType) {
if (poiType != null) {
switch (poiType) {
case V2XPoiTypeEnum.FOURS_BLOCK_UP:
sendShareReceiver("1");
break;
case V2XPoiTypeEnum.TRAFFIC_CHECK:
sendShareReceiver("2");
break;
case V2XPoiTypeEnum.ROAD_CLOSED:
sendShareReceiver("3");
break;
}
}
}
/**
* 向探路模块发送数据纠错广播
*
* @param poiType 当前poi信息
* 提交网络
*/
public static void sendDataErrorReceiverInfo(String poiType, String infoId, String updateType) {
sendDataErrorReceiver(infoId, poiType, updateType);
}
/**
* 发送广播 type 1拥堵2交通检查3封路
*/
public static void sendShareReceiver(String type) {
Intent intent = new Intent();
intent.setAction("com.zhidao.roadcondition.share");
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
intent.putExtra("type", type);
V2XUtils.getApp().sendBroadcast(intent);
Logger.d(MODULE_NAME, "通过广播通知探路正确。。。");
}
/**
* 数据错误
*
* @param id 事件ID
* @param poiType 事件类型
*/
public static void sendDataErrorReceiver(String id, String poiType, String updateType) {
public static void sendShareReceiverInfo(String infoId,
String poiType,
int likeOrDislike) {
showTip();
Intent intent = new Intent();
intent.setAction("com.zhidao.tanlu.dataerror");
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
intent.putExtra("id", id);
intent.putExtra("type", poiType);
intent.putExtra("updateType", updateType);
V2XUtils.getApp().sendBroadcast(intent);
Logger.d(MODULE_NAME, "通过广播通知探路纠错:id = " + id + " poiType = " + poiType + " updateType = " + updateType);
sendShareReceiverInfo(poiType);
V2XServiceManager
.getV2XRefreshModel()
.addPoiInfoFabulous(
null,
infoId,
poiType,
likeOrDislike);
}
/**

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -14,7 +14,7 @@
android:id="@+id/rlRoadEventImg"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#5E6079"
android:background="#555A75"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
@@ -24,7 +24,6 @@
android:id="@+id/ivEventImg"
android:layout_width="@dimen/module_v2x_event_image_width"
android:layout_height="@dimen/module_v2x_event_image_height"
android:background="#5E6079"
android:scaleType="center"
app:miv_failureHolder="@drawable/icon_default_black_logo"
app:miv_overlayImageId="@drawable/icon_default_black_logo"