Commit 5c1ac21c820f99572161f9757132f04f943bf650

Authored by xp.Huang
2 parents 1ca26298 9079096e

Merge branch '20220428' into 'master'

fix: 查看告警时客户合租户管理员兼容问题修复

See merge request huang/thingsboard3.3.2!89
... ... @@ -26,6 +26,7 @@ import org.thingsboard.server.dao.yunteng.service.YtAlarmInfoService;
26 26 import java.util.HashMap;
27 27 import java.util.List;
28 28 import java.util.Map;
  29 +import java.util.UUID;
29 30
30 31 import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*;
31 32
... ... @@ -69,11 +70,11 @@ public class YtAlarmInfoController extends BaseController {
69 70 if (orderType != null) {
70 71 pageFilter.put(ORDER_TYPE, orderType.name());
71 72 }
72   - CustomerId customerId = null;
73   - if (getCurrentUser().isCustomerUser()) {
74   - customerId = getCurrentUser().getCustomerId();
  73 + UUID customerId = null;
  74 + if(getCurrentUser().isCustomerUser()){
  75 + customerId = getCurrentUser().getCustomerId().getId();
75 76 }
76   - return alarmInfoService.alarmPage(pageFilter, getCurrentUser().getTenantId(), customerId, severity, alarmType, startTime, endTime, status, deviceId, deviceType, EntityType.DEVICE, organizationId);
  77 + return alarmInfoService.alarmPage(pageFilter, getCurrentUser().getTenantId(), customerId,severity,alarmType, startTime, endTime, status, deviceId, deviceType, EntityType.DEVICE, organizationId);
77 78 }
78 79
79 80
... ...
... ... @@ -27,6 +27,7 @@ import org.thingsboard.server.dao.yunteng.service.YtAlarmInfoService;
27 27 import java.util.ArrayList;
28 28 import java.util.List;
29 29 import java.util.Map;
  30 +import java.util.UUID;
30 31
31 32 import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*;
32 33
... ... @@ -42,7 +43,7 @@ public class YtAlarmInfoServiceImpl implements YtAlarmInfoService {
42 43 private final OrganizationMapper organizationMapper;
43 44
44 45 @Override
45   - public YtPageData<YtAlarmEntity> alarmPage(Map<String, Object> pageMap, TenantId tenantId, CustomerId customerId, AlarmSeverity severity, String alarmType, Long startTime, Long endTime, List<AlarmStatus> status, String deviceId, DeviceTypeEnum deviceType, EntityType originatorType, String organizationId) {
  46 + public YtPageData<YtAlarmEntity> alarmPage(Map<String, Object> pageMap, TenantId tenantId, UUID customerId, AlarmSeverity severity, String alarmType, Long startTime, Long endTime, List<AlarmStatus> status, String deviceId, DeviceTypeEnum deviceType, EntityType originatorType, String organizationId) {
46 47 IPage<YtAlarmEntity> page = getPage(pageMap, ModelConstants.CREATED_TIME_PROPERTY, false);
47 48 List<String> ids = new ArrayList<>();
48 49 if (StringUtils.isNotBlank(organizationId)) {
... ... @@ -55,7 +56,7 @@ public class YtAlarmInfoServiceImpl implements YtAlarmInfoService {
55 56
56 57 }
57 58
58   - IPage<YtAlarmEntity> tbDatas = ytJpaAarmDao.alarmPage(page, tenantId.getId(), customerId.getId(), severity, alarmType, startTime, endTime, status, deviceId, deviceType, originatorType, ids.size() > 0 ? ids : null);
  59 + IPage<YtAlarmEntity> tbDatas = ytJpaAarmDao.alarmPage(page, tenantId.getId(), customerId, severity, alarmType, startTime, endTime, status, deviceId, deviceType, originatorType, ids.size() > 0 ? ids : null);
59 60 YtPageData<YtAlarmEntity> result = new YtPageData<>(tbDatas.getRecords(), tbDatas.getTotal());
60 61 return result;
61 62 }
... ...
... ... @@ -37,7 +37,7 @@ public interface YtAlarmInfoService {
37 37 * @param organizationId 告警所属组织
38 38 * @return
39 39 */
40   - YtPageData<YtAlarmEntity> alarmPage(Map<String, Object> pageMap, TenantId tenantId, CustomerId customerId, AlarmSeverity severity, String alarmType, Long startTime, Long endTime, List<AlarmStatus> status, String deviceId, DeviceTypeEnum deviceType, EntityType originatorType, String organizationId);
  40 + YtPageData<YtAlarmEntity> alarmPage(Map<String, Object> pageMap, TenantId tenantId, UUID customerId, AlarmSeverity severity, String alarmType, Long startTime, Long endTime, List<AlarmStatus> status, String deviceId, DeviceTypeEnum deviceType, EntityType originatorType, String organizationId);
41 41
42 42
43 43 /**
... ...
... ... @@ -44,7 +44,7 @@
44 44 <where>
45 45 m.tenant_id = #{tenantId}
46 46 <if test="customerId!=null">
47   - AND customer_id = #{customerId}
  47 + AND m.customer_id = #{customerId}
48 48 </if>
49 49 <if test="severity!=null">
50 50 AND severity = #{severity}
... ...