diff --git a/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java index 3aec253af..5ba7e36fd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java @@ -87,17 +87,18 @@ public class ActChairtyServiceImp implements ActChairtyService { @Override public JSONObject gettotal() { List gettotalnum = actChairtyMapper.chairtyClientNum(); - int amount=0 ; + BigDecimal amount= new BigDecimal(0) ; double chairty=0.00; for (JSONObject gettotals : gettotalnum) { - amount += gettotals.getIntValue("sum_ordernum"); - chairty += gettotals.getDoubleValue("count_ordernum") * 0.01; + amount = amount.add(gettotals.getBigDecimal("sum_ordernum")); + chairty += gettotals.getIntValue("count_ordernum") * 0.01; } BigDecimal bg = new BigDecimal(chairty); - double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + double f1 = amount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + double f2 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); JSONObject gettotal = new JSONObject(); - gettotal.put("amount", amount); - gettotal.put("chairty", f1); + gettotal.put("amount", f1); + gettotal.put("chairty", f2); return gettotal; }