Browse Source

修改在线率所需字段

develop
zhaoxianglong 8 months ago
parent
commit
47d7a12280
  1. 14
      zc-business/src/main/java/com/zc/business/controller/StatusController.java
  2. 3
      zc-business/src/main/resources/mapper/business/StatusMapper.xml

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

@ -167,7 +167,7 @@ public class StatusController extends BaseController {
List<Status> lastEntry = ipMap.get(lastKey);
Map<String, List<Status>> typeMap = lastEntry.stream().filter(iteam -> iteam.getType() != null).collect(Collectors.groupingBy(Status::getType));
Map<String,Map<String,String>> subMap=new HashMap<>();
Long sumUseState = 0L;
for (Map.Entry<String, List<Status>> entrys : typeMap.entrySet()) {
Map<String, String> maps=new HashMap<>();
List<Status> groupItems = entrys.getValue();
@ -185,9 +185,12 @@ public class StatusController extends BaseController {
//离线率
maps.put("failRate",failRate);
//已使用数量
maps.put("sum",String.valueOf(groupItems.size()));
List<String> collect = dcDeviceList.stream().filter(item -> Objects.equals(item.getDeviceType(), entrys.getKey())).map(DcDevice::getSumAll).collect(Collectors.toList());
String useStateNum = collect.size() > 0 ? String.valueOf(collect.get(0)) : "0";
sumUseState += Long.valueOf(useStateNum);
maps.put("sumUseState",useStateNum);
//总数
maps.put("sumUseState", String.valueOf(dcDeviceList.stream().filter(item -> Objects.equals(item.getDeviceType(), entrys.getKey())).map(DcDevice::getSumAll).collect(Collectors.toList()).get(0)));
maps.put("sum",String.valueOf(groupItems.size()));
if(itemTypeMap.get(entrys.getKey())!=null) {
subMap.put(itemTypeMap.get(entrys.getKey()), maps);
}
@ -207,10 +210,9 @@ public class StatusController extends BaseController {
//离线率
maps.put("failRate",failRate);
//已使用数量
List<DcDevice> list = dcDeviceService.list();
maps.put("sumUseState",String.valueOf(lastEntry.size()));
maps.put("sumUseState", String.valueOf(sumUseState));
//总数
maps.put("sum",String.valueOf(list.size()));
maps.put("sum",String.valueOf(lastEntry.size()));
subMap.put("全部设备",maps);
return AjaxResult.success(subMap);

3
zc-business/src/main/resources/mapper/business/StatusMapper.xml

@ -103,6 +103,9 @@
<if test="status.deviceId != null">
AND s.device_id = #{status.deviceId}
</if>
<if test="status.useState != null and status.useState != 0">
AND d.use_state = #{status.useState}
</if>
</where>
</select>

Loading…
Cancel
Save