|
|
@@ -70,6 +70,9 @@ public class DevicePermissEventService {
|
|
|
@Autowired
|
|
|
private DevicePermissSendLogService devicePermissSendLogService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserCanUseDeviceService userCanUseDeviceService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private void init(ApplicationContext applicationContext) {
|
|
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
|
|
@@ -172,10 +175,12 @@ public class DevicePermissEventService {
|
|
|
if (StringUtils.isNotEmpty(projectOid) && ObjectUtils.isNotEmpty(userIds[0])) {
|
|
|
executorService.execute(() -> {
|
|
|
String groupId = event.getGroupId();
|
|
|
+
|
|
|
userIds[0] = userIds[0].stream().distinct().collect(Collectors.toList());
|
|
|
// 循环用户数据
|
|
|
for (String userId : userIds[0]) {
|
|
|
- List<String> deviceIds = devicePermissService.getUserAllDeviceIds(projectOid, List.of(userId));
|
|
|
+ List<String> deviceIds = userCanUseDeviceService.getUserDeviceIds(projectOid, userId);
|
|
|
+
|
|
|
// 网关 对应的设备
|
|
|
HashMap<String, List<String>> map = deviceGroupByGateWayId(deviceIds);
|
|
|
if (!map.isEmpty()) {
|
|
|
@@ -184,7 +189,8 @@ public class DevicePermissEventService {
|
|
|
DeviceUsersInfo deviceUsersInfo = new DeviceUsersInfo();
|
|
|
deviceUsersInfo.setGroupId(groupId);
|
|
|
deviceUsersInfo.setGateWayId(gateWayId);
|
|
|
- // 用户数据 (去重)
|
|
|
+
|
|
|
+ // 组装用户权限信息 (用户的基本信息)
|
|
|
List<ProjectUserPermiss> userPermiss = devicePermissIotService.getUserPermiss(projectOid, userIds[0]);
|
|
|
deviceUsersInfo.setUsers(userPermiss);
|
|
|
// 下发用户数据
|
|
|
@@ -196,6 +202,7 @@ public class DevicePermissEventService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 清除所有所有数据
|
|
|
*
|