修改测评问题人记录错误2.调整车道边界类型渲染原则
This commit is contained in:
@@ -24,6 +24,11 @@ class Constant {
|
||||
*/
|
||||
lateinit var USER_ID: String
|
||||
|
||||
/**
|
||||
* 当前用户名称
|
||||
*/
|
||||
lateinit var USER_REAL_NAME: String
|
||||
|
||||
//数据版本
|
||||
lateinit var VERSION_ID: String
|
||||
|
||||
|
||||
@@ -106,11 +106,12 @@ class LoginViewModel @Inject constructor(
|
||||
val userNameCache = sharedPreferences?.getString("userName", null)
|
||||
val passwordCache = sharedPreferences?.getString("passWord", null)
|
||||
val userCodeCache = sharedPreferences?.getString("userCode", null)
|
||||
val userRealName = sharedPreferences?.getString("userRealName", null)
|
||||
//增加缓存记录,不用每次连接网络登录
|
||||
if (userNameCache != null && passwordCache != null && userCodeCache != null) {
|
||||
if (userNameCache != null && passwordCache != null && userCodeCache != null&&userRealName!=null) {
|
||||
if (userNameCache == userName && passwordCache == password) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
createUserFolder(context, userCodeCache)
|
||||
createUserFolder(context, userCodeCache,userRealName)
|
||||
loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
|
||||
}
|
||||
return
|
||||
@@ -133,6 +134,7 @@ class LoginViewModel @Inject constructor(
|
||||
//网络访问
|
||||
loginStatus.postValue(LoginStatus.LOGIN_STATUS_NET_LOADING)
|
||||
var userCode = "99999";
|
||||
var userRealName = "";
|
||||
//登录访问
|
||||
when (val result = networkService.loginUser(LoginUserBean(userName, password))) {
|
||||
is NetResult.Success<*> -> {
|
||||
@@ -153,6 +155,7 @@ class LoginViewModel @Inject constructor(
|
||||
return
|
||||
} else {
|
||||
userCode = defaultUserResponse.obj?.userCode.toString()
|
||||
userRealName = defaultUserResponse.obj?.userName.toString()
|
||||
}
|
||||
} else {
|
||||
withContext(Dispatchers.Main) {
|
||||
@@ -200,7 +203,9 @@ class LoginViewModel @Inject constructor(
|
||||
sharedPreferences?.edit()?.putString("userName", userName)?.commit()
|
||||
sharedPreferences?.edit()?.putString("passWord", password)?.commit()
|
||||
sharedPreferences?.edit()?.putString("userCode", userCode)?.commit()
|
||||
createUserFolder(context, userCode)
|
||||
sharedPreferences?.edit()?.putString("userRealName", userRealName)?.commit()
|
||||
|
||||
createUserFolder(context, userCode,userRealName)
|
||||
} catch (e: IOException) {
|
||||
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_FAILURE)
|
||||
}
|
||||
@@ -242,9 +247,10 @@ class LoginViewModel @Inject constructor(
|
||||
/**
|
||||
* 创建用户目录
|
||||
*/
|
||||
private fun createUserFolder(context: Context, userId: String) {
|
||||
private fun createUserFolder(context: Context, userId: String,userRealName:String) {
|
||||
Constant.IS_VIDEO_SPEED = false
|
||||
Constant.USER_ID = userId
|
||||
Constant.USER_REAL_NAME = userRealName
|
||||
Constant.VERSION_ID = userId
|
||||
Constant.USER_DATA_PATH = Constant.DATA_PATH + Constant.USER_ID + "/" + Constant.VERSION_ID
|
||||
Constant.USER_DATA_ATTACHEMNT_PATH = Constant.USER_DATA_PATH + "/attachment/"
|
||||
|
||||
@@ -321,9 +321,11 @@ class MainViewModel @Inject constructor(
|
||||
} catch (e: Exception) {
|
||||
|
||||
}
|
||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||
location.taskId = id.toString()
|
||||
if (shareUtil?.connectstate == true) {
|
||||
|
||||
location.taskId = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1).toString()
|
||||
|
||||
//判断如果是连接状态并处于录像模式,标记为有效点
|
||||
if (shareUtil?.connectstate == true&&shareUtil?.takeCameraMode==0) {
|
||||
location.media = 1
|
||||
}
|
||||
var disance = 0.0
|
||||
@@ -333,7 +335,6 @@ class MainViewModel @Inject constructor(
|
||||
location.latitude, location.longitude,
|
||||
lastNiLocaion!!.latitude, lastNiLocaion!!.longitude
|
||||
)
|
||||
|
||||
}
|
||||
//室内整理工具时不能进行轨迹存储,判断轨迹间隔要超过2.5并小于60米
|
||||
if (Constant.INDOOR_IP.isEmpty() && (disance == 0.0 || (disance > 2.5 && disance < 60))) {
|
||||
|
||||
@@ -329,6 +329,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val realm = Realm.getDefaultInstance()
|
||||
liveDataQsRecordBean.value!!.checkTime = DateTimeUtil.getDataTime()
|
||||
liveDataQsRecordBean.value!!.checkUserId = Constant.USER_REAL_NAME
|
||||
realm.executeTransaction {
|
||||
it.copyToRealmOrUpdate(liveDataQsRecordBean.value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user