| | |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.node.ForestNodeMerger; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springblade.modules.property.entity.PropertyCompanyEntity; |
| | |
| | | if (dept.getParentId() != 0) { |
| | | parentId = dept.getParentId(); |
| | | } |
| | | List<DeptVO> deptVOS = baseMapper.lazyList(tenantId, parentId, param); |
| | | deptVOS = deptVOS.stream().filter(item -> AuthUtil.getDeptId().contains(item.getId().toString())).collect(Collectors.toList()); |
| | | return deptVOS; |
| | | } |
| | | // 判断点击搜索带有查询条件的情况 |
| | | if (Func.isEmpty(param.get(PARENT_ID)) && param.size() > 1 && Func.toLong(parentId) == 0L) { |
| | |
| | | |
| | | @Override |
| | | public List<DeptVO> tree(String tenantId) { |
| | | return ForestNodeMerger.merge(baseMapper.tree(tenantId)); |
| | | Long parentId = null; |
| | | // 判断数据权限控制,非超管角色只可看到本级及以下数据 |
| | | // if (!AuthUtil.isAdministrator()) { |
| | | // Long deptId = Func.firstLong(AuthUtil.getDeptId()); |
| | | // Dept dept = SysCache.getDept(deptId); |
| | | // if (dept.getParentId() != 0) { |
| | | // parentId = dept.getParentId(); |
| | | // } |
| | | // List<DeptVO> merge = ForestNodeMerger.merge(baseMapper.tree(tenantId, parentId)); |
| | | // List<DeptVO> copy = BeanUtil.copy(merge, DeptVO.class); |
| | | // copy = copy.stream().filter(item -> AuthUtil.getDeptId().contains(item.getId().toString())).collect(Collectors.toList()); |
| | | // return copy; |
| | | // } |
| | | |
| | | return ForestNodeMerger.merge(baseMapper.tree(tenantId, parentId)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | tenantId = StringPool.EMPTY; |
| | | } |
| | | // 判断数据权限控制,非超管角色只可看到本级及以下数据 |
| | | // if (Func.toLong(parentId) == 0L && !AuthUtil.isAdministrator()) { |
| | | // Long deptId = Func.firstLong(AuthUtil.getDeptId()); |
| | | // Dept dept = SysCache.getDept(deptId); |
| | | // if (dept.getParentId() != 0) { |
| | | // parentId = dept.getParentId(); |
| | | // } |
| | | // } |
| | | if (Func.toLong(parentId) == 0L && !AuthUtil.isAdministrator()) { |
| | | Long deptId = Func.firstLong(AuthUtil.getDeptId()); |
| | | Dept dept = SysCache.getDept(deptId); |
| | | if (dept.getParentId() != 0) { |
| | | parentId = dept.getParentId(); |
| | | } |
| | | List<DeptVO> merge = ForestNodeMerger.merge(baseMapper.lazyTree(tenantId, parentId)); |
| | | List<DeptVO> copy = BeanUtil.copy(merge, DeptVO.class); |
| | | copy = copy.stream().filter(item -> AuthUtil.getDeptId().contains(item.getId().toString())).collect(Collectors.toList()); |
| | | return copy; |
| | | } |
| | | return ForestNodeMerger.merge(baseMapper.lazyTree(tenantId, parentId)); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 机构信息处理 |
| | | * |
| | | * @param dept |
| | | */ |
| | | private void deptHandle(Dept dept) { |
| | |
| | | |
| | | /** |
| | | * 自定义新增或修改 |
| | | * |
| | | * @param dept |
| | | * @return |
| | | */ |
| | |
| | | dept.setId(one.getId()); |
| | | flag = updateById(dept); |
| | | } else { |
| | | if (dept.getId() > 0) { |
| | | flag = updateById(dept); |
| | | } else { |
| | | flag = save(dept); |
| | | } |
| | | } |
| | | //保存物业公司信息 |
| | | savePropertyCompany(dept); |
| | |
| | | |
| | | /** |
| | | * 保存物业公司信息 |
| | | * |
| | | * @param dept |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |