Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS

This commit is contained in:
squallzhjch
2023-07-25 10:37:28 +08:00
9 changed files with 176 additions and 157 deletions

View File

@@ -1,5 +1,10 @@
{
"tableMap" : {
"1012": {
"table": "OMDB_CHECKPOINT",
"code": 1012,
"name": "检查点"
},
"2001": {
"table": "OMDB_RD_LINK",
"code": 2001,

View File

@@ -24,6 +24,11 @@ class Constant {
*/
lateinit var USER_ID: String
/**
* 当前用户名称
*/
lateinit var USER_REAL_NAME: String
//数据版本
lateinit var VERSION_ID: String

View File

@@ -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/"

View File

@@ -381,9 +381,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
@@ -393,7 +395,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))) {

View File

@@ -403,6 +403,7 @@ class EvaluationResultViewModel @Inject constructor(
val realm = Realm.getDefaultInstance()
liveDataQsRecordBean.value!!.taskId = liveDataTaskBean.value!!.id
liveDataQsRecordBean.value!!.checkTime = DateTimeUtil.getDataTime()
liveDataQsRecordBean.value!!.checkUserId = Constant.USER_REAL_NAME
realm.executeTransaction {
it.copyToRealmOrUpdate(liveDataQsRecordBean.value)
}

View File

@@ -38,7 +38,7 @@
<item
android:id="@+id/personal_center_menu_version"
android:icon="@drawable/ic_baseline_layers_24"
android:title="版本ONE_QE_V1.2.0_20230707_A" />
android:title="版本ONE_QE_V1.4.0_20230721_A" />
</group>
<group android:checkableBehavior="single">
<item android:title="小标题">