解析错误

This commit is contained in:
liujing
2021-11-15 16:16:49 +08:00
parent cb7c7e3bb7
commit 5c008a6907
6 changed files with 172 additions and 116 deletions

View File

@@ -55,7 +55,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
private TextView connect;//连接
private NoticeTrafficAdapter adapter;
private ArrayList dataArrayList = new ArrayList();
private NoticeTrafficStyleInfo mTrafficStyleInfo;
private NoticeTrafficStyleInfo.NoticeTrafficStyleInfoResult mTrafficStyleInfo;
public NoticeTrafficDialog(@NonNull Context context, NoticeTrafficStylePushData pushData) {
super(context);
@@ -156,7 +156,11 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
private void feedBackTraffic(int i) {
CallerNoticeManager.getNoticeProvider().feedBackNoticeTraffic(mPushData.getInfoId(), MoGoAiCloudClientConfig.getInstance().getSn(), i);
if (i == 1) {
startAutoPilot();
try {
startAutoPilot();
} catch (Exception e) {
e.printStackTrace();
}
}
dismiss();
}
@@ -364,15 +368,13 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
@Override
public void callBackWithResult(NoticeTrafficStyleInfo trafficInfo) {
Log.d(TAG, "交通事故详情::" + trafficInfo);
trafficInfo.setOperaStatus("已处理");
trafficInfo.setTroubleReasonName("逆向");
mTrafficStyleInfo = trafficInfo;
infoRefresh(trafficInfo);
mTrafficStyleInfo = trafficInfo.getResult();
infoRefresh(mTrafficStyleInfo);
}
});
}
private void infoRefresh(NoticeTrafficStyleInfo info) {
private void infoRefresh(NoticeTrafficStyleInfo.NoticeTrafficStyleInfoResult info) {
if (dataArrayList.size() > 0) {
dataArrayList.clear();
}
@@ -403,7 +405,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
NoticeValue reason = new NoticeValue();
reason.setKey("事故原因:");
reason.setValue(info.getTroubleReasonName());
reason.setValue(info.getReason());
dataArrayList.add(reason);
NoticeValue status = new NoticeValue();
@@ -417,7 +419,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog {
dataArrayList.add(location);
NoticeValue style = new NoticeValue();
style.setKey("事故类型");
style.setKey("事故等级");
style.setValue(info.getTroubleTypeName());
dataArrayList.add(style);

View File

@@ -7,9 +7,12 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.QueryMap;
@@ -22,12 +25,12 @@ public interface NoticeApiService {
/**
* 获取道路事故详情
*
* @param accidentParameters 请求数据(sn;infoId)
* @return {@link BaseData}
* @param requestBody 请求体(infoId 交警任务id)
* @return {@link NoticeTrafficStyleInfo}
*/
@FormUrlEncoded
@Headers("Content-Type:application/json;charset=UTF-8")
@POST("/deva/accidentInfoManage/queryMyAccidentHandleInfo/server/v1")
Observable<NoticeTrafficStyleInfo> getAccidentInfo(@FieldMap Map<String, String> accidentParameters);
Observable<NoticeTrafficStyleInfo> getAccidentInfo(@Body RequestBody requestBody);
/**

View File

@@ -1,18 +1,24 @@
package com.mogo.eagle.core.function.notice.network;
import android.content.Context;
import android.util.ArrayMap;
import android.util.Log;
import com.google.gson.Gson;
import com.mogo.cloud.network.NetConstants;
import com.mogo.cloud.network.RetrofitFactory;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.network.ParamsProvider;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.data.notice.NoticeNormalDetail;
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
import com.mogo.module.common.drawer.PushRoadConditionDrawer;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.HashMap;
import java.util.Map;
@@ -23,6 +29,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/**
* @author Jing
@@ -54,14 +62,14 @@ public class NoticeNetWorkManager {
* 获取事故详细信息
*
* @param infoId 事故id
* @param sn 车机sn
* @param callBack 回调
*/
public void requestAccidentInfo(String infoId, String sn, NoticeNetCallBack callBack) {
Map<String, String> map = new HashMap<>();
map.put("sn", sn);
map.put("infoId", infoId);
mNoticeApiService.getAccidentInfo(map)
public void requestAccidentInfo(String infoId, String sn,NoticeNetCallBack callBack) {
NoticeRequest request = new NoticeRequest(infoId);
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"),
GsonUtil.jsonFromObject(request));
mNoticeApiService.getAccidentInfo(requestBody)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<NoticeTrafficStyleInfo>() {
@@ -72,6 +80,7 @@ public class NoticeNetWorkManager {
@Override
public void onNext(@NonNull NoticeTrafficStyleInfo noticeTrafficStyleInfo) {
Log.d(TAG, "onNext:"+noticeTrafficStyleInfo);
if (noticeTrafficStyleInfo != null) {
callBack.callBackWithResult(noticeTrafficStyleInfo);
}
@@ -165,4 +174,5 @@ public class NoticeNetWorkManager {
}
}

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.notice.network;
/**
* @author Jing
* @description 描述
* @since: 11/15/21
*/
public class NoticeRequest {
private String infoId;
public NoticeRequest(String infoId) {
this.infoId = infoId;
}
public String getInfoId() {
return infoId;
}
public void setInfoId(String infoId) {
this.infoId = infoId;
}
}

View File

@@ -41,7 +41,7 @@ class TestNoticeBroadcastReceiver : BroadcastReceiver() {
val video: String = "https://view.2amok.com/20200219/012d8e2a55f227e90d76056bb6aab5e4.mp4"
pushData.poiImgUrl = video
pushData.type = 1
pushData.infoId = "909755160571400192"
pushData.infoId = "909821120032526336"
CallerHmiManager.showTrafficBanner(pushData)
}
}