|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.teachcloud.common.bean.dto.OrgDto;
|
|
import com.qmth.teachcloud.common.bean.dto.OrgDto;
|
|
import com.qmth.teachcloud.common.bean.params.UserSaveParams;
|
|
import com.qmth.teachcloud.common.bean.params.UserSaveParams;
|
|
|
|
+import com.qmth.teachcloud.common.bean.result.SysUserResult;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.entity.BasicCampus;
|
|
import com.qmth.teachcloud.common.entity.BasicCampus;
|
|
import com.qmth.teachcloud.common.entity.SysOrg;
|
|
import com.qmth.teachcloud.common.entity.SysOrg;
|
|
@@ -20,6 +21,7 @@ import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.util.ResultUtil;
|
|
import com.qmth.teachcloud.common.util.ResultUtil;
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -28,6 +30,7 @@ import javax.annotation.Resource;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -59,7 +62,20 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
|
public List<OrgDto> listOrgTree() {
|
|
public List<OrgDto> listOrgTree() {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
List<OrgDto> orgList = this.listOrgAll(schoolId);
|
|
List<OrgDto> orgList = this.listOrgAll(schoolId);
|
|
- Map<Long, OrgDto> map = orgList.stream().collect(Collectors.toMap(OrgDto::getId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
|
|
|
+ Map<Long, OrgDto> map = orgList.stream()
|
|
|
|
+ .peek(e -> {
|
|
|
|
+ // 加入机构下所有人员查询
|
|
|
|
+ List<SysUser> sysUserList = sysUserService.list(new QueryWrapper<SysUser>().lambda()
|
|
|
|
+ .eq(SysUser::getSchoolId,schoolId)
|
|
|
|
+ .eq(SysUser::getOrgId,e.getId()));
|
|
|
|
+
|
|
|
|
+ e.setSysUserList(sysUserList.stream().flatMap(f -> {
|
|
|
|
+ SysUserResult sysUserResult = new SysUserResult();
|
|
|
|
+ BeanUtils.copyProperties(f,sysUserResult);
|
|
|
|
+ return Stream.of(sysUserResult);
|
|
|
|
+ }).collect(Collectors.toList()));
|
|
|
|
+ })
|
|
|
|
+ .collect(Collectors.toMap(OrgDto::getId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
|
|
|
Iterator<Long> iterator = map.keySet().iterator();
|
|
Iterator<Long> iterator = map.keySet().iterator();
|
|
Set<Long> deleteKeys = new HashSet<>();
|
|
Set<Long> deleteKeys = new HashSet<>();
|