[add] 网络请求添加
This commit is contained in:
@@ -6,6 +6,8 @@ import android.util.Log;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.function.api.notice.IMoGoNoticeProvider;
|
||||
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
|
||||
import com.mogo.eagle.core.function.notice.network.NoticeNetWorkManager;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -37,4 +39,15 @@ public class NoticeProvider implements IMoGoNoticeProvider {
|
||||
mContext = context;
|
||||
NoticeSocketManager.getInstance().registerSocketMessageListener(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void feedBackNoticeTraffic(String infoId, String sn, int accept) {
|
||||
NoticeNetWorkManager.getInstance().sendAccidentAcceptStatus(infoId, sn, accept);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestAccidentInfo(String infoId, String sn, NoticeNetCallBack callBack) {
|
||||
NoticeNetWorkManager.getInstance().requestAccidentInfo(infoId, sn, callBack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.notice.network;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalDetail;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -26,11 +27,11 @@ public interface NoticeApiService {
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/accidentInfoManage/queryMyAccidentHandleInfo/server/v1")
|
||||
Observable<BaseData> getAccidentInfo(@FieldMap Map<String, String> accidentParameters);
|
||||
Observable<NoticeTrafficStyleInfo> getAccidentInfo(@FieldMap Map<String, String> accidentParameters);
|
||||
|
||||
|
||||
/**
|
||||
* 获取道路事故详情
|
||||
* 反馈对道路事件的操作
|
||||
*
|
||||
* @param accidentParameters 请求数据(infoID事故ID;sn;status接受状态 0否 1是)
|
||||
* @return {@link BaseData}
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.mogo.cloud.network.RetrofitFactory;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalDetail;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
|
||||
|
||||
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -46,10 +48,11 @@ public class NoticeNetWorkManager {
|
||||
/**
|
||||
* 获取事故详细信息
|
||||
*
|
||||
* @param infoId 事故id
|
||||
* @param sn
|
||||
* @param infoId 事故id
|
||||
* @param sn 车机sn
|
||||
* @param callBack 回调
|
||||
*/
|
||||
public void requestAccidentInfo(String infoId, String sn) {
|
||||
public void requestAccidentInfo(String infoId, String sn, NoticeNetCallBack callBack) {
|
||||
String snString = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
@@ -57,15 +60,17 @@ public class NoticeNetWorkManager {
|
||||
mNoticeApiService.getAccidentInfo(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseData>() {
|
||||
.subscribe(new Observer<NoticeTrafficStyleInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseData baseData) {
|
||||
|
||||
public void onNext(@NonNull NoticeTrafficStyleInfo noticeTrafficStyleInfo) {
|
||||
if (noticeTrafficStyleInfo != null) {
|
||||
callBack.callBackWithResult(noticeTrafficStyleInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,12 +92,11 @@ public class NoticeNetWorkManager {
|
||||
* @param sn
|
||||
* @param status 是否接受 0否 1是
|
||||
*/
|
||||
public void sendAccidentAcceptStatus(String infoId, String sn, String status) {
|
||||
String snString = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
public void sendAccidentAcceptStatus(String infoId, String sn, int status) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("infoId", infoId);
|
||||
map.put("status", status);
|
||||
map.put("status", String.valueOf(status));
|
||||
mNoticeApiService.sendAcceptStatus(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -129,7 +133,6 @@ public class NoticeNetWorkManager {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("infoId", dbId);
|
||||
|
||||
mNoticeApiService.getNoticeDetail(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -158,5 +161,4 @@ public class NoticeNetWorkManager {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user