|
|
@@ -27,17 +27,20 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import vip.xiaonuo.common.annotation.CommonLog;
|
|
|
import vip.xiaonuo.common.pojo.CommonResult;
|
|
|
import vip.xiaonuo.common.pojo.CommonValidList;
|
|
|
+import vip.xiaonuo.common.util.TreeUtil;
|
|
|
import vip.xiaonuo.disk.domain.College;
|
|
|
import vip.xiaonuo.disk.param.CollegeAddParam;
|
|
|
import vip.xiaonuo.disk.param.CollegeEditParam;
|
|
|
import vip.xiaonuo.disk.param.CollegeIdParam;
|
|
|
import vip.xiaonuo.disk.param.CollegePageParam;
|
|
|
import vip.xiaonuo.disk.service.CollegeService;
|
|
|
+import vip.xiaonuo.sys.modular.user.service.SysUserService;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.validation.Valid;
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -56,6 +59,8 @@ public class CollegeController {
|
|
|
|
|
|
@Resource
|
|
|
private CollegeService collegeService;
|
|
|
+ @Resource
|
|
|
+ private SysUserService sysUserService;
|
|
|
|
|
|
/**
|
|
|
* 获取college分页
|
|
|
@@ -173,16 +178,53 @@ public class CollegeController {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 获取院系人员树
|
|
|
+ * 获取院系人员树-一次查回(担心卡,暂时不采用,预备用)
|
|
|
*
|
|
|
* @author xuyuxiang
|
|
|
* @date 2022/4/24 20:00
|
|
|
*/
|
|
|
@ApiOperationSupport(order = 7)
|
|
|
- @ApiOperation("获取组织人员树")
|
|
|
+ @ApiOperation("获取院系人员树-一次查回")
|
|
|
@GetMapping("/disk/college/orgUserTreeSelector")
|
|
|
- public CommonResult<List<Tree<String>>> orgUserTreeSelector() {
|
|
|
- return CommonResult.data(collegeService.orgUserTreeSelector());
|
|
|
+ public CommonResult<List<Map<String,Object>>> orgUserTreeSelector(HttpServletRequest req) {
|
|
|
+ Map param=new HashMap();
|
|
|
+ Map result = new HashMap();
|
|
|
+ String collegeParentId = "0";
|
|
|
+ if(StringUtils.isNotEmpty(req.getParameter("collegeParentId")))collegeParentId=req.getParameter("collegeParentId");
|
|
|
+ //用于装当前单位的map
|
|
|
+ Map nowData = new HashMap();
|
|
|
+ List<Map<String, Object>> tree = new ArrayList<>();
|
|
|
+ //最终用来化成树的集合
|
|
|
+ List<Map<String,Object>> dataList=new ArrayList<>();
|
|
|
+ //查询该父级id的子级院系
|
|
|
+ List<Map<String,Object>> orgList=collegeService.getOrgUserChildList(param);
|
|
|
+ List<Map<String,Object>> userList=sysUserService.getOrgUserChildList(param);
|
|
|
+ dataList.addAll(orgList);
|
|
|
+ dataList.addAll(userList);
|
|
|
+ for(Map one:dataList)
|
|
|
+ {
|
|
|
+ if(one.get("id").equals(collegeParentId))
|
|
|
+ {
|
|
|
+ nowData=one;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ tree = TreeUtil.getThree(dataList,collegeParentId);
|
|
|
+
|
|
|
+ //如果传进来的id不为空,则把传进来的id也作为一条数据
|
|
|
+ List<Map<String,Object>> resultList=new ArrayList<>();
|
|
|
+ if(nowData.get("id")!=null)
|
|
|
+ {
|
|
|
+ nowData.put("children",tree);
|
|
|
+ resultList.add(nowData);
|
|
|
+ result.put("result",resultList);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ resultList.addAll(tree);
|
|
|
+ }
|
|
|
+ return CommonResult.data(resultList);
|
|
|
}
|
|
|
|
|
|
/**
|