联合支付功能测试
This commit is contained in:
@@ -61,7 +61,8 @@
|
|||||||
<!-- </activity>-->
|
<!-- </activity>-->
|
||||||
<!-- <activity android:name="com.sw.dualscreen.activity.CollectedDataActivity" />-->
|
<!-- <activity android:name="com.sw.dualscreen.activity.CollectedDataActivity" />-->
|
||||||
<activity android:name="com.sw.dualscreen.activity.SettingActivity"
|
<activity android:name="com.sw.dualscreen.activity.SettingActivity"
|
||||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
||||||
|
android:launchMode="singleTask" />
|
||||||
<activity android:name="com.sw.dualscreen.activity.CollectedFoodActivity"
|
<activity android:name="com.sw.dualscreen.activity.CollectedFoodActivity"
|
||||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||||
<activity android:name="com.sw.dualscreen.activity.PayActivity"
|
<activity android:name="com.sw.dualscreen.activity.PayActivity"
|
||||||
|
|||||||
@@ -255,40 +255,72 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
binding.ivImg.load(imgUrl)
|
binding.ivImg.load(imgUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联合支付-即放即取模式
|
||||||
|
*/
|
||||||
|
private fun loadJFJQBySettlement(weight: Int) {
|
||||||
|
//即放即取+联合支付人脸查询订单完成
|
||||||
|
if (presentation!!.jointPaymentQueryFinish) {
|
||||||
|
if (weight > WEIGHT_RESET_RECOGNIZE) {
|
||||||
|
//已识别完成人脸并查询到订单数据,增加重量不再重新识别
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//重量小于等于5克时改为识别中页面
|
||||||
|
isAnalyzing = false
|
||||||
|
presentation?.step1FoodRecognizing()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
||||||
|
//秤上重量过下,显示识别中页面
|
||||||
|
presentation?.step1FoodRecognizing()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// val isWeightChange = abs(weight - lastWeight) > 0.02
|
||||||
|
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
|
||||||
|
if (weight != lastWeight) {
|
||||||
|
log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
||||||
|
}
|
||||||
|
recognizeByWeight(weight, isWeightChange)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联合支付-余量计量模式
|
||||||
|
*/
|
||||||
|
private fun loadYLJLBySettlement(weight: Int) {
|
||||||
|
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
||||||
|
//秤上重量过小,显示识别中页面
|
||||||
|
presentation?.step1FoodRecognizing()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//余量计量+联合支付人脸查询订单完成
|
||||||
|
if (presentation!!.jointPaymentQueryFinish) {
|
||||||
|
presentation?.updateWeight(weight)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
|
||||||
|
recognizeByWeight(weight, isWeightChange)
|
||||||
|
}
|
||||||
|
|
||||||
private fun readWeight(weight: Int) {
|
private fun readWeight(weight: Int) {
|
||||||
log("registerDataChange weight = $weight")
|
log("registerDataChange weight = $weight")
|
||||||
//runOnUiThread { binding.tvShowWeight.text="${weight*1000}克" }
|
runOnUiThread {
|
||||||
|
binding.tvShowWeight.let {
|
||||||
|
if (it.text.toString() == weight.toString()) return@runOnUiThread
|
||||||
|
it.text = "$weight"
|
||||||
|
}
|
||||||
|
}
|
||||||
if (settlementMode == 0) {
|
if (settlementMode == 0) {
|
||||||
//联合支付-------------------------------------------
|
//联合支付-------------------------------------------
|
||||||
//0-即放即取,1-余量计量
|
//0-即放即取,1-余量计量
|
||||||
val mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
val mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
||||||
if (mealPickupMode == 1) {
|
if (mealPickupMode == 1) {
|
||||||
|
loadYLJLBySettlement(weight)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//即放即取+联合支付人脸查询订单完成
|
loadJFJQBySettlement(weight)
|
||||||
if (presentation!!.jointPaymentQueryFinish) {
|
|
||||||
if (weight > WEIGHT_RESET_RECOGNIZE) {
|
|
||||||
//已识别完成人脸并查询到订单数据,增加重量不再重新识别
|
|
||||||
return
|
|
||||||
}
|
|
||||||
//重量小于等于5克时改为识别中页面
|
|
||||||
isAnalyzing = false
|
|
||||||
presentation?.step1FoodRecognizing()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
|
||||||
//秤上重量过下,显示识别中页面
|
|
||||||
presentation?.step1FoodRecognizing()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// val isWeightChange = abs(weight - lastWeight) > 0.02
|
|
||||||
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
|
|
||||||
if (weight != lastWeight) {
|
|
||||||
log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
|
||||||
}
|
|
||||||
recognizeByWeight(weight, isWeightChange)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//独立支付-------------------------------------------
|
//独立支付-------------------------------------------
|
||||||
if (lastWeight - weight > 5) {
|
if (lastWeight - weight > 5) {
|
||||||
//及放及取,从秤上拿走超过5克
|
//及放及取,从秤上拿走超过5克
|
||||||
@@ -305,11 +337,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// val isWeightChange = abs(weight - lastWeight) > 0.02
|
|
||||||
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
|
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
|
||||||
if (weight != lastWeight) {
|
|
||||||
log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
|
||||||
}
|
|
||||||
recognizeByWeight(weight, isWeightChange)
|
recognizeByWeight(weight, isWeightChange)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,6 +349,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun recognizeByWeight(weight: Int, isWeightChange: Boolean, block: () -> Unit = {}) {
|
private fun recognizeByWeight(weight: Int, isWeightChange: Boolean, block: () -> Unit = {}) {
|
||||||
|
if (weight != lastWeight) {
|
||||||
|
val payTypeDesc = if (settlementMode == 0) "联合支付" else "独立支付"
|
||||||
|
log("readWeight-${payTypeDesc},weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
||||||
|
}
|
||||||
presentation?.updateWeight(weight)
|
presentation?.updateWeight(weight)
|
||||||
|
|
||||||
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
||||||
@@ -642,6 +674,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
//已显示副屏,则进行更新
|
//已显示副屏,则进行更新
|
||||||
val weight = lastWeight
|
val weight = lastWeight
|
||||||
lastWeight = 0
|
lastWeight = 0
|
||||||
|
presentation?.pauseCamera()
|
||||||
presentation?.hideRecImage()
|
presentation?.hideRecImage()
|
||||||
presentation?.step1FoodRecognizing()
|
presentation?.step1FoodRecognizing()
|
||||||
|
|
||||||
@@ -690,10 +723,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
lastTouchTime = System.currentTimeMillis()
|
lastTouchTime = System.currentTimeMillis()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun joinPayment() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun createOrder(
|
fun createOrder(
|
||||||
foodInfo: FoodInfo,
|
foodInfo: FoodInfo,
|
||||||
foodWeight: Int,
|
foodWeight: Int,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class FoodOrderAdapter(var list: MutableList<FoodItem>) :
|
|||||||
binding.tvFoodName.text = it.foodName
|
binding.tvFoodName.text = it.foodName
|
||||||
val foodPrice = it.foodPrice.format2String(2)
|
val foodPrice = it.foodPrice.format2String(2)
|
||||||
if (it.orderFrom == 2) {
|
if (it.orderFrom == 2) {
|
||||||
binding.tvPriceNorm.text = "${it.specName}-${it.specWeight}克"
|
binding.tvPriceNorm.text = "${it.specName}/${it.specWeight}克"
|
||||||
} else {
|
} else {
|
||||||
binding.tvPriceNorm.text = "${foodPrice}/${it.num}克"
|
binding.tvPriceNorm.text = "${foodPrice}/${it.num}克"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1220,18 +1220,21 @@ class MainScreenPresentation(
|
|||||||
isMember = false
|
isMember = false
|
||||||
//ToastUtils.showToast("isKeepFaceState=$isKeepFaceState,mealPickupMode=$mealPickupMode")
|
//ToastUtils.showToast("isKeepFaceState=$isKeepFaceState,mealPickupMode=$mealPickupMode")
|
||||||
//|| isKeepFaceState
|
//|| isKeepFaceState
|
||||||
if (activity.settlementMode == 0) {
|
// if (activity.settlementMode == 0) {
|
||||||
activity.isAnalyzing = false
|
// activity.isAnalyzing = false
|
||||||
step1FoodRecognizing()
|
// step1FoodRecognizing()
|
||||||
} else {
|
// } else {
|
||||||
if (mealPickupMode == 1) {
|
if (mealPickupMode == 1) {
|
||||||
step2FaceRecognizing(currentFood!!)
|
step2FaceRecognizing(currentFood!!)
|
||||||
isKeepFaceState = false
|
isKeepFaceState = false
|
||||||
|
if (activity.settlementMode == 0) {
|
||||||
|
setTopInfoVisible()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
activity.isAnalyzing = false
|
activity.isAnalyzing = false
|
||||||
step1FoodRecognizing()
|
step1FoodRecognizing()
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1263,11 +1266,15 @@ class MainScreenPresentation(
|
|||||||
// foodWeight = lastWeight
|
// foodWeight = lastWeight
|
||||||
//)
|
//)
|
||||||
//userViewModel.postUserNutritionData(listOf(userNutritionParam))
|
//userViewModel.postUserNutritionData(listOf(userNutritionParam))
|
||||||
|
val realWeight = eatWeight.toDouble()
|
||||||
|
val specWeight = currentFood!!.specWeight
|
||||||
|
val eatNum = activity.getEatNum(realWeight, specWeight)
|
||||||
|
activity.log("createOrder,realWeight=$realWeight,specWeight=$specWeight")
|
||||||
activity.createOrder(
|
activity.createOrder(
|
||||||
foodInfo = currentFood!!,
|
foodInfo = currentFood!!,
|
||||||
foodWeight = lastWeight,
|
foodWeight = lastWeight,
|
||||||
eatWeight = eatWeight,
|
eatWeight = eatWeight,
|
||||||
eatNum = activity.getEatNum(eatWeight.toDouble(), currentFood!!.specWeight),
|
eatNum = eatNum,
|
||||||
userId = currentUserId,
|
userId = currentUserId,
|
||||||
isMember = isMember,
|
isMember = isMember,
|
||||||
notEnoughOneBlock = notEnoughOneBlock,
|
notEnoughOneBlock = notEnoughOneBlock,
|
||||||
|
|||||||
@@ -48,19 +48,22 @@
|
|||||||
android:textColor="#FF0A1428"
|
android:textColor="#FF0A1428"
|
||||||
android:textSize="52sp"
|
android:textSize="52sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
<!-- <TextView-->
|
|
||||||
<!-- android:id="@+id/tvShowWeight"-->
|
<TextView
|
||||||
<!-- android:layout_width="wrap_content"-->
|
android:id="@+id/tvShowWeight"
|
||||||
<!-- android:layout_height="80dp"-->
|
android:layout_width="wrap_content"
|
||||||
<!-- android:textSize="30sp"-->
|
android:layout_height="80dp"
|
||||||
<!-- android:gravity="center"-->
|
android:textSize="40sp"
|
||||||
<!-- tools:text="100克"/>-->
|
android:gravity="center"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
tools:text="100克"/>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/foodDisplayLayout"
|
android:id="@+id/foodDisplayLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="560dp"
|
android:layout_height="560dp"
|
||||||
android:layout_marginHorizontal="28dp"
|
android:layout_marginHorizontal="28dp"
|
||||||
android:layout_marginTop="80dp"
|
android:layout_marginTop="0dp"
|
||||||
android:visibility="visible">
|
android:visibility="visible">
|
||||||
|
|
||||||
<androidx.camera.view.PreviewView
|
<androidx.camera.view.PreviewView
|
||||||
|
|||||||
Reference in New Issue
Block a user