设备联调
This commit is contained in:
Generated
+2
-2
@@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-09-17T07:41:36.397341700Z">
|
||||
<DropdownSelection timestamp="2025-11-06T09:21:30.965681400Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="Default" identifier="serial=192.168.1.80:5555;connection=28be19dc" />
|
||||
<DeviceId pluginId="Default" identifier="serial=?;connection=3c39678a" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
Generated
+1
-1
@@ -4,7 +4,6 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="azul-17" />
|
||||
<option name="modules">
|
||||
@@ -14,6 +13,7 @@
|
||||
<option value="$PROJECT_DIR$/lib_face" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -29,7 +29,7 @@ android {
|
||||
ndk {
|
||||
abiFilters.addAll(listOf("armeabi-v7a"/*, "arm64-v8a"*/))
|
||||
}
|
||||
setProperty("archivesBaseName", "智能餐盘柜_${versionName}")
|
||||
setProperty("archivesBaseName", "zncpg_${versionName}")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
||||
@@ -28,7 +28,7 @@ object GlobalData {
|
||||
|
||||
var appId = "Hkz1rBk6PZXbS8KwKr67K2eZtsz8bRoMHLg64bUdgCZj"
|
||||
var sdkKey = "AabXs3sHM8UhhE7oCGf4LVMLrdkGb1nJNksbjjTdVt7k"
|
||||
var activeKey = "085F-118G-Q391-53YL"
|
||||
var activeKey ="085F-118G-Q3J6-35UX" //"085F-118G-Q391-53YL"
|
||||
|
||||
/**
|
||||
* 具体业务baseurl
|
||||
|
||||
@@ -270,6 +270,7 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
|
||||
lifecycleScope.launch {
|
||||
viewModel.currentUserInfo.collect {
|
||||
if (it == null) return@collect
|
||||
it.showBalanceNotEnoughDialog = true
|
||||
handleLoginSuccess(it, false)
|
||||
}
|
||||
}
|
||||
@@ -317,8 +318,8 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
|
||||
open fun handleLoginSuccess(equipmentUserInfo: EquipmentUserInfo, isAdmin: Boolean) {
|
||||
Timber.d("handleLoginSuccess isAdmin = $isAdmin")
|
||||
val cardBalance = equipmentUserInfo.cardBalance?:0.toDouble()
|
||||
equipmentUserInfo.balanceIsNotEnough = cardBalance <= 0.toDouble()
|
||||
if (equipmentUserInfo.balanceIsNotEnough) {
|
||||
val balanceIsNotEnough = cardBalance <= 0.toDouble()
|
||||
if (balanceIsNotEnough && equipmentUserInfo.showBalanceNotEnoughDialog) {
|
||||
//提示余额不足弹窗
|
||||
BalanceNotEnoughDialog(this).show()
|
||||
return
|
||||
|
||||
@@ -30,7 +30,7 @@ class DeviceInitActivity : BaseActivity<ActivityDeviceInitBinding>() {
|
||||
|
||||
override fun initialize() {
|
||||
var deviceId = AppUtil.getUDID(this)
|
||||
deviceId = "6ce7cd59-b875-38b2-b73d-88a570be3212"
|
||||
deviceId = "be154831-3466-3ba2-a2ea-57652c919fed"
|
||||
GlobalData.deviceId = deviceId
|
||||
val isSuccess = deviceViewModel.checkEquipmentInfo()
|
||||
if (isSuccess) {
|
||||
|
||||
@@ -45,9 +45,11 @@ class LoginByPwdActivity : BaseActivity<ActivityLoginByPwdBinding>() {
|
||||
|
||||
override fun handleLoginSuccess(equipmentUserInfo: EquipmentUserInfo, isAdmin: Boolean) {
|
||||
super.handleLoginSuccess(equipmentUserInfo, isAdmin)
|
||||
if (equipmentUserInfo.balanceIsNotEnough) {
|
||||
return
|
||||
}
|
||||
// val cardBalance = equipmentUserInfo.cardBalance?:0.toDouble()
|
||||
// val balanceIsNotEnough = cardBalance <= 0.toDouble()
|
||||
// if (balanceIsNotEnough) {
|
||||
// return
|
||||
// }
|
||||
LoginByFaceActivity.goInitActivity()
|
||||
finish()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.sw.platecabinet.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.Window
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.sw.platecabinet.databinding.DialogUserBindRemindBinding
|
||||
import com.sw.platecabinet.ext.dp
|
||||
|
||||
open class UserBindRemindDialog(
|
||||
private var activity: FragmentActivity,
|
||||
var content:String
|
||||
) : Dialog(activity) {
|
||||
|
||||
private lateinit var binding: DialogUserBindRemindBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
binding = DialogUserBindRemindBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
window?.run {
|
||||
attributes = attributes.apply {
|
||||
width = 480.dp
|
||||
}
|
||||
setBackgroundDrawable(ColorDrawable())
|
||||
setCancelable(false)
|
||||
}
|
||||
binding.tvBindContent.text = content
|
||||
addListener()
|
||||
}
|
||||
|
||||
private fun addListener() {
|
||||
binding.tvConfirm.setOnClickListener { dismiss() }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.text.Editable
|
||||
import android.text.TextUtils
|
||||
import android.text.TextWatcher
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@@ -20,12 +21,15 @@ import com.sw.platecabinet.adapter.GridSpacingItemDecoration
|
||||
import com.sw.platecabinet.adapter.dpToPx
|
||||
import com.sw.platecabinet.databinding.FragmentBindPlateBinding
|
||||
import com.sw.platecabinet.databinding.ItemSearchUserInfoBinding
|
||||
import com.sw.platecabinet.dialog.UserBindRemindDialog
|
||||
import com.sw.platecabinet.ext.maskName
|
||||
import com.sw.platecabinet.ext.maskPhone
|
||||
import com.sw.platecabinet.model.response.EquipmentUserInfo
|
||||
import com.sw.platecabinet.model.response.SearchResult
|
||||
import com.sw.platecabinet.utils.Debouncer
|
||||
import com.sw.platecabinet.utils.KeyboardUtils
|
||||
import com.sw.platecabinet.viewmodel.SettingViewModel
|
||||
import com.sw.platecabinet.viewmodel.UserViewModel
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
|
||||
@@ -42,6 +46,8 @@ class BindPlateFragment : BaseFragment<FragmentBindPlateBinding>(
|
||||
private var lastText = ""
|
||||
private val debouncer = Debouncer(2000)
|
||||
|
||||
private val userViewModel by viewModels<UserViewModel>()
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(userInfo: EquipmentUserInfo?) =
|
||||
@@ -161,6 +167,10 @@ class BindPlateFragment : BaseFragment<FragmentBindPlateBinding>(
|
||||
}
|
||||
}
|
||||
binding.llBind.setOnClickListener {
|
||||
if (equipmentBoxCode.isNullOrBlank().not()) {
|
||||
showBindDialog()
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (info == null || info!!.equipmentCode?.isEmpty() == true || info!!.equipmentBoxCode?.isEmpty() == true) {
|
||||
ToastUtils.showToast("传入的设备信息异常")
|
||||
return@setOnClickListener
|
||||
@@ -254,8 +264,25 @@ class BindPlateFragment : BaseFragment<FragmentBindPlateBinding>(
|
||||
Timber.d("itemClick ${item.name}, position = $position")
|
||||
checkedItem = item
|
||||
adapter.notifyDataSetChanged()
|
||||
//TODO 调用接口查询用户是否已绑盘
|
||||
this@BindPlateFragment.equipmentBoxCode = null
|
||||
(activity as? MainActivity)?.showWaitingDialog("查询中,请稍后……")
|
||||
userViewModel.getUserInfoById(memberId = item.id!!) {
|
||||
(activity as? MainActivity)?.hideWaitingDialog()
|
||||
this@BindPlateFragment.equipmentBoxCode = it?.equipmentBoxCode
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private var equipmentBoxCode:String? = null
|
||||
|
||||
private fun showBindDialog() {
|
||||
UserBindRemindDialog(
|
||||
activity = requireActivity(),
|
||||
content = "您已绑定编号为${equipmentBoxCode}的柜子,请解绑后重试"
|
||||
)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ data class EquipmentUserInfo(
|
||||
/**
|
||||
* 用于cardBalance后续拦截判断
|
||||
*/
|
||||
var balanceIsNotEnough: Boolean = false
|
||||
var showBalanceNotEnoughDialog: Boolean = false
|
||||
) : Parcelable {
|
||||
|
||||
/**
|
||||
|
||||
@@ -66,9 +66,10 @@ abstract class BaseViewModel() : ViewModel() {
|
||||
}
|
||||
|
||||
fun parseEquipmentInfo(equipmentInfo: EquipmentInfo) {
|
||||
GlobalData.appBaseUrl = equipmentInfo.appPackageUrl!!
|
||||
GlobalData.sdkKey = equipmentInfo.arcsoftSdkKey!!
|
||||
GlobalData.appId = equipmentInfo.arcsoftAppId!!
|
||||
// GlobalData.appBaseUrl = equipmentInfo.appPackageUrl!!
|
||||
GlobalData.appBaseUrl="https://vip.shuziweidao.com"
|
||||
// GlobalData.sdkKey = equipmentInfo.arcsoftSdkKey!!
|
||||
// GlobalData.appId = equipmentInfo.arcsoftAppId!!
|
||||
// GlobalData.activeKey = equipmentInfo.arcsoftActiveKey!!
|
||||
GlobalData.restId = equipmentInfo.canteenId!!
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ class UserViewModel : BaseViewModel() {
|
||||
/**
|
||||
* 通过用户id获取用户信息
|
||||
*/
|
||||
fun getUserInfoById(equipmentCode: String = globalEquipmentCode, memberId: Int) {
|
||||
fun getUserInfoById(equipmentCode: String = globalEquipmentCode, memberId: Int, action:(EquipmentUserInfo?)->Unit={}) {
|
||||
_currentUserInfo.value = null
|
||||
launchWithLoading {
|
||||
val loginParam = LoginParam(
|
||||
@@ -141,6 +141,7 @@ class UserViewModel : BaseViewModel() {
|
||||
val response = repository.equipmentBoxLogin(loginParam)
|
||||
if (parseResponse(response)) {
|
||||
_currentUserInfo.value = response.data
|
||||
action(response.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/dialogContainer"
|
||||
android:layout_width="480dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginTop="0dp"
|
||||
android:background="@drawable/bg_dialog"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="HardcodedText">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:src="@drawable/ic_tip_warn_unbind" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tip_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="温馨提示"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBindContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="请通过小程序或到柜台充值后使用"
|
||||
android:textColor="#ff999999"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="#ff333333" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_confirm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:gravity="center"
|
||||
android:text="知道了"
|
||||
android:textColor="#ffffcc99"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user