Showing
1 changed file
with
6 additions
and
8 deletions
... | ... | @@ -20,10 +20,7 @@ import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; |
20 | 20 | import org.thingsboard.server.dao.yunteng.service.TkDeviceStateLogService; |
21 | 21 | |
22 | 22 | import java.time.LocalDateTime; |
23 | -import java.util.List; | |
24 | -import java.util.Map; | |
25 | -import java.util.Objects; | |
26 | -import java.util.Optional; | |
23 | +import java.util.*; | |
27 | 24 | |
28 | 25 | @Service |
29 | 26 | @RequiredArgsConstructor |
... | ... | @@ -45,10 +42,8 @@ public class TkDeviceStateLogServiceImpl |
45 | 42 | Optional.ofNullable(queryMap.get("status")) |
46 | 43 | .map(obj -> Integer.valueOf(obj.toString())) |
47 | 44 | .orElse(null); |
48 | - LocalDateTime startTime = | |
49 | - (LocalDateTime) Optional.ofNullable(queryMap.get("startTime")).orElse(null); | |
50 | - LocalDateTime endTime = | |
51 | - (LocalDateTime) Optional.ofNullable(queryMap.get("endTime")).orElse(null); | |
45 | + LocalDateTime startTime = (LocalDateTime) queryMap.get("startTime"); | |
46 | + LocalDateTime endTime = (LocalDateTime) queryMap.get("endTime"); | |
52 | 47 | IPage<TkDeviceStateLogEntity> currentPage = |
53 | 48 | getPage(queryMap, FastIotConstants.DefaultOrder.CREATE_TIME, false); |
54 | 49 | List<String> deviceIds = null; |
... | ... | @@ -58,6 +53,9 @@ public class TkDeviceStateLogServiceImpl |
58 | 53 | ? (String) queryMap.get(QueryConstant.CUSTOMER_ID) |
59 | 54 | : null; |
60 | 55 | deviceIds = deviceMapper.findDeviceIdsByCustomerId(customerId); |
56 | + if (null == deviceIds || deviceIds.isEmpty()) { | |
57 | + return new TkPageData<>(new ArrayList<>(), 0); | |
58 | + } | |
61 | 59 | } |
62 | 60 | LambdaQueryWrapper<TkDeviceStateLogEntity> queryWrapper = |
63 | 61 | new LambdaQueryWrapper<TkDeviceStateLogEntity>() | ... | ... |