对于list集合里面的Object参数除1000,取小数点后三位
作者:互联网
for (var e : list1) {
List<Object> tempList = new ArrayList<>();
tempList.add(e.get("name"));
tempList.add(new BigDecimal(e.get("amount") == null ? "0" : e.get("amount").toString()).divide(BigDecimal.valueOf(1000)).setScale(3, BigDecimal.ROUND_HALF_UP));
tempList.add("0");
tempList.add(new BigDecimal(e.get("money") == null ? "0" : e.get("money").toString()).divide(BigDecimal.valueOf(1000)).setScale(3, BigDecimal.ROUND_HALF_UP));
rows.add(tempList);
}
标签:BigDecimal,get,Object,list,add,new,tempList,1000 来源: https://blog.csdn.net/weixin_54363295/article/details/122114260