Commit f7d4708fd1a84ff03da1a77674bc150f66d75af9

Authored by 黄 x
1 parent 35bde263

fix: 修复返回字符串是“”的错误

@@ -3,6 +3,7 @@ package org.thingsboard.server.dao.yunteng.impl; @@ -3,6 +3,7 @@ package org.thingsboard.server.dao.yunteng.impl;
3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 import com.google.common.util.concurrent.*; 4 import com.google.common.util.concurrent.*;
5 import lombok.RequiredArgsConstructor; 5 import lombok.RequiredArgsConstructor;
  6 +import org.apache.commons.lang3.StringUtils;
6 import org.checkerframework.checker.nullness.qual.Nullable; 7 import org.checkerframework.checker.nullness.qual.Nullable;
7 import org.springframework.scheduling.annotation.Async; 8 import org.springframework.scheduling.annotation.Async;
8 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
@@ -79,19 +80,19 @@ public class HomePageServiceImpl implements HomePageService { @@ -79,19 +80,19 @@ public class HomePageServiceImpl implements HomePageService {
79 LocalDateTime endTime = LocalDateTime.of(nowTime.toLocalDate(), LocalTime.MAX); 80 LocalDateTime endTime = LocalDateTime.of(nowTime.toLocalDate(), LocalTime.MAX);
80 HomePageTopMessage messageInfo = new HomePageTopMessage(FastIotConstants.MagicNumber.ZERO); 81 HomePageTopMessage messageInfo = new HomePageTopMessage(FastIotConstants.MagicNumber.ZERO);
81 BaseHomePageTop alarm = new BaseHomePageTop(FastIotConstants.MagicNumber.ZERO); 82 BaseHomePageTop alarm = new BaseHomePageTop(FastIotConstants.MagicNumber.ZERO);
82 - Map<String,Object> queryMap = new HashMap<>(); 83 + Map<String, Object> queryMap = new HashMap<>();
83 List<DeviceDTO> deviceList; 84 List<DeviceDTO> deviceList;
84 if (isPtSysAdmin || isPtAdmin) { 85 if (isPtSysAdmin || isPtAdmin) {
85 setTenantInfoData(homePageLeftTopDTO, startTime, endTime); 86 setTenantInfoData(homePageLeftTopDTO, startTime, endTime);
86 setCustomerInfoData(homePageLeftTopDTO, startTime, endTime); 87 setCustomerInfoData(homePageLeftTopDTO, startTime, endTime);
87 } else if (isTenantAdmin) { 88 } else if (isTenantAdmin) {
88 - queryMap.put("tenantId",tenantId); 89 + queryMap.put("tenantId", tenantId);
89 setAlarmAndMessageInfo(tenantId, messageInfo, alarm); 90 setAlarmAndMessageInfo(tenantId, messageInfo, alarm);
90 91
91 } else { 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 deviceList = deviceMapper.findDevices(queryMap); 97 deviceList = deviceMapper.findDevices(queryMap);
97 homeDeviceInfo = new HomeDeviceInfoDTO(FastIotConstants.MagicNumber.ZERO); 98 homeDeviceInfo = new HomeDeviceInfoDTO(FastIotConstants.MagicNumber.ZERO);
@@ -304,7 +305,11 @@ public class HomePageServiceImpl implements HomePageService { @@ -304,7 +305,11 @@ public class HomePageServiceImpl implements HomePageService {
304 .keySet() 305 .keySet()
305 .forEach( 306 .forEach(
306 mapKey -> { 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 switch (mapKey) { 313 switch (mapKey) {
309 case "createdAlarmsCount": 314 case "createdAlarmsCount":
310 alarm.setSumCount(value); 315 alarm.setSumCount(value);
@@ -33,7 +33,6 @@ public abstract class AbstractBaseService<M extends BaseMapper<T>, T extends Bas @@ -33,7 +33,6 @@ public abstract class AbstractBaseService<M extends BaseMapper<T>, T extends Bas
33 implements BaseService<T> { 33 implements BaseService<T> {
34 34
35 @Autowired protected M baseMapper; 35 @Autowired protected M baseMapper;
36 - @Autowired protected TbClusterService tbClusterService;  
37 @Override 36 @Override
38 public List<T> findAllByTenant(String tenantId) { 37 public List<T> findAllByTenant(String tenantId) {
39 QueryWrapper<T> wrapper = new QueryWrapper<>(); 38 QueryWrapper<T> wrapper = new QueryWrapper<>();