/** * 重置订单优惠信息(主要用于京东订单) * * @param originalOrderList */ public void resetDiscountInfo(List<OriginalOrder> originalOrderList) { if (CollectionUtils.isEmpty(originalOrderList)) { return; } for (OriginalOrder originalOrder : originalOrderList) { originalOrder.setDiscountFee(getDiscountFee(originalOrder.getPromotionInfoList())); originalOrder.setSelfDiscountFee(getSelfDiscountFee(originalOrder.getPromotionInfoList())); if (CollectionUtils.isEmpty(originalOrder.getOriginalOrderItemList())) { continue; } Money totalPayableFee = getTotalPayableFee(originalOrder); for (OriginalOrderItem originalOrderItem : originalOrder.getOriginalOrderItemList()) { originalOrderItem.setPartMjzDiscount( getItemMjzDiscountFee( originalOrderItem.getPayableFee(), totalPayableFee, originalOrder.getDiscountFee())); originalOrderItem.setSelfPartMjzDiscount( getItemMjzDiscountFee( originalOrderItem.getPayableFee(), totalPayableFee, originalOrder.getSelfDiscountFee())); saveOriginalOrderItem(originalOrderItem); } saveOriginalOrder(originalOrder); } }
/** * 获得订单总应付金额 * * @param originalOrder * @return */ public Money getTotalPayableFee(OriginalOrder originalOrder) { Money totalPayableFee = Money.valueOf(0); if (originalOrder == null || CollectionUtils.isEmpty(originalOrder.getOriginalOrderItemList())) { return totalPayableFee; } for (OriginalOrderItem originalOrderItem : originalOrder.getOriginalOrderItemList()) { totalPayableFee = totalPayableFee.add(originalOrderItem.getPayableFee()); } return totalPayableFee; }