|
@@ -1,6 +1,7 @@
|
|
|
package com.qunzhixinxi.hnqz.admin.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
@@ -342,22 +343,27 @@ public class WmDeptTaskTypeConfigServiceImpl extends ServiceImpl<WmDeptTaskTypeC
|
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
|
// 查询上级
|
|
|
- SysDeptRelation ancestorDeptRelation = sysDeptRelationMapper.selectOne(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
|
+ List<SysDeptRelation> relationList = sysDeptRelationMapper.selectList(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
|
.eq(SysDeptRelation::getDescendant, deptId)
|
|
|
.ne(SysDeptRelation::getAncestor, deptId)
|
|
|
.ne(SysDeptRelation::getAncestor, 1));
|
|
|
- List<String> ancestorConfigTaskTypeIdList = null;
|
|
|
- if (ancestorDeptRelation != null) {
|
|
|
- // 上级企业配置
|
|
|
- WmDeptTaskTypeConfig ancestorDeptTaskTypeConfig = this.getOne(Wrappers.<WmDeptTaskTypeConfig>lambdaQuery()
|
|
|
- .eq(WmDeptTaskTypeConfig::getDeptId, ancestorDeptRelation.getAncestor()));
|
|
|
- if (ancestorDeptTaskTypeConfig != null) {
|
|
|
- List<WmDeptTaskTypeConfigJsonDTO> ancestorConfigJsonDTOList = JSON.parseArray(ancestorDeptTaskTypeConfig.getTaskTypeJson(), WmDeptTaskTypeConfigJsonDTO.class);
|
|
|
- ancestorConfigTaskTypeIdList = ancestorConfigJsonDTOList.stream()
|
|
|
- .filter(configJsonDTO -> configJsonDTO.getQualifiedTask() && configJsonDTO.getAssociateLower())
|
|
|
- .map(WmDeptTaskTypeConfigJsonDTO::getTaskTypeName)
|
|
|
- .collect(Collectors.toList());
|
|
|
- }
|
|
|
+ List<String> ancestorConfigTaskTypeIdList = new ArrayList<>();
|
|
|
+ if (CollUtil.isNotEmpty(relationList)) {
|
|
|
+ relationList.forEach(relation -> {
|
|
|
+ // 上级企业配置
|
|
|
+ WmDeptTaskTypeConfig ancestorDeptTaskTypeConfig = this.getOne(Wrappers.<WmDeptTaskTypeConfig>lambdaQuery()
|
|
|
+ .eq(WmDeptTaskTypeConfig::getDeptId, relation.getAncestor()));
|
|
|
+ if (ancestorDeptTaskTypeConfig != null) {
|
|
|
+ List<WmDeptTaskTypeConfigJsonDTO> ancestorConfigJsonDTOList = JSON.parseArray(ancestorDeptTaskTypeConfig.getTaskTypeJson(), WmDeptTaskTypeConfigJsonDTO.class);
|
|
|
+ List<String> collect = ancestorConfigJsonDTOList.stream()
|
|
|
+ .filter(configJsonDTO -> configJsonDTO.getQualifiedTask() && configJsonDTO.getAssociateLower())
|
|
|
+ .map(WmDeptTaskTypeConfigJsonDTO::getTaskTypeName)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (CollUtil.isNotEmpty(collect)) {
|
|
|
+ ancestorConfigTaskTypeIdList.addAll(collect);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
if (CollectionUtil.isEmpty(configTaskTypeIdList) && CollectionUtil.isEmpty(ancestorConfigTaskTypeIdList)) {
|
|
|
return new ArrayList<>();
|
|
@@ -447,32 +453,40 @@ public class WmDeptTaskTypeConfigServiceImpl extends ServiceImpl<WmDeptTaskTypeC
|
|
|
}
|
|
|
|
|
|
// 查询上级的deptId
|
|
|
- SysDeptRelation ancestorDeptRelation = sysDeptRelationMapper.selectOne(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
|
+ List<SysDeptRelation> relationList = sysDeptRelationMapper.selectList(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
|
.eq(SysDeptRelation::getDescendant, deptId)
|
|
|
.ne(SysDeptRelation::getAncestor, deptId)
|
|
|
.ne(SysDeptRelation::getAncestor, 1));
|
|
|
// 上级dept对应任务类型配置
|
|
|
- List<WmDeptTaskTypeConfigJsonDTO> filterAncestorConfigList = null;
|
|
|
- if (ancestorDeptRelation != null) {
|
|
|
- WmDeptTaskTypeConfig ancestorDeptTaskTypeConfig = this.getOne(Wrappers.<WmDeptTaskTypeConfig>lambdaQuery()
|
|
|
- .eq(WmDeptTaskTypeConfig::getDeptId, ancestorDeptRelation.getAncestor()));
|
|
|
- if (ancestorDeptTaskTypeConfig != null) {
|
|
|
- List<WmDeptTaskTypeConfigJsonDTO> ancestorConfigJsonDTOList =
|
|
|
- JSON.parseArray(ancestorDeptTaskTypeConfig.getTaskTypeJson(), WmDeptTaskTypeConfigJsonDTO.class);
|
|
|
- // 转换为key value形式
|
|
|
- if (StringUtils.isNotBlank(taskTypeName)) {
|
|
|
- filterAncestorConfigList = ancestorConfigJsonDTOList.stream()
|
|
|
- .filter(configJsonDTO -> configJsonDTO.getTaskTypeName().equals(taskTypeName)
|
|
|
- && configJsonDTO.getQualifiedTask() && configJsonDTO.getAssociateLower()
|
|
|
- && (configJsonDTO.getYydbStatusSelect() || configJsonDTO.getZbdbStatusSelect()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- } else {
|
|
|
- filterAncestorConfigList = ancestorConfigJsonDTOList.stream()
|
|
|
- .filter(configJsonDTO -> configJsonDTO.getQualifiedTask() && configJsonDTO.getAssociateLower()
|
|
|
- && (configJsonDTO.getYydbStatusSelect() || configJsonDTO.getZbdbStatusSelect()))
|
|
|
- .collect(Collectors.toList());
|
|
|
+ List<WmDeptTaskTypeConfigJsonDTO> filterAncestorConfigList = new ArrayList<>();
|
|
|
+ if (CollUtil.isNotEmpty(relationList)) {
|
|
|
+ relationList.forEach(relation -> {
|
|
|
+ WmDeptTaskTypeConfig ancestorDeptTaskTypeConfig = this.getOne(Wrappers.<WmDeptTaskTypeConfig>lambdaQuery()
|
|
|
+ .eq(WmDeptTaskTypeConfig::getDeptId, relation.getAncestor()));
|
|
|
+ if (ancestorDeptTaskTypeConfig != null) {
|
|
|
+ List<WmDeptTaskTypeConfigJsonDTO> ancestorConfigJsonDTOList =
|
|
|
+ JSON.parseArray(ancestorDeptTaskTypeConfig.getTaskTypeJson(), WmDeptTaskTypeConfigJsonDTO.class);
|
|
|
+ // 转换为key value形式
|
|
|
+ if (StringUtils.isNotBlank(taskTypeName)) {
|
|
|
+ List<WmDeptTaskTypeConfigJsonDTO> collect = ancestorConfigJsonDTOList.stream()
|
|
|
+ .filter(configJsonDTO -> configJsonDTO.getTaskTypeName().equals(taskTypeName)
|
|
|
+ && configJsonDTO.getQualifiedTask() && configJsonDTO.getAssociateLower()
|
|
|
+ && (configJsonDTO.getYydbStatusSelect() || configJsonDTO.getZbdbStatusSelect()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (CollUtil.isNotEmpty(collect)) {
|
|
|
+ filterAncestorConfigList.addAll(collect);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ List<WmDeptTaskTypeConfigJsonDTO> collect = ancestorConfigJsonDTOList.stream()
|
|
|
+ .filter(configJsonDTO -> configJsonDTO.getQualifiedTask() && configJsonDTO.getAssociateLower()
|
|
|
+ && (configJsonDTO.getYydbStatusSelect() || configJsonDTO.getZbdbStatusSelect()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (CollUtil.isNotEmpty(collect)) {
|
|
|
+ filterAncestorConfigList.addAll(collect);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
// 任务配置为空,则直接返回空page
|
|
|
if (CollectionUtil.isEmpty(filterConfigJsonDTOList) && CollectionUtil.isEmpty(filterAncestorConfigList)) {
|