feat(network): queryGoodsList 入参 goodsNames 改为带净材种类的对象列表
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package com.shuwei.dish.match.entity
|
||||
|
||||
/**
|
||||
* 物品名称批量查询入参 DTO
|
||||
* 用于 queryGoodsInfoList 接口 goodsNames 字段的元素类型
|
||||
* @param goodsName 物品名称
|
||||
* @param rawMaterialsType 净材种类
|
||||
*/
|
||||
data class GoodsNameQueryDTO(
|
||||
val goodsName: String,
|
||||
val rawMaterialsType: String
|
||||
)
|
||||
@@ -124,7 +124,7 @@ object FoodModule {
|
||||
val nameScoreList = mutableListOf<IdNameScore>()
|
||||
idScoreList.forEach {
|
||||
val name = foodMap[it.id]?.name ?: ""
|
||||
nameScoreList.add(IdNameScore(id = it.id, name = name, score = it.score))
|
||||
nameScoreList.add(IdNameScore(id = it.id, name = name, score = it.score, rawMaterialsType = ""))
|
||||
}
|
||||
logInfo("queryFood数据:${nameScoreList.toJsonString()}")
|
||||
return nameScoreList
|
||||
@@ -176,7 +176,8 @@ object FoodModule {
|
||||
data class IdNameScore(
|
||||
val id: Long,
|
||||
var name: String,
|
||||
val score: Double
|
||||
val score: Double,
|
||||
val rawMaterialsType: String
|
||||
)
|
||||
|
||||
suspend fun initDefFoodData(context: Context, action: () -> Unit = {}) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.shuwei.dish.match.base.BaseActivity
|
||||
import com.shuwei.dish.match.databinding.ActivityFoodRecognizeBinding
|
||||
import com.shuwei.dish.match.dialog.FoodSearchDialog
|
||||
import com.shuwei.dish.match.entity.GoodsItem
|
||||
import com.shuwei.dish.match.entity.GoodsNameQueryDTO
|
||||
import com.shuwei.dish.match.utils.ActivityManager
|
||||
import com.shuwei.dish.match.utils.WeightUtil
|
||||
import com.shuwei.dish.match.utils.ext.clickWithDebounce
|
||||
@@ -110,8 +111,8 @@ class FoodRecognizeActivity : BaseActivity() {
|
||||
/** 通过name查询IdNameScore */
|
||||
private val nameScoreMap = mutableMapOf<String, FoodModule.IdNameScore>()
|
||||
|
||||
/** 识别物品名称列表 */
|
||||
private val goodsNameList = mutableListOf<String>()
|
||||
/** 识别物品名称列表(名称 + 净材种类,用于批量查询接口) */
|
||||
private val goodsNameList = mutableListOf<GoodsNameQueryDTO>()
|
||||
|
||||
private val scrollListener = object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
@@ -180,7 +181,8 @@ class FoodRecognizeActivity : BaseActivity() {
|
||||
recognizeNameList?.apply {
|
||||
forEach {
|
||||
val goodsName = it.name.split("WP").first()
|
||||
goodsNameList.add(goodsName)
|
||||
val rawMaterialsType = it.rawMaterialsType
|
||||
goodsNameList.add(GoodsNameQueryDTO(goodsName, rawMaterialsType))
|
||||
nameScoreMap.put(goodsName, it)
|
||||
|
||||
// // TODO: 测试数据,临时使用-------------------------
|
||||
|
||||
Reference in New Issue
Block a user