|
@@ -5,17 +5,22 @@ import com.github.microservice.net.ResultContent;
|
|
|
import com.github.microservice.net.ResultMessage;
|
|
import com.github.microservice.net.ResultMessage;
|
|
|
import com.zhongshu.card.client.model.devices.permiss.*;
|
|
import com.zhongshu.card.client.model.devices.permiss.*;
|
|
|
import com.zhongshu.card.client.type.DataState;
|
|
import com.zhongshu.card.client.type.DataState;
|
|
|
|
|
+import com.zhongshu.card.client.type.device.PermissSettingDeviceType;
|
|
|
import com.zhongshu.card.client.type.device.PermissSettingType;
|
|
import com.zhongshu.card.client.type.device.PermissSettingType;
|
|
|
|
|
+import com.zhongshu.card.server.core.dao.devices.DeviceGroupDao;
|
|
|
import com.zhongshu.card.server.core.dao.devices.PermissSettingDao;
|
|
import com.zhongshu.card.server.core.dao.devices.PermissSettingDao;
|
|
|
import com.zhongshu.card.server.core.dao.devices.PermissTimeSlotDao;
|
|
import com.zhongshu.card.server.core.dao.devices.PermissTimeSlotDao;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
|
import com.zhongshu.card.server.core.dao.org.RoleDao;
|
|
import com.zhongshu.card.server.core.dao.org.RoleDao;
|
|
|
|
|
+import com.zhongshu.card.server.core.dao.org.UserGroupDao;
|
|
|
import com.zhongshu.card.server.core.dao.school.AreaDao;
|
|
import com.zhongshu.card.server.core.dao.school.AreaDao;
|
|
|
|
|
+import com.zhongshu.card.server.core.domain.devices.DeviceGroup;
|
|
|
import com.zhongshu.card.server.core.domain.devices.DeviceInfo;
|
|
import com.zhongshu.card.server.core.domain.devices.DeviceInfo;
|
|
|
import com.zhongshu.card.server.core.domain.devices.permiss.PermissSetting;
|
|
import com.zhongshu.card.server.core.domain.devices.permiss.PermissSetting;
|
|
|
import com.zhongshu.card.server.core.domain.devices.permiss.PermissTimeSlot;
|
|
import com.zhongshu.card.server.core.domain.devices.permiss.PermissTimeSlot;
|
|
|
import com.zhongshu.card.server.core.domain.org.Organization;
|
|
import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
import com.zhongshu.card.server.core.domain.org.Role;
|
|
import com.zhongshu.card.server.core.domain.org.Role;
|
|
|
|
|
+import com.zhongshu.card.server.core.domain.org.UserGroup;
|
|
|
import com.zhongshu.card.server.core.domain.school.Area;
|
|
import com.zhongshu.card.server.core.domain.school.Area;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.devices.DeviceInfoServiceImpl;
|
|
import com.zhongshu.card.server.core.service.devices.DeviceInfoServiceImpl;
|
|
@@ -63,6 +68,12 @@ public class PermissSettingService extends SuperService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private AreaDao areaDao;
|
|
private AreaDao areaDao;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private UserGroupDao userGroupDao;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private DeviceGroupDao deviceGroupDao;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 保存设备权限规则数据
|
|
* 保存设备权限规则数据
|
|
|
*
|
|
*
|
|
@@ -150,18 +161,43 @@ public class PermissSettingService extends SuperService {
|
|
|
return model;
|
|
return model;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 人员 - 设备关联模型转换
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
private PermissSettingConfigModel toConfigModel(PermissSettingConfigParam param) {
|
|
private PermissSettingConfigModel toConfigModel(PermissSettingConfigParam param) {
|
|
|
PermissSettingConfigModel model = new PermissSettingConfigModel();
|
|
PermissSettingConfigModel model = new PermissSettingConfigModel();
|
|
|
if (ObjectUtils.isNotEmpty(param)) {
|
|
if (ObjectUtils.isNotEmpty(param)) {
|
|
|
BeanUtils.copyProperties(param, model);
|
|
BeanUtils.copyProperties(param, model);
|
|
|
|
|
|
|
|
- // 设备信息
|
|
|
|
|
- List<DeviceInfo> deviceInfos = deviceInfoService.getDevicesByDeviceIds(param.getDeviceIds());
|
|
|
|
|
- if (ObjectUtils.isNotEmpty(deviceInfos)) {
|
|
|
|
|
- model.setDeviceInfos(deviceInfos.stream().map(it -> {
|
|
|
|
|
- return deviceInfoService.toSimpleModel(it);
|
|
|
|
|
- }).toList());
|
|
|
|
|
|
|
+ String deviceNames = "";
|
|
|
|
|
+
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(param.getDeviceIds())) {
|
|
|
|
|
+ List<String> names = new ArrayList<>();
|
|
|
|
|
+ if (param.getPermissSettingDeviceType() == PermissSettingDeviceType.Device) {
|
|
|
|
|
+ // 设备信息
|
|
|
|
|
+ List<DeviceInfo> deviceInfos = deviceInfoService.getDevicesByDeviceIds(param.getDeviceIds());
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(deviceInfos)) {
|
|
|
|
|
+ names = deviceInfos.stream().map(it -> it.getDeviceName()).toList();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (param.getPermissSettingDeviceType() == PermissSettingDeviceType.DeviceGroup) {
|
|
|
|
|
+ List<DeviceGroup> list = deviceGroupDao.findByIdIn(param.getDeviceIds());
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(list)) {
|
|
|
|
|
+ names = list.stream().map(it -> it.getName()).toList();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (param.getPermissSettingDeviceType() == PermissSettingDeviceType.Area) {
|
|
|
|
|
+ List<Area> areas = areaDao.findByIdIn(param.getDeviceIds());
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(areas)) {
|
|
|
|
|
+ names = areas.stream().map(it -> it.getName()).toList();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(names)) {
|
|
|
|
|
+ deviceNames = StringUtils.join(names, ",");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ model.setDeviceNames(deviceNames);
|
|
|
|
|
|
|
|
String aboutShowDataName = "";
|
|
String aboutShowDataName = "";
|
|
|
// 关联的数据名称
|
|
// 关联的数据名称
|
|
@@ -191,7 +227,14 @@ public class PermissSettingService extends SuperService {
|
|
|
if (ObjectUtils.isNotEmpty(areas)) {
|
|
if (ObjectUtils.isNotEmpty(areas)) {
|
|
|
names = areas.stream().map(it -> it.getName()).toList();
|
|
names = areas.stream().map(it -> it.getName()).toList();
|
|
|
}
|
|
}
|
|
|
|
|
+ } else if (param.getPermissSettingType() == PermissSettingType.UserGroup) {
|
|
|
|
|
+ // 用户分组
|
|
|
|
|
+ List<UserGroup> userGroups = userGroupDao.findByIdIn(param.getDataIds());
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(userGroups)) {
|
|
|
|
|
+ names = userGroups.stream().map(it -> it.getName()).toList();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (ObjectUtils.isNotEmpty(names)) {
|
|
if (ObjectUtils.isNotEmpty(names)) {
|
|
|
aboutShowDataName = String.join(",", names);
|
|
aboutShowDataName = String.join(",", names);
|
|
|
}
|
|
}
|