Merge branch 'dev_robobus-d_241202_6.8.4' into dev_robobus-d_241202_6.8.4_autopilot

# Conflicts:
#	OCH/common/bridge/src/main/java/com/mogo/och/bridge/autopilot/line/LineManager.kt
#	OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt
This commit is contained in:
yangyakun
2024-12-26 19:47:35 +08:00
65 changed files with 1135 additions and 295 deletions

View File

@@ -750,7 +750,10 @@ class DriverM1Model {
if (it == null || it < 0) {
LineManager.setLineInfo(null)
} else {
LineManager.setLineInfo(LineInfo(it.toLong(),mCurrentOrder?.lineName?:"", orderId = data.data.orderNo))
LineManager.setLineInfo(
LineInfo(it.toLong(),
mCurrentOrder?.lineName?:"",
orderId = data.data.orderNo))
}
}

View File

@@ -234,6 +234,10 @@ object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListene
}
}
/**
* 距离终点10m 向地盘查询是否到站地盘的返回值
* [LineManager.mMapLocationListener]
*/
override fun onAutoPilotStation(
token: Long,
timestamp: Long,

View File

@@ -54,7 +54,7 @@ public interface ILineCallback {
default void startAutopilotSuccess(int source, String autopilotId){}
/**
* 距离站点小于15m后向底盘查询是否到站底盘反馈 已到站
* 距离站点小于10m后向底盘查询是否到站底盘反馈 已到站
*/
default void arrivedStationSuccessBySearch(){}
}

View File

@@ -43,6 +43,11 @@ import kotlin.properties.Delegates
*/
object LineManager : CallerBase<ILineCallback>() {
const val TAG = "LineManager"
const val firstStationFirstStartAutopilotFlag = 1
const val middleStationFirstStartAutopilotFlag = 2
const val norFirstStartAutopilotFlag = 3
/**
* 线路信息
*/
@@ -73,10 +78,35 @@ object LineManager : CallerBase<ILineCallback>() {
*/
private var endStation: BusStationBean? = null
/**
* 和[autopilotId]相关 默认为true
* 一个autopilotId范围内第一次启动自驾成功后 为false
*/
var isFirstStartAutopilot = true
/**
* 线路、轨迹、站点 三者确定的id
* 和[teleOrderId] 相关的 默认为true
* 一个teleOrderId范围内第一次启动自驾成功后 为false
*/
var teleIsFirstStartAutopilot = true
/**
* 1 首站点触发
* 2 中间站点触发
* 3 新的站点第一次启动自驾成功后
*/
var autopilotFlag : Int by Delegates.observable(firstStationFirstStartAutopilotFlag) { _, oldValue, newValue ->
if(oldValue!=newValue){
d(TAG,"autopilotFlag old=$oldValue new=$newValue")
}
}
/**
* bizId 小巴、接驳、班车 时任务id
* taxi 目前是orderNo 6.9.0改为任务id
* ochCommon 抽象的自驾id
* 生成规则 lineId_startsiteId_endsiteId_bizId
*/
private var autopilotId: String by Delegates.observable("") { _, oldValue, newValue ->
if (oldValue != newValue) {
@@ -85,7 +115,10 @@ object LineManager : CallerBase<ILineCallback>() {
M_LISTENERS.forEach {
it.value.onAutopilotIdChange(oldValue,newValue)
}
if(!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)&&!AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)){
if(!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)&&
!AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)&&
!AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)
){
val (start, end) = getStations()
if(start!=null&&end!=null){
val ochInfo = OchInfo(0, mutableListOf(start.toMogoLocation(), end.toMogoLocation()))
@@ -100,8 +133,21 @@ object LineManager : CallerBase<ILineCallback>() {
}
}
/**
* bizId 小巴、接驳、班车 时任务id
* taxi 目前是orderNo 6.9.0改为任务id
* 向地盘传递的orderId
* 生成规则 lineId_siteId1_siteId2_siteId3...siteIdn_bizId
*/
private var teleOrderId: String by Delegates.observable("") { _, oldValue, newValue ->
if (oldValue != newValue) {
teleIsFirstStartAutopilot = true
}
}
// 自车定位
/**
* 当前车辆经纬度
*/
private val mMapLocationListener = object : IMoGoChassisLocationGCJ02Listener {
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
if (null == mogoLocation) return
@@ -113,28 +159,43 @@ object LineManager : CallerBase<ILineCallback>() {
mogoLocation.longitude, mogoLocation.latitude
)
if (distance <= OchCommonConst.ARRIVE_AT_END_STATION_DISTANCE) {
val token = CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(autopilotId)
/**
* 在终点10m 范围内向地盘查询是否到站
* [com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager.onAutoPilotStation]
*/
val token = CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(teleOrderId)
OchChainLogManager.writeChainLogAutopilot("到站逻辑","距离站点:$distance 请求token$token")
}
}
}
}
/**
* [mMapLocationListener] 距离终点小于[OchCommonConst.ARRIVE_AT_END_STATION_DISTANCE]后向底盘请求的返回值调用
* @param orderId 和线路相关的值
* @param arrivedStationFlag 是否到站 true 到站 false 没有到站
*/
fun invokeArrivedStation(orderId: String, arrivedStationFlag: Boolean) {
if (this.autopilotId==orderId&&arrivedStationFlag){
if (this.teleOrderId == orderId && arrivedStationFlag) {
M_LISTENERS.forEach {
it.value.arrivedStationSuccessBySearch()
}
}
}
fun searchAutopilotState(){
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotInfo()
}
/**
* [searchAutopilotState] 方法请求的返回值
*/
fun invokeSetIsFirstAutopilot(orderId: String?, firstAutopilotFlag: Boolean, count: Int) {
if (this.autopilotId==orderId){
if (this.teleOrderId==orderId){
if(count>=1){
isFirstStartAutopilot = false
teleIsFirstStartAutopilot = false
}else{
isFirstStartAutopilot = true
teleIsFirstStartAutopilot = true
}
}
}
@@ -143,9 +204,6 @@ object LineManager : CallerBase<ILineCallback>() {
* 设置站点信息
*/
fun setStartAndEndStation(startStation: BusStationBean?, endStation: BusStationBean?) {
if(this.startStation!=startStation||this.endStation!=endStation){
isFirstStartAutopilot = true
}
this.startStation = startStation
this.endStation = endStation
if(startStation==null||endStation==null){
@@ -165,6 +223,7 @@ object LineManager : CallerBase<ILineCallback>() {
@JvmStatic
fun setLineInfo(lineInfo: LineInfo?) {
if (lineInfo == null) {
teleOrderId = ""
clearGlobalTrajectory(true)
CallerEagleBaseFunctionCall4OchManager.updateOrderLine("")
}
@@ -177,10 +236,11 @@ object LineManager : CallerBase<ILineCallback>() {
line.multiMap?.forEach {
sb.append(it.value)
}
OchChainLogManager.writeChainLogAutopilot("设置线路", "$sb")
CallerEagleBaseFunctionCall4OchManager.updateOrderLine(sb.toString())
}
}
OchChainLogManager.writeChainLogAutopilot("自驾参数", "线路信息:$contraiInfo")
OchChainLogManager.writeChainLogAutopilot("设置线路", "线路信息:$_lineInfos")
}
fun getStations(): Pair<BusStationBean?, BusStationBean?> {
@@ -263,6 +323,11 @@ object LineManager : CallerBase<ILineCallback>() {
return@getStationsWithLine
}
d(M_BUS + TAG, "AutopilotControlParameters is update. ${parameters}")
if (lineInfo.isFirstStation(start)) {
autopilotFlag = firstStationFirstStartAutopilotFlag
}else{
autopilotFlag = middleStationFirstStartAutopilotFlag
}
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
val startStationLocation = MogoLocation()
startStationLocation.latitude = start.gcjLat
@@ -277,13 +342,12 @@ object LineManager : CallerBase<ILineCallback>() {
searchAutopilotState()
}
}
fun searchAutopilotState(){
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotInfo()
}
private fun clearAutopilotControlParameters(){
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
TrajectoryAndDistanceManager.setStationPoint(null, null, null)
autopilotId = ""
autopilotFlag = firstStationFirstStartAutopilotFlag
OchLocationManager.removeGCJ02Listener(TAG)
}
@@ -321,6 +385,7 @@ object LineManager : CallerBase<ILineCallback>() {
var parameters: AutopilotControlParameters? = null
getStationsWithLine { start, end, lineInfo ->
this.autopilotId = "${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}"
this.teleOrderId = lineInfo.genAutopilotId()
}
getStationsWithLineAndContrai { start, end, lineInfo, contrai ->
parameters = AutopilotControlParameters()
@@ -331,8 +396,8 @@ object LineManager : CallerBase<ILineCallback>() {
parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon)
parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon)
parameters?.vehicleType = 10
parameters?.orderId = this.autopilotId
parameters?.firstAutopilotFlag = isFirstStartAutopilot
parameters?.orderId = this.teleOrderId
parameters?.firstAutopilotFlag = teleIsFirstStartAutopilot
if (parameters?.autoPilotLine == null) {
parameters?.autoPilotLine = AutoPilotLine(
@@ -352,7 +417,7 @@ object LineManager : CallerBase<ILineCallback>() {
)
}
val (wayLatLons, blackLatLons) = getWayBlackLatLons(contrai.passPoints, contrai.blackPoints)
val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons()
parameters?.wayLatLons = wayLatLons
parameters?.blackLatLons = blackLatLons
@@ -542,7 +607,10 @@ object LineManager : CallerBase<ILineCallback>() {
type,
source
)
if(send){
if(send){// 启动自驾成功回调
teleIsFirstStartAutopilot = false
isFirstStartAutopilot = false
autopilotFlag = norFirstStartAutopilotFlag
M_LISTENERS.forEach {
it.value.startAutopilotSuccess(source,autopilotId)
}
@@ -572,7 +640,7 @@ object LineManager : CallerBase<ILineCallback>() {
}
fun compareFSMAndOchOrderId(autopilotIdFromFsm: String?) {
if(autopilotIdFromFsm == autopilotId){
if(autopilotIdFromFsm == teleOrderId){
// 地盘有和上层一样 不用操作
}else{
if(autopilotIdFromFsm.isNullOrEmpty()){
@@ -580,8 +648,8 @@ object LineManager : CallerBase<ILineCallback>() {
}else{
// 地盘有但是和och出不一样
// todo 需要och 重新出发轨迹下载操作
ToastUtils.showShort("${autopilotIdFromFsm}_${autopilotId}_自动驾驶id不同请排查")
OchChainLogManager.writeChainLogAutopilot("自驾Id","${autopilotIdFromFsm}_${autopilotId}_自动驾驶id不同请排查")
ToastUtils.showShort("${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查")
OchChainLogManager.writeChainLogAutopilot("自驾Id","${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查")
// val initAutopilotControlParameters = initAutopilotControlParameters()
// if (initAutopilotControlParameters!==null&&initAutopilotControlParameters.autoPilotLine!=null
// && contraiInfo!=null

View File

@@ -549,7 +549,7 @@ object CoordinateCalculateRouteUtil {
}
fun getHeadingAngle(location: MogoLocation, nextPoint: MogoLocation): Double {
return getHeadingAngle(
return getHeadingAngleTemp(
location.longitude,
location.latitude,
nextPoint.longitude,

View File

@@ -33,6 +33,8 @@ import com.mogo.eagle.core.utilcode.util.ActivityUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.och.common.module.debug.location.MogoLocationExit
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.manager.scnner.ScannerManager
//import com.mogo.och.bridge.distance.TrajectoryAndDistanceManager
//import com.mogo.och.bridge.utils.CoordinateCalculateRouteUtil
//import com.mogo.och.bridge.utils.CoordinateCalculateRouteUtil
@@ -63,6 +65,7 @@ object DebugDataDispatch {
const val v2N = "xiaozhiV2N"
const val romal = "romal"
const val visualView = "visual"
const val scanner = "scanner"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "location" --es path "1111/11111"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "globalPath" --es path "sy73.json"
@@ -77,6 +80,7 @@ object DebugDataDispatch {
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "romal" --ei show 0
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "visual" --ei show 0
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "showDebugView"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "scanner" --es qrInfo ""
val ROOT_PATH =
@@ -89,6 +93,12 @@ object DebugDataDispatch {
}
when (type) {
scanner -> {
val qrInfo = intent.getStringExtra("qrInfo")
BizLoopManager.runInIoThread{
ScannerManager.parseParams("orderNo=1871744897569038336&uid=828aa91f-49a1-f9b3-4526-f58acda9df60&pipe=mogogosafety&phone=houyanli&lineId=134&expiryTime=1735094149070&bookingTime=1735056000000&tenantId=337197925358633123&availableTimes=1&ticketSize=1&ticketName=%E9%80%9A%E5%8B%A4%E7%A5%A8%E3%81%AE&type=14&shiftsId=4249")
}
}
globalPathMock -> {
sourceFilePath?.let {
loadRawPoints(ROOT_PATH+it)

View File

@@ -235,7 +235,7 @@ object ScannerManager : IOchLanPassengerStatusListener {
}
}
private fun parseParams(payload: String?) {
fun parseParams(payload: String?) {
val parse = Uri.parse("${OchCommonConst.getShuttleUrl()}?${payload}")
val queryParameterNames = parse.queryParameterNames
val mutableMapOf = mutableMapOf<String, String>()

View File

@@ -0,0 +1,188 @@
package com.mogo.och.common.module.utils;
import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import com.shuyu.gsyvideoplayer.GSYVideoBaseManager;
import com.shuyu.gsyvideoplayer.player.IPlayerManager;
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager;
import com.shuyu.gsyvideoplayer.utils.CommonUtil;
import com.shuyu.gsyvideoplayer.video.base.GSYVideoPlayer;
import com.mogo.och.common.module.R;
import java.util.HashMap;
import java.util.Map;
import static com.shuyu.gsyvideoplayer.utils.CommonUtil.hideNavKey;
/**
* 多个播放的管理器
* Created by guoshuyu on 2018/1/31.
*/
public class CustomManager extends GSYVideoBaseManager {
public static final int SMALL_ID = R.id.custom_small_id;
public static final int FULLSCREEN_ID = R.id.custom_full_id;
public static String TAG = "GSYVideoManager";
private static Map<String, CustomManager> sMap = new HashMap<>();
public CustomManager() {
init();
}
@Override
protected IPlayerManager getPlayManager() {
return new IjkPlayerManager();
}
/**
* 退出全屏,主要用于返回键
*
* @return 返回是否全屏
*/
@SuppressWarnings("ResourceType")
public static boolean backFromWindowFull(Context context, String key) {
boolean backFrom = false;
ViewGroup vp = (ViewGroup) (CommonUtil.scanForActivity(context)).findViewById(Window.ID_ANDROID_CONTENT);
View oldF = vp.findViewById(FULLSCREEN_ID);
if (oldF != null) {
backFrom = true;
hideNavKey(context);
if (getCustomManager(key).lastListener() != null) {
getCustomManager(key).lastListener().onBackFullscreen();
}
}
return backFrom;
}
/**
* 页面销毁了记得调用是否所有的video
*/
public static void releaseAllVideos(String key) {
if (getCustomManager(key).listener() != null) {
getCustomManager(key).listener().onCompletion();
}
getCustomManager(key).releaseMediaPlayer();
}
/**
* 暂停播放
*/
public void onPause(String key) {
if (getCustomManager(key).listener() != null) {
getCustomManager(key).listener().onVideoPause();
}
}
/**
* 恢复播放
*/
public void onResume(String key) {
if (getCustomManager(key).listener() != null) {
getCustomManager(key).listener().onVideoResume();
}
}
/**
* 恢复暂停状态
*
* @param seek 是否产生seek动作,直播设置为false
*/
public void onResume(String key, boolean seek) {
if (getCustomManager(key).listener() != null) {
getCustomManager(key).listener().onVideoResume(seek);
}
}
/**
* 单例管理器
*/
public static synchronized Map<String, CustomManager> instance() {
return sMap;
}
/**
* 单例管理器
*/
public static synchronized CustomManager getCustomManager(String key) {
if (TextUtils.isEmpty(key)) {
throw new IllegalStateException("key not be empty");
}
CustomManager customManager = sMap.get(key);
if (customManager == null) {
customManager = new CustomManager();
sMap.put(key, customManager);
}
return customManager;
}
public static void onPauseAll() {
if (sMap.size() > 0) {
for (Map.Entry<String, CustomManager> header : sMap.entrySet()) {
header.getValue().onPause(header.getKey());
}
}
}
public static void onResumeAll() {
if (sMap.size() > 0) {
for (Map.Entry<String, CustomManager> header : sMap.entrySet()) {
header.getValue().onResume(header.getKey());
}
}
}
/**
* 恢复暂停状态
*
* @param seek 是否产生seek动作
*/
public static void onResumeAll(boolean seek) {
if (sMap.size() > 0) {
for (Map.Entry<String, CustomManager> header : sMap.entrySet()) {
header.getValue().onResume(header.getKey(), seek);
}
}
}
public static void clearAllVideo() {
if (sMap.size() > 0) {
for (Map.Entry<String, CustomManager> header : sMap.entrySet()) {
CustomManager.releaseAllVideos(header.getKey());
}
}
sMap.clear();
}
public static void removeManager(String key) {
sMap.remove(key);
}
/**
* 当前是否全屏状态
*
* @return 当前是否全屏状态, true代表是。
*/
@SuppressWarnings("ResourceType")
public static boolean isFullState(Activity activity) {
ViewGroup vp = (ViewGroup) (CommonUtil.scanForActivity(activity)).findViewById(Window.ID_ANDROID_CONTENT);
final View full = vp.findViewById(FULLSCREEN_ID);
GSYVideoPlayer gsyVideoPlayer = null;
if (full != null) {
gsyVideoPlayer = (GSYVideoPlayer) full;
}
return gsyVideoPlayer != null;
}
}

View File

@@ -0,0 +1,25 @@
package com.mogo.och.common.module.utils
import com.mogo.eagle.core.utilcode.util.RegexUtils
object OchPhoneUtil {
/**
* 获取脱敏手机号
*/
fun getPhoneWithoutMiddle(phone:String?): String {
if (!RegexUtils.isMobileExact(phone)) {
return phone?:""
}
var tempPhone = phone
tempPhone?.let {
if (it.length > 8) {
//截取电话号码前三位
val phoneNumPre = it.substring(0, 3)
//截取电话号码后四位
val phoneNumFix = it.substring(7)
tempPhone = "$phoneNumPre****$phoneNumFix"
}
}
return tempPhone?:""
}
}

View File

@@ -1,6 +1,7 @@
import android.content.Context
import android.media.AudioManager
import android.net.Uri
import android.text.TextUtils
import android.util.AttributeSet
import android.widget.ImageView
import android.widget.RelativeLayout
@@ -13,6 +14,7 @@ import com.mogo.eagle.core.utilcode.util.FileUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
import com.mogo.och.common.module.utils.CustomManager
import com.mogo.och.common.module.R
import com.mogo.och.common.module.wigets.media.MediaFileCacheManager
import com.mogo.och.common.module.wigets.media.MediaItem
@@ -22,8 +24,10 @@ import com.mogo.skin.utils.SkinResources
import com.mogo.skin.widget.SkinImageView
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
import com.shuyu.gsyvideoplayer.utils.Debuger
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
import me.jessyan.autosize.utils.AutoSizeUtils
import java.io.File
@@ -250,6 +254,49 @@ class AdvanceGSYVideoPlayer : StandardGSYVideoPlayer {
GSYVideoType.setRenderType(GSYVideoType.GLSURFACE)
}
override fun init(context: Context) {
super.init(context)
onAudioFocusChangeListener =
AudioManager.OnAudioFocusChangeListener { focusChange ->
when (focusChange) {
AudioManager.AUDIOFOCUS_GAIN -> {}
AudioManager.AUDIOFOCUS_LOSS -> {
//todo 判断如果不是外界造成的就不处理
}
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT -> {
//todo 判断如果不是外界造成的就不处理
}
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK -> {}
}
}
}
override fun getGSYVideoManager(): GSYVideoViewBridge {
CustomManager.getCustomManager(getKey()).initContext(getContext().getApplicationContext());
return CustomManager.getCustomManager(getKey());
}
override fun releaseVideos() {
CustomManager.releaseAllVideos(getKey())
}
override fun backFromFull(context: Context?): Boolean {
return CustomManager.backFromWindowFull(context, getKey())
}
fun getKey(): String {
if (mPlayPosition == -22) {
Debuger.printfError(javaClass.simpleName + " used getKey() " + "******* PlayPosition never set. ********")
}
if (TextUtils.isEmpty(mPlayTag)) {
Debuger.printfError(javaClass.simpleName + " used getKey() " + "******* PlayTag never set. ********")
}
Logger.d("MediaLoopPlayView", "key ${(MediaLoopPlayView.TAG + mPlayPosition).toString() + mPlayTag}")
return (MediaLoopPlayView.TAG + mPlayPosition).toString() + mPlayTag
}
override fun hideAllWidget() {
Logger.d(MediaLoopPlayView.TAG, "AdvanceGSYVideoPlayerhideAllWidget")
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="custom_full_id" type="id" />
<item name="custom_small_id" type="id" />
</resources>

View File

@@ -1,5 +1,7 @@
package com.mogo.och.data.bean
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat
data class ContraiInfo(
/**
* 线路id
@@ -34,4 +36,67 @@ data class ContraiInfo(
var passPoints: MutableList<BusStationBean>?=null, // 用于算路的经停点
var blackPoints: MutableList<BusStationBean>?=null, // 用于算路的黑名單點
val source:Int = 1, //轨迹来源1 录制2 自主计算
)
){
fun getWayBlackLatLons(
): Pair<MutableList<AutoPilotLonLat>, MutableList<AutoPilotLonLat>> {
val wayLatLons = mutableListOf<AutoPilotLonLat>()
// 途经点
if (!passPoints.isNullOrEmpty()) {
for (mogoLatLng in passPoints!!) {
wayLatLons.add(
AutoPilotLonLat(
mogoLatLng.lat,
mogoLatLng.lon,
when (mogoLatLng.pointType) {
1 -> {//途径点
false
}
2 -> {//禁行点
false
}
3 -> {//站点
true
}
else -> {
false
}
}
)
)
}
}
val blackLatLons = mutableListOf<AutoPilotLonLat>()
// 黑名单点
if (!blackPoints.isNullOrEmpty()) {
for (mogoLatLng in blackPoints!!) {
blackLatLons.add(
AutoPilotLonLat(
mogoLatLng.lat,
mogoLatLng.lat,
when (mogoLatLng.pointType) {
1 -> {//途径点
false
}
2 -> {//禁行点
false
}
3 -> {//站点
true
}
else -> {
false
}
}
)
)
}
}
return Pair(wayLatLons,blackLatLons)
}
}

View File

@@ -16,6 +16,42 @@ data class LineInfo(
*/
var multiMap: MutableMap<String,String>? = mutableMapOf(),
val orderId:String?=null
val orderId:String?=null,
)
/**
* 站点包含的线路
*/
var siteInfos:MutableList<BusStationBean> = mutableListOf(),
) {
fun genAutopilotId(): String {
val tempAutopilotId = StringBuilder()
tempAutopilotId.append(lineId)
siteInfos.forEach {
tempAutopilotId.append("_")
tempAutopilotId.append(it.siteId)
}
tempAutopilotId.append("_")
tempAutopilotId.append(orderId)
return tempAutopilotId.toString()
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as LineInfo
return lineId == other.lineId
}
override fun hashCode(): Int {
return lineId.hashCode()
}
fun isFirstStation(start: BusStationBean):Boolean {
return siteInfos.first()==start
}
}

View File

@@ -758,15 +758,15 @@ public class OrderModel {
private void updateBusStatus(BusRoutesResult result) {
if (result == null) return;
LineManager.INSTANCE.setContraiInfo(new ContraiInfo(result.getLineId(),result.csvFileUrl,result.csvFileMd5,result.txtFileUrl,result.txtFileMd5,result.contrailSaveTime,null,null,1));
busRoutesResult = result;
stationList.clear();
stationList.addAll(result.getSites());
HashMap<String,String> map = new HashMap<String,String>();
String taskInfo = DateTimeUtil.formatLongToString(
result.getTaskTime(), DateTimeUtil.HH_mm
);
map.put("taskInfo",taskInfo);
LineManager.setLineInfo(new LineInfo(result.getLineId(),result.getName(),map,result.getTaskId()+""));
busRoutesResult = result;
stationList.clear();
stationList.addAll(result.getSites());
LineManager.setLineInfo(new LineInfo(result.getLineId(),result.getName(),map,result.getTaskId()+"",stationList));
for (int i = 0; i < stationList.size(); i++) {
BusStationBean s = stationList.get(i);

View File

@@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 6,
"identityHash": "1d1af100293dd1557307b49359621a5f",
"identityHash": "a2451ba8fe1fb6312258d93e3c2c2c8c",
"entities": [
{
"tableName": "contrail_data_table",
@@ -258,7 +258,7 @@
},
{
"tableName": "task_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `task_data` INTEGER, `task_start_time` INTEGER, `start_time` INTEGER, `end_time` INTEGER, `task_get_time` INTEGER NOT NULL, `status` INTEGER)",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `shifts_id` INTEGER, `task_id` INTEGER, `line_id` INTEGER, `task_data` INTEGER, `task_start_time` INTEGER, `start_time` INTEGER, `end_time` INTEGER, `task_get_time` INTEGER NOT NULL, `status` INTEGER)",
"fields": [
{
"fieldPath": "id",
@@ -266,6 +266,12 @@
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "shiftsId",
"columnName": "shifts_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "taskId",
"columnName": "task_id",
@@ -345,7 +351,7 @@
},
{
"tableName": "used_task_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT)",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `shifts_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT)",
"fields": [
{
"fieldPath": "id",
@@ -359,6 +365,12 @@
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "shiftsId",
"columnName": "shifts_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "lineId",
"columnName": "line_id",
@@ -479,7 +491,7 @@
},
{
"tableName": "event_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `lineId` INTEGER, `task_date` INTEGER, `lineName` TEXT, `task_id` INTEGER, `task_start_time` INTEGER, `business_time` INTEGER, `write_version` INTEGER, `site_id` INTEGER, `seq` INTEGER, `driver_id` INTEGER, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `msg_id` TEXT, `update_time` INTEGER)",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `shifts_id` INTEGER, `lineId` INTEGER, `task_date` INTEGER, `lineName` TEXT, `task_id` INTEGER, `task_start_time` INTEGER, `business_time` INTEGER, `write_version` INTEGER, `site_id` INTEGER, `seq` INTEGER, `driver_id` INTEGER, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `msg_id` TEXT, `update_time` INTEGER)",
"fields": [
{
"fieldPath": "id",
@@ -493,6 +505,12 @@
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "shiftsId",
"columnName": "shifts_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "lineId",
"columnName": "lineId",
@@ -599,7 +617,7 @@
},
{
"tableName": "writeoff_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `msg_id` TEXT, `expiry_time` INTEGER, `booking_time` INTEGER, `type` INTEGER, `task_id` INTEGER, `task_date` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `driver_id` INTEGER, `available_times` INTEGER, `order_no` TEXT, `uid` TEXT, `seq` TEXT, `business_time` INTEGER, `tick_size` INTEGER, `tick_name` TEXT, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `update_time` INTEGER)",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `msg_id` TEXT, `expiry_time` INTEGER, `booking_time` INTEGER, `type` INTEGER, `shifts_id` INTEGER, `task_id` INTEGER, `task_date` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `driver_id` INTEGER, `available_times` INTEGER, `order_no` TEXT, `uid` TEXT, `seq` TEXT, `business_time` INTEGER, `tick_size` INTEGER, `tick_name` TEXT, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `update_time` INTEGER)",
"fields": [
{
"fieldPath": "id",
@@ -631,6 +649,12 @@
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "shiftsId",
"columnName": "shifts_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "taskId",
"columnName": "task_id",
@@ -745,7 +769,7 @@
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '1d1af100293dd1557307b49359621a5f')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'a2451ba8fe1fb6312258d93e3c2c2c8c')"
]
}
}

View File

@@ -74,8 +74,9 @@ class BusRoutesResponse : BaseData() {
if (lineInfo == null && taskAndsite.lineId != null && taskAndsite.lineName != null) {
lineInfo = LineInfo(taskAndsite.lineId!!, taskAndsite.lineName!!, orderId = taskAndsite.taskId.toString())
}
lineInfo?.multiMap?.put("taskInfo",LineModel.getTaskTime())
}
lineInfo?.multiMap?.put("taskInfo",LineModel.getTaskTime())
lineInfo?.siteInfos = result
LineManager.setLineInfo(lineInfo)
return Pair(result,currentStationIndex)

View File

@@ -1,6 +1,8 @@
package com.mogo.och.weaknet.bean.response
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.och.data.bean.SiteIntroduce
import com.mogo.och.weaknet.repository.db.bean.ContrailDataBean
@@ -82,6 +84,10 @@ data class CarExecutableTaskResponse(val data: List<Result>?) : BaseData(){
dataInfo.taskList?.let { taskInfs ->
taskInfs.forEach {
it.lineId = lineId
if(AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
// 班车需要前台生产任务Id 前台规则 任务id 等同模板id
it.taskId = it.shiftsId
}
}
TaskDb.addOrUpdate(taskInfs,lineId)
}

View File

@@ -98,11 +98,7 @@ object EventModel {
}
waitUpdateWriteOffEvent?.let {writeOffEvents->
writeOffEvents.forEach {
it.updateStatus = EventDataBean.updated
it.upDateTime = System.currentTimeMillis()
}
WriteOffDb.saveUpdateSuccess(writeOffEvents)
WriteOffDb.saveUpdateSuccess(writeOffEvents,EventDataBean.updated,System.currentTimeMillis())
}
isUpdating.set(false)

View File

@@ -10,6 +10,7 @@ import com.mogo.eagle.core.data.och.OchInfo
import com.mogo.eagle.core.data.v2x.Point
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.network.utils.digest.DigestUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
@@ -211,8 +212,8 @@ object LineModel {
fun commitSwitchLineId(task: TaskDataBean, line: LineDataBean) {
RxUtils.disposeSubscribe(startTaskDisposable)
line.getLineIdAndName { lineId, lineName ->
task.getLineIdAndName { taskId, taskTime,taskDate ->
RepositoryManager.startTask(taskId, lineId, taskTime, lineName)
task.getLineIdAndName { shiftsId,taskId, taskTime,taskDate ->
RepositoryManager.startTask(shiftsId,taskId, lineId, taskTime, lineName)
?.subscribeOn(Schedulers.io())
?.observeOn(AndroidSchedulers.mainThread())
?.subscribe(object : Observer<Boolean> {
@@ -247,7 +248,7 @@ object LineModel {
override fun onNext(data: Boolean) {
d(TAG, "commitSwitchLineId onNext ${data}")
if (data) {
EventDb.saveEventTaskStart(taskId, lineId, taskTime, lineName,taskDate)
EventDb.saveEventTaskStart(shiftsId,taskId, lineId, taskTime, lineName,taskDate)
OrderModel.queryBusRoutes()
BizLoopManager.runInIoThread{
val querySiteByLineId = SiteDb.querySiteByLineId(lineId)
@@ -311,8 +312,8 @@ object LineModel {
}
fun endTask() {
currentTask?.taskId?.let { taskId ->
RepositoryManager.endTask(taskId)
currentTask?.getLineIdAndName { shiftsId, taskId, taskTime, taskDate ->
RepositoryManager.endTask(shiftsId,taskId)
?.subscribeOn(Schedulers.io())
?.observeOn(AndroidSchedulers.mainThread())
?.subscribe(object : Observer<Boolean> {
@@ -420,7 +421,9 @@ object LineModel {
ochInfo.siteMarkerList = mutableListOf()
CallerDataCenterBizListener.invokeOchInfo(ochInfo)
OchChainLogManager.writeChainLogMap("地图","站点信息:${ochInfo}")
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(true)
}else{
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(false)
val siteList = mutableListOf<SiteMarkerBean>()
var temp: SiteMarkerBean?=null
stationList?.let {

View File

@@ -264,6 +264,7 @@ object OrderModel {
RepositoryManager.leaveStation(
startStation.seq,
startStation.siteId.toLong(),
task.shiftsId?:0L,
task.taskId?:0L,
task.lineId?:0L,
task.taskStartTime?:System.currentTimeMillis(),
@@ -273,11 +274,11 @@ object OrderModel {
?.observeOn(AndroidSchedulers.mainThread())
?.subscribe(object : Observer<Boolean> {
override fun onSubscribe(d: Disposable) {
d(TAG, "onSubscribe")
d(TAG, "driveToNextStation onSubscribe")
}
override fun onError(e: Throwable) {
d(TAG, "onError${e.printStackTrace()}")
d(TAG, "driveToNextStation onError${e.printStackTrace()}")
if (e is DataException) {
}
@@ -297,6 +298,7 @@ object OrderModel {
}
override fun onNext(data: Boolean) {
d(TAG, "driveToNextStation onComplete")
if (data) {
LineModel.leaveStationSuccess()
isArrivedStation = false

View File

@@ -24,8 +24,7 @@ import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffDetialMsg
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffResultMsg
import com.mogo.och.common.module.network.OchCommonServiceCallback
import com.mogo.och.weaknet.bean.response.WriteOffCountResponse
import com.mogo.och.common.module.utils.OchPhoneUtil
import com.mogo.och.weaknet.bean.WriteOffPassenger
import com.mogo.och.weaknet.repository.RepositoryManager
import com.mogo.och.weaknet.repository.exception.DataException
@@ -203,16 +202,16 @@ object TicketModel {
*/
private fun parseData(code:Int,msg:String,phone: String,orderNo: String){
when (code) {
1009 -> sendMessage2Driver("车票所选乘车日期非今日", phone,1009,orderNo)
1005 -> sendMessage2Driver("车辆未登录、或没有任务", phone,1005,orderNo)
1006 -> sendMessage2Driver("车票路线信息与当前车辆执行任务的路线信息不符合", phone,1006,orderNo)
1008 -> sendMessage2Driver("车票剩余可用次数为0", phone,99,orderNo)
1009 -> sendMessage2Driver("乘车日期非今日", phone,1009,orderNo)
1005 -> sendMessage2Driver("当前无路线任务", phone,1005,orderNo)
1006 -> sendMessage2Driver("车票非当前路线", phone,1006,orderNo)
1008 -> sendMessage2Driver("车票剩余可用次数", phone,99,orderNo)
6001 -> sendMessage2Driver("二维码已过期", phone,6001,orderNo)
6002 -> sendMessage2Driver("同一订单核销间隔时间需大于2分钟", phone,6002,orderNo)
6003 -> sendMessage2Driver("车票站点信息与当前车辆执行任务的站点信息不符合", phone,6003,orderNo)
6003 -> sendMessage2Driver("车票非当前站点", phone,6003,orderNo)
6004 -> sendMessage2Driver("车辆未执行任务", phone,6004,orderNo)
6005 -> sendMessage2Driver("车票站点信息与当前车辆执行任务信息不符合", phone,6005,orderNo)
1012 -> sendMessage2Driver("当前用户下单路线非当前的车辆所属公司", phone,1012,orderNo)
6005 -> sendMessage2Driver("车票非当前班次", phone,6005,orderNo)
1012 -> sendMessage2Driver("车票与车辆所属租户不一致", phone,1012,orderNo)
else -> {
try {
val tempcode=msg.toInt()
@@ -233,19 +232,11 @@ object TicketModel {
private fun sendMessage2Driver(message:String,phone:String,code:Int,orderNo: String){
// 发送乘客屏 通过蓝牙告知小程序
LanSocketManager.sendMsgToClient(WriteOffResultMsg(code, phone,orderNo, System.currentTimeMillis(),LineManager.lineInfos?.lineId?:0,LineManager.getStations()?.first?.siteId?.toLong()?:0L))
val failedReason = "验票失败,${message}"
val failedReason = "核销失败,${message}"
// tts
ShuttleVoiceManager.writeOffFaile(failedReason)
var tempPhone = phone
tempPhone.let {
if (it.length > 8) {
//截取电话号码前三位
val phoneNumPre = it.substring(0, 3)
//截取电话号码后四位
val phoneNumFix = it.substring(7)
tempPhone = "$phoneNumPre****$phoneNumFix"
}
}
val reaseonAndPhone = if(tempPhone.isNullOrEmpty()) {
val tempPhone = OchPhoneUtil.getPhoneWithoutMiddle(phone)
val reaseonAndPhone = if(tempPhone.isEmpty()) {
failedReason
}else{
"${failedReason};乘客:${tempPhone}"

View File

@@ -118,22 +118,22 @@ object RepositoryManager {
return lineRepository?.queryCanUserTask(lineId)
}
fun startTask(taskId:Long,lineId:Long,taskTime:Long,lineName:String): Observable<Boolean>? {
return lineRepository?.startTask(taskId,lineId,taskTime,lineName)
fun startTask(shiftsId:Long,taskId:Long,lineId:Long,taskTime:Long,lineName:String): Observable<Boolean>? {
return lineRepository?.startTask(shiftsId,taskId,lineId,taskTime,lineName)
}
fun leaveStation(
seq: Int, siteId: Long, taskId: Long, lineId: Long, taskStartTime: Long, taskDate: Long
seq: Int, siteId: Long,shiftsId:Long ,taskId: Long, lineId: Long, taskStartTime: Long, taskDate: Long
): Observable<Boolean>?{
return lineRepository?.leaveStation(seq,siteId,taskId,lineId,taskStartTime,taskDate)
return lineRepository?.leaveStation(seq,siteId,shiftsId,taskId,lineId,taskStartTime,taskDate)
}
fun arriveStation(seq: Int, siteId: Long, taskId: Long): Observable<Boolean>?{
return lineRepository?.arriveStation(seq,siteId,taskId)
}
fun endTask(taskId: Long): Observable<Boolean>?{
return lineRepository?.endTask(taskId)
fun endTask(shiftsId:Long,taskId: Long): Observable<Boolean>?{
return lineRepository?.endTask(shiftsId,taskId)
}

View File

@@ -91,7 +91,11 @@ abstract class MyDataBase : RoomDatabase() {
private val MIGRATION_5_6 = object : Migration(5, 6) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE ${EventDataBean.tableName} ADD COLUMN task_date INTEGER")
database.execSQL("ALTER TABLE ${EventDataBean.tableName} ADD COLUMN shifts_id INTEGER")
database.execSQL("ALTER TABLE ${WriteOffDataBean.tableName} ADD COLUMN task_date INTEGER")
database.execSQL("ALTER TABLE ${WriteOffDataBean.tableName} ADD COLUMN shifts_id INTEGER")
database.execSQL("ALTER TABLE ${TaskDataBean.tableName} ADD COLUMN shifts_id INTEGER")
database.execSQL("ALTER TABLE ${TaskSiteDataBean.tableName} ADD COLUMN shifts_id INTEGER")
}
}

View File

@@ -18,6 +18,12 @@ data class EventDataBean(
@ColumnInfo(name = "event_type", typeAffinity = ColumnInfo.TEXT)
var eventType: String? = null,
/**
* 生成任务的模板id
*/
@ColumnInfo(name = "shifts_id", typeAffinity = ColumnInfo.INTEGER)
var shiftsId: Long? = null,
/**
* 任务id、模板id
*/

View File

@@ -12,11 +12,17 @@ data class TaskDataBean(
@SerializedName("idtemp")
var id: Int = 0,
/**
* 生成任务的模板id
*/
@ColumnInfo(name = "shifts_id", typeAffinity = ColumnInfo.INTEGER)
var shiftsId: Long? = null,
/**
* 任务id
*/
@ColumnInfo(name = "task_id", typeAffinity = ColumnInfo.INTEGER, index = true)
@SerializedName("id", alternate = ["shiftsId"])
@SerializedName("id")
var taskId: Long? = null,
/**
@@ -87,11 +93,13 @@ data class TaskDataBean(
return result
}
fun getLineIdAndName(function: (taskId: Long, taskTime: Long , taskDate:Long) -> Unit) {
fun getLineIdAndName(function: (shiftsId:Long,taskId: Long, taskTime: Long , taskDate:Long) -> Unit) {
taskId?.let { id ->
taskStartTime?.let { time ->
taskDate?.let { date ->
function(id, time, date)
shiftsId?.let {shiftsId->
function(shiftsId,id, time, date)
}
}
}
}

View File

@@ -15,6 +15,12 @@ data class TaskSiteDataBean(
@ColumnInfo(name = "task_id", typeAffinity = ColumnInfo.INTEGER)
var taskId: Long? = null,
/**
* 生成任务的模板id
*/
@ColumnInfo(name = "shifts_id", typeAffinity = ColumnInfo.INTEGER)
var shiftsId: Long? = null,
/**
* 线路id
*/
@@ -129,12 +135,13 @@ data class TaskSiteDataBean(
/**
* 开始任务 并把第一站置为 2 当前站
*/
fun toTaskSiteDatas(querySites: List<SiteDataBean>, taskId:Long, lineName: String): MutableList<TaskSiteDataBean> {
fun toTaskSiteDatas(querySites: List<SiteDataBean>,shiftsId:Long, taskId:Long, lineName: String): MutableList<TaskSiteDataBean> {
val result = mutableListOf<TaskSiteDataBean>()
var temp: TaskSiteDataBean?=null
querySites.forEach {
temp = TaskSiteDataBean()
temp?.taskId = taskId
temp?.shiftsId = shiftsId
temp?.lineId = it.lineId
temp?.lineName = lineName
temp?.siteId = it.siteId

View File

@@ -36,6 +36,13 @@ data class WriteOffDataBean(
@ColumnInfo(name = "type", typeAffinity = ColumnInfo.INTEGER)
var type: Int? = null,
/**
* 生成任务的模板id
*/
@ColumnInfo(name = "shifts_id", typeAffinity = ColumnInfo.INTEGER)
var shiftsId: Long? = null,
/**
* 当前的任务id、模板id
*/

View File

@@ -20,8 +20,8 @@ interface EventDataDao {
@Delete
fun delete(vararg eventDataBean: EventDataBean)
@Query("UPDATE ${EventDataBean.tableName} SET update_status = :status WHERE id = :id")
fun updateUpdateSatus(id:Int,status:Int):Int
@Query("UPDATE ${EventDataBean.tableName} SET update_status = :status,update_time = :currentTimeMillis WHERE id = :id")
fun updateUpdateSatus(id: Int, status: Int, currentTimeMillis: Long):Int
// 删除过时数据

View File

@@ -39,5 +39,8 @@ interface WriteOffDataDao {
@Query("SELECT count(1) FROM ${WriteOffDataBean.tableName} WHERE update_status = ${WriteOffDataBean.notUpdate}")
fun queryWriteOffByStatusWithPageCount(): Int
@Query("UPDATE ${WriteOffDataBean.tableName} SET update_status = :updated ,update_time = :currentTimeMillis WHERE id = :id")
fun updateStatusAndTime(updated: Int, currentTimeMillis: Long, id: Int)
}

View File

@@ -1,6 +1,15 @@
package com.mogo.och.weaknet.repository.db.exception
class DbException: RuntimeException {
var code:Int = 0
var msg:String = ""
constructor() : super()
constructor(message: String?) : super(message)
constructor(code:Int, message: String) : super("${code}_${message}"){
this.code = code
this.msg = message
}
companion object{
const val NEEDSYNDATA = 10001
}
}

View File

@@ -30,11 +30,12 @@ object EventDb: IDbRepository {
eventDataDao = null
}
fun saveEventTaskStart(taskId: Long, lineId: Long, taskStartTime: Long, name: String,taskDate:Long) {
fun saveEventTaskStart(shiftsId:Long,taskId: Long, lineId: Long, taskStartTime: Long, name: String,taskDate:Long) {
val event = EventDataBean()
event.eventType = EventDataBean.TaskStart
event.lineId = lineId
event.taskId = taskId
event.shiftsId = shiftsId
event.taskDate = taskDate
event.lineName = name
event.taskStartTime = taskStartTime
@@ -51,6 +52,7 @@ object EventDb: IDbRepository {
}
fun saveEventTaskArriveSite(
shiftsId:Long,
taskId: Long,
lineId: Long,
siteId: Long,
@@ -62,6 +64,7 @@ object EventDb: IDbRepository {
val event = EventDataBean()
event.eventType = EventDataBean.TaskArriveSite
event.lineId = lineId
event.shiftsId = shiftsId
event.taskStartTime = taskStartTime
event.lineName = lineName
event.taskId = taskId
@@ -79,6 +82,7 @@ object EventDb: IDbRepository {
}
fun saveEventTaskLeaveSite(
shiftsId:Long,
taskId: Long,
lineId: Long,
siteId: Long,
@@ -90,6 +94,7 @@ object EventDb: IDbRepository {
val event = EventDataBean()
event.eventType = EventDataBean.TaskLeaveSite
event.lineId = lineId
event.shiftsId = shiftsId
event.taskId = taskId
event.taskDate = taskDate
event.taskStartTime = taskStartTime
@@ -107,6 +112,7 @@ object EventDb: IDbRepository {
}
fun saveEventTaskEnd(
shiftsId: Long,
taskId: Long,
lineId: Long,
taskStartTime: Long?,
@@ -116,6 +122,7 @@ object EventDb: IDbRepository {
val event = EventDataBean()
event.eventType = EventDataBean.TaskEnd
event.lineId = lineId
event.shiftsId = shiftsId
event.taskId = taskId
event.taskDate = taskDate
event.lineName = lineName
@@ -151,7 +158,7 @@ object EventDb: IDbRepository {
@Transaction
fun saveUpdateSuccess(waitUpdateEvent: List<EventDataBean>) {
waitUpdateEvent.forEach {
eventDataDao?.updateUpdateSatus(it.id,it.updateStatus)
eventDataDao?.updateUpdateSatus(it.id,it.updateStatus,System.currentTimeMillis())
}
}

View File

@@ -6,6 +6,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.weaknet.model.LineModel
import com.mogo.och.weaknet.repository.db.IDbRepository
import com.mogo.och.weaknet.repository.db.MyDataBase
import com.mogo.och.weaknet.repository.db.bean.TaskDataBean
@@ -89,7 +90,7 @@ object TaskDb : IDbRepository {
return null
}
fun startTask(taskId: Long, lineId: Long,lineName:String): Observable<Boolean>? {
fun startTask(shiftsId:Long,taskId: Long, lineId: Long,lineName:String): Observable<Boolean>? {
return Observable.just(taskId)
.flatMap {
var updateCount:Int? = 0
@@ -105,19 +106,30 @@ object TaskDb : IDbRepository {
}
CallerLogger.d(TAG,"更新任务状态用时:${System.currentTimeMillis()-startTime}")
startTime = System.currentTimeMillis()
updateCount = TaskSiteDb.startTask(taskId, lineId, lineName)
updateCount = TaskSiteDb.startTask(shiftsId,taskId, lineId, lineName)
OchChainLogManager.writeChainLogDb("开始任务", "把正在使用的数据更新到RunningTask表格一共${updateCount}行数据")
CallerLogger.d(TAG,"插入正在运行的线路用时:${System.currentTimeMillis()-startTime}")
} catch (e: Exception) {
if (e is DbException) {
println("数据不全")
// 恢复数据
taskDataDao?.queryTaskByTaskIdOne(taskId)?.let {
it.startTime = null
it.status = TaskDataBean.unUse
// 更新任务状态
taskDataDao?.updateStatus(System.currentTimeMillis(),TaskDataBean.unUse,it.id)
OchChainLogManager.writeChainLogDb("开始任务", "异常情况${lineId}_${lineName}_task:${taskId} 为未使用的状态 原因:${e.message}")
if(e.code==DbException.NEEDSYNDATA) {
// 重新同步 信息
LineModel.refreshTask()
println("数据不全")
// 恢复数据
taskDataDao?.queryTaskByTaskIdOne(taskId)?.let {
it.startTime = null
it.status = TaskDataBean.unUse
// 更新任务状态
taskDataDao?.updateStatus(
System.currentTimeMillis(),
TaskDataBean.unUse,
it.id
)
OchChainLogManager.writeChainLogDb(
"开始任务",
"异常情况${lineId}_${lineName}_task:${taskId} 为未使用的状态 原因:${e.message}"
)
}
}
}
return@flatMap Observable.error(DataException(DataException.startTaskErrorCode,e.message?:""))

View File

@@ -34,28 +34,28 @@ object TaskSiteDb : IDbRepository {
}
// 开始线路
fun startTask(taskId: Long, linId: Long, lineName: String): Int? {
fun startTask(shiftsId:Long,taskId: Long, linId: Long, lineName: String): Int? {
// 获取线路的站点
var startTime = System.currentTimeMillis()
val querySites = SiteDb.querySiteByLineId(linId)?.distinctBy { it.siteId }
val querySites = SiteDb.querySiteByLineId(linId)?.distinctBy { it.siteId }?.sortedBy { it.seq }
if (querySites.isNullOrEmpty()) {
throw DbException("没有站点数据")
throw DbException(DbException.NEEDSYNDATA,"没有站点数据")
}
querySites.forEachIndexed { index, siteDataBean ->
if(index+1!=siteDataBean.seq){
throw DbException(DbException.NEEDSYNDATA,"站点数据排序不对")
}
}
CallerLogger.d(TAG, "查询站点用时:${System.currentTimeMillis() - startTime}")
startTime = System.currentTimeMillis()
val toTaskSiteDatas = TaskSiteDataBean.toTaskSiteDatas(
querySites,
shiftsId,
taskId,
lineName
)
CallerLogger.d(TAG, "数据转换用时:${System.currentTimeMillis() - startTime}")
if (toTaskSiteDatas.size < 2) {
throw DbException("站点数据不全请稍后再试")
throw DbException(DbException.NEEDSYNDATA,"站点数据不全请稍后再试")
}
// 把线路所有的站点搬迁到运行中表格中
startTime = System.currentTimeMillis()
val result = taskSiteDataDao?.insert(*toTaskSiteDatas.toTypedArray())
CallerLogger.d(TAG, "数据插入用时:${System.currentTimeMillis() - startTime}")
return if (result.isNullOrEmpty()) {
null
} else {
@@ -110,6 +110,7 @@ object TaskSiteDb : IDbRepository {
* 从后台恢复正在执行的任务
*/
fun restoreRunningTask(
shiftsId:Long,
taskId: Long,
currentSiteId: Long,
leaving: Boolean,
@@ -123,10 +124,11 @@ object TaskSiteDb : IDbRepository {
// 获取线路的站点
val querySites = SiteDb.querySiteByLineId(lineInfo.lineId!!)?.distinctBy { it.siteId }
if (querySites.isNullOrEmpty()) {
throw DbException("没有站点数据")
throw DbException(DbException.NEEDSYNDATA,"没有站点数据")
}
val toTaskSiteDatas = TaskSiteDataBean.toTaskSiteDatas(
querySites,
shiftsId,
taskId,
lineInfo.lineName!!
)

View File

@@ -1,5 +1,6 @@
package com.mogo.och.weaknet.repository.db.repository
import androidx.room.Transaction
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.weaknet.model.EventModel
import com.mogo.och.weaknet.repository.db.IDbRepository
@@ -38,8 +39,15 @@ object WriteOffDb: IDbRepository {
return writeOffDataDao?.queryWriteOffEventByStatusWithPage()
}
fun saveUpdateSuccess(writeOffEvents: List<WriteOffDataBean>) {
writeOffDataDao?.insert(*writeOffEvents.toTypedArray())
@Transaction
fun saveUpdateSuccess(
writeOffEvents: List<WriteOffDataBean>,
updated: Int,
currentTimeMillis: Long
) {
writeOffEvents.forEach {
writeOffDataDao?.updateStatusAndTime(updated,currentTimeMillis,it.id)
}
}
fun queryWaitUpdateEventByTaskId(taskId: Long): List<WriteOffDataBean>? {

View File

@@ -17,11 +17,12 @@ interface ILineRepository {
fun queryCanUserTask(lineId:Long): Observable<List<TaskDataBean>?>?
fun startTask(taskId:Long,lineId:Long,taskTime:Long,lineName:String): Observable<Boolean>?
fun startTask(shiftsId:Long,taskId:Long,lineId:Long,taskTime:Long,lineName:String): Observable<Boolean>?
fun leaveStation(
seq: Int,
siteId: Long,
shiftsId:Long,
taskId: Long,
lineId: Long,
taskStartTime: Long,
@@ -30,7 +31,7 @@ interface ILineRepository {
fun arriveStation( seq: Int, siteId: Long, taskId: Long): Observable<Boolean>?
fun endTask( taskId: Long): Observable<Boolean>?
fun endTask(shiftsId:Long, taskId: Long): Observable<Boolean>?
fun queryCarExecutableTaskList(ochCommonServiceCallback: OchCommonServiceCallback<CarExecutableTaskResponse>)

View File

@@ -101,8 +101,10 @@ class NormalRepository: ILineRepository {
if (lineInfo == null && busRoutesResult.name != null) {
lineInfo = LineInfo(busRoutesResult.lineId.toLong(), busRoutesResult.name, orderId = busRoutesResult.taskId.toString() )
}
lineInfo?.multiMap?.put("taskInfo", LineModel.getTaskTime())
}
lineInfo?.multiMap?.put("taskInfo", LineModel.getTaskTime())
lineInfo?.siteInfos = result
LineManager.setLineInfo(lineInfo)
LineManager.setContraiInfo(
@@ -144,6 +146,7 @@ class NormalRepository: ILineRepository {
}
override fun startTask(
shiftsId:Long,
taskId: Long,
lineId: Long,
taskTime: Long,
@@ -155,6 +158,7 @@ class NormalRepository: ILineRepository {
override fun leaveStation(
seq: Int,
siteId: Long,
shiftsId:Long,
taskId: Long,
lineId: Long,
taskStartTime: Long,
@@ -172,7 +176,7 @@ class NormalRepository: ILineRepository {
)
}
override fun endTask(taskId: Long): Observable<Boolean>? {
override fun endTask(shiftsId:Long,taskId: Long): Observable<Boolean>? {
return normalLineInterface?.endTask(taskId)
}

View File

@@ -95,7 +95,7 @@ class WeaknetRepository : ILineRepository {
// 恢复站点信息
currentTask?.taskId?.let {
// 获取正在进行中的具体信息
val runnintTaskAndSites = TaskSiteDb.queryRunningTask(it)
val runnintTaskAndSites = TaskSiteDb.queryRunningTask(it)?.distinctBy { it.siteId }
if(runnintTaskAndSites.isNullOrEmpty()||runnintTaskAndSites.size<2){
CallerLogger.d(TAG, "异常情况:有任务:${runningTaskInfo} runningTask 表格没有对应的数据:${runnintTaskAndSites}")
OchChainLogManager.writeChainLogDb("加载任务", "异常情况:有任务:${runningTaskInfo} runningTask 表格没有对应的数据:${runnintTaskAndSites}")
@@ -191,12 +191,14 @@ class WeaknetRepository : ILineRepository {
if(lineId<=0){
return@flatMap Observable.just(false)
}
if(taskId<=0||currentSiteId<=0||taskDate<=0){
if(taskId<=0||currentSiteId<=0){
return@flatMap Observable.just(false)
}
// 日期是否正确
if (!DateTimeUtil.isSameDay(System.currentTimeMillis(),taskDate)) {
return@flatMap Observable.just(false)
if (AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
if (!DateTimeUtil.isSameDay(System.currentTimeMillis(),taskDate)) {
return@flatMap Observable.just(false)
}
}
// region 任务本地是否存在
@@ -277,7 +279,7 @@ class WeaknetRepository : ILineRepository {
TaskDb.restoreTask(taskId)
// 恢复正在执行任务表
TaskSiteDb.restoreRunningTask(taskId,currentSiteId,leaving,lineInfo!!)
TaskSiteDb.restoreRunningTask(it.shiftsId,taskId,currentSiteId,leaving,lineInfo!!)
return@flatMap loadCurrentTaskInfo()
}
@@ -335,17 +337,19 @@ class WeaknetRepository : ILineRepository {
}
override fun startTask(
shiftsId:Long,
taskId: Long,
lineId: Long,
taskTime: Long,
lineName: String
): Observable<Boolean>? {
return TaskDb.startTask(taskId, lineId, lineName)
return TaskDb.startTask(shiftsId,taskId, lineId, lineName)
}
override fun leaveStation(
seq: Int,
siteId: Long,
shiftsId:Long,
taskId: Long,
lineId: Long,
taskStartTime: Long,
@@ -364,6 +368,7 @@ class WeaknetRepository : ILineRepository {
// 设置滑动出发任务
LineManager.getLineInfo { lineInfo ->
EventDb.saveEventTaskLeaveSite(
shiftsId,
taskId,
lineId,
it.siteId.toLong(),
@@ -404,6 +409,7 @@ class WeaknetRepository : ILineRepository {
// 设置到站任务
LineManager.getLineInfo { lineInfo ->
EventDb.saveEventTaskArriveSite(
task.shiftsId!!,
task.taskId!!,
task.lineId!!,
end.siteId.toLong(),
@@ -449,13 +455,13 @@ class WeaknetRepository : ILineRepository {
}
override fun endTask(taskId: Long): Observable<Boolean>? {
override fun endTask(shiftsId:Long,taskId: Long): Observable<Boolean>? {
return Observable.just(taskId).flatMap {
currentTask?.let {task->
if (task.taskId!=null&&task.lineId!=null) {
TaskDb.endTask(task.taskId!!)
LineManager.getLineInfo { lineInfo ->
EventDb.saveEventTaskEnd(task.taskId!!,task.lineId!!,task.taskStartTime,lineInfo.lineName,task.taskDate?:0L)
EventDb.saveEventTaskEnd(shiftsId,task.taskId!!,task.lineId!!,task.taskStartTime,lineInfo.lineName,task.taskDate?:0L)
}
}
}

View File

@@ -136,6 +136,9 @@ class WriteOffCacheRepository : IWriteOffRepository {
throw DataException(1009,"车票所选乘车日期非今日")
}
// 6、校验线路
if(LineManager.lineInfos==null||LineManager.lineInfos?.lineId==null){
throw DataException(1005,"车辆未登录、或没有任务")
}
if(it.lineId==LineManager.lineInfos?.lineId){
lineId = it.lineId
}else{
@@ -186,6 +189,7 @@ class WriteOffCacheRepository : IWriteOffRepository {
addWrite.expiryTime = it.expiryTime
addWrite.bookingTime = it.bookingTime
addWrite.type = it.type
addWrite.shiftsId = it.shiftsId
addWrite.taskId = LineModel.currentTask?.taskId
addWrite.taskDate = LineModel.currentTask?.taskDate
addWrite.lineId = lineId
@@ -243,6 +247,7 @@ class WriteOffCacheRepository : IWriteOffRepository {
//addWrite.bookingTime = it.bookingTime
//addWrite.type = it.type
addWrite.taskId = LineModel.currentTask?.taskId
addWrite.shiftsId = LineModel.currentTask?.shiftsId
LineManager.getStationsWithLine { start, end, lineInfo ->
addWrite.siteId = start.siteId.toLong()
addWrite.lineId = lineInfo.lineId

View File

@@ -12,7 +12,9 @@ import com.mogo.och.bridge.autopilot.trajectory.ITrajectoryListListener
import com.mogo.och.bridge.autopilot.trajectory.TrajectoryManager
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.weaknet.constant.BusConst
import com.mogo.och.weaknet.model.LineModel
import com.mogo.och.weaknet.model.LineModel.currentTask
import com.mogo.och.weaknet.model.LineModel.startStationIndex
import com.mogo.och.weaknet.model.OrderModel.isGoingToNextStation
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
@@ -54,10 +56,11 @@ object BusTrajectoryManager : ITrajectoryListListener {
} else {
OchChainLogManager.writeChainLogTrajectory(
"轨迹监控",
"开始或者结束下发轨迹 轨迹id:${mAutopilotControlParameters!!.autoPilotLine!!.lineId}"
"开始或者结束下发轨迹 轨迹id:${mAutopilotControlParameters!!.autoPilotLine!!.lineId}____${startStationIndex}"
)
}
if (isLogin() && currentTask != null && !isGoingToNextStation) {
if (isLogin() && currentTask != null && !isGoingToNextStation && startStationIndex == 0) {
d(TAG, "syncTrajectoryInfo() start.")
startTrajReqLoop()
} else {

View File

@@ -103,6 +103,24 @@ object TicketModel : StateChangeListener {
}
}
try {
var tempType = 0
if (type is String) {
when (type) {
"shuttle" -> {
tempType = 11
}
"bus" -> {
tempType = 10
}
else -> {
tempType = type.toInt()?:0
}
}
} else {
tempType = type?.toInt() ?: 0
}
val writeOffDetail = WriteOffDetialMsg(0,"",
expiryTime?.toLong()?:0,
bookingTime?.toLong()?:0,
@@ -113,7 +131,7 @@ object TicketModel : StateChangeListener {
phoneNum,
ticketSize?.toInt()?:0,
URLDecoder.decode(ticketName?:"","UTF-8"),
type?.toInt()?:0,
tempType,
shiftsId?.toLong()?:0,
pipe,
startStationId?.toLong()?:0,
@@ -126,13 +144,15 @@ object TicketModel : StateChangeListener {
e.printStackTrace()
CallerLogger.d(M_BUS_P + TAG, "")
// 通知司机屏二维码错误
val writeOffDetail = WriteOffDetialMsg(code = 3001, msg = "参数错误:${payload}")
val writeOffDetail = WriteOffDetialMsg(code = 3001, msg = "出示错误二维码")
OchChainLogManager.writeChainLogWriteOff("核销失败","二维码错误+参数错误:${payload}")
CallerLogger.d(M_BUS_P + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(writeOffDetail))
LanSocketManager.sendMsgToServer(writeOffDetail)
}
}else{
// 通知司机屏二维码错误
val writeOffDetail = WriteOffDetialMsg(code = 3001, msg = "参数错误:${payload}")
val writeOffDetail = WriteOffDetialMsg(code = 3001, msg = "出示错误二维码")
OchChainLogManager.writeChainLogWriteOff("核销失败","二维码错误+参数错误:${payload}")
CallerLogger.d(M_BUS_P + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(writeOffDetail))
LanSocketManager.sendMsgToServer(writeOffDetail)
}

View File

@@ -9,6 +9,9 @@ import com.mogo.och.data.taxi.TaxiOrderStatusEnum
import com.mogo.och.unmanned.taxi.utils.order.OrderListener
import com.mogo.och.unmanned.taxi.utils.order.OrderModel
/**
* 自动探查
*/
class OchAutomaticExplorationView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,

View File

@@ -11,6 +11,7 @@ import com.mogo.eagle.core.utilcode.util.NetworkUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bridge.autopilot.line.LineManager
import com.mogo.och.common.module.network.OchCommonServiceCallback
import com.mogo.och.data.bean.BusStationBean
import com.mogo.och.data.bean.LineInfo
import com.mogo.och.unmanned.taxi.bean.GrayLineBean
import com.mogo.och.unmanned.taxi.bean.QueryGrayContrailListRsp
@@ -153,9 +154,25 @@ class RoutingSelectModel : ViewModel() {
}
DebugView.printInfoMsg("[启自驾] 准备启动自驾")
LineManager.setLineInfo(LineInfo(grayLineBean.lineId?:0L,grayLineBean.lineName?:"", orderId = "${data.taskId}"))
val startStation = grayLineBean.startSite?.toBusStationBean()
val endStation = grayLineBean.endSite?.toBusStationBean()
val temp = mutableListOf<BusStationBean>()
if(startStation!=null){
temp.add(startStation)
}
if(endStation!=null){
temp.add(endStation)
}
LineManager.setLineInfo(
LineInfo(
grayLineBean.lineId?:0L,
grayLineBean.lineName?:"",
orderId = "${data.taskId}",
siteInfos = temp
)
)
LineManager.setContraiInfo(contrailBean.toContraiInfo())
LineManager.setStartAndEndStation(grayLineBean.startSite?.toBusStationBean(),grayLineBean.endSite?.toBusStationBean())
LineManager.setStartAndEndStation(startStation,endStation)
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(true)
viewCallback?.onStartGrayTaskAndQueryContrailSuccess(data)

View File

@@ -54,6 +54,7 @@ import com.mogo.och.bridge.utils.CoordinateCalculateRouteUtil.coordinateConverte
import com.mogo.och.common.module.utils.OCHThreadPoolManager
import com.mogo.och.common.module.utils.RxUtils
import com.mogo.och.common.module.voice.VoiceNotice
import com.mogo.och.data.bean.BusStationBean
import com.mogo.och.data.bean.LineInfo
import com.mogo.och.data.taxi.QueryCarOrderByNoRespBean
import com.mogo.och.unmanned.taxi.bean.PrepareTaskRespBean
@@ -1060,7 +1061,23 @@ object TaxiTaskModel {
mTaskTrajectoryList.addAll(it)
mCurrentTaskTrajectory = it.first { currentTaskLineId == it.lineId }
mCurrentTaskTrajectory?.let {traj->
LineManager.setLineInfo(LineInfo(traj.lineId,traj.lineName, orderId = mCurrentTaskWithOrder?.order?.orderNo?:""))
val startStaion = mCurrentTaskWithOrder?.startSite?.toCommonStation()
val endStaion = mCurrentTaskWithOrder?.endSite?.toCommonStation()
val temp = mutableListOf<BusStationBean>()
if(startStaion!=null){
temp.add(startStaion)
}
if(endStaion!=null){
temp.add(endStaion)
}
LineManager.setLineInfo(
LineInfo(
traj.lineId,
traj.lineName,
orderId = mCurrentTaskWithOrder?.order?.orderNo?:"",
siteInfos = temp
)
)
LineManager.setContraiInfo(traj.toCommonContraiInfo())
}
}

View File

@@ -17,6 +17,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.hmi.ui.widget.ItinerarySummaryDialog
import com.mogo.eagle.core.network.utils.GsonUtil
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
import com.mogo.eagle.core.utilcode.util.ClickUtils
@@ -29,6 +30,7 @@ import com.mogo.och.common.module.map.ICommonNaviChangedCallback
import com.mogo.och.common.module.map.MapMakerManager
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.common.module.utils.FlowBus
import com.mogo.och.common.module.utils.OchPhoneUtil
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.common.module.voice.VoiceNotice
import com.mogo.och.common.module.wigets.CommonSlideView
@@ -50,28 +52,55 @@ import com.mogo.och.unmanned.taxi.ui.task.TaskWithOrderUIState
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel
import com.mogo.och.unmanned.taxi.ui.task.cancleorder.CancleOrderView
import com.mogo.och.unmanned.taxi.utils.TaskUtils
//演练单标识
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_type_exercise
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_type_order
// 距离目的地距离和剩余时间
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_distance_end
// 完成服务
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_end_order
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_order_phone
// 跳过乘客端验证
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_submit_task
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.cancelOrder
// 取消虚拟单
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.cancelTask
// 开始服务
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.commonSlideViewStartServer
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.gourp_order
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.group_itinerary_info
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.include_empty
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.naviToEnd
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.naviToStart
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.prepareTaskCountdownTv
// 前往出车点、前往送架、等待乘客、前往接驾
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.taskStatus
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.endStationName
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.startStationName
// 用户手机号
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_order_phone
// 用户人数
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.orderPhoneAndNum
// 运营单标识
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_type_order
// 取消订单
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.cancelOrder
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.currentTaskStation
// 展示站点信息
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.group_itinerary_info
// 没有任务的情况下展示的
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.include_empty
// 导航到终点
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.naviToEnd
// 导航到起点
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.naviToStart
// 拉取任务倒计时
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.prepareTaskCountdownTv
// 终点名称
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.endStationName
// 起始站点名称
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.startStationName
// 途径点展示
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.pathwayPoint
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.trajectoryType
// 途径站点标识
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.v_bg_route_point_station_name
// 自主算路标识
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.trajectoryType
import kotlinx.coroutines.flow.map
class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineViewCallback,
@@ -117,9 +146,6 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
viewModel?.uiStateFlow?.map { it.taskWithOrderUIState }?.collect { taskAndOrderUiState ->
d(TAG, "uiStateFlow-initViewModelObserver: $taskAndOrderUiState")
when (taskAndOrderUiState) {
is TaskWithOrderUIState.Init -> {
}
// 开始接单后 需要将车开到最近的一个站点就位,然后才能开启 无人化 流程
is TaskWithOrderUIState.TaskDriveToNearestStationTask -> {
if (taskAndOrderUiState.driveToNearestStationTask != null) {
@@ -163,13 +189,100 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
}
// 1、无订单 无任务
// 2、标定单
// 3、虚拟单
// 4、运营单
// 5、倒计时获取虚拟任务
override fun onAttachedToWindow() {
super.onAttachedToWindow()
viewModel = findViewTreeViewModelStoreOwner()?.let {
ViewModelProvider(it).get(ItineraryCurrentModel::class.java)
}
viewModel?.setDistanceCallback(this)
initOnClickListener()
initTaskDebugViewListener()
initViewModelObserver()
showEmptyView()
}
private fun initOnClickListener() {
CallerLogger.d(TAG,"initOnClickListener")
naviToStart.setOnClickListener(this)
naviToEnd.setOnClickListener(this)
cancelTask.setOnClickListener(this)
cancelOrder.setOnClickListener(this)
taskStatus.setOnClickListener(this)
commonSlideViewStartServer.setSlideListener(object :CommonSlideView.SlideListener{
override fun slideEnd() {
d(TAG, taskStatus.text.toString())
startOrEndService()
}
})
actv_submit_task.onClick {
startOrEndService()
}
actv_end_order.onClick {
startOrEndService()
}
}
override fun onClick(v: View?) {
if (!ClickUtils.isFastClick()) {
i(TAG, "view点击过快")
return
}
when (v?.id) {
cancelOrder.id -> {
val currentWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
if (currentWithOrder?.order != null) {
context?.let {
CancleOrderView.showDialog(it)
}
}
}
naviToStart.id,
naviToEnd.id -> {
showNaviToEndStationFragment()
}
cancelTask.id -> {
val builder = CommonDialogStatus.Builder()
val closeLineConfirmDialog = builder
.title(ResourcesUtils.getString(R.string.common_dialog_title))
.tips(ResourcesUtils.getString(R.string.taxi_dialog_cancle_task))
.confirmStr(ResourcesUtils.getString(R.string.common_dialog_confirm))
.cancelStr(ResourcesUtils.getString(R.string.common_dialog_cancel))
.status(CommonDialogStatus.Status.ask)
.build(context)
closeLineConfirmDialog.setClickListener(object : CommonDialogStatus.ClickListener {
override fun confirm() {
viewModel?.cancleTask()
}
override fun cancel() {
closeLineConfirmDialog.dismiss()
}
})
closeLineConfirmDialog.show()
}
}
}
/**
* 更新拉取任务倒计时
*/
private fun updatePrepareTaskDelayUI(millisInFuture: Long, isStart: Boolean) {
CallerLogger.d(TAG,"updatePrepareTaskDelayUI")
DebugView.printInfoMsg("距离任务获取还有 ${DateTimeUtil.second2MMSS(millisInFuture / 1000)}")
if (!isStart) {
prepareTaskCountdownTv.visibility = View.GONE
currentTaskStation.visibility = View.GONE
mPrepareTasCountDownTimer?.cancel()
mPrepareTasCountDownTimer = null
return
@@ -177,31 +290,37 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
if (mPrepareTasCountDownTimer != null) {
prepareTaskCountdownTv.visibility = View.GONE
currentTaskStation.visibility = View.GONE
mPrepareTasCountDownTimer?.cancel()
mPrepareTasCountDownTimer = null
}
mPrepareTasCountDownTimer = object : CountDownTimer(millisInFuture, 1000L) {// 倒计时后开启自驾
override fun onTick(millisUntilFinished: Long) {
DebugView.printInfoMsg("距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished / 1000)}")
// 倒计时
UiThreadHandler.post {
prepareTaskCountdownTv.visibility = View.VISIBLE
prepareTaskCountdownTv.text =
"距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished / 1000)}"
override fun onTick(millisUntilFinished: Long) {
DebugView.printInfoMsg("距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished / 1000)}")
// 倒计时
UiThreadHandler.post {
prepareTaskCountdownTv.visibility = View.VISIBLE
prepareTaskCountdownTv.text = "距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished / 1000)}"
val taskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
if(taskWithOrder?.currentStatus == TaskStatusEnum.CompleteTask.code){
currentTaskStation.visibility = View.VISIBLE
currentTaskStation.text = taskWithOrder.endSite?.siteName?:""
}
}
override fun onFinish() {
//倒计时结束了...
UiThreadHandler.post {
prepareTaskCountdownTv.visibility = View.INVISIBLE
}
mPrepareTasCountDownTimer?.cancel()
}
}
override fun onFinish() {
//倒计时结束了...
UiThreadHandler.post {
prepareTaskCountdownTv.visibility = View.INVISIBLE
currentTaskStation.visibility = View.INVISIBLE
}
mPrepareTasCountDownTimer?.cancel()
}
}
mPrepareTasCountDownTimer?.start()
}
@@ -209,6 +328,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
* 更新当前任务和订单信息
*/
private fun updateViewByCurrentTaskWithOrder(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
CallerLogger.d(TAG,"updateViewByCurrentTaskWithOrder")
if (taskAndOrder == null) return
/**
* 根据任务类型判断任务显示,
@@ -263,6 +383,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
// 第一个特殊任务 也是虚拟任务
private fun updateViewByDriveToNearestStationTask(driveToNearestStationTask: StartServiceRespBean.Result?) {
CallerLogger.d(TAG,"updateViewByDriveToNearestStationTask 标定单")
if (driveToNearestStationTask == null) return
initContainerView(true)
// DriverToNearestStationTask 任务更新
@@ -292,11 +413,13 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun showEmptyView() {
CallerLogger.d(TAG,"showEmptyView")
gourp_order.visibility = GONE
aciv_task_type_exercise.visibility = GONE
group_itinerary_info.visibility = GONE
include_empty.visibility = VISIBLE
prepareTaskCountdownTv.visibility = GONE
currentTaskStation.visibility = View.GONE
cancelTask.visibility = View.GONE
actv_end_order.visibility = GONE
@@ -305,28 +428,8 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun initOnClickListener() {
naviToStart.setOnClickListener(this)
naviToEnd.setOnClickListener(this)
cancelTask.setOnClickListener(this)
cancelOrder.setOnClickListener(this)
taskStatus.setOnClickListener(this)
commonSlideViewStartServer.setSlideListener(object :CommonSlideView.SlideListener{
override fun slideEnd() {
d(TAG, taskStatus.text.toString())
startOrEndService()
}
})
actv_submit_task.onClick {
startOrEndService()
}
actv_end_order.onClick {
startOrEndService()
}
}
private fun initTaskDebugViewListener() {
CallerLogger.d(TAG,"initTaskDebugViewListener")
fragment?.let { fr->
aciv_task_type_exercise.setOnLongClickListener {
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_DEBUG_VIEW)
@@ -342,6 +445,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun startOrEndService() {
CallerLogger.d(TAG,"startOrEndService")
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
if (currentTaskWithOrder?.order == null) return
val order = currentTaskWithOrder.order
@@ -364,6 +468,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun closeOrderDialog() {
CallerLogger.d(TAG,"closeOrderDialog")
val builder = CommonDialogStatus.Builder()
val closeOrderDialog = builder
.title(ResourcesUtils.getString(R.string.dialog_order_close_title))
@@ -384,67 +489,13 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
viewModel = findViewTreeViewModelStoreOwner()?.let {
ViewModelProvider(it).get(ItineraryCurrentModel::class.java)
}
viewModel?.setDistanceCallback(this)
initOnClickListener()
showEmptyView()
initTaskDebugViewListener()
initViewModelObserver()
}
override fun onClick(v: View?) {
if (!ClickUtils.isFastClick()) {
i(TAG, "view点击过快")
return
}
when (v?.id) {
cancelOrder.id -> {
val currentWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
if (currentWithOrder?.order != null) {
context?.let {
CancleOrderView.showDialog(it)
}
}
}
naviToStart.id,
naviToEnd.id -> {
showNaviToEndStationFragment()
}
cancelTask.id -> {
val builder = CommonDialogStatus.Builder()
val closeLineConfirmDialog = builder
.title(ResourcesUtils.getString(R.string.common_dialog_title))
.tips(ResourcesUtils.getString(R.string.taxi_dialog_cancle_task))
.confirmStr(ResourcesUtils.getString(R.string.common_dialog_confirm))
.cancelStr(ResourcesUtils.getString(R.string.common_dialog_cancel))
.status(CommonDialogStatus.Status.ask)
.build(context)
closeLineConfirmDialog.setClickListener(object : CommonDialogStatus.ClickListener {
override fun confirm() {
viewModel?.cancleTask()
}
override fun cancel() {
closeLineConfirmDialog.dismiss()
}
})
closeLineConfirmDialog.show()
}
}
}
/**
* 显示/隐藏 前往任务目的地的导航
*
* @param isShow
*/
private fun showNaviToEndStationFragment() {
CallerLogger.d(TAG,"showNaviToEndStationFragment")
fragment?.let {
TaxiTaskModel.startNaviToEndStation(true);
}
@@ -456,6 +507,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
* @param hasCurrentTask
*/
private fun initContainerView(hasCurrentTask: Boolean) {
CallerLogger.d(TAG,"initContainerView")
d(
TAG,
"hasCurrentTask = $hasCurrentTask"
@@ -463,11 +515,13 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
if (hasCurrentTask) {
include_empty.visibility = View.GONE
prepareTaskCountdownTv.visibility = View.GONE
currentTaskStation.visibility = View.GONE
} else {
// 空页面
include_empty.visibility = View.VISIBLE
// 倒计时
prepareTaskCountdownTv.visibility = View.GONE
currentTaskStation.visibility = View.GONE
// 行程信息
group_itinerary_info.visibility = View.GONE
// 订单信息
@@ -489,10 +543,12 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun removeAllMapMarker() {
CallerLogger.d(TAG,"removeAllMapMarker")
MapMakerManager.removeAllMapMarkerByOwner(TYPE_MARKER_TAXI_ORDER)
}
private fun updateNextTaskFragment(result: QueryCurrentTaskRespBean.Result?) {
CallerLogger.d(TAG,"updateNextTaskFragment")
fragment?.let {
FlowBus.with<QueryCurrentTaskRespBean.Result?>(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_TASK_WITH_ORDER_CHANGED)
.post(it.lifecycleScope, result)
@@ -514,6 +570,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun updateOrderUI(order: OrderDetail) {
CallerLogger.d(TAG,"updateOrderUI")
gourp_order.visibility = View.VISIBLE
cancelOrder.visibility = if (order.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.code
) View.GONE else View.VISIBLE
@@ -538,17 +595,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
order.passengerSize
)
var tempPhone = order.bookingUserPhone
tempPhone.let {
if (it.length > 8) {
//截取电话号码前三位
val phoneNumPre = it.substring(0, 3)
//截取电话号码后四位
val phoneNumFix = it.substring(7)
tempPhone = "$phoneNumPre****$phoneNumFix"
}
}
actv_order_phone.text = tempPhone
actv_order_phone.text = OchPhoneUtil.getPhoneWithoutMiddle(order.bookingUserPhone)
orderPhoneAndNum.text = "${ order.passengerSize}"
@@ -629,7 +676,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
//展示虚拟订单
private fun updateVirtualTaskUI(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
CallerLogger.d(TAG,"updateVirtualTaskUI")
if (taskAndOrder == null) return
val startSite = taskAndOrder.startSite // 起点
@@ -642,6 +689,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
include_empty.visibility = View.GONE
// 倒计时
prepareTaskCountdownTv.visibility = View.GONE
currentTaskStation.visibility = View.GONE
// 行程信息
group_itinerary_info.visibility = View.VISIBLE
// 订单信息
@@ -676,6 +724,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun updatePathwayPoint(taskType: Int, endSiteName: String?) {
CallerLogger.d(TAG,"updatePathwayPoint")
if (TextUtils.isEmpty(endSiteName)) return
pathwayPoint.visibility = if (taskType == TaskTypeEnum.ToOrderStartTask.code)
View.VISIBLE else View.GONE
@@ -683,6 +732,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun updateMapMarkers(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
CallerLogger.d(TAG,"updateMapMarkers")
if (taskAndOrder?.startSite != null
&& taskAndOrder.endSite != null
) {
@@ -755,6 +805,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
isAdd: Boolean, uuid: String,
lat: Double, lon: Double, resourceId: Int
) {
CallerLogger.d(TAG,"setOrRemoveMapMaker")
if (isAdd) {
MapMakerManager.addMapMaker(TYPE_MARKER_TAXI_ORDER, uuid, lat, lon, resourceId)
} else {
@@ -766,6 +817,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
* 根据任务状态计算剩余历程和时间
*/
private fun updateRemainDistanceAndTime(isVoicePlay: Boolean) {
CallerLogger.d(TAG,"updateRemainDistanceAndTime")
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return
d(TAG, "updateRemainDistanceAndTime ${currentTaskWithOrder.currentStatus}")
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code) {
@@ -786,6 +838,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun startNaviToStation(isVoicePlay: Boolean, stationLat: Double, stationLng: Double) {
CallerLogger.d(TAG,"startNaviToStation")
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
val gcJ02Location = OchLocationManager.getGCJ02Location()
val mCurLatitude = gcJ02Location.latitude
@@ -799,6 +852,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun showDialog(){
CallerLogger.d(TAG,"showDialog")
if(dialog==null&&context!=null){
}
@@ -816,6 +870,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun dismissDialog(){
CallerLogger.d(TAG,"dismissDialog")
dialog?.let {
if(it.isShowing){
it.dismiss()
@@ -825,6 +880,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
private fun hideNaviBtns() {
CallerLogger.d(TAG,"hideNaviBtns")
naviToStart.visibility = View.GONE
naviToEnd.visibility = View.GONE
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
@@ -838,10 +894,12 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
override fun onCurrentNaviDistAndTimeChanged(meters: Int, timeInSecond: Long) {
CallerLogger.d(TAG,"onCurrentNaviDistAndTimeChanged")
actv_distance_end.text = TaskUtils.getCurrentTaskDistance(meters.toLong())+" "+TaskUtils.getCurrentTaskTime(timeInSecond)
}
override fun reInitNaviAmap(isPlay: Boolean, isRestart: Boolean) {
CallerLogger.d(TAG,"reInitNaviAmap")
d(TAG, "isPlay = $isPlay, isRestart=$isRestart")
if (!isRestart) {
fragment?.let {
@@ -875,6 +933,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
fun onNaviToEndStationByAMap(isShow: Boolean) {
CallerLogger.d(TAG,"onNaviToEndStationByAMap")
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return
fragment?.let {
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code)
@@ -894,6 +953,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
}
override fun onStartTaskFail() {
CallerLogger.d(TAG,"onStartTaskFail")
commonSlideViewStartServer.reset()
}

View File

@@ -176,10 +176,7 @@ object TaxiTrajectoryManager : ITrajectoryListListener {
preloadContrail.contrailSaveTimeDPQP
val toCommonContraiInfo = preloadContrail.toCommonContraiInfo()
val (wayLatLons, blackLatLons) = LineManager.getWayBlackLatLons(
toCommonContraiInfo.passPoints,
toCommonContraiInfo.blackPoints
)
val (wayLatLons, blackLatLons) = toCommonContraiInfo.getWayBlackLatLons()
mPreAutopilotControlParameters?.wayLatLons = wayLatLons
mPreAutopilotControlParameters?.blackLatLons = blackLatLons
}

View File

@@ -25,8 +25,8 @@
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="@dimen/dp_53"
android:src="@drawable/taxi_task_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_width="@dimen/dp_46"
android:layout_height="@dimen/dp_46"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_order_phone"
@@ -315,9 +315,25 @@
android:layout_height="wrap_content"
android:textColor="@color/common_B3FFFFFF"
android:textSize="@dimen/dp_30"
android:layout_marginTop="50dp"
android:layout_marginTop="@dimen/dp_50"
android:text="距离任务获取还有 12"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@+id/include_empty" />
<TextView
android:id="@+id/currentTaskStation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/common_cccccc"
android:textSize="@dimen/dp_32"
android:layout_marginTop="@dimen/dp_20"
tools:text="当前站点"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@+id/prepareTaskCountdownTv" />
</merge>

View File

@@ -49,10 +49,6 @@ class DataCenterBizProvider:IDataCenterBizProvider {
CallerDataCenterBizListener.invokeLoginStatus(isLogin)
}
override fun notifyOrderID(orderID: String) {
CallerDataCenterBizListener.invokeOrderID(orderID)
}
override fun onDestroy() {
}

View File

@@ -39,5 +39,20 @@ class MogoLogCatchConst {
* 下发关闭链路的类型
*/
const val LOCAL_CONFIG_CLOSE_SINGLE_FW = 7
/**
* 打开高精地图每个瓦片数据文件下载、删除的日志
*/
const val OPEN_HD_MAP_TILE_FILE_LOG = 8
/**
* 关闭高精地图每个瓦片数据文件下载、删除的日志
*/
const val CLOSE_HD_MAP_TILE_FILE_LOG = 9
/**
* 上传Logcat日志
*/
const val UPLOAD_LOG_CAT_FILE = 10
}
}

View File

@@ -22,26 +22,36 @@ import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.core.log.record.LogcatManager
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.map.MogoData.Companion.mogoMapData
import com.zhidao.loglib.bean.RemoteLogPushContent
import com.zhidao.loglib.call.LogInfoManagerFactory
import com.zhidao.loglib.core.ILogListener
import com.zhidao.loglib.core.LogInfoManager
import com.zhjt.mogo_core_function_devatools.logcat.config.LogRecordConfig
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.CACHE_MAP_UPLOAD
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.CACHE_TRACE_UPLOAD
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.CLOSE_HD_MAP_TILE_FILE_LOG
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.LOCAL_CONFIG_CLOSE_LOG
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.LOCAL_CONFIG_CLOSE_SINGLE_FW
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.LOCAL_CONFIG_OPEN_LOG
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.LOG_PUSH_TYPE
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.OPEN_HD_MAP_TILE_FILE_LOG
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.START_CATCH_LOG
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.STOP_CATCH_LOG
import com.zhjt.mogo_core_function_devatools.trace.TraceManager
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchConst.Companion.UPLOAD_LOG_CAT_FILE
import com.zhjt.mogo_core_function_devatools.trace.TraceManager.Companion.traceManager
import com.zhjt.service_biz.BizConfig
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import java.io.File
import java.util.concurrent.TimeUnit.MINUTES
import java.util.concurrent.atomic.AtomicLong
@SuppressLint("StaticFieldLeak")
object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handler.Callback,
@@ -59,6 +69,12 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
private var logInfoManager: LogInfoManager? = null
private var mapCacheUpload = false
private val scope by lazy { CoroutineScope(Dispatchers.IO + SupervisorJob()) }
private val uploadThreshold by lazy { MINUTES.toMillis(1) } //全量日志的上传的安全时间,在此时间内,上传任务只会触发一次
private val lastUploadTime by lazy { AtomicLong(0) }
fun init(context: Context) {
mContext = context
MogoAiCloudSocketManager.getInstance(AbsMogoApplication.getApp().applicationContext)
@@ -140,6 +156,25 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
}
}
}
OPEN_HD_MAP_TILE_FILE_LOG -> {
mogoMapData.get()?.let { map ->
if (!map.isTileFileLogOpen()) {
map.openTileFileLog(true)
map.listenTileFileLog()
}
}
}
CLOSE_HD_MAP_TILE_FILE_LOG -> {
mogoMapData.get()?.let { map ->
if (map.isTileFileLogOpen()) {
map.openTileFileLog(false)
map.stopListenTileFileLog()
}
}
}
UPLOAD_LOG_CAT_FILE -> {
uploadLogcat(obj.cmd.toIntOrNull())
}
else -> {
}
}
@@ -264,6 +299,35 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
CallerAutoPilotControlManager.setEnableLog(false)
}
private fun uploadLogcat(timeType: Int?) {
if (timeType == null) return
val endTime = System.currentTimeMillis()
val startTime = when(timeType) {
LogRecordConfig.ALL_LOG_15_MINUTES -> endTime - MINUTES.toMillis(15)
LogRecordConfig.ALL_LOG_30_MINUTES -> endTime - MINUTES.toMillis(30)
LogRecordConfig.ALL_LOG_45_MINUTES -> endTime - MINUTES.toMillis(45)
LogRecordConfig.ALL_LOG_60_MINUTES -> endTime - MINUTES.toMillis(60)
LogRecordConfig.ALL_LOG_120_MINUTES -> endTime - MINUTES.toMillis(120)
LogRecordConfig.ALL_LOG_SAME_DAY -> endTime - (endTime % 86400000)
LogRecordConfig.ALL_LOG -> 0
else -> endTime
}
if (startTime < endTime) {
val now = System.currentTimeMillis()
val last = lastUploadTime.get()
if (last <= 0) {
lastUploadTime.set(System.currentTimeMillis())
}
if (last > 0 && (now - last) <= uploadThreshold) {
return
}
lastUploadTime.set(System.currentTimeMillis())
scope.launch {
LogcatManager.upload(startTime, endTime)
}
}
}
override fun onError(errorCount: Int) {
ThreadUtils.runOnUiThread {
TipToast.shortTip("日志抓取出现错误,出错数量:$errorCount")

View File

@@ -338,6 +338,7 @@ import kotlin.collections.set
import kotlin.math.abs
import kotlin.system.exitProcess
import com.mogo.eagle.core.function.hmi.ui.tools.ShowDevicesManagerStateDialog
import kotlinx.android.synthetic.main.view_debug_setting.view.tbTileFileLog
/**
@@ -1188,6 +1189,24 @@ internal class DebugSettingView @JvmOverloads constructor(
CallerMapUIServiceManager.getMapUIController()?.setIsDrawPointCloud(isChecked)
CallerSopSettingManager.invokePointCloudListener(isChecked)
}
tbTileFileLog.setOnCheckedChangeListener { compoundButton, isChecked ->
if (!compoundButton.isPressed) {
return@setOnCheckedChangeListener
}
mogoMapData.get()?.let { map ->
if (isChecked) {
if (!map.isTileFileLogOpen()) {
map.openTileFileLog(true)
map.listenTileFileLog()
}
} else {
if (map.isTileFileLogOpen()) {
map.openTileFileLog(false)
map.stopListenTileFileLog()
}
}
}
}
//设置点云大小
btnPointCloudSize.setOnClickListener {

View File

@@ -1904,6 +1904,22 @@
app:layout_constraintRight_toRightOf="@id/tbChangeAutoPilotStatus"
app:layout_constraintTop_toBottomOf="@id/tbChangeAutoPilotStatus"
/>
<ToggleButton
android:id="@+id/tbTileFileLog"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:padding="@dimen/dp_20"
android:textColor="#000"
android:textOff="开启地图瓦片日志"
android:textOn="关闭地图瓦片日志"
android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@id/tbDrawPointCloudData"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tbCarAperture"
/>
<Button
android:id="@+id/btnPointCloudSize"
android:layout_width="wrap_content"

View File

@@ -17,8 +17,8 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_61"
android:format12Hour="HH:mm"
android:format24Hour="HH:mm"
android:format12Hour="HH:mm:ss"
android:format24Hour="HH:mm:ss"
android:textColor="#ffffff"
android:textSize="@dimen/dp_45"
android:textStyle="bold" />

View File

@@ -1861,6 +1861,9 @@ class TravelRealityView @JvmOverloads constructor(
clearSmallSites()
} else {
UiThreadHandler.post {
smallSiteMarkerList?.forEach {
it.destroy()
}
smallSiteMarkerList = mAMap?.addMarkers(markerOptionsList, false)
}
}

View File

@@ -593,7 +593,7 @@ enum class EventTypeEnumNew(
//核销异常
TYPE_ABNORMAL_VERIFICATION(
"ABNORMAL_VERIFICATION",
"验票失败",
"核销失败",
"%s",
R.drawable.icon_warning_take_over,
"%s",

View File

@@ -25,7 +25,6 @@ interface IDataCenterBizListener {
return false
}
fun invokeAutopilotOrderId(orderID:String){}
fun invokeOchInfo(ochInfo: OchInfo) {}
}

View File

@@ -35,5 +35,4 @@ interface IOchFunctionCallNotify {
// 登录状态变化
fun notifyLoginStatus(isLogin: Boolean)
fun notifyOrderID(orderID:String)
}

View File

@@ -24,9 +24,6 @@ object CallerDataCenterBizListener : CallerBase<IDataCenterBizListener>() {
@Volatile
private var inOrder: Boolean = false
@Volatile
private var orderId: String = ""
private val isLoginStatus by lazy { AtomicBoolean(false) }
override fun doSomeAfterAddListener(tag: String, listener: IDataCenterBizListener) {
@@ -35,7 +32,6 @@ object CallerDataCenterBizListener : CallerBase<IDataCenterBizListener>() {
listener.invokeLoginNo(loginNo)
listener.invokeCarNo(no)
listener.invokeOrderStatus(inOrder)
listener.invokeAutopilotOrderId(orderId)
}
fun invokeLoginNo(loginNo: String?) {
@@ -96,23 +92,12 @@ object CallerDataCenterBizListener : CallerBase<IDataCenterBizListener>() {
return isLoginStatus.get()
}
fun invokeOrderID(orderId: String) {
this.orderId = orderId
M_LISTENERS.forEach {
it.value.invokeAutopilotOrderId(orderId)
}
}
fun invokeOchInfo(ochInfo: OchInfo) {
M_LISTENERS.forEach {
it.value.invokeOchInfo(ochInfo)
}
}
fun getOrderId(): String {
return orderId
}
fun getCarModel(): Carmodel? {
return carModel
}

View File

@@ -48,8 +48,4 @@ object CallerDataCenterBizManager: IOchFunctionCallNotify {
dataCenterBizProviderApi?.notifyLoginStatus(isLogin)
}
override fun notifyOrderID(orderID: String) {
dataCenterBizProviderApi?.notifyOrderID(orderID)
}
}

View File

@@ -130,8 +130,4 @@ object CallerEagleBaseFunctionCall4OchManager : IEagleBaseFunctionCall4Och {
override fun onOrderRemoval() {
CallerDataCenterBizManager.notifyOrderRemoval()
}
override fun setOchAutopilotOrderId(orderId: String) {
CallerDataCenterBizManager.notifyOrderID(orderId)
}
}

View File

@@ -80,10 +80,11 @@ MOGO_LOCATION_VERSION=1.4.7.59
# 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.7.59
# 动态换肤SDK
MOGO_SKIN_VERSION=1.4.7.49.19
MOGO_SKIN_VERSION=1.4.7.50
######## MogoAiCloudSDK Version ########
# 自研地图
MAP_SDK_VERSION=3.5.0.0
MAP_SDK_VERSION=3.5.0.3
MAP_SDK_CORE_VERSION=3.5.0.4
MAP_SDK_DATA_VERSION=1.0.0.9
MAP_SDK_OPERATION_VERSION=1.1.4.1
# websocket

View File

@@ -65,7 +65,7 @@ dependencies {
implementation 'com.zhidaoauto.map:net:1.0.1'
implementation "com.zhidaoauto.machine:mapcore:${MAP_SDK_VERSION}"
implementation "com.zhidaoauto.machine:mapcore:${MAP_SDK_CORE_VERSION}"
implementation "com.zhidaoauto.machine:mapdata:${MAP_SDK_DATA_VERSION}"
}

View File

@@ -129,4 +129,12 @@ interface IMogoData {
* 获取路口数据
*/
fun getCrossRoad(lon: Double, lat: Double, angle: Double): CrossRoad?
fun listenTileFileLog()
fun stopListenTileFileLog()
fun openTileFileLog(isOpen: Boolean)
fun isTileFileLogOpen(): Boolean
}

View File

@@ -39,6 +39,8 @@ object MapDataWrapper : IMogoData {
mogoMapData.init(this)
}
private var isTileFileLogOpen = false
/**
* 设置debug模式
*/
@@ -376,4 +378,21 @@ object MapDataWrapper : IMogoData {
}
return temp.get()
}
override fun listenTileFileLog() {
MapAutoApi.setTileFileCallback(TileFileLogCallback())
}
override fun stopListenTileFileLog() {
MapAutoApi.clearTileFileCallback()
}
override fun openTileFileLog(isOpen: Boolean) {
MapAutoApi.openTileLog(isOpen)
isTileFileLogOpen = isOpen
}
override fun isTileFileLogOpen(): Boolean {
return isTileFileLogOpen
}
}

View File

@@ -0,0 +1,28 @@
package com.mogo.map
import com.autonavi.nge.hdmap.ITileCallback
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.zhjt.service.chain.ChainLog
class TileFileLogCallback: ITileCallback {
companion object {
private const val TAG = "TileFileLogCallback"
}
override fun onLogCallback(msg: String) {
invokeNettyConnResult(msg)
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_WEAK_NETWORK,
linkCode = ChainConstant.CHAIN_SOURCE_WEAK_NETWORK,
nodeAliasCode = ChainConstant.CHAIN_CODE_RECORD_WEAK_NETWORK,
paramIndexes = [0]
)
private fun invokeNettyConnResult(msg: String) {
d(M_MAP + TAG, " TileFileLogCallback : $msg")
}
}

View File

@@ -306,9 +306,9 @@ class IFlyTekTts : IMogoTTS, InitListener {
curTtsLevel = -1
if (curTtsEntity != null) {
speakVoiceMap.remove(curTtsEntity.toString())
?.onSpeakError(curTtsEntity.toString(), error.message)
?.onSpeakError(curTtsEntity.toString(), "errorCode is:${error.errorCode},errorDes is:${error.toString()}")
} else {
speakVoiceMap.remove(curTtsContent)?.onSpeakError(curTtsContent, error.message)
speakVoiceMap.remove(curTtsContent)?.onSpeakError(curTtsContent, "errorCode is:${error.errorCode},errorDes is:${error.toString()}")
}
curTtsEntity = null
curTtsContent = ""