[opt] 司乘弱网缓存
This commit is contained in:
@@ -57,6 +57,8 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
api project(":OCH:mogo-och-data")
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
api rootProject.ext.dependencies.mogoutils
|
||||
api rootProject.ext.dependencies.mogocommons
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.mogo.och.common.module.bean
|
||||
|
||||
import com.mogo.och.common.module.bean.dpmsg.DPMsgType
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/14
|
||||
*/
|
||||
data class AppConnectMsg(var isViewShow: Boolean,var isPlay: Boolean,var msg: String)
|
||||
data class AppConnectMsg(var isViewShow: Boolean,var isPlay: Boolean,var msg: String
|
||||
,var type:Int = DPMsgType.TYPE_COMMON.type
|
||||
)
|
||||
|
||||
@@ -8,5 +8,6 @@ enum class DPMsgType(val type: Int) {
|
||||
TYPE_COMMON(0), //常规
|
||||
TYPE_CHANGE_DEST(1),// 变更目的地确认
|
||||
TYPE_OPEN_CLOSE_DOOR(2),//开关门
|
||||
TYPE_ORDER_CLOSED(3) // 订单结束
|
||||
TYPE_ORDER_CLOSED(3), // 订单结束
|
||||
TYPE_TASK_DETAILS(4) //路线任务详情
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
@@ -101,4 +102,12 @@ public class DateTimeUtil {
|
||||
public static long getCurrentTimeStamp(){
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public static long getTodayStartTime(){
|
||||
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+8"));
|
||||
calendar.set(Calendar.HOUR_OF_DAY,0);
|
||||
calendar.set(Calendar.MINUTE,0);
|
||||
calendar.set(Calendar.SECOND,0);
|
||||
return calendar.getTimeInMillis();
|
||||
}
|
||||
}
|
||||
|
||||
1
OCH/mogo-och-data/.gitignore
vendored
Normal file
1
OCH/mogo-och-data/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
46
OCH/mogo-och-data/build.gradle
Normal file
46
OCH/mogo-och-data/build.gradle
Normal file
@@ -0,0 +1,46 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 31
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 31
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.7.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
api rootProject.ext.dependencies.mogoutils
|
||||
}else {
|
||||
api project(":core:mogo-core-utils")
|
||||
}
|
||||
}
|
||||
0
OCH/mogo-och-data/consumer-rules.pro
Normal file
0
OCH/mogo-och-data/consumer-rules.pro
Normal file
21
OCH/mogo-och-data/proguard-rules.pro
vendored
Normal file
21
OCH/mogo-och-data/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.och.data
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.mogo.och.data.test", appContext.packageName)
|
||||
}
|
||||
}
|
||||
5
OCH/mogo-och-data/src/main/AndroidManifest.xml
Normal file
5
OCH/mogo-och-data/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.och.data">
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.mogo.och.data.bean
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/3/27
|
||||
*/
|
||||
|
||||
object BusCacheKey{
|
||||
const val BUS_LINE_CACHE = "bus_line_cache"
|
||||
}
|
||||
|
||||
data class LoginCacheStatus(var login: Boolean,var updateTime: Long)
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
package com.mogo.och.data.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,6 +16,8 @@ public class BusRoutesResult {
|
||||
private int status;
|
||||
private long taskTime; //线路时间班次
|
||||
private int taskId;// 线路班次id
|
||||
private String runningDur; //运营时间
|
||||
private long writeVersion; //更新时间戳
|
||||
|
||||
//线路轨迹相关字段
|
||||
public String csvFileUrl = ""; //轨迹文件下载的cos url,默认“”
|
||||
@@ -30,6 +32,14 @@ public class BusRoutesResult {
|
||||
public String txtFileMd5DPQP = ""; //轨迹文件md5,默认“”
|
||||
public long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
|
||||
public String getRunningDur() {
|
||||
return runningDur;
|
||||
}
|
||||
|
||||
public void setRunningDur(String runningDur) {
|
||||
this.runningDur = runningDur;
|
||||
}
|
||||
|
||||
public int getLineId() {
|
||||
return lineId;
|
||||
}
|
||||
@@ -54,16 +64,26 @@ public class BusRoutesResult {
|
||||
return taskTime;
|
||||
}
|
||||
|
||||
public long getWriteVersion() {
|
||||
return writeVersion;
|
||||
}
|
||||
|
||||
public void setWriteVersion(long writeVersion) {
|
||||
this.writeVersion = writeVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusRoutesResult{" +
|
||||
"sites=" + sites +
|
||||
", lineId=" + lineId +
|
||||
", name='" + name + '\'' +
|
||||
", taskTime='" + taskTime + '\'' +
|
||||
", lineType=" + lineType +
|
||||
", description='" + description + '\'' +
|
||||
", status=" + status +
|
||||
", taskTime=" + taskTime +
|
||||
", taskId=" + taskId +
|
||||
", writeVersion=" + writeVersion +
|
||||
", csvFileUrl='" + csvFileUrl + '\'' +
|
||||
", csvFileMd5='" + csvFileMd5 + '\'' +
|
||||
", txtFileUrl='" + txtFileUrl + '\'' +
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
package com.mogo.och.data.bean;
|
||||
|
||||
/**
|
||||
* 单个网约车小巴车站信息
|
||||
28
OCH/mogo-och-data/src/main/java/com/mogo/och/data/manager/cache/CacheDataManager.kt
vendored
Normal file
28
OCH/mogo-och-data/src/main/java/com/mogo/och/data/manager/cache/CacheDataManager.kt
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.mogo.och.data.manager.cache
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/3/27
|
||||
*/
|
||||
class CacheDataManager private constructor(){
|
||||
companion object{
|
||||
val instance: CacheDataManager by lazy (mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
CacheDataManager()
|
||||
}
|
||||
}
|
||||
|
||||
fun putCacheData(context: Context, key:String, jsonStr: String){
|
||||
SharedPrefsMgr.getInstance(context).putString(key,jsonStr)
|
||||
}
|
||||
|
||||
fun getCacheData(context: Context, key: String) : String{
|
||||
return SharedPrefsMgr.getInstance(context).getString(key)
|
||||
}
|
||||
|
||||
fun clearCacheData(context: Context, key: String){
|
||||
SharedPrefsMgr.getInstance(context).remove(key)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.och.data
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
implementation project(":OCH:mogo-och-common-module")
|
||||
// implementation project(":OCH:mogo-och-data")
|
||||
compileOnly project(":libraries:mogo-map")
|
||||
implementation project(':core:mogo-core-res')
|
||||
testImplementation 'junit:junit:4.12'
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mogo.och.bus.passenger.R;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil;
|
||||
import com.mogo.och.common.module.wigets.MarqueeTextView;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,9 +31,9 @@ import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STAT
|
||||
public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private Context mContext;
|
||||
private List<BusPassengerStation> mStations;
|
||||
private List<BusStationBean> mStations;
|
||||
|
||||
public BusPassengerLineStationsAdapter(Context context, List<BusPassengerStation> stations){
|
||||
public BusPassengerLineStationsAdapter(Context context, List<BusStationBean> stations){
|
||||
this.mContext = context;
|
||||
this.mStations = stations;
|
||||
}
|
||||
@@ -47,7 +48,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
BusPassengerStation station = mStations.get(position);
|
||||
BusStationBean station = mStations.get(position);
|
||||
StationViewHolder viewHolder = (StationViewHolder)holder;
|
||||
viewHolder.stationName.setText(station.getName());
|
||||
BlinkAnimationUtil.clearAnimation(viewHolder.stationCircle);
|
||||
@@ -75,7 +76,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
|
||||
viewHolder.groupStationTagPanel.setVisibility(View.GONE);
|
||||
}
|
||||
viewHolder.curArrowBg.setVisibility(View.VISIBLE);
|
||||
BusPassengerStation preStation = mStations.get(position -1);
|
||||
BusStationBean preStation = mStations.get(position -1);
|
||||
if (station.getDrivingStatus() == STATION_STATUS_LEAVING ||
|
||||
(station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving())){ //过站
|
||||
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.bus.passenger.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口请求响应结果 返回的是对应司机屏的线路信息
|
||||
@@ -8,13 +9,13 @@ import com.mogo.eagle.core.data.BaseData;
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusPassengerRoutesResponse extends BaseData {
|
||||
private BusPassengerRoutesResult data;
|
||||
private BusRoutesResult data;
|
||||
|
||||
public BusPassengerRoutesResult getResult() {
|
||||
public BusRoutesResult getResult() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setResult(BusPassengerRoutesResult data) {
|
||||
public void setResult(BusRoutesResult data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ public class BusPassengerRoutesResult {
|
||||
private int status;
|
||||
private String runningDur; //运营时间
|
||||
private long taskTime; //线路时间班次
|
||||
private long writeVersion;//更新时间戳
|
||||
|
||||
public List<BusPassengerStation> getSites() {
|
||||
return sites;
|
||||
@@ -46,6 +47,10 @@ public class BusPassengerRoutesResult {
|
||||
return runningDur;
|
||||
}
|
||||
|
||||
public long getWriteVersion() {
|
||||
return writeVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusPassengerRoutesResult{" +
|
||||
@@ -55,6 +60,7 @@ public class BusPassengerRoutesResult {
|
||||
", lineType=" + lineType +
|
||||
", description='" + description + '\'' +
|
||||
", status=" + status +
|
||||
", writeVersion="+ writeVersion+
|
||||
", runningDur='" + runningDur + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface IBusPassengerRouteLineInfoCallback {
|
||||
void updateLineInfo(String lineName, String lineDurTime);
|
||||
void updateStationsInfo(List<BusPassengerStation> stations, int currentStationIndex, boolean isArrived);
|
||||
void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived);
|
||||
void showNoTaskView();
|
||||
void hideNoTaskView();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,17 @@ import com.mogo.commons.module.intent.IMogoIntentListener;
|
||||
import com.mogo.commons.module.intent.IntentManager;
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener;
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener;
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
|
||||
import com.mogo.och.common.module.bean.AppConnectMsg;
|
||||
import com.mogo.och.common.module.bean.dpmsg.DPMsgType;
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager;
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.commons.module.status.StatusDescriptor;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
@@ -39,9 +50,6 @@ import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.och.bus.passenger.R;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResult;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerAutopilotPlanningCallback;
|
||||
@@ -53,6 +61,8 @@ import com.mogo.och.bus.passenger.network.BusPassengerServiceManager;
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -91,9 +101,9 @@ public class BusPassengerModel {
|
||||
|
||||
private MogoLocation mLocation = null;
|
||||
|
||||
private BusPassengerRoutesResult routesResult = null;
|
||||
private BusRoutesResult routesResult = null;
|
||||
|
||||
List<BusPassengerStation> mStations = new ArrayList<>();
|
||||
List<BusStationBean> mStations = new ArrayList<>();
|
||||
private int mNextStationIndex = 0;// 要到达站的index
|
||||
private List<MogoLocation> mTwoStationsRouts = new ArrayList<>();
|
||||
private int mPreRouteIndex = 0;
|
||||
@@ -172,23 +182,19 @@ public class BusPassengerModel {
|
||||
public void onSuccess(BusPassengerRoutesResponse data) {
|
||||
if ( data == null || data.getResult() == null) {
|
||||
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = null");
|
||||
if (routesResult != null) {
|
||||
routesResult = null;
|
||||
mNextStationIndex = 0;
|
||||
startOrStopCalculateRouteInfo(false);
|
||||
if (mRouteLineInfoCallback != null){
|
||||
mRouteLineInfoCallback.showNoTaskView();
|
||||
}
|
||||
}
|
||||
|
||||
clearLocalRouteResult();
|
||||
return;
|
||||
}
|
||||
if (routesResult != null && data.getResult().equals(routesResult)){
|
||||
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = not update");
|
||||
return;
|
||||
}
|
||||
routesResult = data.getResult();
|
||||
updatePassengerRouteInfo(data.getResult());
|
||||
|
||||
if (routesResult != null &&
|
||||
routesResult.getWriteVersion() < data.getResult().getWriteVersion()){
|
||||
routesResult = data.getResult();
|
||||
}
|
||||
updatePassengerRouteInfo(routesResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -211,16 +217,29 @@ public class BusPassengerModel {
|
||||
});
|
||||
}
|
||||
|
||||
private void updatePassengerRouteInfo(BusPassengerRoutesResult result) {
|
||||
private void clearLocalRouteResult() {
|
||||
if (routesResult != null) {
|
||||
routesResult = null;
|
||||
mNextStationIndex = 0;
|
||||
startOrStopCalculateRouteInfo(false);
|
||||
if (mRouteLineInfoCallback != null){
|
||||
mRouteLineInfoCallback.showNoTaskView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePassengerRouteInfo(BusRoutesResult result) {
|
||||
if (routesResult == null) return;
|
||||
|
||||
if (mRouteLineInfoCallback != null){
|
||||
mRouteLineInfoCallback.updateLineInfo(result.getName(),result.getRunningDur());
|
||||
mRouteLineInfoCallback.hideNoTaskView();
|
||||
if (result.getSites() != null){
|
||||
List<BusPassengerStation> stations = result.getSites();
|
||||
List<BusStationBean> stations = result.getSites();
|
||||
mStations.clear();
|
||||
mStations.addAll(stations);
|
||||
for (int i = 0; i< stations.size(); i++){
|
||||
BusPassengerStation station = stations.get(i);
|
||||
BusStationBean station = stations.get(i);
|
||||
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving() && i+1 < stations.size()){
|
||||
mRouteLineInfoCallback.updateStationsInfo(stations,i+1,false);
|
||||
if(mNextStationIndex != i+1){
|
||||
@@ -283,6 +302,9 @@ public class BusPassengerModel {
|
||||
//2021.11.1 自动驾驶路线规划接口
|
||||
CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
|
||||
|
||||
//监听司机端消息
|
||||
CallerTelematicListenerManager.INSTANCE.addListener(TAG,mReceivedMsgListener);
|
||||
|
||||
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
|
||||
}
|
||||
|
||||
@@ -299,8 +321,39 @@ public class BusPassengerModel {
|
||||
CallerPlanningRottingListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
|
||||
|
||||
AbnormalFactorsLoopManager.INSTANCE.stopLoopAbnormalFactors();
|
||||
|
||||
CallerTelematicListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
private final IReceivedMsgListener mReceivedMsgListener = new IReceivedMsgListener() {
|
||||
@Override
|
||||
public void onReceivedMsg(int type, @NonNull byte[] byteArray) {
|
||||
if (OchCommonConst.BUSINESS_STRING == type){
|
||||
|
||||
AppConnectMsg msg = GsonUtils.fromJson(new String(byteArray), AppConnectMsg.class);
|
||||
Logger.d(SceneConstant.M_BUS_P+TAG,"onReceivedMsg = "+GsonUtils.toJson(msg));
|
||||
if (msg.getType() == DPMsgType.TYPE_TASK_DETAILS.getType()){
|
||||
if (msg.getMsg().isEmpty()){
|
||||
clearLocalRouteResult();
|
||||
return;
|
||||
}
|
||||
BusRoutesResult result = GsonUtils.fromJson(msg.getMsg(),BusRoutesResult.class);
|
||||
if (result.getWriteVersion() > routesResult.getWriteVersion()){
|
||||
routesResult = result;
|
||||
updatePassengerRouteInfo(routesResult);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (msg.isViewShow()){ //消息盒子显示内容
|
||||
OCHSocketMessageManager.INSTANCE.pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(),msg.getMsg(),
|
||||
OCHSocketMessageManager.OPERATION_SYSTEM);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//监听网络变化,避免启动机器时无网导致无法更新订单信息
|
||||
private final IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() {
|
||||
@Override
|
||||
@@ -437,8 +490,8 @@ public class BusPassengerModel {
|
||||
if (mStations.size() > 1){ //两个站点及以上要计算两个站点间的轨迹路线
|
||||
if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex - 1 >=0){
|
||||
mTwoStationsRouts.clear();
|
||||
BusPassengerStation stationNext = mStations.get(mNextStationIndex);
|
||||
BusPassengerStation stationCur = mStations.get(mNextStationIndex - 1);
|
||||
BusStationBean stationNext = mStations.get(mNextStationIndex);
|
||||
BusStationBean stationCur = mStations.get(mNextStationIndex - 1);
|
||||
//当前站在轨迹中对应的点
|
||||
int currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(0
|
||||
,mRoutePoints
|
||||
@@ -487,7 +540,7 @@ public class BusPassengerModel {
|
||||
float lastSumLength = 0;
|
||||
if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex >= 0){
|
||||
BusPassengerStation stationNext = mStations.get(mNextStationIndex);
|
||||
BusStationBean stationNext = mStations.get(mNextStationIndex);
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
stationNext.getGcjLon(), stationNext.getGcjLat(),
|
||||
mLocation.getLongitude(), mLocation.getLatitude());
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerRouteLineInfoCallback;
|
||||
import com.mogo.och.bus.passenger.model.BusPassengerModel;
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -131,7 +132,7 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStationsInfo(List<BusPassengerStation> stations,int currentStationIndex,boolean isArrived) {
|
||||
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
|
||||
runOnUIThread(() -> mView.updateStationsInfo(stations,currentStationIndex, isArrived));
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter;
|
||||
import com.mogo.och.bus.passenger.ui.layoutmanager.CenterLayoutManager;
|
||||
import com.mogo.och.bus.passenger.utils.BPRouteDataTestUtils;
|
||||
import com.mogo.och.common.module.wigets.MarqueeTextView;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -42,7 +43,7 @@ public class BusPassengerRouteFragment extends
|
||||
|
||||
private final String TAG = "BusPassengerRouteFragment";
|
||||
|
||||
private final List<BusPassengerStation> mStationsList = new ArrayList<>();
|
||||
private final List<BusStationBean> mStationsList = new ArrayList<>();
|
||||
|
||||
private TextView mSpeedTv;
|
||||
private ConstraintLayout mNoLineInfoView;
|
||||
@@ -236,7 +237,7 @@ public class BusPassengerRouteFragment extends
|
||||
* @param currentStationIndex
|
||||
* @param isArrived 是否到站并离开,true 到达当前站 currentStationIndex 未离开, false 正在前往此站 currentStationIndex
|
||||
*/
|
||||
public void updateStationsInfo(List<BusPassengerStation> stations, int currentStationIndex,boolean isArrived) {
|
||||
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
|
||||
updateArrivedStation(stations.get(currentStationIndex).getName(),currentStationIndex,isArrived);
|
||||
mStationsList.clear();
|
||||
mStationsList.addAll(stations);
|
||||
@@ -257,7 +258,7 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWayPointList(List<BusPassengerStation> stations,int currentStationIndex) {
|
||||
private void updateWayPointList(List<BusStationBean> stations,int currentStationIndex) {
|
||||
List<LatLng> mLineStationsList = new ArrayList<>();
|
||||
for (int i = 0; i< stations.size(); i++) {//站点集合
|
||||
// LatLng latLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(getContext()
|
||||
|
||||
@@ -56,6 +56,7 @@ dependencies {
|
||||
compileOnly rootProject.ext.dependencies.recyclerviewadapterhelper
|
||||
|
||||
implementation project(":OCH:mogo-och-common-module")
|
||||
implementation project(":OCH:mogo-och-data")
|
||||
compileOnly project(":libraries:mogo-map")
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
|
||||
/**
|
||||
* 中止/结束任务请求
|
||||
@@ -9,9 +10,11 @@ public class BusCloseTaskRequest {
|
||||
|
||||
private String sn;
|
||||
private int taskId;
|
||||
private long writeVersion;
|
||||
public BusCloseTaskRequest(int taskId) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.taskId = taskId;
|
||||
this.writeVersion = DateTimeUtil.getCurrentTimeStamp();
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
@@ -9,9 +10,11 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
public class BusResetDrivingLineRequest {
|
||||
public String sn;
|
||||
public int taskId; //切换到的线路id
|
||||
public long writeVersion; //更新时间戳
|
||||
|
||||
public BusResetDrivingLineRequest(int taskId) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.taskId = taskId;
|
||||
this.writeVersion = DateTimeUtil.getCurrentTimeStamp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口请求响应结果
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -14,11 +15,13 @@ public class BusUpdateSiteStatusRequest {
|
||||
public int taskId;
|
||||
public int seq;//站点序号
|
||||
public int siteId;//站点id
|
||||
public long writeVersion; //更新时间戳
|
||||
|
||||
public BusUpdateSiteStatusRequest(int taskId,int siteId,int seq) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.seq = seq;
|
||||
this.siteId = siteId;
|
||||
this.taskId = taskId;
|
||||
this.writeVersion = DateTimeUtil.getCurrentTimeStamp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.callback;
|
||||
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -36,16 +36,14 @@ import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView;
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
|
||||
import com.mogo.eagle.core.function.smp.view.SmallMapView;
|
||||
import com.mogo.eagle.core.function.view.MapBizView;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.model.OrderModel;
|
||||
import com.mogo.och.bus.util.BDRouteDataTestUtils;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.net.login.LoginBusImpl;
|
||||
import com.mogo.och.bus.presenter.BusPresenter;
|
||||
|
||||
@@ -26,7 +26,8 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.common.module.bean.dpmsg.DPMsgType;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.data.SystemMsg;
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
@@ -44,7 +45,7 @@ import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.bean.WriteOffPassenger;
|
||||
import com.mogo.och.bus.callback.IBusADASStatusCallback;
|
||||
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
|
||||
@@ -67,9 +68,10 @@ import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch;
|
||||
import com.mogo.och.common.module.voice.VoiceManager;
|
||||
import com.mogo.och.common.module.voice.VoiceNotice;
|
||||
import com.mogo.och.data.bean.BusCacheKey;
|
||||
import com.mogo.och.data.manager.cache.CacheDataManager;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -236,7 +238,7 @@ public class OrderModel {
|
||||
}
|
||||
|
||||
if (list != null && list.contains(2)){ //乘客屏
|
||||
AppConnectMsg msg = new AppConnectMsg(true,false,obj.getContext());
|
||||
AppConnectMsg msg = new AppConnectMsg(true,false,obj.getContext(),DPMsgType.TYPE_COMMON.getType());
|
||||
CallerTelematicManager.INSTANCE.sendMsgToAllClients(OchCommonConst.BUSINESS_STRING,
|
||||
GsonUtils.toJson(msg).getBytes());
|
||||
}
|
||||
@@ -402,6 +404,31 @@ public class OrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
public void queryBusCacheRoutes(){
|
||||
String cacheData = CacheDataManager.Companion.getInstance().getCacheData(mContext,
|
||||
BusCacheKey.BUS_LINE_CACHE);
|
||||
if (cacheData == null || cacheData.isEmpty()){
|
||||
queryBusRoutes();
|
||||
}else {
|
||||
BusRoutesResult data = GsonUtils.fromJson(cacheData,BusRoutesResult.class);
|
||||
getCacheRouteSuccess(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void getCacheRouteSuccess(BusRoutesResult data){
|
||||
if (data == null || data.getSites() == null
|
||||
|| data.getSites().isEmpty()
|
||||
|| data.getWriteVersion() < DateTimeUtil.getTodayStartTime()) {
|
||||
//当为空时,显示无绑定路线图
|
||||
queryBusRoutes();
|
||||
CacheDataManager.Companion.getInstance().clearCacheData(mContext, BusCacheKey.BUS_LINE_CACHE);
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "获取到小巴路线数据: " + GsonUtils.toJson(data));
|
||||
updateBusStatus(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小巴路线
|
||||
*/
|
||||
@@ -414,19 +441,27 @@ public class OrderModel {
|
||||
|| data.getResult() == null
|
||||
|| data.getResult().getSites() == null
|
||||
|| data.getResult().getSites().isEmpty()) {
|
||||
//当为空时,显示无绑定路线图
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "获取到小巴路线数据:空 ");
|
||||
if (refreshBusStationsCallback != null) {
|
||||
refreshBusStationsCallback.updateEmptyUi();
|
||||
}
|
||||
clearAutopilotControlParameters();
|
||||
closeBeautificationMode();
|
||||
clearStartAutopilotTag();
|
||||
removeTipRunnables();
|
||||
// //当为空时,显示无绑定路线图
|
||||
// CallerLogger.INSTANCE.d(M_BUS + TAG, "获取到小巴路线数据:空 ");
|
||||
// if (refreshBusStationsCallback != null) {
|
||||
// refreshBusStationsCallback.updateEmptyUi();
|
||||
// }
|
||||
// clearAutopilotControlParameters();
|
||||
// closeBeautificationMode();
|
||||
// clearStartAutopilotTag();
|
||||
// removeTipRunnables();
|
||||
CacheDataManager.Companion.getInstance().clearCacheData(mContext,BusCacheKey.BUS_LINE_CACHE);
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "获取到小巴路线数据: " + data);
|
||||
updateBusStatus(data.getResult());
|
||||
|
||||
if (busRoutesResult != null && busRoutesResult.getWriteVersion() < data.getResult().getWriteVersion()){
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "更新小巴路线数据: " + data);
|
||||
// updateBusStatus(data.getResult());
|
||||
CacheDataManager.Companion.getInstance().putCacheData(mContext,
|
||||
BusCacheKey.BUS_LINE_CACHE,
|
||||
GsonUtils.toJson(data.getResult()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -559,6 +594,11 @@ public class OrderModel {
|
||||
, ""
|
||||
, false);
|
||||
}
|
||||
|
||||
CacheDataManager.Companion.getInstance().clearCacheData(mContext, BusCacheKey.BUS_LINE_CACHE);
|
||||
busRoutesResult = null;
|
||||
|
||||
sendTaskDetailsToClients();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -586,6 +626,30 @@ public class OrderModel {
|
||||
, nextStation
|
||||
, isLastStop);
|
||||
}
|
||||
|
||||
reBuildCacheRouteData(leaveIndex,BusConst.STATION_STATUS_STOPPED,true);
|
||||
}
|
||||
|
||||
private void reBuildCacheRouteData(int currentIndex, int currentDrivingStatus, boolean isLeaving) {
|
||||
if (busRoutesResult != null){
|
||||
busRoutesResult.setWriteVersion(DateTimeUtil.getCurrentTimeStamp());
|
||||
List<BusStationBean> sites = busRoutesResult.getSites();
|
||||
BusStationBean bean = sites.get(currentIndex);
|
||||
bean.setDrivingStatus(currentDrivingStatus);
|
||||
bean.setLeaving(isLeaving);
|
||||
sites.set(currentIndex,bean);
|
||||
if (currentDrivingStatus == STATION_STATUS_STOPPED && !isLeaving){
|
||||
BusStationBean beanPre = sites.get(currentIndex -1);
|
||||
beanPre.setDrivingStatus(BusConst.STATION_STATUS_LEAVING);
|
||||
beanPre.setLeaving(false);
|
||||
sites.set(currentIndex -1,beanPre);
|
||||
}
|
||||
busRoutesResult.setSite(sites);
|
||||
CacheDataManager.Companion.getInstance().putCacheData(mContext, BusCacheKey.BUS_LINE_CACHE,
|
||||
GsonUtils.toJson(busRoutesResult));
|
||||
|
||||
sendTaskDetailsToClients();
|
||||
}
|
||||
}
|
||||
|
||||
private void onStartAutopilot(int leaveIndex) {
|
||||
@@ -647,6 +711,10 @@ public class OrderModel {
|
||||
String departureStopName = stationList.get(backgroundCurrentStationIndex).getName();
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "arriveSiteStation-currentStationIndex = " + arrivedStationIndex);
|
||||
|
||||
isArrivedStation = true;
|
||||
isGoingToNextStation = false;
|
||||
arriveStationSuccess(arrivedStationIndex, departureStopName, arriveStation);
|
||||
|
||||
OrderServiceManager.arriveSiteStation(mContext,
|
||||
stationList.get(arrivedStationIndex).getSeq(),
|
||||
stationList.get(arrivedStationIndex).getSiteId(),
|
||||
@@ -655,35 +723,35 @@ public class OrderModel {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "行程日志-arriveSiteStation success");
|
||||
if (o != null && o.code == 0){
|
||||
queryBusRoutes();
|
||||
isArrivedStation = true;
|
||||
isGoingToNextStation = false;
|
||||
arriveStationSuccess(arrivedStationIndex, departureStopName, arriveStation);
|
||||
}
|
||||
// if (o != null && o.code == 0){
|
||||
// queryBusRoutes();
|
||||
// isArrivedStation = true;
|
||||
// isGoingToNextStation = false;
|
||||
// arriveStationSuccess(arrivedStationIndex, departureStopName, arriveStation);
|
||||
// }
|
||||
//5s轮询核销乘客
|
||||
// startOrStopQueryPassengerWriteOff(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
|
||||
} else {
|
||||
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
|
||||
}
|
||||
// if (!NetworkUtils.isConnected(mContext)) {
|
||||
// ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
|
||||
// } else {
|
||||
// ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (ToastUtilsOch.isCustomFastClick(5000)) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
} else {
|
||||
if (isArrivedStation) return;
|
||||
ToastUtils.showShort(failMsg);
|
||||
}
|
||||
}
|
||||
// if (ToastUtilsOch.isCustomFastClick(5000)) {
|
||||
// if (!NetworkUtils.isConnected(mContext)) {
|
||||
// ToastUtils.showShort("网络异常,请稍后重试");
|
||||
// } else {
|
||||
// if (isArrivedStation) return;
|
||||
// ToastUtils.showShort(failMsg);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -705,12 +773,22 @@ public class OrderModel {
|
||||
VoiceManager.INSTANCE.arrivedStation(arriveStation);
|
||||
|
||||
sendArrivedStationToClient(arriveStation);
|
||||
|
||||
reBuildCacheRouteData(arrivedStationIndex, BusConst.STATION_STATUS_STOPPED,false);
|
||||
}
|
||||
|
||||
private void sendTaskDetailsToClients() {
|
||||
AppConnectMsg arrivedMsg = new AppConnectMsg(false,false,String.format(mContext
|
||||
.getString(R.string.bus_arrived_station_tip),
|
||||
GsonUtils.toJson(busRoutesResult)), DPMsgType.TYPE_TASK_DETAILS.getType());
|
||||
CallerTelematicManager.INSTANCE.sendMsgToAllClients(OchCommonConst.BUSINESS_STRING,
|
||||
GsonUtils.toJson(arrivedMsg).getBytes());
|
||||
}
|
||||
|
||||
private void sendArrivedStationToClient(String arriveStation) {
|
||||
AppConnectMsg arrivedMsg = new AppConnectMsg(false,true,String.format(mContext
|
||||
.getString(R.string.bus_arrived_station_tip),
|
||||
arriveStation));
|
||||
arriveStation),DPMsgType.TYPE_COMMON.getType());
|
||||
CallerTelematicManager.INSTANCE.sendMsgToAllClients(OchCommonConst.BUSINESS_STRING,
|
||||
GsonUtils.toJson(arrivedMsg).getBytes());
|
||||
}
|
||||
@@ -718,23 +796,24 @@ public class OrderModel {
|
||||
private void sendStartStationToClient(String nextStation) {
|
||||
AppConnectMsg arrivedMsg = new AppConnectMsg(false,true,String.format(mContext
|
||||
.getString(R.string.bus_leave_station_tip),
|
||||
nextStation));
|
||||
UiThreadHandler.postDelayed(()->{
|
||||
CallerTelematicManager.INSTANCE.sendMsgToAllClients(OchCommonConst.BUSINESS_STRING,
|
||||
GsonUtils.toJson(arrivedMsg).getBytes());
|
||||
},DELAY_10S);
|
||||
nextStation),DPMsgType.TYPE_COMMON.getType());
|
||||
|
||||
UiThreadHandler.postDelayed(()->
|
||||
CallerTelematicManager.INSTANCE.sendMsgToAllClients(OchCommonConst.BUSINESS_STRING,
|
||||
GsonUtils.toJson(arrivedMsg).getBytes()),DELAY_10S);
|
||||
}
|
||||
|
||||
private void sendEndTaskToClient() {
|
||||
AppConnectMsg arrivedMsg = new AppConnectMsg(false,true,mContext
|
||||
.getString(R.string.bus_end_task_tip));
|
||||
.getString(R.string.bus_end_task_tip),
|
||||
DPMsgType.TYPE_COMMON.getType());
|
||||
|
||||
CallerTelematicManager.INSTANCE.sendMsgToAllClients(OchCommonConst.BUSINESS_STRING,
|
||||
GsonUtils.toJson(arrivedMsg).getBytes());
|
||||
}
|
||||
|
||||
public void sendWriteOffNumToClient(String msg){
|
||||
AppConnectMsg arrivedMsg = new AppConnectMsg(false,true,msg);
|
||||
AppConnectMsg arrivedMsg = new AppConnectMsg(false,true,msg,DPMsgType.TYPE_COMMON.getType());
|
||||
|
||||
CallerTelematicManager.INSTANCE.sendMsgToAllClients(OchCommonConst.BUSINESS_STRING,
|
||||
GsonUtils.toJson(arrivedMsg).getBytes());
|
||||
@@ -751,6 +830,11 @@ public class OrderModel {
|
||||
}
|
||||
final String currentStationName = stationList.get(backgroundCurrentStationIndex).getName();
|
||||
String finalNextStationName = nextStationName;
|
||||
|
||||
isArrivedStation = false;
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "行程日志-离站成功开往下一站====");
|
||||
leaveStationSuccess(backgroundCurrentStationIndex, currentStationName, finalNextStationName);
|
||||
|
||||
OrderServiceManager.leaveStation(mContext,
|
||||
stationList.get(backgroundCurrentStationIndex).getSeq(),
|
||||
stationList.get(backgroundCurrentStationIndex).getSiteId(),
|
||||
@@ -758,31 +842,31 @@ public class OrderModel {
|
||||
new OchCommonServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
isArrivedStation = false;
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "行程日志-离站成功开往下一站====");
|
||||
//需要更改当前站和下一站的状态 然后渲染
|
||||
//startOrStopQueryPassengerWriteOff(false);
|
||||
queryBusRoutes();
|
||||
leaveStationSuccess(backgroundCurrentStationIndex, currentStationName, finalNextStationName);
|
||||
// isArrivedStation = false;
|
||||
// CallerLogger.INSTANCE.d(M_BUS + TAG, "行程日志-离站成功开往下一站====");
|
||||
// //需要更改当前站和下一站的状态 然后渲染
|
||||
// //startOrStopQueryPassengerWriteOff(false);
|
||||
// queryBusRoutes();
|
||||
// leaveStationSuccess(backgroundCurrentStationIndex, currentStationName, finalNextStationName);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
|
||||
} else {
|
||||
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
|
||||
}
|
||||
// if (!NetworkUtils.isConnected(mContext)) {
|
||||
// ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
|
||||
// } else {
|
||||
// ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试");
|
||||
} else {
|
||||
ToastUtils.showShort("离站上报失败:" + failMsg);
|
||||
}
|
||||
// if (!NetworkUtils.isConnected(mContext)) {
|
||||
// ToastUtils.showShort("网络异常,请稍后重试");
|
||||
// } else {
|
||||
// ToastUtils.showShort("离站上报失败:" + failMsg);
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
import com.mogo.och.bus.bean.WriteOffPassenger;
|
||||
import com.mogo.och.bus.callback.IBusADASStatusCallback;
|
||||
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
|
||||
@@ -308,7 +308,8 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, " loginStatus =" + LoginStatusManager.isLogin());
|
||||
if(LoginStatusManager.isLogin()){
|
||||
OrderModel.getInstance().startOrStopOrderLoop(true);
|
||||
OrderModel.getInstance().queryBusRoutes();
|
||||
// OrderModel.getInstance().queryBusRoutes();
|
||||
OrderModel.getInstance().queryBusCacheRoutes();
|
||||
}else {
|
||||
BusTrajectoryManager.getInstance().stopTrajReqLoop();
|
||||
OrderModel.getInstance().startOrStopOrderLoop(false);
|
||||
|
||||
@@ -6,11 +6,10 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.model.OrderModel;
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager;
|
||||
import com.zhidao.socket.utils.LoginStatusUtil;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@@ -68,3 +68,4 @@ include ':OCH:mogo-och-charter'
|
||||
include ':OCH:mogo-och-charter-passenger'
|
||||
include ':OCH:mogo-och-shuttle'
|
||||
include ':OCH:mogo-och-shuttle-passenger'
|
||||
include ':OCH:mogo-och-data'
|
||||
|
||||
Reference in New Issue
Block a user