|
@@ -117,6 +117,9 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
private TblOprLogService logService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private DailyActiveUsersService dailyActiveUsersService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private org.springframework.data.redis.core.RedisTemplate<String, Object> redisTemplate;
|
|
|
|
|
|
|
|
@@ -145,7 +148,6 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
|
|
|
// 统计设备总数和告警数量
|
|
|
int totalDevices = 0;
|
|
|
- int warningDevices = 0;
|
|
|
|
|
|
for (DevInfo devInfo : devInfos) {
|
|
|
DeviceDTO dto = new DeviceDTO();
|
|
@@ -154,19 +156,21 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
|
|
|
// 统计设备数量
|
|
|
totalDevices++;
|
|
|
- // 统计异常设备数量(异常事件表未处理的设备)
|
|
|
- boolean hasWarning = alarmEventService.QueryAlarm(devInfo.getDevId());
|
|
|
- if (hasWarning) {
|
|
|
- warningDevices++;
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ // 统计异常事件数量(用户所有设备当天的异常事件数量)
|
|
|
+ List<Long> devIds = devInfos.stream()
|
|
|
+ .map(DevInfo::getDevId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ long warningNums = alarmEventService.countUserDevicesAlarmEvents(devIds);
|
|
|
|
|
|
homeInfoDTO.setDeviceList(deviceDTOs);
|
|
|
// 设置设备总数
|
|
|
homeInfoDTO.setDevNum(totalDevices);
|
|
|
// 设置告警数量
|
|
|
- homeInfoDTO.setWarnNum(warningDevices);
|
|
|
+ homeInfoDTO.setWarnNum(warningNums);
|
|
|
|
|
|
/*
|
|
|
* 查询群组数量
|
|
@@ -181,6 +185,11 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
*/
|
|
|
homeInfoDTO.setShareNum(devShareService.querySharedNumByUserId(userId).size());
|
|
|
|
|
|
+ /*
|
|
|
+ * 调取首页记录日活次数
|
|
|
+ */
|
|
|
+ dailyActiveUsersService.insertDailyActiveUsers(userId);
|
|
|
+
|
|
|
return homeInfoDTO;
|
|
|
}
|
|
|
|
|
@@ -374,17 +383,17 @@ public class DeviceGatewayImpl implements DeviceGateway {
|
|
|
return this.eventService.update(updateWrapper);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public Boolean handleAlarmEvent(Long alarmEventId) {
|
|
|
- //获取当前操作者手机号
|
|
|
- String phone = (String) StpUtil.getSession().get(UserConstants.SA_USER_PHONE);
|
|
|
-
|
|
|
- LambdaUpdateWrapper<AlarmEvent> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.eq(AlarmEvent::getAlarmEventId, alarmEventId)
|
|
|
- .set(AlarmEvent::getIsHandle, 1)
|
|
|
- .set(AlarmEvent::getRemark, PhoneUtils.maskPhone(phone));
|
|
|
- return this.alarmEventService.update(updateWrapper);
|
|
|
- }
|
|
|
+// @Override
|
|
|
+// public Boolean handleAlarmEvent(Long alarmEventId) {
|
|
|
+// //获取当前操作者手机号
|
|
|
+// String phone = (String) StpUtil.getSession().get(UserConstants.SA_USER_PHONE);
|
|
|
+//
|
|
|
+// LambdaUpdateWrapper<AlarmEvent> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+// updateWrapper.eq(AlarmEvent::getAlarmEventId, alarmEventId)
|
|
|
+// .set(AlarmEvent::getIsHandle, 1)
|
|
|
+// .set(AlarmEvent::getRemark, PhoneUtils.maskPhone(phone));
|
|
|
+// return this.alarmEventService.update(updateWrapper);
|
|
|
+// }
|
|
|
|
|
|
|
|
|
@Override
|