[fea]
[轨迹下载回调相关]
This commit is contained in:
yangyakun
2024-12-06 14:31:57 +08:00
parent d98a9d3b1a
commit cee6be8bb5
18 changed files with 494 additions and 439 deletions

View File

@@ -13,6 +13,7 @@ public class LoginInfo {
private String phone;//手机号
private Integer lineId;//线路id
private Integer taskId;//任务id
private Integer siteId;//任务id
private String vin;//车辆唯一识别码
private String cityCode;//城市编码
private String brand;//东风
@@ -24,6 +25,8 @@ public class LoginInfo {
private long tenantId;//租户id:
private long driverId;
private long businessStatus;//?????
public int getDriverStatus() {
return driverStatus;
}
@@ -160,6 +163,22 @@ public class LoginInfo {
this.driverId = driverId;
}
public Integer getSiteId() {
return siteId;
}
public void setSiteId(Integer siteId) {
this.siteId = siteId;
}
public long getBusinessStatus() {
return businessStatus;
}
public void setBusinessStatus(long businessStatus) {
this.businessStatus = businessStatus;
}
@Override
public String toString() {
return "LoginInfo{" +
@@ -173,6 +192,7 @@ public class LoginInfo {
", phone='" + phone + '\'' +
", lineId=" + lineId +
", taskId=" + taskId +
", siteId=" + siteId +
", vin='" + vin + '\'' +
", cityCode='" + cityCode + '\'' +
", brand='" + brand + '\'' +
@@ -180,6 +200,7 @@ public class LoginInfo {
", photos='" + photos + '\'' +
", tenantId=" + tenantId +
", driverId=" + driverId +
", businessStatus=" + businessStatus +
'}';
}
@@ -189,30 +210,7 @@ public class LoginInfo {
if (o == null || getClass() != o.getClass()) return false;
LoginInfo loginInfo = (LoginInfo) o;
if (driverStatus != loginInfo.driverStatus) return false;
if (servingStatus != loginInfo.servingStatus) return false;
if (businessType != loginInfo.businessType) return false;
if (purpose != loginInfo.purpose) return false;
if (tenantId != loginInfo.tenantId) return false;
if (driverId != loginInfo.driverId) return false;
if (!Objects.equals(orderNo, loginInfo.orderNo))
return false;
if (!Objects.equals(sn, loginInfo.sn)) return false;
if (!Objects.equals(plateNumber, loginInfo.plateNumber))
return false;
if (!Objects.equals(phone, loginInfo.phone)) return false;
if (!Objects.equals(lineId, loginInfo.lineId))
return false;
if (!Objects.equals(taskId, loginInfo.taskId))
return false;
if (!Objects.equals(vin, loginInfo.vin)) return false;
if (!Objects.equals(cityCode, loginInfo.cityCode))
return false;
if (!Objects.equals(brand, loginInfo.brand)) return false;
if (!Objects.equals(carModel, loginInfo.carModel))
return false;
return Objects.equals(photos, loginInfo.photos);
return driverStatus == loginInfo.driverStatus && servingStatus == loginInfo.servingStatus && businessType == loginInfo.businessType && purpose == loginInfo.purpose && tenantId == loginInfo.tenantId && driverId == loginInfo.driverId && businessStatus == loginInfo.businessStatus && Objects.equals(orderNo, loginInfo.orderNo) && Objects.equals(sn, loginInfo.sn) && Objects.equals(plateNumber, loginInfo.plateNumber) && Objects.equals(phone, loginInfo.phone) && Objects.equals(lineId, loginInfo.lineId) && Objects.equals(taskId, loginInfo.taskId) && Objects.equals(siteId, loginInfo.siteId) && Objects.equals(vin, loginInfo.vin) && Objects.equals(cityCode, loginInfo.cityCode) && Objects.equals(brand, loginInfo.brand) && Objects.equals(carModel, loginInfo.carModel) && Objects.equals(photos, loginInfo.photos);
}
@Override
@@ -220,20 +218,22 @@ public class LoginInfo {
int result = driverStatus;
result = 31 * result + servingStatus;
result = 31 * result + businessType;
result = 31 * result + (int)tenantId;
result = 31 * result + (int)driverId;
result = 31 * result + (orderNo != null ? orderNo.hashCode() : 0);
result = 31 * result + Objects.hashCode(orderNo);
result = 31 * result + purpose;
result = 31 * result + (sn != null ? sn.hashCode() : 0);
result = 31 * result + (plateNumber != null ? plateNumber.hashCode() : 0);
result = 31 * result + (phone != null ? phone.hashCode() : 0);
result = 31 * result + (lineId != null ? lineId.hashCode() : 0);
result = 31 * result + (taskId != null ? taskId.hashCode() : 0);
result = 31 * result + (vin != null ? vin.hashCode() : 0);
result = 31 * result + (cityCode != null ? cityCode.hashCode() : 0);
result = 31 * result + (brand != null ? brand.hashCode() : 0);
result = 31 * result + (carModel != null ? carModel.hashCode() : 0);
result = 31 * result + (photos != null ? photos.hashCode() : 0);
result = 31 * result + Objects.hashCode(sn);
result = 31 * result + Objects.hashCode(plateNumber);
result = 31 * result + Objects.hashCode(phone);
result = 31 * result + Objects.hashCode(lineId);
result = 31 * result + Objects.hashCode(taskId);
result = 31 * result + Objects.hashCode(siteId);
result = 31 * result + Objects.hashCode(vin);
result = 31 * result + Objects.hashCode(cityCode);
result = 31 * result + Objects.hashCode(brand);
result = 31 * result + Objects.hashCode(carModel);
result = 31 * result + Objects.hashCode(photos);
result = 31 * result + Long.hashCode(tenantId);
result = 31 * result + Long.hashCode(driverId);
result = 31 * result + Long.hashCode(businessStatus);
return result;
}
}

View File

@@ -132,12 +132,7 @@ object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListene
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
super.onAutopilotGuardian(guardianInfo)
var lineId = -1L
if (MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_START == guardianInfo?.code ||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_SUCCESS == guardianInfo?.code ||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_FAILURE == guardianInfo?.code ||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_WARNING == guardianInfo?.code ||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_TIMEOUT == guardianInfo?.code
) {
guardianInfo?.let {
val msg = guardianInfo.msg
try {
val regex = Regex("lineid:(\\d+)")
@@ -159,16 +154,9 @@ object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListene
}
}
if (MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_SUCCESS == guardianInfo?.code){
TrajectoryManager.addDownLoadSuccessLine(lineId)
}
if (MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_FAILURE == guardianInfo?.code){
// 更新轨迹没有更新lineId 第二次下载失败 删除App成功缓存(概率很低)
TrajectoryManager.removeDownLoadSuccessLine(lineId)
}
}
TrajectoryManager.carDownLoadTrajectoryLog(guardianInfo?.code)
TrajectoryManager.carDownLoadTrajectoryLog(guardianInfo?.code,lineId)
M_LISTENERS.forEach {
val listener = it.value

View File

@@ -4,12 +4,29 @@ import com.mogo.eagle.core.data.map.MogoLocation
interface ITrajectoryListListener{
/**
* @param routeArrivied 已经走过的坐标
* @param routeArriving 没有走过的坐标
* @param location 车的坐标
* @return
* @param trajectoryList gcj 坐标轨迹集合
*/
fun trajectoryCallback(
trajectoryList: MutableList<MogoLocation>,
)
fun trajectoryCallback(trajectoryList: MutableList<MogoLocation>){}
/**
* @param maxDistanceAllPoint 轨迹全长
*/
fun trajectoryDistanceCallback(maxDistanceAllPoint: Double){}
// 开始下载轨迹
fun onDownLoadStart(lineId: Long){}
// 下载轨迹成功
fun onDownLoadSuccess(lineId: Long){}
// 下载轨迹是吧
fun onDownLoadFail(lineId: Long){}
// 下载轨迹超时
fun onDownLoadTimeout(lineId: Long){}
// 加载轨迹失败
fun onLoadFail(lineId: Long){}
// 轨迹不存在
fun onTrajectoryNotExist(lineId: Long){}
// 底盘已就行
fun onDownLoadReady(lineId: Long) {}
// 当前位置距离轨迹大于15m
fun onDistanceWithTrajectory(lineId: Long) {}
}

View File

@@ -9,17 +9,14 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager.writeChainLog
import com.mogo.och.common.module.utils.CallerBase
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
import com.zhjt.mogo.adas.data.bean.MogoReport
import mogo.telematics.pad.MessagePad
import java.util.concurrent.ConcurrentHashMap
object TrajectoryManager : IMoGoPlanningRottingListener {
object TrajectoryManager : CallerBase<ITrajectoryListListener>(),IMoGoPlanningRottingListener {
const val TAG = "TrajectoryManager"
private val distanceListeners: ConcurrentHashMap<String, ITrajectoryListListener> =
ConcurrentHashMap()
private val downLoadSuccessLineIds = mutableListOf<Long>()
/**
@@ -88,52 +85,92 @@ object TrajectoryManager : IMoGoPlanningRottingListener {
maxDistanceAllPoint += distanceItem
}
}
distanceListeners.forEach {
M_LISTENERS.forEach {
it.value.trajectoryCallback(mRoutePoints)
}
M_LISTENERS.forEach {
it.value.trajectoryDistanceCallback(maxDistanceAllPoint)
}
}
fun addTrajectoryListListenerr(tag: String, listener: ITrajectoryListListener?) {
if (distanceListeners.containsKey(tag)) {
return
}
if(listener==null){
distanceListeners.remove(tag)
return
}
distanceListeners[tag] = listener
}
fun addDownLoadSuccessLine(lineId:Long){
private fun addDownLoadSuccessLine(lineId:Long){
if(lineId>0){
OchChainLogManager.writeChainLog("轨迹监控", " 轨迹下载成功${lineId}", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
downLoadSuccessLineIds.add(lineId)
}
}
fun removeDownLoadSuccessLine(lineId:Long){
private fun removeDownLoadSuccessLine(lineId:Long){
if(lineId>0&& downLoadSuccessLineIds.contains(lineId)){
downLoadSuccessLineIds.remove(lineId)
}
}
fun carDownLoadTrajectoryLog(code:String?){
fun carDownLoadTrajectoryLog(code: String?, lineId: Long){
when (code) {
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_START -> writeTrajectoryLog("轨迹开始下载")
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_SUCCESS -> writeTrajectoryLog("轨迹下载成功")
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_FAILURE -> writeTrajectoryLog("轨迹下载失败,本地无对应轨迹")
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_WARNING -> writeTrajectoryLog("轨迹下载失败,本地有对应轨迹,认为成功")
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_TIMEOUT -> writeTrajectoryLog("轨迹下载超时")
MogoReport.Code.Info.ISSM.FUNC_AUTO_PILOT_READY -> writeTrajectoryLog("再次发起下载、 ssm ready再次发起下载")
MogoReport.Code.Error.EMAP.TRA_LOAD_FAILED -> writeTrajectoryLog("onAutopilotGuardian() 加载轨迹文件失败")
MogoReport.Code.Error.EMAP.TRA_NOT_EXIST -> writeTrajectoryLog("onAutopilotGuardian() 无法找到轨迹文件")
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_START -> {
writeTrajectoryLog("轨迹开始下载")
M_LISTENERS.forEach {
it.value.onDownLoadStart(lineId)
}
}
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_SUCCESS -> {
writeTrajectoryLog("轨迹下载成功")
addDownLoadSuccessLine(lineId)
M_LISTENERS.forEach {
it.value.onDownLoadSuccess(lineId)
}
}
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_FAILURE -> {
writeTrajectoryLog("轨迹下载失败,本地无对应轨迹")
// 更新轨迹没有更新lineId 第二次下载失败 删除App成功缓存(概率很低)
removeDownLoadSuccessLine(lineId)
M_LISTENERS.forEach {
it.value.onDownLoadFail(lineId)
}
}
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_WARNING -> {
writeTrajectoryLog("轨迹下载失败,本地有对应轨迹,认为成功")
M_LISTENERS.forEach {
it.value.onDownLoadSuccess(lineId)
}
}
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_TIMEOUT -> {
writeTrajectoryLog("轨迹下载超时")
M_LISTENERS.forEach {
it.value.onDownLoadTimeout(lineId)
}
}
MogoReport.Code.Info.ISSM.FUNC_AUTO_PILOT_READY -> {
writeTrajectoryLog("再次发起下载、 ssm ready再次发起下载")
M_LISTENERS.forEach {
it.value.onDownLoadReady(lineId)
}
}
MogoReport.Code.Error.EMAP.TRA_LOAD_FAILED -> {
writeTrajectoryLog("onAutopilotGuardian() 加载轨迹文件失败")
M_LISTENERS.forEach {
it.value.onLoadFail(lineId)
}
}
MogoReport.Code.Error.EMAP.TRA_NOT_EXIST -> {
writeTrajectoryLog("onAutopilotGuardian() 无法找到轨迹文件")
M_LISTENERS.forEach {
it.value.onTrajectoryNotExist(lineId)
}
}
MogoReport.Code.Error.EMAP.ATTITUDE_INIT_FAILED->{
writeTrajectoryLog("onAutopilotGuardian() 当前位置距离轨迹距离大于15m")
M_LISTENERS.forEach {
it.value.onDistanceWithTrajectory(lineId)
}
}
else -> {}
}
}
private fun writeTrajectoryLog(message:String){
writeChainLog("轨迹监控", "再次发起下载", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
writeChainLog("轨迹监控", message, true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
}
}