modify cmdb
This commit is contained in:
@@ -51,18 +51,14 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
|
||||
@Override
|
||||
public void getBindingcarInfo(String macAddress) {
|
||||
mAddress = macAddress;
|
||||
if (HmiBuildConfig.isShowSnBindingView) {
|
||||
if (getScreenType() == 1) {
|
||||
BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, getScreenType());
|
||||
}
|
||||
if (HmiBuildConfig.isShowSnBindingView) { //TODO 需要验证
|
||||
// BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, getScreenType());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyCarInfo(BindingcarCallBack callBack) {
|
||||
if (getScreenType() == 1) {
|
||||
BindingcarNetWorkManager.getInstance().modifyBindingcar(mAddress, callBack, getScreenType());
|
||||
}
|
||||
// BindingcarNetWorkManager.getInstance().modifyBindingcar(mAddress, callBack, getScreenType());
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +68,9 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
|
||||
screenType = 1; //司机屏
|
||||
}
|
||||
|
||||
// if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
// screenType = 2; //乘客屏
|
||||
// }
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
screenType = 2; //乘客屏
|
||||
}
|
||||
return screenType;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.constants.SharedPrefsConstants;
|
||||
import com.mogo.eagle.core.data.bindingcar.BindingcarInfo;
|
||||
import com.mogo.eagle.core.data.bindingcar.CarInfo;
|
||||
@@ -14,6 +15,7 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.DeviceIdUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
|
||||
@@ -37,7 +39,7 @@ public class BindingcarNetWorkManager {
|
||||
private static final String TAG = "BindingcarNetWorkManager";
|
||||
|
||||
private BindingcarNetWorkManager() {
|
||||
mBindingcarApiService = MoGoRetrofitFactory.getInstance(HostConst.BINDING_SN_HOST)
|
||||
mBindingcarApiService = MoGoRetrofitFactory.getInstance(HostConst.BINDING_SN_HOST_TEST)
|
||||
.create(BindingcarApiService.class);
|
||||
}
|
||||
|
||||
@@ -54,12 +56,17 @@ public class BindingcarNetWorkManager {
|
||||
|
||||
|
||||
/**
|
||||
* 获取绑定的车辆信息
|
||||
* 获取绑定的车辆信息 TODO
|
||||
*
|
||||
* @param macAddress mac地址
|
||||
*/
|
||||
public void getBindingcarInfo(Context context, String macAddress, int screenType) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String sn = DeviceIdUtils.getWidevineIDWithMd5(AbsMogoApplication.getApp());
|
||||
// String macAddress = "48:b0:2d:3a:bc:7";
|
||||
// String sn = "X20202203105S688HZ";
|
||||
// int screenType = 1;
|
||||
|
||||
Log.d("liyz", "getBindingcarInfo --- sn = " + sn + "--macAddress = " +macAddress + "--screenType = " + screenType);
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, sn, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mBindingcarApiService.getBindingcarInfo(token, requestBody)
|
||||
@@ -75,13 +82,13 @@ public class BindingcarNetWorkManager {
|
||||
if (info != null && info.getData() != null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "getBindingcarInfo onNext info.getData() =" + info.getData().toString());
|
||||
Log.d("liyz", "getBindingcarInfo onNext info.getData() =" + info.getData().toString() + "--compare = " + info.getData().getCompare());
|
||||
if (info.getData().getCompare() == 0) {
|
||||
if (info.getData().getCompare().equals(0)) {
|
||||
CallerHmiManager.INSTANCE.showBindingcarDialog();
|
||||
} else if (info.getData().getCompare() == 3) {
|
||||
} else if (info.getData().getCompare().equals(3)) {
|
||||
CallerHmiManager.INSTANCE.showModifyBindingcarDialog();
|
||||
}
|
||||
|
||||
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, GsonUtils.toJson(info.data));
|
||||
SharedPrefsMgr.getInstance(context).putString(SharedPrefsConstants.CAR_INFO, GsonUtils.toJson(info.getData()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +100,7 @@ public class BindingcarNetWorkManager {
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.d("liyz", "getBindingcarInfo onComplete -------- ");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -103,7 +111,9 @@ public class BindingcarNetWorkManager {
|
||||
* mac: 48:b0:2d:3a:9c:19
|
||||
*/
|
||||
public void modifyBindingcar(String macAddress, BindingcarCallBack callBack, int screenType) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
// String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String sn = DeviceIdUtils.getWidevineIDWithMd5(AbsMogoApplication.getApp());
|
||||
Log.d("liyz", "modifyBindingcar --- sn = " + sn + "---macAddress = " + macAddress);
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, sn, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mBindingcarApiService.modifyBindingcarInfo(token, requestBody)
|
||||
@@ -120,6 +130,8 @@ public class BindingcarNetWorkManager {
|
||||
callBack.callBackResult(info);
|
||||
CallerLogger.INSTANCE.d(TAG, "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
|
||||
Log.d("liyz", "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
|
||||
} else {
|
||||
Log.e("liyz", "modifyBindingcar info == null");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@ class ModifyBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifec
|
||||
*/
|
||||
fun modifyBindingcar() {
|
||||
CallerBindingcarManager.getBindingcarProvider().modifyCarInfo {
|
||||
if (it.code == 200) {
|
||||
Log.e("liyz", "it.code == ${it.code}" )
|
||||
if (it.code != 205) {
|
||||
TipToast.shortTip("修改绑定成功")
|
||||
} else {
|
||||
TipToast.shortTip("修改绑定失败")
|
||||
|
||||
@@ -50,7 +50,7 @@ class ToBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifecycle
|
||||
*/
|
||||
fun toBindingcar() {
|
||||
CallerBindingcarManager.getBindingcarProvider().modifyCarInfo {
|
||||
if (it.code == 200) {
|
||||
if (it.code != 205) {
|
||||
TipToast.shortTip("绑定成功")
|
||||
} else {
|
||||
TipToast.shortTip("绑定失败")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.eagle.core.data.bindingcar;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -8,24 +9,25 @@ import java.io.Serializable;
|
||||
* @since 3/16/22
|
||||
*/
|
||||
public class CarInfo implements Serializable {
|
||||
// compare为0 是表示车辆未绑定ipad sn
|
||||
// compare为0 是表示车辆未绑定ipad sn
|
||||
// compare为1 是表示车辆已绑定ipad sn 并且 与所传appsn一致
|
||||
// compare为2 是表示cmdb车辆没有真实绑定ipad
|
||||
// compare为3 是表示车辆已绑定ipad sn 并且 与所传appsn不一致
|
||||
private int compare;
|
||||
private String old_version;
|
||||
private String vendor; //销售商
|
||||
private String series; //类别
|
||||
private String model; //款式
|
||||
private String new_version;
|
||||
private String brand; //品牌
|
||||
private String energy_type; //驱动类型
|
||||
private String compare;
|
||||
private String old_version;
|
||||
private String vendor; //销售商
|
||||
private String series; //类别
|
||||
private String model; //款式
|
||||
private String new_version;
|
||||
private String brand; //品牌
|
||||
private String energy_type; //驱动类型
|
||||
private List<String> passenger; //乘客数量
|
||||
|
||||
public int getCompare() {
|
||||
public String getCompare() {
|
||||
return compare;
|
||||
}
|
||||
|
||||
public void setCompare(int compare) {
|
||||
public void setCompare(String compare) {
|
||||
this.compare = compare;
|
||||
}
|
||||
|
||||
@@ -85,6 +87,14 @@ public class CarInfo implements Serializable {
|
||||
this.energy_type = energy_type;
|
||||
}
|
||||
|
||||
public List<String> getPassenger() {
|
||||
return passenger;
|
||||
}
|
||||
|
||||
public void setPassenger(List<String> passenger) {
|
||||
this.passenger = passenger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CarInfo{" +
|
||||
@@ -96,7 +106,7 @@ public class CarInfo implements Serializable {
|
||||
", new_version='" + new_version + '\'' +
|
||||
", brand='" + brand + '\'' +
|
||||
", energy_type='" + energy_type + '\'' +
|
||||
", passenger=" + passenger +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,5 +20,7 @@ public class HostConst {
|
||||
public static final String SOCKET_CENTER_DOMAIN = "socketRegion";
|
||||
|
||||
public static final String BINDING_SN_HOST = "https://mygateway.zhidaozhixing.com/cmdbapi/"; //中台提供的接口服务
|
||||
public static final String BINDING_SN_HOST_TEST = "https://mygateway.zhidaozhixing.com/cmdbapitest/"; //中台提供的接口服务测试
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user