/** * 添加换回的商品 * * @param list :要添加的huan回商品列表 */ private void addReceiveGoods(List<RefundGoodBean> list) { Log.d(TAG1, "addReceiveGoods,list size = " + list.size()); exchangeReceiveGoodBeans.addAll(list); for (int i = 0; i < list.size(); i++) { RefundGoodBean goodBean = list.get(i); for (int j = 0; j < goodBean.goodSizeBeans.size(); j++) { Log.d(TAG1, "goodBean.goodSizeBeans size = " + goodBean.goodSizeBeans.size()); RefundGoodSizeBean sizeBean = goodBean.goodSizeBeans.get(j); if (!exchangeReceiveGoodsMap.containsKey(sizeBean.getUniqueKey())) { exchangeReceiveGoodsMap.put(sizeBean.getUniqueKey(), sizeBean); } } } mReceiveAdapter.setList(exchangeReceiveGoodBeans); }
/** * 添加退回的商品 * * @param list :要添加的退回商品列表 */ private void addSendGoods(List<RefundGoodBean> list) { exChangeSendGoodBeans.clear(); exChangeSendGoodBeans.addAll(list); for (int i = exChangeSendGoodBeans.size() - 1; i >= 0; i--) { RefundGoodBean goodBean = exChangeSendGoodBeans.get(i); boolean isRemoveGood = true; // 是否删除不包含货品的商品对象 for (int j = goodBean.goodSizeBeans.size() - 1; j >= 0; j--) { RefundGoodSizeBean sizeBean = goodBean.goodSizeBeans.get(j); Log.d(TAG1, "sizeBean.quanlity = " + sizeBean.quantity); if (sizeBean.quantity.trim().equals("0")) { goodBean.goodSizeBeans.remove(sizeBean); continue; } isRemoveGood = false; if (!exChangeSendGoodsMap.containsKey(sizeBean.getUniqueKey())) { exChangeSendGoodsMap.put(sizeBean.getUniqueKey(), sizeBean); } } if (isRemoveGood) { exChangeSendGoodBeans.remove(goodBean); } } mSendAdapter.setList(exChangeSendGoodBeans); }