...
|
...
|
@@ -3,6 +3,7 @@ package org.thingsboard.server.dao.yunteng.impl; |
3
|
3
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
4
|
4
|
import com.google.common.util.concurrent.*;
|
5
|
5
|
import lombok.RequiredArgsConstructor;
|
|
6
|
+import org.apache.commons.lang3.StringUtils;
|
6
|
7
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
7
|
8
|
import org.springframework.scheduling.annotation.Async;
|
8
|
9
|
import org.springframework.stereotype.Service;
|
...
|
...
|
@@ -79,19 +80,19 @@ public class HomePageServiceImpl implements HomePageService { |
79
|
80
|
LocalDateTime endTime = LocalDateTime.of(nowTime.toLocalDate(), LocalTime.MAX);
|
80
|
81
|
HomePageTopMessage messageInfo = new HomePageTopMessage(FastIotConstants.MagicNumber.ZERO);
|
81
|
82
|
BaseHomePageTop alarm = new BaseHomePageTop(FastIotConstants.MagicNumber.ZERO);
|
82
|
|
- Map<String,Object> queryMap = new HashMap<>();
|
|
83
|
+ Map<String, Object> queryMap = new HashMap<>();
|
83
|
84
|
List<DeviceDTO> deviceList;
|
84
|
85
|
if (isPtSysAdmin || isPtAdmin) {
|
85
|
86
|
setTenantInfoData(homePageLeftTopDTO, startTime, endTime);
|
86
|
87
|
setCustomerInfoData(homePageLeftTopDTO, startTime, endTime);
|
87
|
88
|
} else if (isTenantAdmin) {
|
88
|
|
- queryMap.put("tenantId",tenantId);
|
|
89
|
+ queryMap.put("tenantId", tenantId);
|
89
|
90
|
setAlarmAndMessageInfo(tenantId, messageInfo, alarm);
|
90
|
91
|
|
91
|
92
|
} else {
|
92
|
|
- String customerId = userMapper.findCustomerIdByUserId(currentUserId);
|
93
|
|
- //查询customerId
|
94
|
|
- queryMap.put("customerId",customerId);
|
|
93
|
+ String customerId = userMapper.findCustomerIdByUserId(currentUserId);
|
|
94
|
+ // 查询customerId
|
|
95
|
+ queryMap.put("customerId", customerId);
|
95
|
96
|
}
|
96
|
97
|
deviceList = deviceMapper.findDevices(queryMap);
|
97
|
98
|
homeDeviceInfo = new HomeDeviceInfoDTO(FastIotConstants.MagicNumber.ZERO);
|
...
|
...
|
@@ -304,7 +305,11 @@ public class HomePageServiceImpl implements HomePageService { |
304
|
305
|
.keySet()
|
305
|
306
|
.forEach(
|
306
|
307
|
mapKey -> {
|
307
|
|
- Integer value = Integer.valueOf(tsValueMap.get(mapKey).getValue());
|
|
308
|
+ String tsValue = tsValueMap.get(mapKey).getValue();
|
|
309
|
+ Integer value =
|
|
310
|
+ StringUtils.isEmpty(tsValue)
|
|
311
|
+ ? FastIotConstants.MagicNumber.ZERO
|
|
312
|
+ : Integer.valueOf(tsValue);
|
308
|
313
|
switch (mapKey) {
|
309
|
314
|
case "createdAlarmsCount":
|
310
|
315
|
alarm.setSumCount(value);
|
...
|
...
|
|