From 4e7771400eb33e30073612a73a699ac9d3fd3280 Mon Sep 17 00:00:00 2001 From: bxb Date: Fri, 17 Mar 2023 19:42:50 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]=E6=94=B6?= =?UTF-8?q?=E9=9B=86=E4=BA=BA=E5=B7=A5=E9=A9=BE=E9=A9=B6=E5=AD=90=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E8=BD=A8=E8=BF=B9=E7=82=B9=E9=80=BB=E8=BE=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/och/sweeper/model/SweeperTaskModel.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/model/SweeperTaskModel.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/model/SweeperTaskModel.java index 5182e28a36..12b9f07723 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/model/SweeperTaskModel.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/model/SweeperTaskModel.java @@ -28,7 +28,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListener import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.CoordinateUtils; import com.mogo.eagle.core.utilcode.util.NetworkUtils; -import com.mogo.eagle.core.utilcode.util.ThreadUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager; import com.mogo.och.common.module.biz.common.socketmessage.data.OCHOperationalMessage; @@ -192,7 +191,7 @@ public class SweeperTaskModel { @Override public void onAutopilotRotting(MessagePad.GlobalPathResp routeList) { - if (null != routeList && routeList.getWayPointsList().size() > 0) { + if (null != routeList && routeList.getWayPointsList()!=null&&routeList.getWayPointsList().size() > 0) { if (mCurrentSubTaskDetail.getLineId() != mLineId) {//判断是否同一条路线 mLineId = mCurrentSubTaskDetail.getLineId(); points.addAll(coordinateConverterWgsToGcjList(mContext, routeList.getWayPointsList())); @@ -311,8 +310,6 @@ public class SweeperTaskModel { + ", mLatitude=" + gnssInfo.getLatitude() + ", mSubTaskType=" + mSubTaskType +", mIsSubTaskWorking=" + mIsSubTaskWorking + ", isAutopilotSubTaskArriveEndSite=" + isAutopilotSubTaskArriveEndSite ); - mLongitude = gnssInfo.getLongitude(); - mLatitude = gnssInfo.getLatitude(); if (mControllerStatusCallback != null) { mControllerStatusCallback.onCarLocationChanged(gnssInfo); } @@ -335,12 +332,10 @@ public class SweeperTaskModel { private void addCoordinates(MogoLocation mogoLatLng) { String tempLongitude = NumberFormatUtil.cutOutNumber(mogoLatLng.getLongitude(), 5); String tempLatitude = NumberFormatUtil.cutOutNumber(mogoLatLng.getLatitude(), 5); - - String latitude = NumberFormatUtil.cutOutNumber(points.get(points.size()-1).latitude, 5); - String longitude = NumberFormatUtil.cutOutNumber(points.get(points.size()-1).longitude, 5); - //用于过滤车是否停在原地,经纬度相同的情况 - if (!tempLongitude.equals(longitude) && !tempLatitude.equals(latitude)) { + if (!tempLongitude.equals(mLongitude) && !tempLatitude.equals(mLatitude)) { + mLongitude = mogoLatLng.getLongitude(); + mLatitude = mogoLatLng.getLatitude(); SweeperRoutePlanningUpdateReqBean.Result result = new SweeperRoutePlanningUpdateReqBean.Result(); result.latitude = mogoLatLng.getLatitude(); result.longitude = mogoLatLng.getLongitude(); From 1e524aea62d40cf0f62ef2ee59a20335b20474ca Mon Sep 17 00:00:00 2001 From: bxb Date: Fri, 17 Mar 2023 19:45:12 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]=E4=BB=8E?= =?UTF-8?q?=E8=87=AA=E9=A9=BE=E8=B7=B3=E8=BD=AC=E5=88=B0=E4=BA=BA=E5=B7=A5?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=97=B6=EF=BC=8C=E9=AB=98=E5=BE=B7=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E5=81=B6=E7=8E=B0=E6=97=A0=E8=B7=AF=E7=BA=BF=E6=88=96?= =?UTF-8?q?=E9=BB=91=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fragment/BaseSweeperTabFragment.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java index c6c6374cbd..3f234b97ba 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java @@ -380,16 +380,31 @@ public abstract class BaseSweeperTabFragment Date: Mon, 20 Mar 2023 16:45:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[=E6=B8=85=E6=89=AB=E8=BD=A6]=E4=BA=BA?= =?UTF-8?q?=E5=B7=A5=E5=AF=BC=E8=88=AA=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fragment/BaseSweeperTabFragment.java | 2 +- .../fragment/SweeperAmapNaviFragment.java | 13 +++ .../och/sweeper/fragment/SweeperFragment.kt | 3 +- .../och/sweeper/net/ISweeperApiService.java | 1 - .../och/sweeper/net/SweeperServiceManager.kt | 91 +++++++++++-------- 5 files changed, 67 insertions(+), 43 deletions(-) diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java index 3f234b97ba..274f62d862 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java @@ -401,11 +401,11 @@ public abstract class BaseSweeperTabFragment>?) { - val map= hashMapOf() - map["serviceAppId"] = MoGoAiCloudClientConfig.getInstance().serviceAppId - map["token"] = MoGoAiCloudClientConfig.getInstance().token - map["sn"] = MoGoAiCloudClientConfig.getInstance().sn + val map = hashMapOf() + map["serviceAppId"] = getServiceAppId() + map["token"] = getToken() + map["sn"] = getCarSN() d(SceneConstant.M_SWEEPER + TAG, "getCurrentTask:" + GsonUtil.jsonFromObject(map)) mService.getCurrentTask( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - MoGoAiCloudClientConfig.getInstance().token, - MoGoAiCloudClientConfig.getInstance().sn + getServiceAppId(), + getToken(), + getCarSN() ) .transformTry() .subscribe(OchCommonSubscribeImpl(context, callback, "getCurrentTask")) @@ -43,31 +43,32 @@ object SweeperServiceManager { */ @JvmStatic fun getMainTaskList(context: Context, callback: OchCommonServiceCallback>>?) { - val map= hashMapOf() - map["serviceAppId"] = MoGoAiCloudClientConfig.getInstance().serviceAppId - map["token"] = MoGoAiCloudClientConfig.getInstance().token - map["sn"] = MoGoAiCloudClientConfig.getInstance().sn + val map = hashMapOf() + map["serviceAppId"] = getServiceAppId() + map["token"] = getToken() + map["sn"] = getCarSN() d(SceneConstant.M_SWEEPER + TAG, "getMainTaskList:" + GsonUtil.jsonFromObject(map)) mService.getMainTaskList( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - MoGoAiCloudClientConfig.getInstance().token, - MoGoAiCloudClientConfig.getInstance().sn + getServiceAppId(), + getToken(), + getCarSN() ) .transformTry() .subscribe(OchCommonSubscribeImpl(context, callback, "getMainTaskList")) } + /** * 获取子任务列表 */ @JvmStatic fun getSubTaskList(taskId: Int, context: Context, callback: OchCommonServiceCallback>>?) { - val map= hashMapOf() - map["carSn"] = MoGoAiCloudClientConfig.getInstance().sn + val map = hashMapOf() + map["carSn"] = getCarSN() map["taskId"] = taskId.toString() d(SceneConstant.M_SWEEPER + TAG, "getSubTaskList:" + GsonUtil.jsonFromObject(map)) mService.getSubTaskList( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - MoGoAiCloudClientConfig.getInstance().token, + getServiceAppId(), + getToken(), map ) .transformTry() @@ -79,13 +80,13 @@ object SweeperServiceManager { */ @JvmStatic fun getSubTaskDetail(subTaskId: Int, context: Context, callback: OchCommonServiceCallback>?) { - val map= hashMapOf() - map["carSn"] = MoGoAiCloudClientConfig.getInstance().sn + val map = hashMapOf() + map["carSn"] = getCarSN() map["taskId"] = subTaskId.toString() d(SceneConstant.M_SWEEPER + TAG, "getSubTaskDetail:" + GsonUtil.jsonFromObject(map)) mService.getSubTaskDetail( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - MoGoAiCloudClientConfig.getInstance().token, + getServiceAppId(), + getToken(), map ) .transformTry() @@ -96,12 +97,12 @@ object SweeperServiceManager { * 子任务开始上报 */ @JvmStatic - fun subTaskStart(isFirst:Boolean,isEnd:Boolean,subTaskId: Int,context: Context, callback: OchCommonServiceCallback>?) { - val subStartRequest = SubStartRequest(MoGoAiCloudClientConfig.getInstance().sn, subTaskId, System.currentTimeMillis(),isFirst,isEnd) + fun subTaskStart(isFirst: Boolean, isEnd: Boolean, subTaskId: Int, context: Context, callback: OchCommonServiceCallback>?) { + val subStartRequest = SubStartRequest(getCarSN(), subTaskId, System.currentTimeMillis(), isFirst, isEnd) d(SceneConstant.M_SWEEPER + TAG, "subTaskStart:" + GsonUtil.jsonFromObject(subStartRequest)) mService.subTaskStart( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - MoGoAiCloudClientConfig.getInstance().token, + getServiceAppId(), + getToken(), subStartRequest ) .transformTry() @@ -112,12 +113,12 @@ object SweeperServiceManager { * 子任务结束上报 */ @JvmStatic - fun subTaskEnd(isFirst:Boolean,isEnd:Boolean,subTaskId: Int,context: Context, callback: OchCommonServiceCallback>?) { - val subStartRequest = SubStartRequest(MoGoAiCloudClientConfig.getInstance().sn, subTaskId, System.currentTimeMillis(),isFirst,isEnd) + fun subTaskEnd(isFirst: Boolean, isEnd: Boolean, subTaskId: Int, context: Context, callback: OchCommonServiceCallback>?) { + val subStartRequest = SubStartRequest(getCarSN(), subTaskId, System.currentTimeMillis(), isFirst, isEnd) d(SceneConstant.M_SWEEPER + TAG, "subTaskEnd:" + GsonUtil.jsonFromObject(subStartRequest)) mService.subTaskEnd( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - MoGoAiCloudClientConfig.getInstance().token, + getServiceAppId(), + getToken(), subStartRequest ) .transformTry() @@ -128,12 +129,12 @@ object SweeperServiceManager { * 子任务跳过上报 */ @JvmStatic - fun subTaskSkip(isFirst:Boolean,isEnd:Boolean,subTaskId: Int,context: Context, callback: OchCommonServiceCallback>?) { - val subStartRequest = SubStartRequest(MoGoAiCloudClientConfig.getInstance().sn, subTaskId, System.currentTimeMillis(),isFirst,isEnd) + fun subTaskSkip(isFirst: Boolean, isEnd: Boolean, subTaskId: Int, context: Context, callback: OchCommonServiceCallback>?) { + val subStartRequest = SubStartRequest(getCarSN(), subTaskId, System.currentTimeMillis(), isFirst, isEnd) d(SceneConstant.M_SWEEPER + TAG, "subTaskSkip:" + GsonUtil.jsonFromObject(subStartRequest)) mService.subTaskSkip( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - MoGoAiCloudClientConfig.getInstance().token, + getServiceAppId(), + getToken(), subStartRequest ) .transformTry() @@ -144,17 +145,29 @@ object SweeperServiceManager { * 主任务重置 */ @JvmStatic - fun mainTaskReset(taskId: Int,context: Context, callback: OchCommonServiceCallback>?) { - val map= hashMapOf() - map["carSn"] = MoGoAiCloudClientConfig.getInstance().sn + fun mainTaskReset(taskId: Int, context: Context, callback: OchCommonServiceCallback>?) { + val map = hashMapOf() + map["carSn"] = getCarSN() map["taskId"] = taskId.toString() d(SceneConstant.M_SWEEPER + TAG, "mainTaskReset:" + GsonUtil.jsonFromObject(map)) mService.mainTaskReset( - MoGoAiCloudClientConfig.getInstance().serviceAppId, - MoGoAiCloudClientConfig.getInstance().token, + getServiceAppId(), + getToken(), map ) .transformTry() .subscribe(OchCommonSubscribeImpl(context, callback, "mainTaskReset")) } + + private fun getCarSN(): String { + return MoGoAiCloudClientConfig.getInstance().sn + } + + private fun getServiceAppId(): String { + return MoGoAiCloudClientConfig.getInstance().serviceAppId + } + + private fun getToken(): String { + return MoGoAiCloudClientConfig.getInstance().token + } } \ No newline at end of file