lmw
2023-06-14 c6a53572a83eaf4ad0d6193303e5acc4929b239f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.kuanzhai.driver.ui.merchant
 
import android.view.View
import com.driver.emanagercar.ui.base.BaseRecyclerFragment
import com.kuanzhai.driver.bean.MerchantCouponData
import com.kuanzhai.driver.bean.MerchantCouponListBean
import com.kuanzhai.driver.bean.UserInfoBean
import com.kuanzhai.driver.netUtls.Api
import com.kuanzhai.driver.netUtls.getMapByAny
import com.kuanzhai.driver.ui.adapter.ConponMerchantMineAdapter
import java.util.HashMap
 
/**
 * @ClassName ConponMerchantMineFragment
 * @Description TODO
 * @Author Administrator
 * @Date 2022/2/9 17:34
 * @Version 1.0
 */
class ConponMerchantMineFragment:BaseRecyclerFragment<MutableList<MerchantCouponData>>(ConponMerchantMineAdapter()) {
 
    var type = 1 //1=正常,2=失效
 
    override fun pathUrl(): String? {
        return Api.getMyMerchantCoupon
    }
 
    override fun mapObject(): HashMap<String?, Any?>? {
        (adapter as ConponMerchantMineAdapter).type = type
       var map = getMapByAny()
        map["type"] = type
        return map
    }
 
    override fun mapString(): HashMap<String?, String?>? {
        return null
    }
 
 
 
    override fun getDatas(t: String?): List<MutableList<MerchantCouponData>> {
        var nowList = gson.fromJson<MerchantCouponListBean>(t,MerchantCouponListBean::class.java).data
        var list = arrayListOf<MutableList<MerchantCouponData>>()
        for (item in nowList){
            var isAdd = false
             for (itemList in list){
                for (c in itemList){
                    if (c.merchantId == item.merchantId){
                        itemList.add(item)
                        isAdd = true
                        break
                    }
                }
            }
            if (!isAdd){
                var inList = mutableListOf<MerchantCouponData>()
                inList.add(item)
                list.add(inList)
            }
        }
       return list
    }
 
    override fun onItemClick(view: View?, position: Int) {
 
    }
 
    override fun initView() {
    }
}