Browse Source

解决设备状态柱状图按时间和类型请求返回值均为0

develop
zhaoxianglong 8 months ago
parent
commit
7432e4cf56
  1. 2
      zc-business/src/main/java/com/zc/business/controller/StatusController.java

2
zc-business/src/main/java/com/zc/business/controller/StatusController.java

@ -86,7 +86,7 @@ public class StatusController extends BaseController {
Map<String,String> mapSort=new TreeMap<>();
for (Map.Entry<String, List<Status>> entry : mapTime.entrySet()) {
List<Status> groupItems = entry.getValue();
long count = groupItems.stream().filter(iteam -> iteam.getDeviceStatus() == "1").count();
long count = groupItems.stream().filter(iteam -> Objects.equals(iteam.getDeviceStatus(), "1")).count();
String onlineRate=String.format("%.2f%%", (double) count / groupItems.size() * 100);
mapSort.put(entry.getKey(),onlineRate);
}

Loading…
Cancel
Save