提交 39028b22 编写于 作者: sq3536's avatar sq3536

单位部门选择接口

上级 23c32b0e
package cn.ibizlab.core.extensions.domain;
import cn.ibizlab.core.ou.domain.IBZDepartment;
import cn.ibizlab.core.ou.domain.IBZOrganization;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.LinkedHashSet;
import java.util.Set;
@Data
public class DeptMap {
private String deptid;
private IBZDepartment dept;
private Set<String> parent=new LinkedHashSet<>();
private Set<String> sub=new LinkedHashSet<>();
private Set<String> father=new LinkedHashSet<>();
private Set<String> children=new LinkedHashSet<>();
public String getDeptid()
{
if(StringUtils.isEmpty(deptid)&&dept!=null)
deptid=dept.getDeptid();
return deptid;
}
public Set<String> getSub()
{
if(sub.size()==0&&(dept!=null||(!StringUtils.isEmpty(getDeptid()))))
sub.add(getDeptid());
return sub;
}
public Set<String> getParent()
{
if(parent.size()==0&&dept!=null&&(!StringUtils.isEmpty(dept.getParentdeptid())))
parent.add(dept.getParentdeptid());
return parent;
}
public Set<String> getFather()
{
if(father.size()==0&&getParent().size()>0)
father.add(parent.iterator().next());
return father;
}
}
package cn.ibizlab.core.extensions.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class DeptNode {
@JSONField(name = "id")
@JsonProperty("id")
private String deptid;
@JSONField(name = "label")
@JsonProperty("label")
private String deptname;
@JSONField(name = "code")
@JsonProperty("code")
private String deptcode;
@JSONField(name = "level")
@JsonProperty("level")
private Integer deptlevel;
@JSONField(name = "bcode")
@JsonProperty("bcode")
private String bcode;
@JSONField(name = "filter")
@JsonProperty("filter")
private List<String> filter = new ArrayList<>();
private List<DeptNode> children = new ArrayList<>();
private boolean disabled = false;
public boolean getIsLeaf()
{
return children.size()==0;
}
}
package cn.ibizlab.core.extensions.domain;
import cn.ibizlab.core.ou.domain.IBZOrganization;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.LinkedHashSet;
import java.util.Set;
@Data
public class OrgMap {
private String orgid;
private IBZOrganization org;
private Set<String> parent=new LinkedHashSet<>();
private Set<String> sub=new LinkedHashSet<>();
private Set<String> father=new LinkedHashSet<>();
private Set<String> children=new LinkedHashSet<>();
public String getOrgid()
{
if(StringUtils.isEmpty(orgid)&&org!=null)
orgid=org.getOrgid();
return orgid;
}
public Set<String> getSub()
{
if(sub.size()==0&&(org!=null||(!StringUtils.isEmpty(getOrgid()))))
sub.add(getOrgid());
return sub;
}
public Set<String> getParent()
{
if(parent.size()==0&&org!=null&&(!StringUtils.isEmpty(org.getParentorgid())))
parent.add(org.getParentorgid());
return parent;
}
public Set<String> getFather()
{
if(father.size()==0&&getParent().size()>0)
father.add(parent.iterator().next());
return father;
}
}
package cn.ibizlab.core.extensions.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class OrgNode {
@JSONField(name = "id")
@JsonProperty("id")
private String orgid;
@JSONField(name = "label")
@JsonProperty("label")
private String orgname;
@JSONField(name = "code")
@JsonProperty("code")
private String orgcode;
@JSONField(name = "level")
@JsonProperty("level")
private Integer orglevel;
@JSONField(name = "filter")
@JsonProperty("filter")
private List<String> filter = new ArrayList<>();
private List<OrgNode> children = new ArrayList<>();
private boolean disabled = false;
public boolean getIsLeaf()
{
return children.size()==0;
}
}
package cn.ibizlab.core.extensions.mapping;
import cn.ibizlab.core.extensions.domain.DeptNode;
import cn.ibizlab.core.ou.domain.IBZDepartment;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
@Mapper(componentModel = "spring", uses = {},
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface IBZDept2NodeMapping extends MappingBase<DeptNode, IBZDepartment>
{
}
package cn.ibizlab.core.extensions.mapping;
import cn.ibizlab.core.extensions.domain.OrgNode;
import cn.ibizlab.core.ou.domain.IBZOrganization;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
@Mapper(componentModel = "spring", uses = {},
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface IBZOrg2NodeMapping extends MappingBase<OrgNode, IBZOrganization>
{
}
package cn.ibizlab.core.extensions.service; package cn.ibizlab.core.extensions.service;
import cn.ibizlab.core.extensions.domain.DeptMap;
import cn.ibizlab.core.extensions.domain.DeptNode;
import cn.ibizlab.core.extensions.domain.OrgMap;
import cn.ibizlab.core.extensions.domain.OrgNode;
import cn.ibizlab.core.extensions.mapping.IBZDept2NodeMapping;
import cn.ibizlab.core.extensions.mapping.IBZOrg2NodeMapping;
import cn.ibizlab.core.ou.domain.IBZDepartment;
import cn.ibizlab.core.ou.domain.IBZEmployee; import cn.ibizlab.core.ou.domain.IBZEmployee;
import cn.ibizlab.core.ou.domain.IBZOrganization;
import cn.ibizlab.core.ou.service.IIBZEmployeeService; import cn.ibizlab.core.ou.service.IIBZEmployeeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -42,28 +50,28 @@ public class OUCoreService ...@@ -42,28 +50,28 @@ public class OUCoreService
{ {
if(StringUtils.isEmpty(orgid) || "nullorgid".equals(orgid)) if(StringUtils.isEmpty(orgid) || "nullorgid".equals(orgid))
return new ArrayList<>(); return new ArrayList<>();
Map<String, Map<String, Set<String>>> store=ouModelService.getOrgModel(); Map<String, OrgMap> store=ouModelService.getOrgModel();
Map<String, Set<String>> orgmodel=this.getOrgModel(orgid); OrgMap orgmodel=this.getOrgModel(orgid);
if(orgmodel.get("sub").size()==store.size()) if(orgmodel.getSub().size()==store.size())
return iibzEmployeeService.list(); return iibzEmployeeService.list();
return iibzEmployeeService.list(new QueryWrapper<IBZEmployee>().in("orgid",orgmodel.get("sub"))); return iibzEmployeeService.list(new QueryWrapper<IBZEmployee>().in("orgid",orgmodel.getSub()));
} }
public List<IBZEmployee> getSubEmpByDept(String deptid) public List<IBZEmployee> getSubEmpByDept(String deptid)
{ {
if(StringUtils.isEmpty(deptid) || "nulldeptid".equals(deptid)) if(StringUtils.isEmpty(deptid) || "nulldeptid".equals(deptid))
return new ArrayList<>(); return new ArrayList<>();
Map<String, Set<String>> deptmodel=this.getDeptModel(deptid); DeptMap deptmodel=this.getDeptModel(deptid);
return iibzEmployeeService.list(new QueryWrapper<IBZEmployee>().in("mdeptid",deptmodel.get("sub"))); return iibzEmployeeService.list(new QueryWrapper<IBZEmployee>().in("mdeptid",deptmodel.getSub()));
} }
public List<IBZEmployee> getParentEmpByOrg(String orgid,boolean bRecurrence) public List<IBZEmployee> getParentEmpByOrg(String orgid,boolean bRecurrence)
{ {
if(StringUtils.isEmpty(orgid) || "nullorgid".equals(orgid)) if(StringUtils.isEmpty(orgid) || "nullorgid".equals(orgid))
return new ArrayList<>(); return new ArrayList<>();
Map<String, Set<String>> orgmodel=this.getOrgModel(orgid); OrgMap orgmodel=this.getOrgModel(orgid);
List<String> parent=new ArrayList<>(); List<String> parent=new ArrayList<>();
for(String str:orgmodel.get("parent")) for(String str:orgmodel.getParent())
{ {
parent.add(str); parent.add(str);
if(!bRecurrence) if(!bRecurrence)
...@@ -78,9 +86,9 @@ public class OUCoreService ...@@ -78,9 +86,9 @@ public class OUCoreService
{ {
if(StringUtils.isEmpty(deptid) || "nulldeptid".equals(deptid)) if(StringUtils.isEmpty(deptid) || "nulldeptid".equals(deptid))
return new ArrayList<>(); return new ArrayList<>();
Map<String, Set<String>> deptmodel=this.getDeptModel(deptid); DeptMap deptmodel=this.getDeptModel(deptid);
List<String> parent=new ArrayList<>(); List<String> parent=new ArrayList<>();
for(String str:deptmodel.get("parent")) for(String str:deptmodel.getParent())
{ {
parent.add(str); parent.add(str);
if(!bRecurrence) if(!bRecurrence)
...@@ -91,42 +99,169 @@ public class OUCoreService ...@@ -91,42 +99,169 @@ public class OUCoreService
return iibzEmployeeService.list(new QueryWrapper<IBZEmployee>().in("mdeptid",parent)); return iibzEmployeeService.list(new QueryWrapper<IBZEmployee>().in("mdeptid",parent));
} }
public Map<String, Set<String>> getOrgModel(String orgid) public OrgMap getOrgModel(String orgid)
{ {
Map<String, Map<String, Set<String>>> store=ouModelService.getOrgModel(); Map<String, OrgMap> store=ouModelService.getOrgModel();
if(store.containsKey(orgid)) if(store.containsKey(orgid))
{ {
Map<String, Set<String>> map = store.get(orgid); OrgMap map = store.get(orgid);
return map; return map;
} }
else else
{ {
Map<String, Set<String>> map=new HashMap<>(); OrgMap map = new OrgMap();
map.put("parent",new LinkedHashSet<>()); map.setOrgid(orgid);
Set<String> sub=new LinkedHashSet<>();
sub.add(orgid);
map.put("sub",sub);
return map; return map;
} }
} }
public Map<String, Set<String>> getDeptModel(String deptid) public DeptMap getDeptModel(String deptid)
{ {
Map<String, Map<String, Set<String>>> store=ouModelService.getDeptModel(ouModelService.getOrgModel()); Map<String, DeptMap> store=ouModelService.getDeptModel(ouModelService.getOrgModel());
if(store.containsKey(deptid)) if(store.containsKey(deptid))
{ {
Map<String, Set<String>> map = store.get(deptid); DeptMap map = store.get(deptid);
return map; return map;
} }
else else
{ {
Map<String, Set<String>> map=new HashMap<>(); DeptMap map = new DeptMap();
map.put("parent",new LinkedHashSet<>()); map.setDeptid(deptid);
Set<String> sub=new LinkedHashSet<>();
sub.add(deptid);
map.put("sub",sub);
return map; return map;
} }
} }
@Autowired
private IBZOrg2NodeMapping org2NodeMapping;
public List<OrgNode> getOrgNode(String root)
{
if(StringUtils.isEmpty(root))
root="alls";
List<OrgNode> list=new ArrayList<>();
Map<String,OrgMap> store=ouModelService.getOrgModel();
for(OrgMap map:store.values())
{
IBZOrganization org=map.getOrg();
String parent=org.getParentorgid();
if(StringUtils.isEmpty(parent))
parent="alls";
if(parent.equals(root)||root.equals(org.getOrgid()))
{
OrgNode node=org2NodeMapping.toDto(org);
node.getFilter().addAll(map.getParent());
node.getFilter().add(node.getOrgid());
if(root.equals(org.getOrgid())) {
list.add(0,node);
}
else {
looporg(node, store);
list.add(node);
}
}
}
return list;
}
private void looporg(OrgNode node,Map<String,OrgMap> store)
{
Set<String> children=store.get(node.getOrgid()).getChildren();
for(String child:children)
{
OrgMap childMap=store.get(child);
OrgNode sub=org2NodeMapping.toDto(childMap.getOrg());
sub.getFilter().addAll(childMap.getParent());
sub.getFilter().add(sub.getOrgid());
node.getChildren().add(sub);
looporg(sub,store);
}
}
@Autowired
private IBZDept2NodeMapping dept2NodeMapping;
public List<DeptNode> getDeptNode(String orgid)
{
List<DeptNode> list=new ArrayList<>();
if(StringUtils.isEmpty(orgid))
return list;
Map<String,DeptMap> store=ouModelService.getDeptModel(ouModelService.getOrgModel());
for(DeptMap map:store.values())
{
IBZDepartment dept=map.getDept();
if(StringUtils.isEmpty(dept.getParentdeptid())&&orgid.equals(dept.getOrgid()))
{
DeptNode node=dept2NodeMapping.toDto(dept);
loopdept(node,store);
list.add(node);
}
}
return list;
}
public List<DeptNode> getOrgDeptNode(String orgid)
{
List<DeptNode> list=new ArrayList<>();
if(StringUtils.isEmpty(orgid))
orgid="alls";
Map<String,DeptNode> parentNode=new HashMap<>();
List<OrgNode> listOrg=getOrgNode(orgid);
for(OrgNode org:listOrg)
{
DeptNode node = changeOrgNode2DeptNode(org,parentNode);
list.add(node);
}
Map<String,DeptMap> store=ouModelService.getDeptModel(ouModelService.getOrgModel());
for(DeptMap map:store.values())
{
IBZDepartment dept=map.getDept();
if(StringUtils.isEmpty(dept.getParentdeptid()))
{
DeptNode node=dept2NodeMapping.toDto(dept);
if(parentNode.containsKey(dept.getOrgid())) {
node.setFilter(parentNode.get(dept.getOrgid()).getFilter());
parentNode.get(dept.getOrgid()).getChildren().add(node);
loopdept(node,store);
}
}
}
return list;
}
private void loopdept(DeptNode node,Map<String,DeptMap> store)
{
Set<String> children=store.get(node.getDeptid()).getChildren();
for(String child:children)
{
DeptMap childMap=store.get(child);
DeptNode sub=dept2NodeMapping.toDto(childMap.getDept());
sub.setFilter(node.getFilter());
node.getChildren().add(sub);
loopdept(sub,store);
}
}
private DeptNode changeOrgNode2DeptNode(OrgNode orgnode,Map<String,DeptNode> parentNode)
{
DeptNode node = new DeptNode();
node.setDeptid(orgnode.getOrgid());
node.setDeptname(orgnode.getOrgname());
node.setFilter(orgnode.getFilter());
node.setDisabled(true);
parentNode.put(orgnode.getOrgid(),node);
for(OrgNode org:orgnode.getChildren())
{
node.getChildren().add(changeOrgNode2DeptNode(org,parentNode));
}
return node;
}
} }
package cn.ibizlab.core.extensions.service; package cn.ibizlab.core.extensions.service;
import cn.ibizlab.core.extensions.domain.DeptMap;
import cn.ibizlab.core.extensions.domain.OrgMap;
import cn.ibizlab.core.ou.domain.IBZDepartment; import cn.ibizlab.core.ou.domain.IBZDepartment;
import cn.ibizlab.core.ou.domain.IBZOrganization; import cn.ibizlab.core.ou.domain.IBZOrganization;
import cn.ibizlab.core.ou.service.IIBZDepartmentService; import cn.ibizlab.core.ou.service.IIBZDepartmentService;
...@@ -24,11 +26,13 @@ public class OUModelService ...@@ -24,11 +26,13 @@ public class OUModelService
@Autowired @Autowired
private IIBZDepartmentService iibzDepartmentService; private IIBZDepartmentService iibzDepartmentService;
private Map<String, Map<String, Set<String>>> orgmap=null; private Map<String, OrgMap> orgmap=null;
private Object lockOrg=new Object(); private Object lockOrg=new Object();
//@Cacheable( value="ibzou-model",key = "'orgmap'") //@Cacheable( value="ibzou-model",key = "'orgmap'")
public Map<String, Map<String, Set<String>>> getOrgModel() public Map<String, OrgMap> getOrgModel()
{ {
if(orgmap!=null) if(orgmap!=null)
return orgmap; return orgmap;
...@@ -36,34 +40,32 @@ public class OUModelService ...@@ -36,34 +40,32 @@ public class OUModelService
{ {
if(orgmap!=null) if(orgmap!=null)
return orgmap; return orgmap;
Map<String, Map<String, Set<String>>> store=new LinkedHashMap<>(); Map<String, OrgMap> store=new LinkedHashMap<>();
Map<String, IBZOrganization> orgset=new LinkedHashMap<>(); List<IBZOrganization> listOrg=iibzOrganizationService.list(new QueryWrapper<IBZOrganization>().orderByAsc("showorder","orgcode"));
List<IBZOrganization> listOrg=iibzOrganizationService.list();
for(IBZOrganization org:listOrg) for(IBZOrganization org:listOrg)
{ {
Map<String, Set<String>> map=new HashMap<>(); OrgMap map=new OrgMap();
Set<String> parent=new LinkedHashSet<String>(); map.setOrg(org);
if(!StringUtils.isEmpty(org.getParentorgid()))
parent.add(org.getParentorgid());
map.put("parent",parent);
Set<String> sub=new LinkedHashSet<String>();
sub.add(org.getOrgid());
map.put("sub",sub);
store.put(org.getOrgid(),map); store.put(org.getOrgid(),map);
orgset.put(org.getOrgid(),org);
} }
for(IBZOrganization org:listOrg) for(IBZOrganization org:listOrg)
{ {
loopOrg(org,orgset,store); loopOrg(org,store);
if(!StringUtils.isEmpty(org.getParentorgid())) {
if (store.containsKey(org.getParentorgid())) {
store.get(org.getParentorgid()).getChildren().add(org.getOrgid());
}
}
} }
for(IBZOrganization org:listOrg) for(IBZOrganization org:listOrg)
{ {
for(String sub:store.get(org.getOrgid()).get("sub")) for(String sub:store.get(org.getOrgid()).getSub())
{ {
if(!org.getOrgid().equals(sub)) if(!org.getOrgid().equals(sub))
store.get(sub).get("parent").add(org.getOrgid()); store.get(sub).getParent().add(org.getOrgid());
} }
} }
...@@ -73,14 +75,14 @@ public class OUModelService ...@@ -73,14 +75,14 @@ public class OUModelService
return orgmap; return orgmap;
} }
public void loopOrg(IBZOrganization org,Map<String, IBZOrganization> orgset,Map<String, Map<String, Set<String>>> store) public void loopOrg(IBZOrganization org,Map<String, OrgMap> store)
{ {
if(!StringUtils.isEmpty(org.getParentorgid())) if(!StringUtils.isEmpty(org.getParentorgid()))
{ {
if(store.containsKey(org.getParentorgid())) if(store.containsKey(org.getParentorgid()))
{ {
store.get(org.getParentorgid()).get("sub").add(org.getOrgid()); store.get(org.getParentorgid()).getSub().add(org.getOrgid());
loopOrg(orgset.get(org.getParentorgid()),orgset,store); loopOrg(store.get(org.getParentorgid()).getOrg(),store);
} }
} }
...@@ -88,12 +90,12 @@ public class OUModelService ...@@ -88,12 +90,12 @@ public class OUModelService
private Map<String, Map<String, Set<String>>> deptmap=null; private Map<String, DeptMap> deptmap=null;
private Object lockDept=new Object(); private Object lockDept=new Object();
//@Cacheable( value="ibzou-model",key = "'deptmap'") //@Cacheable( value="ibzou-model",key = "'deptmap'")
public Map<String, Map<String, Set<String>>> getDeptModel(Map<String, Map<String, Set<String>>> orgstore) public Map<String, DeptMap> getDeptModel(Map<String, OrgMap> orgstore)
{ {
if(deptmap!=null) if(deptmap!=null)
return deptmap; return deptmap;
...@@ -103,24 +105,15 @@ public class OUModelService ...@@ -103,24 +105,15 @@ public class OUModelService
return deptmap; return deptmap;
if(orgstore==null) if(orgstore==null)
orgstore=this.getOrgModel(); orgstore=this.getOrgModel();
Map<String, Map<String, Set<String>>> store=new LinkedHashMap<>(); Map<String, DeptMap> store=new LinkedHashMap<>();
Map<String, IBZDepartment> deptset=new LinkedHashMap<>();
Map<String, Set<String>> bcmap=new HashMap<>(); Map<String, Set<String>> bcmap=new HashMap<>();
List<IBZDepartment> listDept=iibzDepartmentService.list(); List<IBZDepartment> listDept=iibzDepartmentService.list(new QueryWrapper<IBZDepartment>().orderByAsc("showorder","deptcode"));
for(IBZDepartment dept:listDept) for(IBZDepartment dept:listDept)
{ {
Map<String, Set<String>> map=new HashMap<>(); DeptMap map=new DeptMap();
Set<String> parent=new LinkedHashSet<String>(); map.setDept(dept);
if(!StringUtils.isEmpty(dept.getParentdeptid()))
parent.add(dept.getParentdeptid());
map.put("parent",parent);
Set<String> sub=new LinkedHashSet<String>();
sub.add(dept.getDeptid());
map.put("sub",sub);
store.put(dept.getDeptid(),map); store.put(dept.getDeptid(),map);
deptset.put(dept.getDeptid(),dept);
String bc=dept.getBcode(); String bc=dept.getBcode();
if(!StringUtils.isEmpty(bc)) if(!StringUtils.isEmpty(bc))
...@@ -147,15 +140,20 @@ public class OUModelService ...@@ -147,15 +140,20 @@ public class OUModelService
for(IBZDepartment dept:listDept) for(IBZDepartment dept:listDept)
{ {
loopDept(dept,deptset,store); loopDept(dept,store);
if(!StringUtils.isEmpty(dept.getParentdeptid())) {
if (store.containsKey(dept.getParentdeptid())) {
store.get(dept.getParentdeptid()).getChildren().add(dept.getDeptid());
}
}
} }
for(IBZDepartment dept:listDept) for(IBZDepartment dept:listDept)
{ {
for(String sub:store.get(dept.getDeptid()).get("sub")) for(String sub:store.get(dept.getDeptid()).getSub())
{ {
if(!dept.getDeptid().equals(sub)) if(!dept.getDeptid().equals(sub))
store.get(sub).get("parent").add(dept.getDeptid()); store.get(sub).getParent().add(dept.getDeptid());
} }
} }
...@@ -185,15 +183,15 @@ public class OUModelService ...@@ -185,15 +183,15 @@ public class OUModelService
{ {
String bcdept=bcstringarr[0]; String bcdept=bcstringarr[0];
String bcorg=bcstringarr[1]; String bcorg=bcstringarr[1];
for(String porg:orgstore.get(orgid).get("parent")) for(String porg:orgstore.get(orgid).getParent())
{ {
if(bcorg.equals(porg)) if(bcorg.equals(porg))
store.get(dept.getDeptid()).get("parent").add(bcdept); store.get(dept.getDeptid()).getParent().add(bcdept);
} }
for(String sorg:orgstore.get(orgid).get("sub")) for(String sorg:orgstore.get(orgid).getSub())
{ {
if(bcorg.equals(sorg)) if(bcorg.equals(sorg))
store.get(dept.getDeptid()).get("sub").add(bcdept); store.get(dept.getDeptid()).getSub().add(bcdept);
} }
} }
} }
...@@ -209,14 +207,14 @@ public class OUModelService ...@@ -209,14 +207,14 @@ public class OUModelService
return deptmap; return deptmap;
} }
public void loopDept(IBZDepartment dept,Map<String, IBZDepartment> deptset,Map<String, Map<String, Set<String>>> store) public void loopDept(IBZDepartment dept,Map<String,DeptMap> store)
{ {
if(!StringUtils.isEmpty(dept.getParentdeptid())) if(!StringUtils.isEmpty(dept.getParentdeptid()))
{ {
if(store.containsKey(dept.getParentdeptid())) if(store.containsKey(dept.getParentdeptid()))
{ {
store.get(dept.getParentdeptid()).get("sub").add(dept.getDeptid()); store.get(dept.getParentdeptid()).getSub().add(dept.getDeptid());
loopDept(deptset.get(dept.getParentdeptid()),deptset,store); loopDept(store.get(dept.getParentdeptid()).getDept(),store);
} }
} }
......
package cn.ibizlab.api.rest.extensions; package cn.ibizlab.api.rest.extensions;
import cn.ibizlab.core.extensions.domain.DeptMap;
import cn.ibizlab.core.extensions.domain.DeptNode;
import cn.ibizlab.core.extensions.domain.OrgMap;
import cn.ibizlab.core.extensions.domain.OrgNode;
import cn.ibizlab.core.extensions.service.OUCoreService; import cn.ibizlab.core.extensions.service.OUCoreService;
import cn.ibizlab.core.ou.domain.IBZEmployee; import cn.ibizlab.core.ou.domain.IBZEmployee;
import cn.ibizlab.core.ou.service.IIBZEmployeeService; import cn.ibizlab.core.ou.service.IIBZEmployeeService;
...@@ -117,32 +121,47 @@ public class OUCoreResource ...@@ -117,32 +121,47 @@ public class OUCoreResource
return ResponseEntity.ok(map); return ResponseEntity.ok(map);
} }
@GetMapping("/ibzorganizations/picker")
public ResponseEntity<List<OrgNode>> getPicker()
{
List<OrgNode> list=ouCoreService.getOrgNode("alls");
return ResponseEntity.ok(list);
}
@GetMapping("/ibzorganizations/{orgId}/ibzdepartments/picker")
public ResponseEntity<List<DeptNode>> getOrgDeptPicker(@PathVariable("orgId") String orgId)
{
List<DeptNode> list=ouCoreService.getDeptNode(orgId);
return ResponseEntity.ok(list);
}
@GetMapping("/ibzorganizations/{orgId}/suborg/picker")
public ResponseEntity<List<OrgNode>> getSubOrgPicker(@PathVariable("orgId") String orgId)
{
List<OrgNode> list=ouCoreService.getOrgNode(orgId);
return ResponseEntity.ok(list);
}
@GetMapping("/ibzorganizations/{orgId}/suborg/ibzdepartments/picker")
public ResponseEntity<List<DeptNode>> getSubOrgDeptPicker(@PathVariable("orgId") String orgId)
{
List<DeptNode> list=ouCoreService.getOrgDeptNode(orgId);
return ResponseEntity.ok(list);
}
private Map<String, Set<String>> getMaps(String orgid,String deptid) private Map<String, Set<String>> getMaps(String orgid,String deptid)
{ {
Map<String, Set<String>> map=new LinkedHashMap<>(); Map<String, Set<String>> map=new LinkedHashMap<>();
Map<String, Set<String>> storemap=ouCoreService.getOrgModel(orgid); OrgMap storemap=ouCoreService.getOrgModel(orgid);
map.put("parentorg",storemap.get("parent")); map.put("parentorg",storemap.getParent());
map.put("suborg",storemap.get("sub")); map.put("suborg",storemap.getSub());
Set<String> father=new LinkedHashSet<>(); map.put("fatherorg",storemap.getFather());
for(String str:storemap.get("parent"))
{ DeptMap storedeptmap=ouCoreService.getDeptModel(deptid);
father.add(str); map.put("parentdept",storedeptmap.getParent());
break; map.put("subdept",storedeptmap.getSub());
} map.put("fatherdept",storedeptmap.getFather());
map.put("fatherorg",father);
Map<String, Set<String>> storedeptmap=ouCoreService.getDeptModel(deptid);
map.put("parentdept",storedeptmap.get("parent"));
map.put("subdept",storedeptmap.get("sub"));
Set<String> fatherdept=new LinkedHashSet<>();
for(String str:storedeptmap.get("parent"))
{
fatherdept.add(str);
break;
}
map.put("fatherdept",fatherdept);
return map; return map;
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册