| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.DecimalFormat; |
| | | import java.time.*; |
| | | |
| | | |
| | |
| | | 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; |
| | | |
| | |
| | | } |
| | | |
| | | // 计算平均值 |
| | | return sum / totalElements; |
| | | double average = sum / totalElements; |
| | | |
| | | // 格式化为两位小数 |
| | | return Double.parseDouble(DF.format(average)); |
| | | } |
| | | |
| | | @ResponseBody |