Quellcode durchsuchen

客户抄表率BUG

lin vor 4 Jahren
Ursprung
Commit
c0b4dc0677

+ 12 - 0
smart-city-platform/src/main/java/com/bz/smart_city/commom/util/TreeUtil.java

@@ -406,5 +406,17 @@ public class TreeUtil {
 
     }
 
+    public static void  eliminateCustomerRate(List<CustomerRateDto> list){
+        if (list != null && list.size()>0) {
+            for (CustomerRateDto customerRateDto : list) {
+                if (customerRateDto.getChildren() != null) {
+                    customerRateDto.setChildren(customerRateDto.getChildren().stream().filter(p -> p.getDeviceCount() > 0).sorted(Comparator.comparingInt(CustomerRateDto::getDeviceCount).reversed()).collect(Collectors.toList()));
+                }
+                eliminateCustomerRate(customerRateDto.getChildren());
+            }
+        }
+
+    }
+
 
 }

+ 1 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/StatMeterReadRateByBuildingServiceImpl.java

@@ -390,6 +390,7 @@ public class StatMeterReadRateByBuildingServiceImpl implements StatMeterReadRate
             return TreeUtil.getCustomerRateTreeNode(list,customerId);
         }
         List<CustomerRateDto> newList = list.stream().filter(p -> p.getDeviceCount() > 0).sorted(Comparator.comparingInt(CustomerRateDto::getDeviceCount).reversed()).collect(Collectors.toList());
+        TreeUtil.eliminateCustomerRate(newList);
         return newList;
     }