r.getTotalInvestMoney():也是BigDecimal 类型
BigDecimal totalInvestMoney=null;
for (RebareDetailedVO r : rdVoList) {
totalInvestMoney=totalInvestMoney.add(r.getTotalInvestMoney());
}
为什么add的时候会报错.
很简单啊,因为你初始化为totalInvestMoney=null;修正下初始化为0:
BigDecimal totalInvestMoney= BigDecimal.ZERO;
不行的!!1