修改大数据页面数据保存小数点后两位

This commit is contained in:
wans 2021-10-25 15:13:42 +08:00
parent d034a0c536
commit 86418e86e0

View File

@ -254,7 +254,9 @@ public class DataReleaseController extends AbstractController {
nowGrade += Integer.parseInt(gradeItem.get("grade").toString()); nowGrade += Integer.parseInt(gradeItem.get("grade").toString());
} }
} }
BigDecimal ratioBigDecimal = bdr.getRatio(nowGrade.doubleValue(), totalGrade.doubleValue(), 2); BigDecimal ratioBigDecimal = new BigDecimal(( nowGrade.doubleValue() / totalGrade.doubleValue() ) * 100)
.setScale(2,BigDecimal.ROUND_HALF_UP);
//bdr.getRatio(nowGrade.doubleValue(), totalGrade.doubleValue(), 2);
Map<String, Object> resData = new HashMap<>(4); Map<String, Object> resData = new HashMap<>(4);
resData.put("value",ratioBigDecimal.doubleValue()); resData.put("value",ratioBigDecimal.doubleValue());
bdr.setData(resData); bdr.setData(resData);