|
@@ -50,8 +50,8 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
|
|
|
|
|
|
@Override
|
|
|
public List<MonthRankingVo> monthRanking(List<SsBbMonth> list) {
|
|
|
-
|
|
|
- Map<String, BigDecimal> map = this.monthSewGroup(list);
|
|
|
+
|
|
|
+ Map<String, BigDecimal> map = this.stpSewGroup(list);
|
|
|
|
|
|
Map<String, BigDecimal> rankingMap = new LinkedHashMap<>();
|
|
|
|
|
@@ -59,6 +59,7 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
|
|
|
.sorted(Map.Entry.<String, BigDecimal>comparingByValue()
|
|
|
.reversed()).limit(10).forEachOrdered(e -> rankingMap.put(e.getKey(), e.getValue()));
|
|
|
|
|
|
+
|
|
|
|
|
|
List<MonthRankingVo> result = new LinkedList<>();
|
|
|
rankingMap.keySet().forEach(k -> {
|
|
@@ -70,6 +71,33 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * 污水处理厂名称分组污水处理量
|
|
|
+ */
|
|
|
+ private Map<String, BigDecimal> stpSewGroup(List<SsBbMonth> list) {
|
|
|
+ Map<String, BigDecimal> map = new HashMap<>(12);
|
|
|
+
|
|
|
+ list.forEach(dto -> {
|
|
|
+ String ssclcbh = dto.getSsclcmc();
|
|
|
+ sewGroup(map, dto, ssclcbh);
|
|
|
+ });
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 分组方法
|
|
|
+ */
|
|
|
+ private void sewGroup(Map<String, BigDecimal> map, SsBbMonth dto, String ssclcbh) {
|
|
|
+ BigDecimal yclsl = dto.getYclsl() == null ? BigDecimal.ZERO : BigDecimal.valueOf(dto.getYclsl());
|
|
|
+ if (map.containsKey(ssclcbh)) {
|
|
|
+ BigDecimal decimal = map.get(ssclcbh);
|
|
|
+ decimal = decimal.add(yclsl);
|
|
|
+ map.put(ssclcbh, decimal);
|
|
|
+ } else {
|
|
|
+ map.put(ssclcbh, yclsl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
* 数据月份分组污水处理量
|
|
|
*/
|
|
@@ -79,14 +107,7 @@ public class SsBbMonthServiceImpl extends ServiceImpl<SsBbMonthMapper, SsBbMonth
|
|
|
|
|
|
list.forEach(dto -> {
|
|
|
String umonth = dto.getUmonth();
|
|
|
- BigDecimal yclsl = dto.getYclsl() == null ? BigDecimal.ZERO : BigDecimal.valueOf(dto.getYclsl());
|
|
|
- if (map.containsKey(umonth)) {
|
|
|
- BigDecimal decimal = map.get(umonth);
|
|
|
- decimal = decimal.add(yclsl);
|
|
|
- map.put(umonth, decimal);
|
|
|
- } else {
|
|
|
- map.put(umonth, yclsl);
|
|
|
- }
|
|
|
+ sewGroup(map, dto, umonth);
|
|
|
});
|
|
|
return map;
|
|
|
}
|