Merge branch '930' into dev_MogoAP_eagle-1030_211020_8.0.14
This commit is contained in:
@@ -10,7 +10,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.eagle.core.data.notice.NoticeInfo;
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficInfo;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,7 @@ public class NoticeBannerView extends ConstraintLayout {
|
||||
}
|
||||
|
||||
//数据改变刷新UI
|
||||
public void pushBeanChanged(NoticeInfo info){
|
||||
public void pushBeanChanged(NoticeTrafficInfo info){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,15 +9,20 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.data.notice.NoticeValue;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @description 事故详情(事故来源等)呈现
|
||||
* @since: 10/26/21
|
||||
*/
|
||||
class NoticeTrafficAdapter extends RecyclerView.Adapter {
|
||||
LayoutInflater mLayoutInflater;
|
||||
private List<NoticeValue> data = new ArrayList();
|
||||
|
||||
public NoticeTrafficAdapter(@NonNull Context context) {
|
||||
mLayoutInflater = LayoutInflater.from(context);
|
||||
@@ -34,7 +39,9 @@ class NoticeTrafficAdapter extends RecyclerView.Adapter {
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
|
||||
NoticeValue value = data.get(position);
|
||||
((TrafficInfoHolder) holder).keyText.setText(value.getKey());
|
||||
((TrafficInfoHolder) holder).valueText.setText(value.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,14 +41,14 @@ public class NoticeProvider implements IMoGoNoticeProvider {
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
NoticeSocketManager.getInstance().unRegisterSocketMessage();
|
||||
NoticeSocketManager.getInstance().unRegisterSocketMessageListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Log.d(TAG, "init");
|
||||
mContext = context;
|
||||
NoticeSocketManager.getInstance().registerSocketMessage(context);
|
||||
NoticeSocketManager.getInstance().registerSocketMessageListener(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ class NoticeSocketManager {
|
||||
private String TAG = "AINotice";
|
||||
private static NoticeSocketManager mNoticeSocketManager;
|
||||
private NoticeMessageListener mNoticeMessageListener;
|
||||
private static IMogoServiceApis mMoGoServiceApis;
|
||||
private Context mContext;
|
||||
|
||||
public static synchronized NoticeSocketManager getInstance() {
|
||||
@@ -29,23 +28,17 @@ class NoticeSocketManager {
|
||||
return mNoticeSocketManager;
|
||||
}
|
||||
|
||||
public void registerSocketMessage(Context context) {
|
||||
public void registerSocketMessageListener(Context context) {
|
||||
Log.d(TAG, "registerSocketMessage");
|
||||
mContext = context;
|
||||
mNoticeMessageListener = new NoticeMessageListener();
|
||||
if (mMoGoServiceApis == null) {
|
||||
mMoGoServiceApis = (IMogoServiceApis) ARouter.getInstance().build(com.mogo.eagle.core.data.constants.
|
||||
MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
|
||||
}
|
||||
mMoGoServiceApis.
|
||||
getSocketManagerApi(context).
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(context).
|
||||
registerOnMessageListener(100, mNoticeMessageListener);
|
||||
}
|
||||
|
||||
public void unRegisterSocketMessage() {
|
||||
public void unRegisterSocketMessageListener() {
|
||||
if (mNoticeMessageListener != null) {
|
||||
mMoGoServiceApis
|
||||
.getSocketManagerApi(mContext).
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(mContext).
|
||||
unregisterOnMessageListener(100, mNoticeMessageListener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mogo.eagle.core.function.notice.network;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
* @description 云公告相关的短链请求接口定义
|
||||
* @since: 10/28/21
|
||||
*/
|
||||
public interface NoticeApiService {
|
||||
/**
|
||||
* 获取道路事故详情
|
||||
*
|
||||
* @param accidentParameters 请求数据(sn;infoId)
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/accidentInfoManage/queryMyAccidentHandleInfo/server/v1")
|
||||
Observable<BaseData> getAccidentInfo(@FieldMap Map<String, String> accidentParameters);
|
||||
|
||||
|
||||
/**
|
||||
* 获取道路事故详情
|
||||
*
|
||||
* @param accidentParameters 请求数据(infoID事故ID;sn;status接受状态 0否 1是)
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/accidentInfoManage/policeUpdateTroubleStatus")
|
||||
Observable<BaseData> sendAcceptStatus(@FieldMap Map<String, String> accidentParameters);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.mogo.eagle.core.function.notice.network;
|
||||
|
||||
import com.mogo.cloud.network.NetConstants;
|
||||
import com.mogo.cloud.network.RetrofitFactory;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
* @description 云公告网络请求类
|
||||
* @since: 10/28/21
|
||||
*/
|
||||
public class NoticeNetWorkManager {
|
||||
private String TAG = "AINotice";
|
||||
private static volatile NoticeNetWorkManager requestNoticeManager;
|
||||
private final NoticeApiService mNoticeApiService;
|
||||
|
||||
private NoticeNetWorkManager() {
|
||||
mNoticeApiService = RetrofitFactory.INSTANCE.getInstance(NetConstants.DEVA_HOST) //todo 涉及云公告
|
||||
.create(NoticeApiService.class);
|
||||
}
|
||||
|
||||
public static NoticeNetWorkManager getInstance() {
|
||||
if (requestNoticeManager == null) {
|
||||
synchronized (NoticeNetWorkManager.class) {
|
||||
if (requestNoticeManager == null) {
|
||||
requestNoticeManager = new NoticeNetWorkManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return requestNoticeManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取事故详细信息
|
||||
*
|
||||
* @param infoId 事故id
|
||||
* @param sn
|
||||
*/
|
||||
public void requestAccidentInfo(String infoId, String sn) {
|
||||
String snString = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("infoId", infoId);
|
||||
mNoticeApiService.getAccidentInfo(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseData>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseData baseData) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈交警是否接受事故任务
|
||||
*
|
||||
* @param infoId 事故id
|
||||
* @param sn
|
||||
* @param status 是否接受 0否 1是
|
||||
*/
|
||||
public void sendAccidentAcceptStatus(String infoId, String sn, String status) {
|
||||
String snString = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("infoId", infoId);
|
||||
map.put("status", status);
|
||||
mNoticeApiService.sendAcceptStatus(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseData>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseData baseData) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,13 @@ import java.io.Serializable;
|
||||
* @description 交通事故任务详情数据bean
|
||||
* @since: 10/26/21
|
||||
*/
|
||||
public class NoticeInfo implements Serializable {
|
||||
public class NoticeTrafficInfo implements Serializable {
|
||||
private String infoId;//事故id
|
||||
private String poiType;//事故类型
|
||||
private long dataCreateTime;//事故发生时间
|
||||
private long dataHandleTime;//事故处理时间
|
||||
private String operaStatus;//事故状态
|
||||
private String reason;//事故原因
|
||||
private String troubleReasonName;//事故原因
|
||||
|
||||
public String getInfoId() {
|
||||
return infoId;
|
||||
@@ -22,6 +23,14 @@ public class NoticeInfo implements Serializable {
|
||||
this.infoId = infoId;
|
||||
}
|
||||
|
||||
public String getPoiType() {
|
||||
return poiType;
|
||||
}
|
||||
|
||||
public void setPoiType(String poiType) {
|
||||
this.poiType = poiType;
|
||||
}
|
||||
|
||||
public long getDataCreateTime() {
|
||||
return dataCreateTime;
|
||||
}
|
||||
@@ -46,22 +55,23 @@ public class NoticeInfo implements Serializable {
|
||||
this.operaStatus = operaStatus;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
public String getTroubleReasonName() {
|
||||
return troubleReasonName;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
public void setTroubleReasonName(String troubleReasonName) {
|
||||
this.troubleReasonName = troubleReasonName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NoticeInfo{" +
|
||||
return "NoticeTrafficInfo{" +
|
||||
"infoId='" + infoId + '\'' +
|
||||
", poiType='" + poiType + '\'' +
|
||||
", dataCreateTime=" + dataCreateTime +
|
||||
", dataHandleTime=" + dataHandleTime +
|
||||
", operaStatus='" + operaStatus + '\'' +
|
||||
", reason='" + reason + '\'' +
|
||||
", troubleReasonName='" + troubleReasonName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.mogo.eagle.core.data.notice;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
* @description 存储交通事故键值对value
|
||||
* @since: 10/28/21
|
||||
*/
|
||||
public class NoticeValue implements Serializable {
|
||||
private String key;
|
||||
private String value;
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NoticeValue{" +
|
||||
"key='" + key + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user