|
|
@@ -48,13 +48,14 @@ public class AlarmReviewScopeService {
|
|
|
/** 读取与审核授权独立,列表菜单不能授予跨系统审核能力。 */
|
|
|
public List<Integer> resolveOperations(AlarmReviewQuery query) {
|
|
|
return resolve(query, new HashSet<>(Arrays.asList("subSystem/alarm/common/remind", "subSystem/alarm/common/list",
|
|
|
- "subSystem/drainage/alarm/analysis", "subSystem/drainage/alarm/alarmGIS",
|
|
|
+ "subSystem/alarm/common/analysis", "subSystem/alarm/common/alarmGIS",
|
|
|
"subSystem/waterSupply/alarm/alarmGIS")));
|
|
|
}
|
|
|
|
|
|
private List<Integer> resolve(AlarmReviewQuery query, Set<String> components) {
|
|
|
- EquipmentTypeEnum root = EquipmentTypeEnum.getById(query.getRootTypeId());
|
|
|
- if (root == null || !root.isRoot()) throw new ServiceException("无效的设备大类");
|
|
|
+ Integer rootTypeId = query.getRootTypeId();
|
|
|
+ EquipmentTypeEnum root = rootTypeId == null ? null : EquipmentTypeEnum.getById(rootTypeId);
|
|
|
+ if (rootTypeId != null && (root == null || !root.isRoot())) throw new ServiceException("无效的设备大类");
|
|
|
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
|
|
|
boolean allowed = menuService.selectMenuList(SecurityUtils.getUserId()).stream()
|
|
|
.anyMatch(menu -> matches(menu, query, components));
|
|
|
@@ -62,15 +63,20 @@ public class AlarmReviewScopeService {
|
|
|
}
|
|
|
List<EquipmentType> types = typeMapper.selectList(null);
|
|
|
Set<Integer> ids = new LinkedHashSet<>();
|
|
|
- if (types.stream().noneMatch(type -> root.getId().equals(type.getId()))) return new ArrayList<>();
|
|
|
- ids.add(root.getId());
|
|
|
- boolean changed;
|
|
|
- do {
|
|
|
- changed = false;
|
|
|
- for (EquipmentType type : types) {
|
|
|
- if (type.getId() != null && ids.contains(type.getParentId())) changed |= ids.add(type.getId());
|
|
|
- }
|
|
|
- } while (changed);
|
|
|
+ if (root != null) {
|
|
|
+ if (types.stream().noneMatch(type -> root.getId().equals(type.getId()))) return new ArrayList<>();
|
|
|
+ ids.add(root.getId());
|
|
|
+ boolean changed;
|
|
|
+ do {
|
|
|
+ changed = false;
|
|
|
+ for (EquipmentType type : types) {
|
|
|
+ if (type.getId() != null && ids.contains(type.getParentId())) changed |= ids.add(type.getId());
|
|
|
+ }
|
|
|
+ } while (changed);
|
|
|
+ } else {
|
|
|
+ // rootTypeId 为空:返回全部设备类型,支持"按全部子系统"查询
|
|
|
+ types.stream().map(EquipmentType::getId).filter(Objects::nonNull).forEach(ids::add);
|
|
|
+ }
|
|
|
return new ArrayList<>(ids);
|
|
|
}
|
|
|
|