BigDecimal surplusQty = orderDetailList.stream().map(OrderDetail::getGoodsQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
List<PurOrderDtl> purOrderDtlList = new ArrayList<>();
PurOrderDtl purOrderDtl1 = new PurOrderDtl();
purOrderDtl1.setUnitPrice(new BigDecimal("20"));
purOrderDtl1.setGoodsQty(new BigDecimal("3"));
PurOrderDtl purOrderDtl2 = new PurOrderDtl();
purOrderDtl2.setUnitPrice(new BigDecimal("10"));
purOrderDtl2.setGoodsQty(new BigDecimal("2.2"));
purOrderDtlList.add(purOrderDtl1);
purOrderDtlList.add(purOrderDtl2);
BigDecimal total = new BigDecimal("0");
for (PurOrderDtl purOrderDtl3 : purOrderDtlList) {
total = total.add(purOrderDtl3.getUnitPrice().multiply(purOrderDtl3.getGoodsQty()));
}
System.out.println(total);
BigDecimal reduce = purOrderDtlList.stream().map(purOrderDtl ->
purOrderDtl.getUnitPrice().multiply(purOrderDtl.getGoodsQty())).reduce(BigDecimal::add).get();
System.out.println(reduce);
BigDecimal totalConsumption = orderPayDTOList.stream().filter(orderPayDTO ->
orderPayDTO.getPayMoney() != null).map(OrderPayDTO::getPayMoney)
.reduce(BigDecimal.ZERO, BigDecimal::add);