Commit 7dace73fc857f29aeb2b36648d469ed8e956d988
1 parent
907a1201
fix: fix some bug【DEFECT-745 、DEFECT-744、DEFECT-743、DEFECT-742】 on teambition
Showing
21 changed files
with
216 additions
and
100 deletions
@@ -62,12 +62,14 @@ public class YtConfigurationCenterController extends BaseController { | @@ -62,12 +62,14 @@ public class YtConfigurationCenterController extends BaseController { | ||
62 | if (null != orderType) { | 62 | if (null != orderType) { |
63 | queryMap.put(ORDER_TYPE, orderType.name()); | 63 | queryMap.put(ORDER_TYPE, orderType.name()); |
64 | } | 64 | } |
65 | - return ytConfigurationCenterService.page(queryMap); | 65 | + queryMap.put("userId",getCurrentUser().getCurrentUserId()); |
66 | + return ytConfigurationCenterService.page(queryMap, getCurrentUser().isTenantAdmin()); | ||
66 | } | 67 | } |
67 | 68 | ||
68 | @PostMapping | 69 | @PostMapping |
69 | @ApiOperation("新增") | 70 | @ApiOperation("新增") |
70 | - @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:configuration:center:post'})") | 71 | + @PreAuthorize( |
72 | + "@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:configuration:center:post'})") | ||
71 | public ResponseEntity<ConfigurationCenterDTO> save( | 73 | public ResponseEntity<ConfigurationCenterDTO> save( |
72 | @Validated({AddGroup.class}) @RequestBody ConfigurationCenterDTO configurationCenterDTO) | 74 | @Validated({AddGroup.class}) @RequestBody ConfigurationCenterDTO configurationCenterDTO) |
73 | throws ThingsboardException { | 75 | throws ThingsboardException { |
@@ -78,7 +80,8 @@ public class YtConfigurationCenterController extends BaseController { | @@ -78,7 +80,8 @@ public class YtConfigurationCenterController extends BaseController { | ||
78 | 80 | ||
79 | @PutMapping | 81 | @PutMapping |
80 | @ApiOperation("修改") | 82 | @ApiOperation("修改") |
81 | - @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:configuration:center:update'})") | 83 | + @PreAuthorize( |
84 | + "@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:configuration:center:update'})") | ||
82 | public ResponseEntity<ConfigurationCenterDTO> update( | 85 | public ResponseEntity<ConfigurationCenterDTO> update( |
83 | @Validated({UpdateGroup.class}) @RequestBody ConfigurationCenterDTO configurationCenterDTO) | 86 | @Validated({UpdateGroup.class}) @RequestBody ConfigurationCenterDTO configurationCenterDTO) |
84 | throws ThingsboardException { | 87 | throws ThingsboardException { |
@@ -89,7 +92,8 @@ public class YtConfigurationCenterController extends BaseController { | @@ -89,7 +92,8 @@ public class YtConfigurationCenterController extends BaseController { | ||
89 | 92 | ||
90 | @DeleteMapping | 93 | @DeleteMapping |
91 | @ApiOperation("删除") | 94 | @ApiOperation("删除") |
92 | - @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:configuration:center:delete'})") | 95 | + @PreAuthorize( |
96 | + "@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:configuration:center:delete'})") | ||
93 | public ResponseEntity<Boolean> delete( | 97 | public ResponseEntity<Boolean> delete( |
94 | @Validated({DeleteGroup.class}) @RequestBody DeleteDTO deleteDTO) | 98 | @Validated({DeleteGroup.class}) @RequestBody DeleteDTO deleteDTO) |
95 | throws ThingsboardException { | 99 | throws ThingsboardException { |
@@ -99,7 +103,8 @@ public class YtConfigurationCenterController extends BaseController { | @@ -99,7 +103,8 @@ public class YtConfigurationCenterController extends BaseController { | ||
99 | 103 | ||
100 | @GetMapping("/get_configuration_info/{id}") | 104 | @GetMapping("/get_configuration_info/{id}") |
101 | @ApiOperation("获取组态信息") | 105 | @ApiOperation("获取组态信息") |
102 | - @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:configuration:center:get_configuration_info:get'})") | 106 | + @PreAuthorize( |
107 | + "@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:configuration:center:get_configuration_info:get'})") | ||
103 | public ResponseEntity<ConfigurationContentInfoDTO> getConfigurationInfos( | 108 | public ResponseEntity<ConfigurationContentInfoDTO> getConfigurationInfos( |
104 | @PathVariable("id") String id) throws ThingsboardException { | 109 | @PathVariable("id") String id) throws ThingsboardException { |
105 | return ResponseEntity.ok( | 110 | return ResponseEntity.ok( |
@@ -43,7 +43,9 @@ public class YtDataBoardController extends BaseController { | @@ -43,7 +43,9 @@ public class YtDataBoardController extends BaseController { | ||
43 | @RequestParam(PAGE_SIZE) int pageSize, | 43 | @RequestParam(PAGE_SIZE) int pageSize, |
44 | @RequestParam(PAGE) int page, | 44 | @RequestParam(PAGE) int page, |
45 | @RequestParam(value = ORDER_FILED, required = false) String orderBy, | 45 | @RequestParam(value = ORDER_FILED, required = false) String orderBy, |
46 | - @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType) | 46 | + @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType, |
47 | + @RequestParam(value = "organizationId", required = false) String organizationId, | ||
48 | + @RequestParam(value = "name", required = false) String name) | ||
47 | throws ThingsboardException { | 49 | throws ThingsboardException { |
48 | Map<String, Object> queryMap = new HashMap<>(); | 50 | Map<String, Object> queryMap = new HashMap<>(); |
49 | queryMap.put(PAGE_SIZE, pageSize); | 51 | queryMap.put(PAGE_SIZE, pageSize); |
@@ -51,7 +53,14 @@ public class YtDataBoardController extends BaseController { | @@ -51,7 +53,14 @@ public class YtDataBoardController extends BaseController { | ||
51 | queryMap.put(ORDER_FILED, orderBy); | 53 | queryMap.put(ORDER_FILED, orderBy); |
52 | queryMap.put(ORDER_TYPE, orderType); | 54 | queryMap.put(ORDER_TYPE, orderType); |
53 | queryMap.put(TENANT_ID, getCurrentUser().getCurrentTenantId()); | 55 | queryMap.put(TENANT_ID, getCurrentUser().getCurrentTenantId()); |
54 | - return ytDataBoardService.dataBoardPage(queryMap); | 56 | + if (StringUtils.isNotBlank(organizationId)) { |
57 | + queryMap.put("organizationId", organizationId); | ||
58 | + } | ||
59 | + if (StringUtils.isNotBlank(name)) { | ||
60 | + queryMap.put("name", name); | ||
61 | + } | ||
62 | + queryMap.put("userId",getCurrentUser().getCurrentUserId()); | ||
63 | + return ytDataBoardService.dataBoardPage(queryMap, getCurrentUser().isTenantAdmin()); | ||
55 | } | 64 | } |
56 | 65 | ||
57 | @DeleteMapping | 66 | @DeleteMapping |
@@ -63,6 +63,7 @@ public class YtReportFormConfigController extends BaseController { | @@ -63,6 +63,7 @@ public class YtReportFormConfigController extends BaseController { | ||
63 | if (orderType != null) { | 63 | if (orderType != null) { |
64 | queryMap.put(ORDER_TYPE, orderType.name()); | 64 | queryMap.put(ORDER_TYPE, orderType.name()); |
65 | } | 65 | } |
66 | + queryMap.put("userId",getCurrentUser().getCurrentUserId()); | ||
66 | if (null != startTime && null != endTime) { | 67 | if (null != startTime && null != endTime) { |
67 | if (startTime > endTime) { | 68 | if (startTime > endTime) { |
68 | throw new YtDataValidationException( | 69 | throw new YtDataValidationException( |
@@ -71,7 +72,7 @@ public class YtReportFormConfigController extends BaseController { | @@ -71,7 +72,7 @@ public class YtReportFormConfigController extends BaseController { | ||
71 | queryMap.put("startTime", new Timestamp(startTime).toLocalDateTime()); | 72 | queryMap.put("startTime", new Timestamp(startTime).toLocalDateTime()); |
72 | queryMap.put("endTime", new Timestamp(endTime).toLocalDateTime()); | 73 | queryMap.put("endTime", new Timestamp(endTime).toLocalDateTime()); |
73 | } | 74 | } |
74 | - return reportFormConfigService.page(queryMap); | 75 | + return reportFormConfigService.page(queryMap, getCurrentUser().isTenantAdmin()); |
75 | } | 76 | } |
76 | 77 | ||
77 | @PostMapping | 78 | @PostMapping |
@@ -75,12 +75,14 @@ public class YtReportGenerateRecordController extends BaseController { | @@ -75,12 +75,14 @@ public class YtReportGenerateRecordController extends BaseController { | ||
75 | if (orderType != null) { | 75 | if (orderType != null) { |
76 | queryMap.put(ORDER_TYPE, orderType.name()); | 76 | queryMap.put(ORDER_TYPE, orderType.name()); |
77 | } | 77 | } |
78 | - return reportFormGenerateRecordService.page(queryMap); | 78 | + queryMap.put("userId", getCurrentUser().getCurrentUserId()); |
79 | + return reportFormGenerateRecordService.page(queryMap, getCurrentUser().isTenantAdmin()); | ||
79 | } | 80 | } |
80 | 81 | ||
81 | @DeleteMapping | 82 | @DeleteMapping |
82 | @ApiOperation("删除") | 83 | @ApiOperation("删除") |
83 | - @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:report:generate:record:delete'})") | 84 | + @PreAuthorize( |
85 | + "@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:report:generate:record:delete'})") | ||
84 | public ResponseResult<Boolean> deleteReportGenerateRecord( | 86 | public ResponseResult<Boolean> deleteReportGenerateRecord( |
85 | @Validated({DeleteGroup.class}) @RequestBody DeleteDTO deleteDTO) { | 87 | @Validated({DeleteGroup.class}) @RequestBody DeleteDTO deleteDTO) { |
86 | return reportFormGenerateRecordService.deleteReportGenerateRecord(deleteDTO) | 88 | return reportFormGenerateRecordService.deleteReportGenerateRecord(deleteDTO) |
@@ -28,46 +28,51 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -28,46 +28,51 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
28 | @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{})") | 28 | @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{})") |
29 | public class YtVideoPlatformController extends BaseController { | 29 | public class YtVideoPlatformController extends BaseController { |
30 | 30 | ||
31 | - private final YtVideoPlatformService videoPlatformService; | 31 | + private final YtVideoPlatformService videoPlatformService; |
32 | 32 | ||
33 | - @GetMapping(params = {PAGE_SIZE, PAGE}) | ||
34 | - @ApiOperation("分页") | ||
35 | - public YtPageData<YtVideoPlatformDTO> pageVideoPlatform( | ||
36 | - @RequestParam(PAGE_SIZE) int pageSize, | ||
37 | - @RequestParam(PAGE) int page, | ||
38 | - @RequestParam(value = "host", required = false) String host, | ||
39 | - @RequestParam(value = ORDER_FILED, required = false) String orderBy, | ||
40 | - @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType) | ||
41 | - throws ThingsboardException { | 33 | + @GetMapping(params = {PAGE_SIZE, PAGE}) |
34 | + @ApiOperation("分页") | ||
35 | + public YtPageData<YtVideoPlatformDTO> pageVideoPlatform( | ||
36 | + @RequestParam(PAGE_SIZE) int pageSize, | ||
37 | + @RequestParam(PAGE) int page, | ||
38 | + @RequestParam(value = "host", required = false) String host, | ||
39 | + @RequestParam(value = ORDER_FILED, required = false) String orderBy, | ||
40 | + @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType) | ||
41 | + throws ThingsboardException { | ||
42 | 42 | ||
43 | + IPage<YtVideoPlatformEntity> pageInfo = | ||
44 | + videoPlatformService.getPage(page, pageSize, orderBy, orderType); | ||
45 | + return videoPlatformService.page( | ||
46 | + pageInfo, | ||
47 | + getCurrentUser().isPtTenantAdmin(), | ||
48 | + getCurrentUser().getCurrentTenantId(), | ||
49 | + getCurrentUser().getCurrentUserId(), | ||
50 | + host); | ||
51 | + } | ||
43 | 52 | ||
44 | - IPage<YtVideoPlatformEntity> pageInfo = videoPlatformService.getPage(page, pageSize, orderBy, orderType); | ||
45 | - return videoPlatformService.page(pageInfo, getCurrentUser().isPtTenantAdmin(), | ||
46 | - getCurrentUser().getCurrentTenantId(), | ||
47 | - getCurrentUser().getCurrentUserId(), host); | ||
48 | - } | 53 | + @PostMapping |
54 | + @ApiOperation("新增|编辑") | ||
55 | + @PreAuthorize( | ||
56 | + "@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:video:platform:post','api:yt:video:platform:update'})") | ||
57 | + public YtVideoPlatformDTO saveOrUpdateVideoPlatform( | ||
58 | + @Validated @RequestBody YtVideoPlatformDTO dto) throws ThingsboardException { | ||
59 | + dto.setTenantId(getCurrentUser().getCurrentTenantId()); | ||
60 | + return videoPlatformService.saveOrUpdate(dto); | ||
61 | + } | ||
49 | 62 | ||
50 | - @PostMapping | ||
51 | - @ApiOperation("新增|编辑") | ||
52 | - @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:video:platform:post','api:yt:video:platform:update'})") | ||
53 | - public YtVideoPlatformDTO saveOrUpdateVideoPlatform( | ||
54 | - @Validated @RequestBody YtVideoPlatformDTO dto) throws ThingsboardException { | ||
55 | - dto.setTenantId(getCurrentUser().getCurrentTenantId()); | ||
56 | - return videoPlatformService.saveOrUpdate(dto); | ||
57 | - } | 63 | + @DeleteMapping |
64 | + @ApiOperation("删除") | ||
65 | + @PreAuthorize( | ||
66 | + "@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:video:platform:delete'})") | ||
67 | + public boolean deleteVideoPlatform(@Validated(DeleteGroup.class) @RequestBody DeleteDTO deleteDTO) | ||
68 | + throws ThingsboardException { | ||
69 | + deleteDTO.setTenantId(getCurrentUser().getCurrentTenantId()); | ||
70 | + return videoPlatformService.deleteDataByIds(deleteDTO); | ||
71 | + } | ||
58 | 72 | ||
59 | - @DeleteMapping | ||
60 | - @ApiOperation("删除") | ||
61 | - @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{'api:yt:video:platform:delete'})") | ||
62 | - public boolean deleteVideoPlatform(@Validated(DeleteGroup.class) @RequestBody DeleteDTO deleteDTO) | ||
63 | - throws ThingsboardException { | ||
64 | - deleteDTO.setTenantId(getCurrentUser().getCurrentTenantId()); | ||
65 | - return videoPlatformService.deleteDataByIds(deleteDTO); | ||
66 | - } | ||
67 | - @GetMapping | ||
68 | - @ApiOperation("获取当前用户的流媒体配置列表") | ||
69 | - public List<YtVideoPlatformDTO> getVideoPlatformsByUser() throws ThingsboardException { | ||
70 | - return videoPlatformService.getVideoPlatformsByUser(getCurrentUser().isTenantAdmin(), | ||
71 | - getCurrentUser().getCurrentTenantId(), getCurrentUser().getCurrentUserId()); | ||
72 | - } | 73 | + @GetMapping |
74 | + @ApiOperation("获取当前用户的流媒体配置列表") | ||
75 | + public List<YtVideoPlatformDTO> getVideoPlatformsByUser() throws ThingsboardException { | ||
76 | + return videoPlatformService.getVideoPlatformsByUser(getCurrentUser().getCurrentTenantId()); | ||
77 | + } | ||
73 | } | 78 | } |
@@ -17,6 +17,10 @@ public class DataBoardDTO extends TenantDTO { | @@ -17,6 +17,10 @@ public class DataBoardDTO extends TenantDTO { | ||
17 | @NotEmpty(message = "数据看板名称不能为空或者空字符串",groups = AddGroup.class) | 17 | @NotEmpty(message = "数据看板名称不能为空或者空字符串",groups = AddGroup.class) |
18 | private String name; | 18 | private String name; |
19 | 19 | ||
20 | + @ApiModelProperty(value = "组织ID", required = true) | ||
21 | + @NotEmpty(message = "组织ID不能为空或者空字符串",groups = AddGroup.class) | ||
22 | + private String organizationId; | ||
23 | + | ||
20 | @ApiModelProperty(value = "视图类型") | 24 | @ApiModelProperty(value = "视图类型") |
21 | private ViewType viewType = ViewType.PRIVATE_VIEW; | 25 | private ViewType viewType = ViewType.PRIVATE_VIEW; |
22 | 26 |
@@ -19,6 +19,9 @@ public class ReportGenerateRecordDTO extends TenantDTO { | @@ -19,6 +19,9 @@ public class ReportGenerateRecordDTO extends TenantDTO { | ||
19 | @ApiModelProperty(value = "组织名称") | 19 | @ApiModelProperty(value = "组织名称") |
20 | private String organizationName; | 20 | private String organizationName; |
21 | 21 | ||
22 | + @ApiModelProperty(value = "组织ID") | ||
23 | + private String organizationId; | ||
24 | + | ||
22 | @ApiModelProperty(value = "数据对比:0历史数据 1环比 2同比") | 25 | @ApiModelProperty(value = "数据对比:0历史数据 1环比 2同比") |
23 | private Integer dataCompare; | 26 | private Integer dataCompare; |
24 | 27 |
@@ -28,4 +28,6 @@ public class DataBoard extends TenantBaseEntity { | @@ -28,4 +28,6 @@ public class DataBoard extends TenantBaseEntity { | ||
28 | private String remark; | 28 | private String remark; |
29 | 29 | ||
30 | private Integer componentNum; | 30 | private Integer componentNum; |
31 | + | ||
32 | + private String organizationId; | ||
31 | } | 33 | } |
@@ -20,6 +20,9 @@ public class ReportGenerateRecord extends TenantBaseEntity { | @@ -20,6 +20,9 @@ public class ReportGenerateRecord extends TenantBaseEntity { | ||
20 | /** 组织名称 */ | 20 | /** 组织名称 */ |
21 | private String organizationName; | 21 | private String organizationName; |
22 | 22 | ||
23 | + /** 组织ID */ | ||
24 | + private String organizationId; | ||
25 | + | ||
23 | /** 数据对比:0历史数据 1环比 2同比 */ | 26 | /** 数据对比:0历史数据 1环比 2同比 */ |
24 | private Integer dataCompare; | 27 | private Integer dataCompare; |
25 | 28 |
@@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | @@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
5 | import lombok.RequiredArgsConstructor; | 5 | import lombok.RequiredArgsConstructor; |
6 | import lombok.extern.slf4j.Slf4j; | 6 | import lombok.extern.slf4j.Slf4j; |
7 | -import org.apache.commons.lang3.ObjectUtils; | ||
8 | import org.apache.commons.lang3.StringUtils; | 7 | import org.apache.commons.lang3.StringUtils; |
9 | -import org.jetbrains.annotations.Nullable; | ||
10 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
11 | import org.springframework.transaction.annotation.Transactional; | 9 | import org.springframework.transaction.annotation.Transactional; |
12 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | 10 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; |
@@ -44,7 +42,7 @@ public class UserOrganizationMappingServiceImpl implements UserOrganizationMappi | @@ -44,7 +42,7 @@ public class UserOrganizationMappingServiceImpl implements UserOrganizationMappi | ||
44 | organizationMapper.findOrganizationTreeList(tenantId, List.of(ids)).stream() | 42 | organizationMapper.findOrganizationTreeList(tenantId, List.of(ids)).stream() |
45 | .map(OrganizationDTO::getId) | 43 | .map(OrganizationDTO::getId) |
46 | .collect(Collectors.toList()); | 44 | .collect(Collectors.toList()); |
47 | - if (null == collect || collect.size()==0) { | 45 | + if (null == collect || collect.size() == 0) { |
48 | return new ArrayList<>(); | 46 | return new ArrayList<>(); |
49 | } else { | 47 | } else { |
50 | Set<String> clearList = new HashSet<>(); | 48 | Set<String> clearList = new HashSet<>(); |
@@ -76,8 +74,6 @@ public class UserOrganizationMappingServiceImpl implements UserOrganizationMappi | @@ -76,8 +74,6 @@ public class UserOrganizationMappingServiceImpl implements UserOrganizationMappi | ||
76 | batchInsert(userId, organizationIds); | 74 | batchInsert(userId, organizationIds); |
77 | } | 75 | } |
78 | 76 | ||
79 | - | ||
80 | - | ||
81 | @Override | 77 | @Override |
82 | public List<String> getOrganizationIdsByUserId(String userId) { | 78 | public List<String> getOrganizationIdsByUserId(String userId) { |
83 | if (StringUtils.isEmpty(userId)) { | 79 | if (StringUtils.isEmpty(userId)) { |
@@ -104,15 +100,18 @@ public class UserOrganizationMappingServiceImpl implements UserOrganizationMappi | @@ -104,15 +100,18 @@ public class UserOrganizationMappingServiceImpl implements UserOrganizationMappi | ||
104 | } | 100 | } |
105 | 101 | ||
106 | @Override | 102 | @Override |
107 | - public List<String> getEnableOrganizationIds(boolean isPtTenantAdmin, String tenantId, String userId, String organizationId) { | 103 | + public List<String> getEnableOrganizationIds( |
104 | + boolean isPtTenantAdmin, String tenantId, String userId, String organizationId) { | ||
108 | List<String> organizationIds = null; | 105 | List<String> organizationIds = null; |
109 | if (StringUtils.isNotEmpty(organizationId)) { | 106 | if (StringUtils.isNotEmpty(organizationId)) { |
110 | - List<OrganizationDTO> organizationList = organizationMapper.findOrganizationTreeList(tenantId, new HashSet<>(List.of(organizationId))); | ||
111 | - if(organizationList.size()== FastIotConstants.MagicNumber.ZERO){ | 107 | + List<OrganizationDTO> organizationList = |
108 | + organizationMapper.findOrganizationTreeList( | ||
109 | + tenantId, new HashSet<>(List.of(organizationId))); | ||
110 | + if (organizationList.size() == FastIotConstants.MagicNumber.ZERO) { | ||
112 | throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); | 111 | throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); |
113 | } | 112 | } |
114 | - organizationIds = organizationList.stream() | ||
115 | - .map(BaseDTO::getId).distinct().collect(Collectors.toList()); | 113 | + organizationIds = |
114 | + organizationList.stream().map(BaseDTO::getId).distinct().collect(Collectors.toList()); | ||
116 | } else { | 115 | } else { |
117 | if (!isPtTenantAdmin) { | 116 | if (!isPtTenantAdmin) { |
118 | organizationIds = getOrganizationIdsByUserId(userId); | 117 | organizationIds = getOrganizationIdsByUserId(userId); |
@@ -120,4 +119,23 @@ public class UserOrganizationMappingServiceImpl implements UserOrganizationMappi | @@ -120,4 +119,23 @@ public class UserOrganizationMappingServiceImpl implements UserOrganizationMappi | ||
120 | } | 119 | } |
121 | return organizationIds; | 120 | return organizationIds; |
122 | } | 121 | } |
122 | + | ||
123 | + @Override | ||
124 | + public List<String> compareOrganizationIdsByCustomerId( | ||
125 | + List<String> organizationIds, String userId) { | ||
126 | + int zero = FastIotConstants.MagicNumber.ZERO; | ||
127 | + List<String> list = getOrganizationIdsByUserId(userId); | ||
128 | + if (organizationIds != null && organizationIds.size() > zero && list.size() > zero) { | ||
129 | + List<String> result = new ArrayList<>(); | ||
130 | + for (String id : organizationIds) { | ||
131 | + if (list.contains(id)) { | ||
132 | + result.add(id); | ||
133 | + } | ||
134 | + } | ||
135 | + if (result.size() > zero) { | ||
136 | + return result; | ||
137 | + } | ||
138 | + } | ||
139 | + return list; | ||
140 | + } | ||
123 | } | 141 | } |
@@ -16,9 +16,9 @@ import org.thingsboard.server.dao.yunteng.entities.ConfigurationCenter; | @@ -16,9 +16,9 @@ import org.thingsboard.server.dao.yunteng.entities.ConfigurationCenter; | ||
16 | import org.thingsboard.server.dao.yunteng.mapper.ConfigurationCenterMapper; | 16 | import org.thingsboard.server.dao.yunteng.mapper.ConfigurationCenterMapper; |
17 | import org.thingsboard.server.dao.yunteng.mapper.OrganizationMapper; | 17 | import org.thingsboard.server.dao.yunteng.mapper.OrganizationMapper; |
18 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; | 18 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; |
19 | +import org.thingsboard.server.dao.yunteng.service.UserOrganizationMappingService; | ||
19 | import org.thingsboard.server.dao.yunteng.service.YtConfigurationCenterService; | 20 | import org.thingsboard.server.dao.yunteng.service.YtConfigurationCenterService; |
20 | import org.thingsboard.server.dao.yunteng.service.YtConfigurationContentService; | 21 | import org.thingsboard.server.dao.yunteng.service.YtConfigurationContentService; |
21 | - | ||
22 | import java.util.HashSet; | 22 | import java.util.HashSet; |
23 | import java.util.List; | 23 | import java.util.List; |
24 | import java.util.Map; | 24 | import java.util.Map; |
@@ -32,9 +32,12 @@ public class YtConfigurationCenterServiceImpl | @@ -32,9 +32,12 @@ public class YtConfigurationCenterServiceImpl | ||
32 | implements YtConfigurationCenterService { | 32 | implements YtConfigurationCenterService { |
33 | private final OrganizationMapper organizationMapper; | 33 | private final OrganizationMapper organizationMapper; |
34 | private final YtConfigurationContentService ytConfigurationContentService; | 34 | private final YtConfigurationContentService ytConfigurationContentService; |
35 | + private final UserOrganizationMappingService userOrganizationMappingService; | ||
35 | 36 | ||
36 | @Override | 37 | @Override |
37 | - public YtPageData<ConfigurationCenterDTO> page(Map<String, Object> queryMap) { | 38 | + public YtPageData<ConfigurationCenterDTO> page( |
39 | + Map<String, Object> queryMap, boolean tenantAdmin) { | ||
40 | + List<String> organizationIds = null; | ||
38 | if (null != queryMap.get("organizationId")) { | 41 | if (null != queryMap.get("organizationId")) { |
39 | String organizationId = (String) queryMap.get("organizationId"); | 42 | String organizationId = (String) queryMap.get("organizationId"); |
40 | List<OrganizationDTO> organizationList = | 43 | List<OrganizationDTO> organizationList = |
@@ -43,11 +46,16 @@ public class YtConfigurationCenterServiceImpl | @@ -43,11 +46,16 @@ public class YtConfigurationCenterServiceImpl | ||
43 | if (organizationList.size() == FastIotConstants.MagicNumber.ZERO) { | 46 | if (organizationList.size() == FastIotConstants.MagicNumber.ZERO) { |
44 | throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); | 47 | throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); |
45 | } | 48 | } |
46 | - List<String> organizationIds = | 49 | + organizationIds = |
47 | organizationList.stream().map(BaseDTO::getId).distinct().collect(Collectors.toList()); | 50 | organizationList.stream().map(BaseDTO::getId).distinct().collect(Collectors.toList()); |
48 | - if (organizationIds.size() > FastIotConstants.MagicNumber.ZERO) { | ||
49 | - queryMap.put("organizationIds", organizationIds); | ||
50 | - } | 51 | + } |
52 | + if (!tenantAdmin && null != queryMap.get("userId")) { | ||
53 | + // 获取客户的组织关系 | ||
54 | + String userId = (String) queryMap.get("userId"); | ||
55 | + organizationIds = userOrganizationMappingService.compareOrganizationIdsByCustomerId(organizationIds,userId); | ||
56 | + } | ||
57 | + if (null != organizationIds && organizationIds.size() > FastIotConstants.MagicNumber.ZERO) { | ||
58 | + queryMap.put("organizationIds", organizationIds); | ||
51 | } | 59 | } |
52 | IPage<ConfigurationCenter> page = | 60 | IPage<ConfigurationCenter> page = |
53 | getPage(queryMap, FastIotConstants.DefaultOrder.CREATE_TIME, false); | 61 | getPage(queryMap, FastIotConstants.DefaultOrder.CREATE_TIME, false); |
@@ -59,14 +67,16 @@ public class YtConfigurationCenterServiceImpl | @@ -59,14 +67,16 @@ public class YtConfigurationCenterServiceImpl | ||
59 | @Override | 67 | @Override |
60 | @Transactional | 68 | @Transactional |
61 | public ConfigurationCenterDTO saveConfiguration(ConfigurationCenterDTO configurationCenterDTO) { | 69 | public ConfigurationCenterDTO saveConfiguration(ConfigurationCenterDTO configurationCenterDTO) { |
62 | - ConfigurationCenter configurationCenter = configurationCenterDTO.getEntity(ConfigurationCenter.class); | 70 | + ConfigurationCenter configurationCenter = |
71 | + configurationCenterDTO.getEntity(ConfigurationCenter.class); | ||
63 | baseMapper.insert(configurationCenter); | 72 | baseMapper.insert(configurationCenter); |
64 | ConfigurationContentDTO contentDTO = new ConfigurationContentDTO(); | 73 | ConfigurationContentDTO contentDTO = new ConfigurationContentDTO(); |
65 | contentDTO.setTenantId(configurationCenter.getTenantId()); | 74 | contentDTO.setTenantId(configurationCenter.getTenantId()); |
66 | contentDTO.setType(FastIotConstants.PC_TYPE); | 75 | contentDTO.setType(FastIotConstants.PC_TYPE); |
67 | contentDTO.setName(FastIotConstants.FIRST_PAGE_NAME); | 76 | contentDTO.setName(FastIotConstants.FIRST_PAGE_NAME); |
68 | contentDTO.setConfigurationId(configurationCenter.getId()); | 77 | contentDTO.setConfigurationId(configurationCenter.getId()); |
69 | - contentDTO.setContent("<mxGraphModel><root><mxCell id=\"0\"/><mxCell id=\"1\" parent=\"0\"/></root></mxGraphModel>"); | 78 | + contentDTO.setContent( |
79 | + "<mxGraphModel><root><mxCell id=\"0\"/><mxCell id=\"1\" parent=\"0\"/></root></mxGraphModel>"); | ||
70 | ytConfigurationContentService.saveConfigurationContent(contentDTO); | 80 | ytConfigurationContentService.saveConfigurationContent(contentDTO); |
71 | return configurationCenterDTO; | 81 | return configurationCenterDTO; |
72 | } | 82 | } |
@@ -3,43 +3,78 @@ package org.thingsboard.server.dao.yunteng.impl; | @@ -3,43 +3,78 @@ 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.baomidou.mybatisplus.core.metadata.IPage; | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; |
5 | import com.fasterxml.jackson.databind.JsonNode; | 5 | import com.fasterxml.jackson.databind.JsonNode; |
6 | +import lombok.RequiredArgsConstructor; | ||
6 | import org.apache.commons.lang3.StringUtils; | 7 | import org.apache.commons.lang3.StringUtils; |
7 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
8 | import org.springframework.transaction.annotation.Transactional; | 9 | import org.springframework.transaction.annotation.Transactional; |
9 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | 10 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; |
10 | import org.thingsboard.server.common.data.yunteng.core.exception.YtDataValidationException; | 11 | import org.thingsboard.server.common.data.yunteng.core.exception.YtDataValidationException; |
11 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | 12 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; |
13 | +import org.thingsboard.server.common.data.yunteng.dto.BaseDTO; | ||
12 | import org.thingsboard.server.common.data.yunteng.dto.DataBoardDTO; | 14 | import org.thingsboard.server.common.data.yunteng.dto.DataBoardDTO; |
13 | import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | 15 | import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; |
16 | +import org.thingsboard.server.common.data.yunteng.dto.OrganizationDTO; | ||
14 | import org.thingsboard.server.common.data.yunteng.dto.board.ComponentLayoutDTO; | 17 | import org.thingsboard.server.common.data.yunteng.dto.board.ComponentLayoutDTO; |
15 | import org.thingsboard.server.common.data.yunteng.utils.JacksonUtil; | 18 | import org.thingsboard.server.common.data.yunteng.utils.JacksonUtil; |
16 | import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; | 19 | import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; |
17 | import org.thingsboard.server.dao.yunteng.entities.DataBoard; | 20 | import org.thingsboard.server.dao.yunteng.entities.DataBoard; |
18 | import org.thingsboard.server.dao.yunteng.mapper.DataBoardMapper; | 21 | import org.thingsboard.server.dao.yunteng.mapper.DataBoardMapper; |
22 | +import org.thingsboard.server.dao.yunteng.mapper.OrganizationMapper; | ||
19 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; | 23 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; |
24 | +import org.thingsboard.server.dao.yunteng.service.UserOrganizationMappingService; | ||
20 | import org.thingsboard.server.dao.yunteng.service.YtDataBoardService; | 25 | import org.thingsboard.server.dao.yunteng.service.YtDataBoardService; |
21 | 26 | ||
22 | -import java.util.ArrayList; | ||
23 | -import java.util.List; | ||
24 | -import java.util.Map; | ||
25 | -import java.util.Optional; | 27 | +import java.util.*; |
28 | +import java.util.stream.Collectors; | ||
26 | 29 | ||
27 | @Service | 30 | @Service |
31 | +@RequiredArgsConstructor | ||
28 | public class YtDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, DataBoard> | 32 | public class YtDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, DataBoard> |
29 | implements YtDataBoardService { | 33 | implements YtDataBoardService { |
34 | + private final OrganizationMapper organizationMapper; | ||
35 | + private final UserOrganizationMappingService userOrganizationMappingService; | ||
36 | + | ||
30 | @Override | 37 | @Override |
31 | - public YtPageData<DataBoardDTO> dataBoardPage(Map<String, Object> queryMap) { | 38 | + public YtPageData<DataBoardDTO> dataBoardPage(Map<String, Object> queryMap, boolean tenantAdmin) { |
39 | + int zero = FastIotConstants.MagicNumber.ZERO; | ||
40 | + String name = null != queryMap.get("name") ? queryMap.get("name").toString() : null; | ||
32 | String tenantId = | 41 | String tenantId = |
33 | Optional.ofNullable(queryMap.get("tenantId")) | 42 | Optional.ofNullable(queryMap.get("tenantId")) |
34 | - .map(obj -> queryMap.get("tenantId").toString()) | 43 | + .map(Object::toString) |
35 | .orElseThrow( | 44 | .orElseThrow( |
36 | () -> { | 45 | () -> { |
37 | throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); | 46 | throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); |
38 | }); | 47 | }); |
48 | + String organizationId = | ||
49 | + null != queryMap.get("organizationId") ? queryMap.get("organizationId").toString() : null; | ||
50 | + List<String> organizationIds = null; | ||
51 | + if (null != organizationId) { | ||
52 | + List<OrganizationDTO> list = | ||
53 | + organizationMapper.findOrganizationTreeList( | ||
54 | + (String) queryMap.get("tenantId"), new HashSet<>(List.of(organizationId))); | ||
55 | + if (list.size() == zero) { | ||
56 | + throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); | ||
57 | + } | ||
58 | + organizationIds = list.stream().map(BaseDTO::getId).distinct().collect(Collectors.toList()); | ||
59 | + } | ||
60 | + | ||
61 | + if (!tenantAdmin && null != queryMap.get("userId")) { | ||
62 | + // 获取客户的组织关系 | ||
63 | + String userId = (String) queryMap.get("userId"); | ||
64 | + organizationIds = | ||
65 | + userOrganizationMappingService.compareOrganizationIdsByCustomerId( | ||
66 | + organizationIds, userId); | ||
67 | + } | ||
39 | IPage<DataBoard> page = | 68 | IPage<DataBoard> page = |
40 | baseMapper.selectPage( | 69 | baseMapper.selectPage( |
41 | getPage(queryMap, FastIotConstants.DefaultOrder.CREATE_TIME, false), | 70 | getPage(queryMap, FastIotConstants.DefaultOrder.CREATE_TIME, false), |
42 | - new LambdaQueryWrapper<DataBoard>().eq(DataBoard::getTenantId, tenantId)); | 71 | + new LambdaQueryWrapper<DataBoard>() |
72 | + .eq(DataBoard::getTenantId, tenantId) | ||
73 | + .like(StringUtils.isNotEmpty(name), DataBoard::getName, name) | ||
74 | + .in( | ||
75 | + null != organizationIds && organizationIds.size() > zero, | ||
76 | + DataBoard::getOrganizationId, | ||
77 | + organizationIds)); | ||
43 | return getPageData(page, DataBoardDTO.class); | 78 | return getPageData(page, DataBoardDTO.class); |
44 | } | 79 | } |
45 | 80 | ||
@@ -127,5 +162,5 @@ public class YtDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, | @@ -127,5 +162,5 @@ public class YtDataBoardServiceImpl extends AbstractBaseService<DataBoardMapper, | ||
127 | @Override | 162 | @Override |
128 | public boolean updateDataBoardComponentNum(String id, String tenantId, int count) { | 163 | public boolean updateDataBoardComponentNum(String id, String tenantId, int count) { |
129 | return baseMapper.updateDataBoardComponentNum(id, tenantId, count); | 164 | return baseMapper.updateDataBoardComponentNum(id, tenantId, count); |
130 | - } | 165 | + } |
131 | } | 166 | } |
@@ -22,10 +22,8 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; | @@ -22,10 +22,8 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; | ||
22 | import org.thingsboard.server.dao.yunteng.entities.ReportFormConfig; | 22 | import org.thingsboard.server.dao.yunteng.entities.ReportFormConfig; |
23 | import org.thingsboard.server.dao.yunteng.mapper.OrganizationMapper; | 23 | import org.thingsboard.server.dao.yunteng.mapper.OrganizationMapper; |
24 | import org.thingsboard.server.dao.yunteng.mapper.ReportFormConfigMapper; | 24 | import org.thingsboard.server.dao.yunteng.mapper.ReportFormConfigMapper; |
25 | -import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; | ||
26 | -import org.thingsboard.server.dao.yunteng.service.YtReportFormConfigService; | ||
27 | -import org.thingsboard.server.dao.yunteng.service.YtReportGenerateRecordService; | ||
28 | -import org.thingsboard.server.dao.yunteng.service.YtSysJobService; | 25 | +import org.thingsboard.server.dao.yunteng.service.*; |
26 | + | ||
29 | import java.util.*; | 27 | import java.util.*; |
30 | import java.util.stream.Collectors; | 28 | import java.util.stream.Collectors; |
31 | 29 | ||
@@ -38,9 +36,9 @@ public class YtReportFromConfigServiceImpl | @@ -38,9 +36,9 @@ public class YtReportFromConfigServiceImpl | ||
38 | private final OrganizationMapper organizationMapper; | 36 | private final OrganizationMapper organizationMapper; |
39 | private final YtSysJobService ytSysJobService; | 37 | private final YtSysJobService ytSysJobService; |
40 | private final YtReportGenerateRecordService ytReportGenerateRecordService; | 38 | private final YtReportGenerateRecordService ytReportGenerateRecordService; |
41 | - | 39 | + private final UserOrganizationMappingService userOrganizationMappingService; |
42 | @Override | 40 | @Override |
43 | - public YtPageData<ReportFormConfigDTO> page(Map<String, Object> queryMap) { | 41 | + public YtPageData<ReportFormConfigDTO> page(Map<String, Object> queryMap,boolean tenantAdmin) { |
44 | String tenantId = | 42 | String tenantId = |
45 | Optional.ofNullable(queryMap.get("tenantId")).map(Object::toString).orElse(null); | 43 | Optional.ofNullable(queryMap.get("tenantId")).map(Object::toString).orElse(null); |
46 | List<String> organizationIds = | 44 | List<String> organizationIds = |
@@ -58,6 +56,10 @@ public class YtReportFromConfigServiceImpl | @@ -58,6 +56,10 @@ public class YtReportFromConfigServiceImpl | ||
58 | return null; | 56 | return null; |
59 | }) | 57 | }) |
60 | .orElse(null); | 58 | .orElse(null); |
59 | + if(!tenantAdmin && null != queryMap.get("userId")){ | ||
60 | + String userId = queryMap.get("userId").toString(); | ||
61 | + organizationIds = userOrganizationMappingService.compareOrganizationIdsByCustomerId(organizationIds,userId); | ||
62 | + } | ||
61 | queryMap.put("organizationIds", organizationIds); | 63 | queryMap.put("organizationIds", organizationIds); |
62 | IPage<ReportFormConfigDTO> page = | 64 | IPage<ReportFormConfigDTO> page = |
63 | baseMapper.getReportFormConfigPage( | 65 | baseMapper.getReportFormConfigPage( |
@@ -37,6 +37,7 @@ import org.thingsboard.server.dao.timeseries.TimeseriesService; | @@ -37,6 +37,7 @@ import org.thingsboard.server.dao.timeseries.TimeseriesService; | ||
37 | import org.thingsboard.server.dao.yunteng.entities.ReportGenerateRecord; | 37 | import org.thingsboard.server.dao.yunteng.entities.ReportGenerateRecord; |
38 | import org.thingsboard.server.dao.yunteng.mapper.ReportGenerateRecordMapper; | 38 | import org.thingsboard.server.dao.yunteng.mapper.ReportGenerateRecordMapper; |
39 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; | 39 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; |
40 | +import org.thingsboard.server.dao.yunteng.service.UserOrganizationMappingService; | ||
40 | import org.thingsboard.server.dao.yunteng.service.YtOrganizationService; | 41 | import org.thingsboard.server.dao.yunteng.service.YtOrganizationService; |
41 | import org.thingsboard.server.dao.yunteng.service.YtReportGenerateRecordService; | 42 | import org.thingsboard.server.dao.yunteng.service.YtReportGenerateRecordService; |
42 | 43 | ||
@@ -62,9 +63,11 @@ public class YtReportGenerateRecordServiceImpl | @@ -62,9 +63,11 @@ public class YtReportGenerateRecordServiceImpl | ||
62 | private final YtOrganizationService ytOrganizationService; | 63 | private final YtOrganizationService ytOrganizationService; |
63 | private final TimeseriesService tsService; | 64 | private final TimeseriesService tsService; |
64 | private final FileStorageService fileStorageService; | 65 | private final FileStorageService fileStorageService; |
66 | + private final UserOrganizationMappingService userOrganizationMappingService; | ||
65 | 67 | ||
66 | @Override | 68 | @Override |
67 | - public YtPageData<ReportGenerateRecordDTO> page(Map<String, Object> queryMap) { | 69 | + public YtPageData<ReportGenerateRecordDTO> page( |
70 | + Map<String, Object> queryMap, boolean tenantAdmin) { | ||
68 | String reportConfigName = | 71 | String reportConfigName = |
69 | Optional.ofNullable(queryMap.get("reportConfigName")).map(Object::toString).orElse(null); | 72 | Optional.ofNullable(queryMap.get("reportConfigName")).map(Object::toString).orElse(null); |
70 | LocalDateTime startTime = | 73 | LocalDateTime startTime = |
@@ -75,6 +78,12 @@ public class YtReportGenerateRecordServiceImpl | @@ -75,6 +78,12 @@ public class YtReportGenerateRecordServiceImpl | ||
75 | Optional.ofNullable(queryMap.get("executeStatus")) | 78 | Optional.ofNullable(queryMap.get("executeStatus")) |
76 | .map(obj -> Integer.valueOf(obj.toString())) | 79 | .map(obj -> Integer.valueOf(obj.toString())) |
77 | .orElse(null); | 80 | .orElse(null); |
81 | + List<String> organizationIds = null; | ||
82 | + if (!tenantAdmin && null != queryMap.get("userId")) { | ||
83 | + organizationIds = | ||
84 | + userOrganizationMappingService.getOrganizationIdsByUserId( | ||
85 | + queryMap.get("userId").toString()); | ||
86 | + } | ||
78 | IPage<ReportGenerateRecord> iPage = | 87 | IPage<ReportGenerateRecord> iPage = |
79 | baseMapper.selectPage( | 88 | baseMapper.selectPage( |
80 | getPage(queryMap, "execute_time", false), | 89 | getPage(queryMap, "execute_time", false), |
@@ -89,7 +98,11 @@ public class YtReportGenerateRecordServiceImpl | @@ -89,7 +98,11 @@ public class YtReportGenerateRecordServiceImpl | ||
89 | null != startTime && null != endTime, | 98 | null != startTime && null != endTime, |
90 | ReportGenerateRecord::getExecuteTime, | 99 | ReportGenerateRecord::getExecuteTime, |
91 | startTime, | 100 | startTime, |
92 | - endTime)); | 101 | + endTime) |
102 | + .in( | ||
103 | + organizationIds != null && organizationIds.size() > 0, | ||
104 | + ReportGenerateRecord::getOrganizationId, | ||
105 | + organizationIds)); | ||
93 | return getPageData(iPage, ReportGenerateRecordDTO.class); | 106 | return getPageData(iPage, ReportGenerateRecordDTO.class); |
94 | } | 107 | } |
95 | 108 | ||
@@ -144,6 +157,7 @@ public class YtReportGenerateRecordServiceImpl | @@ -144,6 +157,7 @@ public class YtReportGenerateRecordServiceImpl | ||
144 | dto.setJobId(jobId); | 157 | dto.setJobId(jobId); |
145 | dto.setReportConfigName(reportFormConfigDTO.getName()); | 158 | dto.setReportConfigName(reportFormConfigDTO.getName()); |
146 | dto.setOrganizationName(null != organizationDTO ? organizationDTO.getName() : null); | 159 | dto.setOrganizationName(null != organizationDTO ? organizationDTO.getName() : null); |
160 | + dto.setOrganizationId(null != organizationDTO ? organizationDTO.getId() : null); | ||
147 | dto.setDataCompare(reportFormConfigDTO.getDataType()); | 161 | dto.setDataCompare(reportFormConfigDTO.getDataType()); |
148 | dto.setExecuteTime(time); | 162 | dto.setExecuteTime(time); |
149 | dto.setCreateTime(time); | 163 | dto.setCreateTime(time); |
@@ -79,11 +79,9 @@ public class YtVideoPlatformServiceImpl extends AbstractBaseService<YtVideoPlatf | @@ -79,11 +79,9 @@ public class YtVideoPlatformServiceImpl extends AbstractBaseService<YtVideoPlatf | ||
79 | } | 79 | } |
80 | 80 | ||
81 | @Override | 81 | @Override |
82 | - public List<YtVideoPlatformDTO> getVideoPlatformsByUser(boolean isTenantAdmin, String tenantId, | ||
83 | - String customerUserId) { | 82 | + public List<YtVideoPlatformDTO> getVideoPlatformsByUser(String tenantId) { |
84 | return baseMapper.selectList(new LambdaQueryWrapper<YtVideoPlatformEntity>(). | 83 | return baseMapper.selectList(new LambdaQueryWrapper<YtVideoPlatformEntity>(). |
85 | - eq(YtVideoPlatformEntity::getTenantId, tenantId) | ||
86 | - .eq(!isTenantAdmin, YtVideoPlatformEntity::getCreator, customerUserId)).stream() | 84 | + eq(YtVideoPlatformEntity::getTenantId, tenantId)).stream() |
87 | .map(ytVideoPlatformEntity -> ytVideoPlatformEntity | 85 | .map(ytVideoPlatformEntity -> ytVideoPlatformEntity |
88 | .getDTO(YtVideoPlatformDTO.class)).collect(Collectors.toList()); | 86 | .getDTO(YtVideoPlatformDTO.class)).collect(Collectors.toList()); |
89 | } | 87 | } |
@@ -42,4 +42,12 @@ public interface UserOrganizationMappingService { | @@ -42,4 +42,12 @@ public interface UserOrganizationMappingService { | ||
42 | * @return | 42 | * @return |
43 | */ | 43 | */ |
44 | List<String> getEnableOrganizationIds(boolean isPtTenantAdmin, String tenantId, String userId, String organizationId); | 44 | List<String> getEnableOrganizationIds(boolean isPtTenantAdmin, String tenantId, String userId, String organizationId); |
45 | + | ||
46 | + /** | ||
47 | + * 比较一个组织与另一个用户查出来的组织相同的数据结果 | ||
48 | + * @param organizationIds 源组织 | ||
49 | + * @param userId 用户ID | ||
50 | + * @return 返回相同的组织 | ||
51 | + */ | ||
52 | + List<String> compareOrganizationIdsByCustomerId(List<String> organizationIds,String userId); | ||
45 | } | 53 | } |
@@ -8,7 +8,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; | @@ -8,7 +8,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.YtPageData; | ||
8 | import java.util.Map; | 8 | import java.util.Map; |
9 | 9 | ||
10 | public interface YtConfigurationCenterService { | 10 | public interface YtConfigurationCenterService { |
11 | - YtPageData<ConfigurationCenterDTO> page(Map<String, Object> queryMap); | 11 | + YtPageData<ConfigurationCenterDTO> page(Map<String, Object> queryMap,boolean tenantAdmin); |
12 | 12 | ||
13 | ConfigurationCenterDTO saveConfiguration(ConfigurationCenterDTO configurationCenterDTO); | 13 | ConfigurationCenterDTO saveConfiguration(ConfigurationCenterDTO configurationCenterDTO); |
14 | 14 |
@@ -15,7 +15,7 @@ public interface YtDataBoardService { | @@ -15,7 +15,7 @@ public interface YtDataBoardService { | ||
15 | * @param queryMap 分页查询条件 | 15 | * @param queryMap 分页查询条件 |
16 | * @return 分页数据 | 16 | * @return 分页数据 |
17 | */ | 17 | */ |
18 | - YtPageData<DataBoardDTO> dataBoardPage(Map<String, Object> queryMap); | 18 | + YtPageData<DataBoardDTO> dataBoardPage(Map<String, Object> queryMap,boolean tenantAdmin); |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * 修改或保存数据看板 | 21 | * 修改或保存数据看板 |
@@ -11,7 +11,7 @@ import java.util.List; | @@ -11,7 +11,7 @@ import java.util.List; | ||
11 | import java.util.Map; | 11 | import java.util.Map; |
12 | 12 | ||
13 | public interface YtReportFormConfigService { | 13 | public interface YtReportFormConfigService { |
14 | - YtPageData<ReportFormConfigDTO> page(Map<String, Object> queryMap); | 14 | + YtPageData<ReportFormConfigDTO> page(Map<String, Object> queryMap,boolean tenantAdmin); |
15 | 15 | ||
16 | ReportFormConfigDTO saveOrUpdateReportFormConfig(ReportFormConfigDTO report) throws SchedulerException; | 16 | ReportFormConfigDTO saveOrUpdateReportFormConfig(ReportFormConfigDTO report) throws SchedulerException; |
17 | 17 |
@@ -11,7 +11,7 @@ import java.util.Map; | @@ -11,7 +11,7 @@ import java.util.Map; | ||
11 | 11 | ||
12 | public interface YtReportGenerateRecordService { | 12 | public interface YtReportGenerateRecordService { |
13 | 13 | ||
14 | - YtPageData<ReportGenerateRecordDTO> page(Map<String, Object> queryMap); | 14 | + YtPageData<ReportGenerateRecordDTO> page(Map<String, Object> queryMap,boolean tenantAdmin); |
15 | 15 | ||
16 | ReportGenerateRecordDTO saveOrUpdateReportGenerateRecord(ReportGenerateRecordDTO recordDTO); | 16 | ReportGenerateRecordDTO saveOrUpdateReportGenerateRecord(ReportGenerateRecordDTO recordDTO); |
17 | 17 |
@@ -16,30 +16,27 @@ public interface YtVideoPlatformService extends BaseService<YtVideoPlatformEntit | @@ -16,30 +16,27 @@ public interface YtVideoPlatformService extends BaseService<YtVideoPlatformEntit | ||
16 | * @param tenantId 租户ID | 16 | * @param tenantId 租户ID |
17 | * @param currentUserId 用户ID | 17 | * @param currentUserId 用户ID |
18 | * @param host 流媒体地址 | 18 | * @param host 流媒体地址 |
19 | - * @return | ||
20 | */ | 19 | */ |
21 | YtPageData<YtVideoPlatformDTO> page(IPage<YtVideoPlatformEntity> pageInfo, | 20 | YtPageData<YtVideoPlatformDTO> page(IPage<YtVideoPlatformEntity> pageInfo, |
22 | boolean isPtTenantAdmin, String tenantId, String currentUserId, String host); | 21 | boolean isPtTenantAdmin, String tenantId, String currentUserId, String host); |
23 | 22 | ||
24 | - /** | ||
25 | - * @param dto | ||
26 | - * @return | 23 | + /** 保存或更新流媒体配置 |
24 | + * @param dto 流媒体配置信息 | ||
25 | + * @return 流媒体信息 | ||
27 | */ | 26 | */ |
28 | YtVideoPlatformDTO saveOrUpdate(YtVideoPlatformDTO dto); | 27 | YtVideoPlatformDTO saveOrUpdate(YtVideoPlatformDTO dto); |
29 | 28 | ||
30 | - /** | ||
31 | - * @param deleteDTO | ||
32 | - * @return | 29 | + /** 删除流媒体配置 |
30 | + * @param deleteDTO 删除参数 | ||
31 | + * @return true成功 false失败 | ||
33 | */ | 32 | */ |
34 | boolean deleteDataByIds(DeleteDTO deleteDTO); | 33 | boolean deleteDataByIds(DeleteDTO deleteDTO); |
35 | 34 | ||
36 | /** | 35 | /** |
37 | * 获取当前用户的流媒体配置信息列表 | 36 | * 获取当前用户的流媒体配置信息列表 |
38 | - * @param isTenantAdmin 是否租户管理员 | ||
39 | * @param tenantId 租户ID | 37 | * @param tenantId 租户ID |
40 | - * @param customerUserId 客户ID | ||
41 | - * @return | 38 | + * @return 流媒体配置列表 |
42 | */ | 39 | */ |
43 | - List<YtVideoPlatformDTO> getVideoPlatformsByUser(boolean isTenantAdmin, String tenantId,String customerUserId); | 40 | + List<YtVideoPlatformDTO> getVideoPlatformsByUser(String tenantId); |
44 | 41 | ||
45 | } | 42 | } |