/** * 添加换回的商品 * * @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); }
/** 获取退回商品总价 */ public void setSendTotalPriceText() { Log.d(TAG1, "=====> setReceiveTotalPriceText"); Set<String> keySet = exChangeSendGoodsMap.keySet(); totalSendPrice = 0; Iterator<String> iterator = keySet.iterator(); while (iterator.hasNext()) { RefundGoodSizeBean sizeBean = exChangeSendGoodsMap.get(iterator.next()); if (sizeBean.isSelcetd()) { totalSendPrice += (Integer.valueOf(sizeBean.getQuantity()) * Float.valueOf(sizeBean.getCommodity_price())); } } BigDecimal b = new BigDecimal(totalSendPrice); totalSendPrice = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue(); tv_total_send_price.setText("小计金额:" + (totalSendPrice)); Log.d(TAG1, "totalSendPrice:" + totalSendPrice); }
/** * 添加退回的商品 * * @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); }
/** 设置参数 */ private void setCommitApplyParams() { uid = AppContext.userInfo.id; Log.d(TAG1, "uid = " + uid); Log.d(TAG1, "oids = " + oids); Set<String> sendGoodIds = new TreeSet<String>(); Set<String> keySet = exChangeSendGoodsMap.keySet(); Iterator<String> iteratorSend = keySet.iterator(); RefundGoodSizeBean sizeBean = null; StringBuffer buffer = new StringBuffer(); while (iteratorSend.hasNext()) { sizeBean = exChangeSendGoodsMap.get(iteratorSend.next()); if (sizeBean.isSelcetd()) { buffer.append(sizeBean.good_code + "," + sizeBean.getQuantity() + ","); if (!sendGoodIds.contains(sizeBean.order_id)) { sendGoodIds.add(sizeBean.order_id); // 获取退回商品所属的订单id } } } dataArrOut = buffer.toString().substring(0, buffer.length() - 1); keySet = exchangeReceiveGoodsMap.keySet(); Iterator<String> iteratorReceive = keySet.iterator(); buffer = new StringBuffer(); while (iteratorReceive.hasNext()) { sizeBean = exchangeReceiveGoodsMap.get(iteratorReceive.next()); if (sizeBean.isSelcetd()) { buffer.append( sizeBean.good_code + "," + sizeBean.getQuantity() + "," + sizeBean.getSpec_name_value() + ","); } } dataArr = buffer.toString().substring(0, buffer.length() - 1); Log.d(TAG1, "dataArrOut = " + dataArrOut); Log.d(TAG1, "dataArr = " + dataArr); Log.d(TAG1, "cid = " + cid); Iterator<String> iterator = sendGoodIds.iterator(); buffer = new StringBuffer(); while (iterator.hasNext()) { buffer.append(iterator.next() + ","); } oids = buffer.toString().substring(0, buffer.length() - 1); Log.d(TAG1, "sendGoodIds size = " + sendGoodIds.size() + ", oids = " + oids); }