From e5ff111e8fee671016a33e391d496170e1c31cd1 Mon Sep 17 00:00:00 2001 From: Lx <935448346@qq.com> Date: Fri, 13 Jun 2025 18:06:46 +0800 Subject: [PATCH] 0613-1 --- .../module/base/service/impl/DataViewServiceImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DataViewServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DataViewServiceImpl.java index 3978ebc1..fb4af103 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DataViewServiceImpl.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DataViewServiceImpl.java @@ -250,7 +250,8 @@ public class DataViewServiceImpl implements DataViewService { studentInfoMap.put("schoolRate", 0 != schoolRate ? (Double.parseDouble(df.format(schoolRate)) * 100) : 0); studentInfoMap.put("businessNum", businessNum); studentInfoMap.put("businessAmount", businessAmount); - studentInfoMap.put("businessRate", 0 != businessRate ? (Double.parseDouble(df.format(businessRate)) * 100) : 0); +// studentInfoMap.put("businessRate", 0 != businessRate ? (Double.parseDouble(df.format(businessRate)) * 100) : 0); + studentInfoMap.put("businessRate", businessRate != 0 ? formatRate(businessRate) : 0); rtnObj.setStudentInfo(studentInfoMap); /*4.财务情况--*/ //应收 @@ -392,7 +393,12 @@ public class DataViewServiceImpl implements DataViewService { return rtnObj; } - + private Double formatRate(double rate) { + return BigDecimal.valueOf(rate) + .multiply(BigDecimal.valueOf(100)) // 转为百分比 + .setScale(2, RoundingMode.HALF_UP) // 四舍五入保留两位小数 + .doubleValue(); // 转为 Double 存入 Map + } @Override public IndexDataVO selectIndexInfoByBusiness(String type, String timeType, Long coachId, String startTime, String endTime, Integer isSign) { IndexDataVO rtnObj = new IndexDataVO();