diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java index 3e20055ccd..9b2db5c224 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java @@ -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.NoticeTrafficAccountInfo mTrafficStyleInfo; public NoticeTrafficDialog(@NonNull Context context, NoticeTrafficStylePushData pushData) { super(context); @@ -139,7 +139,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog { mRecyclerView.setLayoutManager(layoutManager); layoutManager.setOrientation(GridLayoutManager.VERTICAL); NoticeTrafficInfoGridItemDivider gridLayoutDivider = new NoticeTrafficInfoGridItemDivider(1, - (mContext.getResources().getColor(R.color.notice_check_dialog_bg_color))); + (mContext.getResources().getColor(R.color.notice_traffic_line))); mRecyclerView.addItemDecoration(gridLayoutDivider); } catch (Exception e) { e.printStackTrace(); @@ -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,38 +368,26 @@ 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().getAccidentInfo(); + infoRefresh(mTrafficStyleInfo); } }); } - private void infoRefresh(NoticeTrafficStyleInfo info) { + private void infoRefresh(NoticeTrafficStyleInfo.NoticeTrafficAccountInfo info) { if (dataArrayList.size() > 0) { dataArrayList.clear(); } NoticeValue laiYuan = new NoticeValue(); laiYuan.setKey("事故来源:"); - laiYuan.setValue("--"); + laiYuan.setValue(info.getUploadType()); dataArrayList.add(laiYuan); - NoticeValue zeRen = new NoticeValue(); - zeRen.setKey("责 任 方:"); - zeRen.setValue("--"); - dataArrayList.add(zeRen); - NoticeValue cTime = new NoticeValue(); cTime.setKey("事故时间:"); cTime.setValue(DateTimeUtils.getTimeText(info.getDataCreateTime(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm)); dataArrayList.add(cTime); - NoticeValue p = new NoticeValue(); - p.setKey("责 任 人:"); - p.setValue("--"); - dataArrayList.add(p); - NoticeValue hTime = new NoticeValue(); hTime.setKey("处理时间:"); hTime.setValue(DateTimeUtils.getTimeText(info.getDataHandleTime(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm)); @@ -403,12 +395,16 @@ 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(); status.setKey("处理状态:"); - status.setValue(info.getOperaStatus()); + if (info.getOperaStatus() == "0"){ + status.setValue("待处理"); + }else { + status.setValue("已处理"); + } dataArrayList.add(status); NoticeValue location = new NoticeValue(); @@ -417,7 +413,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog { dataArrayList.add(location); NoticeValue style = new NoticeValue(); - style.setKey("事故类型:"); + style.setKey("事故等级:"); style.setValue(info.getTroubleTypeName()); dataArrayList.add(style); diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml index c2f73b11e0..85570384fa 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/notice_dialog_traffic_police.xml @@ -4,6 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="@dimen/notice_traffic_back__width" android:layout_height="@dimen/notice_traffic_back__height" + android:layout_gravity="center" android:background="@drawable/notice_dialog_check_background"> + android:layout_height="wrap_content" + android:paddingTop="4px" + android:background="@color/notice_banner_blue"> diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/color.xml index 5caff3edca..d9bae6a025 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/color.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/color.xml @@ -4,6 +4,6 @@ #1F9BFE #5A8EFD #E63B4577 - #D5D5D4 + #CCD5D5D4 #3B4577 \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml index 20d6dc41a5..fef115a7ad 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml @@ -24,7 +24,9 @@ 54px 56px 62px + 70px 80px + 80px 140px 150px 180px diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeApiService.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeApiService.java index bb9046b992..bb4ca9592f 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeApiService.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeApiService.java @@ -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 getAccidentInfo(@FieldMap Map accidentParameters); + Observable getAccidentInfo(@Body RequestBody requestBody); /** diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeNetWorkManager.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeNetWorkManager.java index da2585dee1..afae6533d9 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeNetWorkManager.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeNetWorkManager.java @@ -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 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() { @@ -72,7 +80,8 @@ public class NoticeNetWorkManager { @Override public void onNext(@NonNull NoticeTrafficStyleInfo noticeTrafficStyleInfo) { - if (noticeTrafficStyleInfo != null) { + Log.d(TAG, "onNext:"+noticeTrafficStyleInfo); + if (noticeTrafficStyleInfo.getResult().getAccidentInfo() != null) { callBack.callBackWithResult(noticeTrafficStyleInfo); } } @@ -165,4 +174,5 @@ public class NoticeNetWorkManager { } + } diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeRequest.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeRequest.java new file mode 100644 index 0000000000..fd28d24d13 --- /dev/null +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/network/NoticeRequest.java @@ -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; + } +} diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt index 1b244171a7..f4620b3373 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/test/TestNoticeBroadcastReceiver.kt @@ -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 = "909754135789686784" CallerHmiManager.showTrafficBanner(pushData) } } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeTrafficStyleInfo.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeTrafficStyleInfo.java index 85171dbf6a..0b13691295 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeTrafficStyleInfo.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/notice/NoticeTrafficStyleInfo.java @@ -10,110 +10,157 @@ import java.io.Serializable; * @since: 10/26/21 */ public class NoticeTrafficStyleInfo extends BaseData { - private String infoId;//事故id - private String poiType;//事故类型 - private long dataCreateTime;//事故发生时间 - private long dataHandleTime;//事故处理时间 - private String operaStatus;//事故处理状态 - private String troubleReasonName;//事故原因 - private String uploadAddress;//事故地点名称 - private String troubleTypeName;//事故等级描述 - private double lat;//纬度 - private double lon;//经度 + public NoticeTrafficStyleInfoResult result; - public String getInfoId() { - return infoId; + public NoticeTrafficStyleInfoResult getResult() { + return result; } - public void setInfoId(String infoId) { - this.infoId = infoId; - } - - public String getPoiType() { - return poiType; - } - - public void setPoiType(String poiType) { - this.poiType = poiType; - } - - public long getDataCreateTime() { - return dataCreateTime; - } - - public void setDataCreateTime(long dataCreateTime) { - this.dataCreateTime = dataCreateTime; - } - - public long getDataHandleTime() { - return dataHandleTime; - } - - public void setDataHandleTime(long dataHandleTime) { - this.dataHandleTime = dataHandleTime; - } - - public String getOperaStatus() { - return operaStatus; - } - - public void setOperaStatus(String operaStatus) { - this.operaStatus = operaStatus; - } - - public String getTroubleReasonName() { - return troubleReasonName; - } - - public void setTroubleReasonName(String troubleReasonName) { - this.troubleReasonName = troubleReasonName; - } - - public String getUploadAddress() { - return uploadAddress; - } - - public void setUploadAddress(String uploadAddress) { - this.uploadAddress = uploadAddress; - } - - public double getLat() { - return lat; - } - - public void setLat(double lat) { - this.lat = lat; - } - - public double getLon() { - return lon; - } - - public void setLon(double lon) { - this.lon = lon; - } - - public String getTroubleTypeName() { - return troubleTypeName; - } - - public void setTroubleTypeName(String troubleTypeName) { - this.troubleTypeName = troubleTypeName; + public void setResult(NoticeTrafficStyleInfoResult result) { + this.result = result; } @Override public String toString() { return "NoticeTrafficStyleInfo{" + - "infoId='" + infoId + '\'' + - ", poiType='" + poiType + '\'' + - ", dataCreateTime=" + dataCreateTime + - ", dataHandleTime=" + dataHandleTime + - ", operaStatus='" + operaStatus + '\'' + - ", troubleReasonName='" + troubleReasonName + '\'' + - ", uploadAddress='" + uploadAddress + '\'' + - ", troubleTypeName='" + troubleTypeName + '\'' + - ", lat=" + lat + - ", lon=" + lon + + "result=" + result + '}'; } + + public class NoticeTrafficAccountInfo implements Serializable{ + private String infoId;//事故id + private String poiType;//事故类型 + private long dataCreateTime;//事故发生时间 + private long dataHandleTime;//事故处理时间 + private String operaStatus;//事故处理状态 + private String reason;//事故原因 + private double lon;//经度 + private double lat;//纬度 + private String troubleTypeName;//事故等级描述 + private String uploadType;//事故等级描述 + private String uploadAddress;//事故地点名称 + public String getInfoId() { + return infoId; + } + + public void setInfoId(String infoId) { + this.infoId = infoId; + } + + public String getPoiType() { + return poiType; + } + + public void setPoiType(String poiType) { + this.poiType = poiType; + } + + public long getDataCreateTime() { + return dataCreateTime; + } + + public void setDataCreateTime(long dataCreateTime) { + this.dataCreateTime = dataCreateTime; + } + + public long getDataHandleTime() { + return dataHandleTime; + } + + public void setDataHandleTime(long dataHandleTime) { + this.dataHandleTime = dataHandleTime; + } + + public String getOperaStatus() { + return operaStatus; + } + + public void setOperaStatus(String operaStatus) { + this.operaStatus = operaStatus; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public String getUploadAddress() { + return uploadAddress; + } + + public void setUploadAddress(String uploadAddress) { + this.uploadAddress = uploadAddress; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } + + public String getTroubleTypeName() { + return troubleTypeName; + } + + public void setTroubleTypeName(String troubleTypeName) { + this.troubleTypeName = troubleTypeName; + } + + public String getUploadType() { + return uploadType; + } + + public void setUploadType(String uploadType) { + this.uploadType = uploadType; + } + + @Override + public String toString() { + return "NoticeTrafficAccountInfo{" + + "infoId='" + infoId + '\'' + + ", poiType='" + poiType + '\'' + + ", dataCreateTime=" + dataCreateTime + + ", dataHandleTime=" + dataHandleTime + + ", operaStatus='" + operaStatus + '\'' + + ", reason='" + reason + '\'' + + ", lon=" + lon + + ", lat=" + lat + + ", troubleTypeName='" + troubleTypeName + '\'' + + ", uploadType='" + uploadType + '\'' + + ", uploadAddress='" + uploadAddress + '\'' + + '}'; + } + } + + public class NoticeTrafficStyleInfoResult implements Serializable{ + private NoticeTrafficAccountInfo accidentInfo; + + public NoticeTrafficAccountInfo getAccidentInfo() { + return accidentInfo; + } + + public void setAccidentInfo(NoticeTrafficAccountInfo accidentInfo) { + this.accidentInfo = accidentInfo; + } + + @Override + public String toString() { + return "NoticeTrafficStyleInfoResult{" + + "accidentInfo=" + accidentInfo + + '}'; + } + } } diff --git a/core/mogo-core-res/src/main/res/layout/item_notice_video_small.xml b/core/mogo-core-res/src/main/res/layout/item_notice_video_small.xml index 2aa7d13372..c04a002a1a 100644 --- a/core/mogo-core-res/src/main/res/layout/item_notice_video_small.xml +++ b/core/mogo-core-res/src/main/res/layout/item_notice_video_small.xml @@ -48,7 +48,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" - android:layout_marginRight="@dimen/notice_current_time_margin_small" android:gravity="center_vertical" android:text="02:23" android:layout_marginBottom="@dimen/notice_time_bottom" @@ -72,7 +71,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" - android:layout_marginLeft="@dimen/notice_current_time_margin_small" android:layout_marginBottom="@dimen/notice_time_bottom" android:text="08:66" android:gravity="center_vertical" diff --git a/core/mogo-core-res/src/main/res/values/dimens.xml b/core/mogo-core-res/src/main/res/values/dimens.xml index 139d0d6104..265d067c33 100644 --- a/core/mogo-core-res/src/main/res/values/dimens.xml +++ b/core/mogo-core-res/src/main/res/values/dimens.xml @@ -3,6 +3,8 @@ 20px 52px + 65px + 200px 300px 300px 60px @@ -60,7 +62,6 @@ 35px 26px - 15px 600px 30px 18px