[2.14.0]避免Bag列表出现重复key的bag包

This commit is contained in:
xuxinchao
2023-02-17 07:35:57 +08:00
parent c7e65d8c45
commit 76f47c6da8

View File

@@ -280,6 +280,7 @@ class BadCaseManagerView @JvmOverloads constructor(
clBagHaveDataLayout.visibility = View.VISIBLE
clBagNoDataLayout.visibility = View.GONE
if(bagManager.bagsInfoRespCount>0){
bagManagerEntity.bagsInfoResp.clear()
for(bagInfo in bagManager.bagsInfoRespList){
bagInfo?.let {
it.timestamp?.let { time ->
@@ -291,6 +292,7 @@ class BadCaseManagerView @JvmOverloads constructor(
bagInfoEntity.bagPath = it.bagPath
bagInfoEntity.mergeStat = it.mergeStat
bagInfoEntity.uploadStat = it.uploadStat
bagInfoEntity.itemType = 0
bagInfoEntity.description = descriptionEntity
for(subBag in it.subBagsList){
val subBagEntity = SubBagEntity(subBag.key,subBag.host,subBag.size)
@@ -299,7 +301,7 @@ class BadCaseManagerView @JvmOverloads constructor(
val month = time.substring(4,6)
val day = time.substring(6,8)
val time = "${month}${day}"
val timeStr = "${month}${day}"
var containTime = false
for(bag in bagManagerEntity.bagsInfoResp){
if(bag.timeStr == time){
@@ -308,13 +310,21 @@ class BadCaseManagerView @JvmOverloads constructor(
}
if(!containTime || bagManagerEntity.bagsInfoResp.size ==0){
//增加时间的
val bagInfoEntity = BagInfoEntity()
bagInfoEntity.itemType = 1
bagInfoEntity.timeStr = time
val bagInfoTimeEntity = BagInfoEntity()
bagInfoTimeEntity.itemType = 1
bagInfoTimeEntity.timeStr = timeStr
bagInfoTimeEntity.timestamp = time.substring(0,8)
bagManagerEntity.bagsInfoResp.add(bagInfoTimeEntity)
}
var containKey = false
for(bagInfoContain in bagManagerEntity.bagsInfoResp){
if(bagInfoContain.key == bagInfoEntity.key){
containKey = true
}
}
if(!containKey){
bagManagerEntity.bagsInfoResp.add(bagInfoEntity)
}
bagManagerEntity.bagsInfoResp.add(bagInfoEntity)
}
}
}