luodangjia
2024-10-26 070d0169294696eb53423115ee1c66cad6bd382f
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -3,6 +3,7 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.time.*;
@@ -1239,8 +1240,8 @@
        return R.ok(tCharingUserEquimentVO);
    }
    private static double calculateAveragePercent(List<Map<String, Object>> mapList1, List<Map<String, Object>> mapList2) {
    private static final DecimalFormat DF = new DecimalFormat("#.00");
    public static double calculateAveragePercent(List<Map<String, Object>> mapList1, List<Map<String, Object>> mapList2) {
        int totalElements = mapList1.size() + mapList2.size();
        double sum = 0.0;
@@ -1262,7 +1263,10 @@
        }
        // 计算平均值
        return sum / totalElements;
        double average = sum / totalElements;
        // 格式化为两位小数
        return Double.parseDouble(DF.format(average));
    }
    @ResponseBody