[6.10.0]
[fea] [删除车型维度]
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package com.mogo.och.common.module.biz.lansocket
|
||||
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.och.common.module.BuildConfig
|
||||
import com.mogo.och.common.module.biz.lansocket.bean.DevicesInfo
|
||||
import com.mogo.och.common.module.biz.login.ILoginCallback
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
||||
import com.mogo.och.common.module.biz.login.EnumLoginStatus
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
@@ -15,10 +18,14 @@ import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.ChangeBusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.EnvCheck
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.ScreenType
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.FlavorUtils
|
||||
|
||||
object LoginLanDriverSocket : ILoginCallback {
|
||||
private const val TAG = "LoginLanSocket"
|
||||
private const val TAG = M_OCHCOMMON+"LoginLanSocket"
|
||||
|
||||
private val thridDevices = mutableListOf<DevicesInfo>()
|
||||
|
||||
// 接受到客户端注册信息后立即返回业务模式
|
||||
private val registerListener = object : ILanMessageListener<BaseDPMsg> {
|
||||
@@ -28,6 +35,15 @@ object LoginLanDriverSocket : ILoginCallback {
|
||||
|
||||
override fun onLanMsgReceived(obj: BaseDPMsg?) {
|
||||
println("-------${obj}")
|
||||
obj?.let {msg->
|
||||
var currentDevices = thridDevices.find { it.sn == msg.sourceSn && it.msgVersion == msg.msgVersion }
|
||||
if(currentDevices==null){
|
||||
currentDevices = DevicesInfo(msg.sourceScreenType, msg.sourceSn,msg.msgVersion)
|
||||
thridDevices.add(currentDevices)
|
||||
}else{
|
||||
currentDevices.registerTime = DateTimeUtil.getCurrentTimeStamp()
|
||||
}
|
||||
}
|
||||
if(LoginStatusManager.isLogin()) {
|
||||
FlavorUtils.getEnvCheck()
|
||||
val msg = ChangeBusinessType(FlavorUtils.vehicleType!!, FlavorUtils.businessType!!, FlavorUtils.projectType!!, FlavorUtils.envType!!)
|
||||
@@ -37,9 +53,10 @@ object LoginLanDriverSocket : ILoginCallback {
|
||||
val msg = ChangeBusinessType(FlavorUtils.vehicleType!!, BusinessType.none, FlavorUtils.projectType!!, FlavorUtils.envType!!)
|
||||
LanSocketManager.sendMsgToClient(msg)
|
||||
}
|
||||
LoginStatusManager.sendLogin2Client()
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
fun load() {
|
||||
OchChainLogManager.writeChainLogInit("初始化信息","初始司机屏局域网内通知监听")
|
||||
@@ -47,6 +64,7 @@ object LoginLanDriverSocket : ILoginCallback {
|
||||
|
||||
init {
|
||||
// 登录状态变化的监听
|
||||
CallerLogger.d(TAG,"初始化局域网通信")
|
||||
LoginStatusManager.addListener(TAG, this)
|
||||
// 注册监听乘客屏和报站屏注册信息
|
||||
LanSocketManager.registerSocketMessageListener(
|
||||
@@ -56,11 +74,11 @@ object LoginLanDriverSocket : ILoginCallback {
|
||||
}
|
||||
|
||||
// 司机端发送业务模式更改和环境校验
|
||||
override fun onStatusChange(currentStatus: LoginStatusEnum?) {
|
||||
override fun onLoginStatusChange(currentStatus: EnumLoginStatus?) {
|
||||
FlavorUtils.getEnvCheck()
|
||||
if (FlavorUtils.vehicleType != null && FlavorUtils.projectType != null && FlavorUtils.envType != null) {
|
||||
when (currentStatus) {
|
||||
LoginStatusEnum.Login -> {
|
||||
EnumLoginStatus.Login -> {
|
||||
val msg =
|
||||
ChangeBusinessType(
|
||||
FlavorUtils.vehicleType!!,
|
||||
|
||||
@@ -3,11 +3,8 @@ package com.mogo.och.common.module.biz.lansocket
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.Product
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
@@ -15,16 +12,11 @@ import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||
import com.mogo.och.common.module.manager.socket.lan.ILanMessageListener
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BaseDPMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.ChangeBusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.EnvCheck
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.EnvType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.ProjectType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.ScreenType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.VehicleType
|
||||
import com.mogo.och.common.module.utils.CallerBase
|
||||
import java.lang.StringBuilder
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
object LoginLanPassengerSocket : IReceivedMsgListener, CallerBase<IOchLanPassengerStatusListener>() {
|
||||
@@ -83,73 +75,12 @@ object LoginLanPassengerSocket : IReceivedMsgListener, CallerBase<IOchLanPasseng
|
||||
|
||||
override fun onLanMsgReceived(first: EnvCheck?) {
|
||||
first?.let {
|
||||
val checkEnv = checkEnv(first.projectType, first.envType, first.vehicleType, first.businessType)
|
||||
if (first.sourceScreenType== ScreenType.Driver) {
|
||||
driverSn = first.sourceSn
|
||||
}
|
||||
if(checkEnv){
|
||||
|
||||
}else{
|
||||
CallerLogger.d(TAG, "乘客屏 收到消息 检测环境不支持:${LoginStatusEnum.Logout}")
|
||||
LoginStatusManager.setLoginStatus(LoginStatusEnum.Logout)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun checkEnv(
|
||||
projectType: ProjectType,
|
||||
envType: EnvType,
|
||||
vehicleType: VehicleType,
|
||||
businessType: BusinessType
|
||||
): Boolean {
|
||||
return LoginStatusManager.checkAllEnv(projectType, envType, vehicleType, businessType)
|
||||
}
|
||||
|
||||
// 环境监测+业务展示和跳转
|
||||
private val changeBusinessType = object : ILanMessageListener<ChangeBusinessType> {
|
||||
override fun targetLan(): Class<ChangeBusinessType> {
|
||||
return ChangeBusinessType::class.java
|
||||
}
|
||||
|
||||
override fun onLanMsgReceived(first: ChangeBusinessType?) {
|
||||
first?.let {
|
||||
val checkEnv = checkEnv(
|
||||
first.projectType,
|
||||
first.envType,
|
||||
first.vehicleType,
|
||||
first.businessType
|
||||
)
|
||||
if(checkEnv){
|
||||
val status = StringBuilder()
|
||||
status.append("切换业务模式<当前:${LoginStatusManager.getBusInessType().name}")
|
||||
when (first.businessType) {
|
||||
BusinessType.none -> {
|
||||
LoginStatusManager.setBusinessType(Product.NONE.code)
|
||||
CallerLogger.d(TAG, "乘客屏 收到消息 司机屏没有登录:${LoginStatusEnum.Logout}")
|
||||
return LoginStatusManager.setLoginStatus(LoginStatusEnum.Logout)
|
||||
}
|
||||
BusinessType.bus -> LoginStatusManager.setBusinessType(Product.BUS.code)
|
||||
BusinessType.shuttle -> LoginStatusManager.setBusinessType(Product.SHUTTLE.code)
|
||||
BusinessType.charter -> LoginStatusManager.setBusinessType(Product.CHARTER.code)
|
||||
BusinessType.taxi -> LoginStatusManager.setBusinessType(Product.TAXI.code)
|
||||
BusinessType.taxiunmanned ->LoginStatusManager.setBusinessType(Product.TAXI.code)
|
||||
BusinessType.scheduled ->LoginStatusManager.setBusinessType(Product.SCHEDULED.code)
|
||||
}
|
||||
status.append(", 切换后:${LoginStatusManager.getBusInessType().name}>")
|
||||
LoginStatusManager.changeStatus(status.toString())
|
||||
UiThreadHandler.postDelayed({
|
||||
CallerLogger.d(TAG, "乘客屏 收到消息 司机屏业务模式相同:${LoginStatusEnum.Login}")
|
||||
LoginStatusManager.setLoginStatus(LoginStatusEnum.Login)
|
||||
},2000)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
fun load() {
|
||||
OchChainLogManager.writeChainLogInit("初始化信息","初始局乘客屏局域网内部分信息")
|
||||
}
|
||||
@@ -164,11 +95,7 @@ object LoginLanPassengerSocket : IReceivedMsgListener, CallerBase<IOchLanPasseng
|
||||
DPMsgType.TYPE_ENV_CHECK.type,
|
||||
checkListener
|
||||
)
|
||||
// 乘客屏监听司机端发送的业务修改通知(
|
||||
LanSocketManager.registerSocketMessageListener(
|
||||
DPMsgType.TYPE_CHANGE_BUSINESS_TYPE.type,
|
||||
changeBusinessType
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.och.common.module.biz.lansocket.bean
|
||||
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.ScreenType
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
|
||||
data class DevicesInfo(
|
||||
val screenType: ScreenType,// 屏幕类型
|
||||
val sn: String,// 屏幕sn
|
||||
val msgVersion:Int,
|
||||
var registerTime: Long = DateTimeUtil.getCurrentTimeStamp(),//注册时间
|
||||
){
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as DevicesInfo
|
||||
|
||||
if (sn != other.sn) return false
|
||||
if (msgVersion != other.msgVersion) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = sn.hashCode()
|
||||
result = 31 * result + msgVersion
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,14 @@ package com.mogo.och.common.module.biz.login
|
||||
* 10 已登录,
|
||||
* 20 已登出,
|
||||
*/
|
||||
enum class LoginStatusEnum(val code: Int) {
|
||||
enum class EnumLoginStatus(val code: Int) {
|
||||
None( -1 ),
|
||||
Login( 1),
|
||||
Logout( 0),;
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun valueOf(code: Int): LoginStatusEnum? {
|
||||
fun valueOf(code: Int): EnumLoginStatus {
|
||||
for (value in values()) {
|
||||
if (value.code == code) {
|
||||
return value
|
||||
@@ -8,14 +8,14 @@ package com.mogo.och.common.module.biz.login
|
||||
* 10 接单状态 可接单,
|
||||
* 20 暂停接到哪 不可接单,
|
||||
*/
|
||||
enum class OpenOrderStatusEnum(val code: Int) {
|
||||
enum class EnumOpenOrderStatus(val code: Int) {
|
||||
UnOrdering( 0 ),
|
||||
Ordering( 1),
|
||||
None( -1),;
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun valueOf(code: Int): OpenOrderStatusEnum {
|
||||
fun valueOf(code: Int): EnumOpenOrderStatus {
|
||||
for (value in values()) {
|
||||
if (value.code == code) {
|
||||
return value
|
||||
@@ -4,7 +4,7 @@ package com.mogo.och.common.module.biz.login
|
||||
* Created on 2021/12/7
|
||||
* 1 运营, 2 测试, 3演示
|
||||
*/
|
||||
enum class RoleEnum(val code: Int) {
|
||||
enum class EnumRole(val code: Int) {
|
||||
None( 0),
|
||||
OPERATION( 1),
|
||||
TEST( 2),
|
||||
@@ -13,13 +13,13 @@ enum class RoleEnum(val code: Int) {
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun valueOf(code: Int?): RoleEnum {
|
||||
for (value in RoleEnum.values()) {
|
||||
fun valueOf(code: Int?): EnumRole {
|
||||
for (value in EnumRole.values()) {
|
||||
if (value.code == code) {
|
||||
return value
|
||||
}
|
||||
}
|
||||
return RoleEnum.None
|
||||
return EnumRole.None
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,18 +2,21 @@ package com.mogo.och.common.module.biz.login;
|
||||
|
||||
import com.mogo.eagle.core.data.enums.Carmodel;
|
||||
import com.mogo.eagle.core.utilcode.mogo.Product;
|
||||
import com.mogo.eagle.core.utilcode.mogo.Vehicle;
|
||||
|
||||
public interface ILoginCallback {
|
||||
|
||||
default void onStatusChange(LoginStatusEnum currentStatus){}
|
||||
default void onLoginStatusChange(EnumLoginStatus currentStatus){}
|
||||
|
||||
default void onCarModelChange(Carmodel currentStatus){}
|
||||
|
||||
default void onBusinessChange(Product businessEnum){}
|
||||
default void onProductChange(Product businessEnum){}
|
||||
|
||||
default void onOpenOrderStatusEnumChange(OpenOrderStatusEnum businessEnum){}
|
||||
default void onVehicleChage(Vehicle vehicle){}
|
||||
|
||||
default void onBusinessChangeDebug(Product businessEnum){}
|
||||
default void onOpenOrderStatusEnumChange(EnumOpenOrderStatus businessEnum){}
|
||||
|
||||
default void onTenantIdChange(Long tenantId){}
|
||||
|
||||
default void onLoginErrorInfo(int code,String msg){}
|
||||
|
||||
|
||||
@@ -1,278 +0,0 @@
|
||||
package com.mogo.och.common.module.biz.login;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class LoginInfo {
|
||||
private int driverStatus; //1登录,0登出
|
||||
private int servingStatus;//1接单中,0暂停接单
|
||||
private int businessType; //9: taxi. 10: bus公交 11:接驳 13:包车
|
||||
private String orderNo;
|
||||
private int purpose; // 1 运营, 2 测试, 3演示
|
||||
private String sn;
|
||||
private String plateNumber;//车牌号
|
||||
private String phone;//手机号
|
||||
private Long lineId;//线路id
|
||||
private Long taskId;//任务id
|
||||
private Long siteId;//站点id 包车使用
|
||||
private Long currentSite;//当前站点 接驳、公交、班车使用
|
||||
private Boolean leaving;// 当前站点是否出发
|
||||
private Long shiftsId;//模板id
|
||||
private Long taskDate;// 任务或模板的日期
|
||||
private String vin;//车辆唯一识别码
|
||||
private String cityCode;//城市编码
|
||||
private String brand;//东风
|
||||
//
|
||||
// E70 东风 H9 红旗
|
||||
// B2 B1 M1
|
||||
private String carModel;
|
||||
private String photos;//车身照片:
|
||||
private long tenantId;//租户id:
|
||||
private long driverId;
|
||||
|
||||
private long businessStatus;//?????
|
||||
|
||||
public int getDriverStatus() {
|
||||
return driverStatus;
|
||||
}
|
||||
|
||||
public void setDriverStatus(int driverStatus) {
|
||||
this.driverStatus = driverStatus;
|
||||
}
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public int getPurpose() {
|
||||
return purpose;
|
||||
}
|
||||
|
||||
public void setPurpose(int purpose) {
|
||||
this.purpose = purpose;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getPlateNumber() {
|
||||
return plateNumber;
|
||||
}
|
||||
|
||||
public void setPlateNumber(String plateNumber) {
|
||||
this.plateNumber = plateNumber;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public int getServingStatus() {
|
||||
return servingStatus;
|
||||
}
|
||||
|
||||
public void setServingStatus(int servingStatus) {
|
||||
this.servingStatus = servingStatus;
|
||||
}
|
||||
|
||||
public int getBusinessType() {
|
||||
return businessType;
|
||||
}
|
||||
|
||||
public void setBusinessType(int businessType) {
|
||||
this.businessType = businessType;
|
||||
}
|
||||
|
||||
public String getVin() {
|
||||
return vin;
|
||||
}
|
||||
|
||||
public void setVin(String vin) {
|
||||
this.vin = vin;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public String getBrand() {
|
||||
return brand;
|
||||
}
|
||||
|
||||
public void setBrand(String brand) {
|
||||
this.brand = brand;
|
||||
}
|
||||
|
||||
public String getCarModel() {
|
||||
return carModel;
|
||||
}
|
||||
|
||||
public void setCarModel(String carModel) {
|
||||
this.carModel = carModel;
|
||||
}
|
||||
|
||||
public String getPhotos() {
|
||||
return photos;
|
||||
}
|
||||
|
||||
public void setPhotos(String photos) {
|
||||
this.photos = photos;
|
||||
}
|
||||
|
||||
public long getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(long tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public long getDriverId() {
|
||||
return driverId;
|
||||
}
|
||||
|
||||
public void setDriverId(long driverId) {
|
||||
this.driverId = driverId;
|
||||
}
|
||||
|
||||
|
||||
public long getBusinessStatus() {
|
||||
return businessStatus;
|
||||
}
|
||||
|
||||
public void setBusinessStatus(long businessStatus) {
|
||||
this.businessStatus = businessStatus;
|
||||
}
|
||||
|
||||
public Long getCurrentSite() {
|
||||
return currentSite;
|
||||
}
|
||||
|
||||
public void setCurrentSite(Long currentSite) {
|
||||
this.currentSite = currentSite;
|
||||
}
|
||||
|
||||
public Boolean getLeaving() {
|
||||
return leaving;
|
||||
}
|
||||
|
||||
public void setLeaving(Boolean leaving) {
|
||||
this.leaving = leaving;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Long getTaskDate() {
|
||||
return taskDate;
|
||||
}
|
||||
|
||||
public void setTaskDate(Long taskDate) {
|
||||
this.taskDate = taskDate;
|
||||
}
|
||||
|
||||
public Long getLineId() {
|
||||
return lineId;
|
||||
}
|
||||
|
||||
public void setLineId(Long lineId) {
|
||||
this.lineId = lineId;
|
||||
}
|
||||
|
||||
public Long getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(Long taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public Long getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setSiteId(Long siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public Long getShiftsId() {
|
||||
return shiftsId;
|
||||
}
|
||||
|
||||
public void setShiftsId(Long shiftsId) {
|
||||
this.shiftsId = shiftsId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LoginInfo{" +
|
||||
"driverStatus=" + driverStatus +
|
||||
", servingStatus=" + servingStatus +
|
||||
", businessType=" + businessType +
|
||||
", orderNo='" + orderNo + '\'' +
|
||||
", purpose=" + purpose +
|
||||
", sn='" + sn + '\'' +
|
||||
", plateNumber='" + plateNumber + '\'' +
|
||||
", phone='" + phone + '\'' +
|
||||
", lineId=" + lineId +
|
||||
", taskId=" + taskId +
|
||||
", siteId=" + siteId +
|
||||
", vin='" + vin + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", brand='" + brand + '\'' +
|
||||
", carModel='" + carModel + '\'' +
|
||||
", photos='" + photos + '\'' +
|
||||
", tenantId=" + tenantId +
|
||||
", driverId=" + driverId +
|
||||
", businessStatus=" + businessStatus +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
LoginInfo loginInfo = (LoginInfo) o;
|
||||
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
|
||||
public int hashCode() {
|
||||
int result = driverStatus;
|
||||
result = 31 * result + servingStatus;
|
||||
result = 31 * result + businessType;
|
||||
result = 31 * result + Objects.hashCode(orderNo);
|
||||
result = 31 * result + purpose;
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -2,49 +2,76 @@ package com.mogo.och.common.module.biz.login
|
||||
|
||||
import com.mogo.eagle.core.data.enums.Carmodel
|
||||
import com.mogo.eagle.core.utilcode.mogo.Product
|
||||
import com.mogo.eagle.core.utilcode.mogo.Vehicle
|
||||
import com.mogo.och.common.module.biz.login.bean.OchBizInfo
|
||||
import com.mogo.och.common.module.biz.login.bean.OchCarInfo
|
||||
import com.mogo.och.common.module.biz.login.bean.OchLoginInfo
|
||||
import com.mogo.och.common.module.biz.provider.CommonService
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.EnvType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.ProjectType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.VehicleType
|
||||
|
||||
interface LoginService :CommonService {
|
||||
fun setLoginInfo(loginInfo: LoginInfo)
|
||||
fun getLoginInfo():LoginInfo?
|
||||
|
||||
fun getPurpose():RoleEnum
|
||||
/**
|
||||
* 获取登录新形象
|
||||
*/
|
||||
fun getOchLoginInfo():OchLoginInfo?
|
||||
|
||||
/**
|
||||
* 获取业务信息
|
||||
*/
|
||||
fun getOchBizInfo():OchBizInfo?
|
||||
|
||||
/**
|
||||
* 获取车辆信息
|
||||
*/
|
||||
fun getOchCarInfo():OchCarInfo?
|
||||
|
||||
/**
|
||||
* 设置角色
|
||||
*/
|
||||
fun getPurpose():EnumRole
|
||||
|
||||
/**
|
||||
* 判断是否登录
|
||||
*/
|
||||
fun isLogin():Boolean
|
||||
fun getLoginStatus(): LoginStatusEnum
|
||||
fun getCarModel(): Carmodel
|
||||
fun setLoginStatus(loginStatus: LoginStatusEnum)
|
||||
fun setLoginStatus(status: Int)
|
||||
fun setBusinessType(type: Int)
|
||||
|
||||
fun getBusinessType(): Product
|
||||
/**
|
||||
* 获取登录状态
|
||||
*/
|
||||
fun getLoginStatus(): EnumLoginStatus
|
||||
|
||||
/**
|
||||
* 获取车辆模型
|
||||
*/
|
||||
fun getCarModelType(): Carmodel
|
||||
|
||||
/**
|
||||
* 获取业务模式
|
||||
*/
|
||||
fun getProductType(): Product
|
||||
|
||||
/**
|
||||
* 通过网络获取登录状态
|
||||
* @param readCatche true:先使用缓存同时网络请求也存在 false:只是用缓存
|
||||
*/
|
||||
fun queryLoginStatusByNet(readCatche:Boolean=false)
|
||||
|
||||
/**
|
||||
* 登出
|
||||
*/
|
||||
fun loginOut()
|
||||
fun checkBusiness(businessType: Int): Boolean
|
||||
fun checkAllEnv(
|
||||
projectType: ProjectType,
|
||||
envType: EnvType,
|
||||
vehicleType: VehicleType,
|
||||
businessType: BusinessType
|
||||
): Boolean
|
||||
|
||||
fun changeStatus(currentStatus: String)
|
||||
|
||||
fun setOpenOrderStatusType(type: Int)
|
||||
|
||||
fun getOpenOrderStatusType(): OpenOrderStatusEnum
|
||||
fun getOpenOrderStatusType(): EnumOpenOrderStatus
|
||||
|
||||
fun isOpenOrderType(): Boolean
|
||||
|
||||
fun removeLoginInfo()
|
||||
|
||||
fun getVehicleType(): Vehicle
|
||||
|
||||
fun sendLogin2Client()
|
||||
}
|
||||
@@ -1,22 +1,18 @@
|
||||
package com.mogo.och.common.module.biz.login
|
||||
|
||||
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.Carmodel
|
||||
import com.mogo.eagle.core.utilcode.mogo.Product
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.Vehicle
|
||||
import com.mogo.och.common.module.biz.login.bean.OchBizInfo
|
||||
import com.mogo.och.common.module.biz.login.bean.OchCarInfo
|
||||
import com.mogo.och.common.module.biz.login.bean.OchLoginInfo
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.EnvType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.ProjectType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.VehicleType
|
||||
import com.mogo.och.common.module.utils.CallerBase
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
object LoginStatusManager : CallerBase<ILoginCallback>() {
|
||||
|
||||
@@ -24,7 +20,6 @@ object LoginStatusManager : CallerBase<ILoginCallback>() {
|
||||
ARouter.getInstance().build(OchCommonConst.BIZ_LOGIN).navigation() as LoginService
|
||||
|
||||
private var TAG = "LoginStatusManager"
|
||||
private var TAGLoopStatus = "LoginStatusManagerLoop"
|
||||
|
||||
@JvmStatic
|
||||
fun getFragment():Fragment {
|
||||
@@ -33,6 +28,7 @@ object LoginStatusManager : CallerBase<ILoginCallback>() {
|
||||
}
|
||||
throw ClassNotFoundException("没有找到登录Fragment");
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun resetFragment(){
|
||||
loginService?.let {
|
||||
@@ -49,51 +45,57 @@ object LoginStatusManager : CallerBase<ILoginCallback>() {
|
||||
fun queryLoginStatusByNet(readCatche:Boolean=false) {
|
||||
loginService?.queryLoginStatusByNet(readCatche)
|
||||
}
|
||||
@JvmStatic
|
||||
fun getPurpose(): RoleEnum {
|
||||
|
||||
fun getOchCarInfo(): OchCarInfo? {
|
||||
return loginService?.getOchCarInfo()
|
||||
}
|
||||
|
||||
fun getOchBizInfo(): OchBizInfo? {
|
||||
return loginService?.getOchBizInfo()
|
||||
}
|
||||
|
||||
fun getOchLoginInfo(): OchLoginInfo? {
|
||||
return loginService?.getOchLoginInfo()
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除登录信息
|
||||
*/
|
||||
fun removeLoginInfo() {
|
||||
loginService?.removeLoginInfo()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务模式
|
||||
*/
|
||||
fun getProductType():Product{
|
||||
loginService?.let {
|
||||
return it.getPurpose()
|
||||
}
|
||||
return RoleEnum.None
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setLoginInfo(loginInfo: LoginInfo) {
|
||||
loginService?.setLoginInfo(loginInfo)
|
||||
}
|
||||
|
||||
fun getLoginInfo(): LoginInfo? {
|
||||
return loginService?.getLoginInfo()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setLoginStatus(status: Int) {
|
||||
loginService?.setLoginStatus(status)
|
||||
}
|
||||
@JvmStatic
|
||||
fun setBusinessType(type: Int) {
|
||||
loginService?.setBusinessType(type)
|
||||
}
|
||||
|
||||
fun getBusInessType():Product{
|
||||
loginService?.let {
|
||||
return it.getBusinessType()
|
||||
return it.getProductType()
|
||||
}
|
||||
return Product.NONE
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setOpenOrderType(type: Int) {
|
||||
loginService?.setOpenOrderStatusType(type)
|
||||
fun getVehicleType():Vehicle{
|
||||
loginService?.let {
|
||||
return it.getVehicleType()
|
||||
}
|
||||
return Vehicle.NONE
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取接单状态
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getOpenOrderType():OpenOrderStatusEnum{
|
||||
fun getOpenOrderType():EnumOpenOrderStatus{
|
||||
loginService?.let {
|
||||
return it.getOpenOrderStatusType()
|
||||
}
|
||||
return OpenOrderStatusEnum.None
|
||||
return EnumOpenOrderStatus.None
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在接单中
|
||||
*/
|
||||
@JvmStatic
|
||||
fun isOpenOrderType():Boolean{
|
||||
loginService?.let {
|
||||
@@ -102,34 +104,20 @@ object LoginStatusManager : CallerBase<ILoginCallback>() {
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录状态
|
||||
*/
|
||||
@JvmStatic
|
||||
fun setLoginStatus(loginStatus: LoginStatusEnum) {
|
||||
CallerLogger.d(TAG, "setLoginStatus:${loginStatus}")
|
||||
loginService?.setLoginStatus(loginStatus)
|
||||
}
|
||||
|
||||
|
||||
fun removeLoginInfo() {
|
||||
loginService?.removeLoginInfo()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getLoginStatus(): LoginStatusEnum {
|
||||
fun getLoginStatus(): EnumLoginStatus {
|
||||
loginService?.let {
|
||||
return it.getLoginStatus()
|
||||
}
|
||||
return LoginStatusEnum.None
|
||||
return EnumLoginStatus.None
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getCarModel(): Carmodel {
|
||||
loginService?.let {
|
||||
return it.getCarModel()
|
||||
}
|
||||
return Carmodel.T2
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否登录中
|
||||
*/
|
||||
@JvmStatic
|
||||
fun isLogin(): Boolean {
|
||||
loginService?.let {
|
||||
@@ -138,72 +126,73 @@ object LoginStatusManager : CallerBase<ILoginCallback>() {
|
||||
return false
|
||||
}
|
||||
|
||||
fun invokeLoginStatusChange(currentStatus: LoginStatusEnum) {
|
||||
Log.d("登录","设置源:invokeLoginStatusChange")
|
||||
if(!FunctionBuildConfig.isOffLine){
|
||||
if(currentStatus==LoginStatusEnum.Login){
|
||||
Log.d("登录","设置源:queryLoginStatusByNet")
|
||||
BizLoopManager.setLoopFunction(TAGLoopStatus, LoopInfo(60*2, ::queryLoginStatusByNet,immediately = true, scheduler = Schedulers.io()))
|
||||
}else{
|
||||
BizLoopManager.removeLoopFunction(TAGLoopStatus)
|
||||
}
|
||||
/**
|
||||
* 获取车辆模型
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getCarModel(): Carmodel {
|
||||
loginService?.let {
|
||||
return it.getCarModelType()
|
||||
}
|
||||
return Carmodel.T2
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送登录信息到乘客屏
|
||||
*/
|
||||
fun sendLogin2Client() {
|
||||
loginService?.sendLogin2Client()
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录状态变更通知
|
||||
*/
|
||||
fun invokeLoginStatusChange(currentStatus: EnumLoginStatus) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onStatusChange(currentStatus)
|
||||
listener.onLoginStatusChange(currentStatus)
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeLBusinessTypeChange(currentStatus: Product) {
|
||||
/**
|
||||
* 业务模式发生变化通知
|
||||
*/
|
||||
fun invokeLProductChange(currentStatus: Product) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onBusinessChange(currentStatus)
|
||||
}
|
||||
}
|
||||
fun invokeLBusinessTypeChangeDebug(currentStatus: Product) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onBusinessChangeDebug(currentStatus)
|
||||
listener.onProductChange(currentStatus)
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeLOpenOrderStatusChange(currentStatus: OpenOrderStatusEnum) {
|
||||
/**
|
||||
* 车型发生变化通知
|
||||
*/
|
||||
fun invokeLVehicleChange(currentStatus: Vehicle) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onVehicleChage(currentStatus)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接单状态变化发送通知
|
||||
*/
|
||||
fun invokeOpenOrderStatusChange(currentStatus: EnumOpenOrderStatus) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onOpenOrderStatusEnumChange(currentStatus)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun checkBusiness(businessType: Int):Boolean {
|
||||
loginService?.let {
|
||||
return it.checkBusiness(businessType)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun checkAllEnv(
|
||||
projectType: ProjectType,
|
||||
envType: EnvType,
|
||||
vehicleType: VehicleType,
|
||||
businessType: BusinessType
|
||||
):Boolean {
|
||||
loginService?.let {
|
||||
return it.checkAllEnv(projectType,envType,vehicleType,businessType)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun changeStatus(status: String) {
|
||||
loginService?.let {
|
||||
it.changeStatus(status)
|
||||
}
|
||||
loginService?.changeStatus(status)
|
||||
}
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: ILoginCallback) {
|
||||
super.doSomeAfterAddListener(tag, listener)
|
||||
listener.onStatusChange(getLoginStatus())
|
||||
listener.onBusinessChange(getBusInessType())
|
||||
listener.onLoginStatusChange(getLoginStatus())
|
||||
listener.onProductChange(getProductType())
|
||||
listener.onVehicleChage(getVehicleType())
|
||||
listener.onOpenOrderStatusEnumChange(getOpenOrderType())
|
||||
listener.onCarModelChange(getCarModel())
|
||||
}
|
||||
@@ -215,6 +204,9 @@ object LoginStatusManager : CallerBase<ILoginCallback>() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆模型变化通知
|
||||
*/
|
||||
fun invokeCarModelChange(carModel: Carmodel) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
@@ -222,5 +214,12 @@ object LoginStatusManager : CallerBase<ILoginCallback>() {
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeTenantIdChange(tenantId: Long) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onTenantIdChange(tenantId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.mogo.och.common.module.biz.login.bean
|
||||
|
||||
data class OchBizInfo(
|
||||
|
||||
//9: taxi. 10: bus公交 11:接驳 13:包车 14:班车
|
||||
val businessType: Int = -1,
|
||||
|
||||
// taxi使用
|
||||
// 订单号
|
||||
val orderNo: String = "",
|
||||
//1接单中,0暂停接单
|
||||
val servingStatus: Int = 0,
|
||||
|
||||
//接驳、公交、班车使用
|
||||
// 正在执行的线路id
|
||||
val lineId: Long,
|
||||
// 正在执行的班次id
|
||||
val taskId: Long,
|
||||
// 当前站点
|
||||
val currentSite: Long,
|
||||
// 是否滑动出发
|
||||
val leaving: Boolean,
|
||||
// 当前班次的模板id
|
||||
val shiftsId: Long,
|
||||
// 当前班次的具体时间
|
||||
val taskDate: Long,
|
||||
|
||||
// 包车使用
|
||||
// 当前站点id 包车使用
|
||||
val siteId: Long,
|
||||
// 包车车辆状态 1:闲置中 2:使用中
|
||||
val businessStatus: Long,
|
||||
)
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.mogo.och.common.module.biz.login.bean
|
||||
|
||||
data class OchCarInfo(
|
||||
val plateNumber:String?,
|
||||
val vin:String?,
|
||||
val cityCode:String?,// 车辆所在城市
|
||||
val brand:String?,// 车辆生产产商 品牌
|
||||
val carModel:String?,// 车辆类型 型号
|
||||
val photos:String?,// 车身照片
|
||||
// 租户id
|
||||
val tenantId: Long?,
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.och.common.module.biz.login.bean
|
||||
|
||||
data class OchLoginInfo(
|
||||
//1登录,0登出
|
||||
val driverStatus: Int = 0,
|
||||
// 1 运营, 2 测试, 3演示
|
||||
val purpose: Int = 0,
|
||||
// 后台车辆配置的sn
|
||||
val sn: String = "",
|
||||
// 司机手机号
|
||||
val phone: String = "",
|
||||
// 司机id
|
||||
val driverId: Long?,
|
||||
)
|
||||
@@ -4,8 +4,9 @@ import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OFFLINE
|
||||
import com.mogo.och.common.module.biz.lansocket.LoginLanDriverSocket
|
||||
import com.mogo.och.common.module.biz.login.ILoginCallback
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
||||
import com.mogo.och.common.module.biz.login.EnumLoginStatus
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
@@ -17,18 +18,20 @@ object OfflineManager : ILoginCallback {
|
||||
private var offlineService: OfflineService? = ARouter.getInstance().build(OchCommonConst.BIZ_OFFLINE).navigation() as OfflineService
|
||||
|
||||
init {
|
||||
CallerLogger.d(TAG,"初始化离线系统")
|
||||
LoginStatusManager.addListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun onStatusChange(currentStatus: LoginStatusEnum?) {
|
||||
if(!FunctionBuildConfig.isOffLine){
|
||||
if(currentStatus==LoginStatusEnum.Login) {
|
||||
// 同步数据
|
||||
synergyBaseData()
|
||||
// 删除正在运行的数据
|
||||
deleteObsoleteData()
|
||||
}
|
||||
}
|
||||
override fun onLoginStatusChange(currentStatus: EnumLoginStatus?) {
|
||||
// TODO: 6.10.0 删除离线数据
|
||||
// if(!FunctionBuildConfig.isOffLine){
|
||||
// if(currentStatus==EnumLoginStatus.Login) {
|
||||
// // 同步数据
|
||||
// synergyBaseData()
|
||||
// // 删除正在运行的数据
|
||||
// deleteObsoleteData()
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -109,7 +109,7 @@ object ScannerManager : IOchLanPassengerStatusListener {
|
||||
|
||||
override fun onReceive(data: VerificationData?) {
|
||||
OchChainLogManager.writeChainLogScanner(
|
||||
TAG + "onActiveDataReceive",
|
||||
TAG + "ScannerManageronActiveDataReceive",
|
||||
"扫码结果:data:${data}"
|
||||
)
|
||||
data?.let {
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
|
||||
open class BaseDPMsg(
|
||||
open var type: Int = DPMsgType.TYPE_CLIENT_REGISTER.type,
|
||||
open var msgVersion: Int = 1,
|
||||
open var msgVersion: Int = 2,
|
||||
open var targetScreenTypes: MutableList<ScreenType> =
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
mutableListOf(ScreenType.Passenger, ScreenType.Guide)
|
||||
|
||||
@@ -22,5 +22,6 @@ enum class DPMsgType(val type: Int) {
|
||||
TYPE_WRITEOFF_INFO_DETAIL(13), //核销信息
|
||||
TYPE_WRITEOFF_INFO_RESULT(14), //核销结果
|
||||
TYPE_OUTOF_VOICE(15), //转发给乘客屏播放
|
||||
TYPE_LOGIN_INFO(16), //转发给乘客屏播放
|
||||
TYPE_CLIENT_REGISTER(12); //客户端注册 服务端需要
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.mogo.och.common.module.manager.socket.lan.bean
|
||||
|
||||
import com.mogo.commons.env.Env
|
||||
import com.mogo.commons.env.Project
|
||||
import com.mogo.och.common.module.biz.login.bean.OchLoginInfo
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/3/27
|
||||
@@ -130,6 +134,11 @@ data class OutofVoice(
|
||||
val notice: String,
|
||||
) : BaseDPMsg(DPMsgType.TYPE_OUTOF_VOICE.type, targetScreenTypes = mutableListOf(ScreenType.Passenger))
|
||||
|
||||
data class LoginInfo2Client(
|
||||
val loginInfo: String,
|
||||
val project: Project,
|
||||
val env: Env,
|
||||
) : BaseDPMsg(DPMsgType.TYPE_LOGIN_INFO.type,targetScreenTypes = mutableListOf(ScreenType.Passenger))
|
||||
|
||||
// 车辆类型
|
||||
enum class VehicleType {
|
||||
|
||||
@@ -2,11 +2,9 @@ package com.mogo.och.common.module.network.interceptor
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
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.mogo.logger.CallerLogger
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
||||
import com.mogo.och.common.module.biz.login.EnumLoginStatus
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableSource
|
||||
import io.reactivex.functions.Function
|
||||
@@ -19,12 +17,8 @@ class FRetryWithTime<T : BaseData> : Function<T, ObservableSource<T>> {
|
||||
MoGoAiCloudClient.getInstance().refreshToken()
|
||||
return Observable.error(OchCommonRetryException())
|
||||
}else if(it.code == 1003){
|
||||
if(!FunctionBuildConfig.isOffLine&&!FunctionBuildConfig.ochdebug){
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerLogger.d("FRetryWithTime", "接口失败报错 1003:${LoginStatusEnum.Logout}")
|
||||
LoginStatusManager.setLoginStatus(LoginStatusEnum.Logout)
|
||||
}
|
||||
}
|
||||
CallerLogger.d("FRetryWithTime", "接口失败报错 1003:${EnumLoginStatus.Logout}")
|
||||
LoginStatusManager.queryLoginStatusByNet(false)
|
||||
}
|
||||
}
|
||||
return Observable.just(baseData)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.mogo.och.common.module.utils
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.env.Env
|
||||
import com.mogo.commons.env.EnvUtils
|
||||
import com.mogo.commons.env.Project
|
||||
import com.mogo.commons.env.ProjectUtils
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
@@ -8,6 +10,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.Product
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.EnvType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.ProjectType
|
||||
@@ -41,7 +44,7 @@ object FlavorUtils {
|
||||
} else if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||
info.append(" B2")
|
||||
} else {
|
||||
info.append(" C1")
|
||||
info.append(" none")
|
||||
}
|
||||
|
||||
when (DebugConfig.getNetMode()) {
|
||||
@@ -68,61 +71,14 @@ object FlavorUtils {
|
||||
}
|
||||
|
||||
info.append(" ${AppUtils.getAppVersionName()}")
|
||||
info.append(" AppSN:${SharedPrefsMgr.getInstance().sn}")
|
||||
info.append(" AppSN:${OchSPManager.getSn()}")
|
||||
return info.toString()
|
||||
}
|
||||
|
||||
fun getBusinessInfo(businessType: Int): String {
|
||||
val businessEnum = Product.valueOf(businessType)
|
||||
FunctionBuildConfig.supportBusiness.forEach {
|
||||
when (it) {
|
||||
"shuttle" -> {
|
||||
val isSupply = businessEnum == Product.SHUTTLE
|
||||
if (isSupply) {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
"bus" -> {
|
||||
val isSupply = businessEnum == Product.BUS
|
||||
if (isSupply) {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
"taxi" -> {
|
||||
val isSupply = businessEnum == Product.TAXI
|
||||
if (isSupply) {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
"charter" -> {
|
||||
val isSupply = businessEnum == Product.CHARTER
|
||||
if (isSupply) {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
"scheduled" -> {
|
||||
val isSupply = businessEnum == Product.SCHEDULED
|
||||
if (isSupply) {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
val reason = StringBuilder()
|
||||
reason.append("业务异常<当前支持:")
|
||||
FunctionBuildConfig.supportBusiness.forEachIndexed { index, s ->
|
||||
if (index == FunctionBuildConfig.supportBusiness.size - 1) {
|
||||
reason.append(s)
|
||||
} else {
|
||||
reason.append("${s},")
|
||||
}
|
||||
}
|
||||
when (businessEnum) {
|
||||
Product.TAXI -> reason.append(" 后台配置:taxi>")
|
||||
Product.BUS -> reason.append(" 后台配置:bus>")
|
||||
@@ -212,100 +168,25 @@ object FlavorUtils {
|
||||
}
|
||||
|
||||
fun checkAllEnv(
|
||||
projectType: ProjectType,
|
||||
envType: EnvType,
|
||||
vehicleType: VehicleType,
|
||||
businessType: BusinessType
|
||||
projectType: Project,
|
||||
envType: Env,
|
||||
): String {
|
||||
|
||||
val reason = StringBuilder()
|
||||
|
||||
val isProjectSupply = when (ProjectUtils.getProjectType()) {
|
||||
Project.SAAS -> projectType == ProjectType.saas
|
||||
Project.DALI -> projectType == ProjectType.dali
|
||||
Project.MOGO -> projectType == ProjectType.mogo
|
||||
Project.YANTAI -> projectType == ProjectType.yantai
|
||||
}
|
||||
val isProjectSupply = ProjectUtils.getProjectType()==projectType
|
||||
|
||||
if (!isProjectSupply) {
|
||||
reason.append("项目异常<当前:${ProjectUtils.getProjectType().name}, 后台配置:${projectType.name}> ")
|
||||
reason.append("项目异常<当前:${ProjectUtils.getProjectType().value}, 后台配置:${projectType.value}> ")
|
||||
}
|
||||
|
||||
val currentVehicle: String
|
||||
val vehicleTypeSupply =
|
||||
if (AppIdentityModeUtils.isT1T2(FunctionBuildConfig.appIdentityMode)) {
|
||||
currentVehicle = VehicleType.T1T2.name
|
||||
vehicleType == VehicleType.T1T2
|
||||
} else if (AppIdentityModeUtils.isM1(FunctionBuildConfig.appIdentityMode)) {
|
||||
currentVehicle = VehicleType.M1.name
|
||||
vehicleType == VehicleType.M1
|
||||
} else if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
||||
currentVehicle = VehicleType.B1.name
|
||||
vehicleType == VehicleType.B1
|
||||
} else if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) {
|
||||
currentVehicle = VehicleType.B2.name
|
||||
vehicleType == VehicleType.B2
|
||||
} else {
|
||||
currentVehicle = VehicleType.C1.name
|
||||
vehicleType == VehicleType.C1
|
||||
}
|
||||
if (!vehicleTypeSupply) {
|
||||
reason.append("车型异常<当前:${currentVehicle}, 后台配置:${vehicleType.name}> ")
|
||||
}
|
||||
val envTypeSupply = EnvUtils.getEnvType()==envType
|
||||
|
||||
val currentenvType: String
|
||||
val envTypeSupply = when (DebugConfig.getNetMode()) {
|
||||
2 -> {
|
||||
currentenvType = EnvType.qa.name
|
||||
envType == EnvType.qa
|
||||
}
|
||||
|
||||
3 -> {
|
||||
currentenvType = EnvType.online.name
|
||||
envType == EnvType.online
|
||||
}
|
||||
|
||||
4 -> {
|
||||
currentenvType = EnvType.demo.name
|
||||
envType == EnvType.demo
|
||||
}
|
||||
|
||||
else -> {
|
||||
currentenvType = EnvType.qa.name
|
||||
envType == EnvType.qa
|
||||
}
|
||||
}
|
||||
if (!envTypeSupply) {
|
||||
reason.append("环境异常<当前:${currentenvType} 后台配置:${envType.name}> ")
|
||||
}
|
||||
|
||||
|
||||
val businessTypeSupply = checkBusinessMine(businessType)
|
||||
|
||||
if (!businessTypeSupply) {
|
||||
reason.append("业务异常<当前支持:")
|
||||
FunctionBuildConfig.supportBusiness.forEachIndexed { index, s ->
|
||||
if (index == FunctionBuildConfig.supportBusiness.size - 1) {
|
||||
reason.append(s)
|
||||
} else {
|
||||
reason.append("${s},")
|
||||
}
|
||||
}
|
||||
reason.append(" 后台配置:${businessType.name}> ")
|
||||
reason.append("环境异常<当前:${EnvUtils.getEnvType().value} 后台配置:${envType.value}> ")
|
||||
}
|
||||
|
||||
return reason.toString()
|
||||
}
|
||||
|
||||
fun checkBusinessMine(businessType: BusinessType): Boolean {
|
||||
if (businessType == BusinessType.none) {
|
||||
return true
|
||||
}
|
||||
FunctionBuildConfig.supportBusiness.forEach {
|
||||
if (businessType.name == it) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class LoadingMapStatusView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerLogger.d(TAG,"onAttachedToWindow")
|
||||
CallerLogger.d(TAG,"地图loading_onAttachedToWindow")
|
||||
LoginStatusManager.addListener(TAG,this)
|
||||
visibility = VISIBLE
|
||||
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener(TAG,this)
|
||||
|
||||
@@ -3,15 +3,16 @@ package com.mogo.och.common.module.wigets.map.orderstatus
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.R
|
||||
import com.mogo.och.common.module.biz.login.ILoginCallback
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.biz.login.OpenOrderStatusEnum
|
||||
import com.mogo.och.common.module.biz.login.EnumOpenOrderStatus
|
||||
|
||||
class OrderStatusViewModel : ViewModel(), ILoginCallback {
|
||||
|
||||
private val TAG = OrderStatusViewModel::class.java.simpleName
|
||||
private val TAG = M_OCHCOMMON+OrderStatusViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: IVisualCallback? = null
|
||||
|
||||
@@ -26,11 +27,12 @@ class OrderStatusViewModel : ViewModel(), ILoginCallback {
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: IVisualCallback) {
|
||||
CallerLogger.d(TAG,"监听接单状态")
|
||||
LoginStatusManager.addListener(TAG, this)
|
||||
this.viewCallback = viewCallback
|
||||
}
|
||||
|
||||
override fun onOpenOrderStatusEnumChange(businessEnum: OpenOrderStatusEnum?) {
|
||||
override fun onOpenOrderStatusEnumChange(businessEnum: EnumOpenOrderStatus?) {
|
||||
CallerLogger.d(TAG,"新的接单状态${businessEnum}")
|
||||
UiThreadHandler.post({
|
||||
if (LoginStatusManager.isOpenOrderType()) {
|
||||
|
||||
Reference in New Issue
Block a user