|
@@ -950,40 +950,49 @@ public class ApiController {
|
|
|
Map<String, Map<String, List<WmTaskType>>> pTaskTypeMap = baseTypeList1.stream()
|
|
|
.collect(Collectors.groupingBy(WmTaskType::getParentId, Collectors.groupingBy(WmTaskType::getBaseId)));
|
|
|
|
|
|
- // 查询所有子id对应的taskType列表
|
|
|
- List<WmTaskType> baseTypeList2 = wmTaskTypeService.
|
|
|
- list(Wrappers.<WmTaskType>query().lambda().eq(WmTaskType::getTaskTypeLevel, "1").in(WmTaskType::getId, id));
|
|
|
-
|
|
|
- // 所有子id对应的taskType列表 按照父id分组
|
|
|
- Map<String, Map<String, List<WmTaskType>>> cTaskTypeMap = baseTypeList2.stream()
|
|
|
- .collect(Collectors.groupingBy(WmTaskType::getParentId, Collectors.groupingBy(WmTaskType::getBaseId)));
|
|
|
- // 对应的parentId
|
|
|
- Set<String> cPidSet = cTaskTypeMap.keySet();
|
|
|
-
|
|
|
- // 解决页面父级id和数据库存的父级id不一致的问题(如一对一专访在页面父级是p-16,但taskType表中父级id为p-1)
|
|
|
- // 比较baseTypeList1和baseTypeList2中parentId相同的taskTypeId的数据,如果baseId相同,则取baseTypeList2中的taskTypeId
|
|
|
- for (Map.Entry<String, Map<String, List<WmTaskType>>> entry : pTaskTypeMap.entrySet()) {
|
|
|
- // 获取父级id
|
|
|
- String pid = entry.getKey();
|
|
|
- // 判断大类中是否有相同的父类id
|
|
|
- if (cPidSet.contains(pid)) {
|
|
|
- // baseId
|
|
|
- Map<String, List<WmTaskType>> value = entry.getValue();
|
|
|
- Set<String> pBaseIds = value.keySet();
|
|
|
- // small
|
|
|
- Map<String, List<WmTaskType>> cVal = cTaskTypeMap.get(pid);
|
|
|
- Set<String> cBaseIds = cVal.keySet();
|
|
|
- // 求个交集,找出公共的
|
|
|
- Set<String> res = new HashSet<>(pBaseIds);
|
|
|
- res.retainAll(cBaseIds);
|
|
|
- // 找出的存入temp
|
|
|
- for (String bId : res) {
|
|
|
- temp.addAll(cVal.get(bId));
|
|
|
+ if (CollUtil.isNotEmpty(id)) {
|
|
|
+ // 查询所有子id对应的taskType列表
|
|
|
+ List<WmTaskType> baseTypeList2 = wmTaskTypeService.
|
|
|
+ list(Wrappers.<WmTaskType>query().lambda().eq(WmTaskType::getTaskTypeLevel, "1").in(WmTaskType::getId, id));
|
|
|
+
|
|
|
+ // 所有子id对应的taskType列表 按照父id分组
|
|
|
+ Map<String, Map<String, List<WmTaskType>>> cTaskTypeMap = baseTypeList2.stream()
|
|
|
+ .collect(Collectors.groupingBy(WmTaskType::getParentId, Collectors.groupingBy(WmTaskType::getBaseId)));
|
|
|
+ // 对应的parentId
|
|
|
+ Set<String> cPidSet = cTaskTypeMap.keySet();
|
|
|
+
|
|
|
+ // 解决页面父级id和数据库存的父级id不一致的问题(如一对一专访在页面父级是p-16,但taskType表中父级id为p-1)
|
|
|
+ // 比较baseTypeList1和baseTypeList2中parentId相同的taskTypeId的数据,如果baseId相同,则取baseTypeList2中的taskTypeId
|
|
|
+ for (Map.Entry<String, Map<String, List<WmTaskType>>> entry : pTaskTypeMap.entrySet()) {
|
|
|
+ // 获取父级id
|
|
|
+ String pid = entry.getKey();
|
|
|
+ // 判断大类中是否有相同的父类id
|
|
|
+ if (cPidSet.contains(pid)) {
|
|
|
+ // baseId
|
|
|
+ Map<String, List<WmTaskType>> value = entry.getValue();
|
|
|
+ Set<String> pBaseIds = value.keySet();
|
|
|
+ // small
|
|
|
+ Map<String, List<WmTaskType>> cVal = cTaskTypeMap.get(pid);
|
|
|
+ Set<String> cBaseIds = cVal.keySet();
|
|
|
+ // 求个交集,找出公共的
|
|
|
+ Set<String> res = new HashSet<>(pBaseIds);
|
|
|
+ res.retainAll(cBaseIds);
|
|
|
+ // 找出的存入temp
|
|
|
+ for (String bId : res) {
|
|
|
+ temp.addAll(cVal.get(bId));
|
|
|
+ }
|
|
|
+ // 取父级中对应baseId是独有的部分
|
|
|
+ pBaseIds.stream().filter(i -> !res.contains(i)).forEach(i -> temp.addAll(value.get(i)));
|
|
|
}
|
|
|
- // 取父级中对应baseId是独有的部分
|
|
|
- pBaseIds.stream().filter(i -> !res.contains(i)).forEach(i -> temp.addAll(value.get(i)));
|
|
|
}
|
|
|
+ } else {
|
|
|
+ temp.addAll(baseTypeList1);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ // 查询所有子id对应的taskType列表
|
|
|
+ List<WmTaskType> baseTypeList2 = wmTaskTypeService.
|
|
|
+ list(Wrappers.<WmTaskType>query().lambda().eq(WmTaskType::getTaskTypeLevel, "1").in(WmTaskType::getId, id));
|
|
|
+ temp.addAll(baseTypeList2);
|
|
|
}
|
|
|
}
|
|
|
|