提交 66921c0e 编写于 作者: zhouweidong's avatar zhouweidong

USR代码

上级 735f0a96
...@@ -114,7 +114,11 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -114,7 +114,11 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/"+downloadpath+"/**").permitAll() .antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll() .antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll() .antMatchers("/"+previewpath+"/**").permitAll()
.anyRequest().authenticated() .antMatchers("/ibzou/org/**").permitAll()
.antMatchers("/ibzemployees/**/oumaps").permitAll()
.antMatchers("/dictionarys/**").permitAll()
.antMatchers("/sysemployees/**/oumaps").permitAll()
.anyRequest().authenticated()
// 防止iframe 造成跨域 // 防止iframe 造成跨域
.and().headers().frameOptions().disable(); .and().headers().frameOptions().disable();
httpSecurity httpSecurity
......
package cn.ibizlab.core.ou.extensions.aspect;
import cn.ibizlab.core.ou.extensions.service.OUModelService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* 实体属性默认值切面,只有新建(Create)时才会填充默认值
*/
@Aspect
@Order(0)
@Component
public class OUModelRefreshAspect
{
@Autowired
@Lazy
private OUModelService ouModelService;
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysOrganizationService.creat*(..))")
public void AfterCreateOrg(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysOrganizationService.updat*(..))")
public void AfterUpdateOrg(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysOrganizationService.remov*(..))")
public void AfterRemoveOrg(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysOrganizationService.sav*(..))")
public void AfterSaveOrg(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysDepartmentService.creat*(..))")
public void AfterCreateDept(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysDepartmentService.updat*(..))")
public void AfterUpdateDept(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysDepartmentService.remov*(..))")
public void AfterRemoveDept(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
@After(value = "execution(* cn.ibizlab.core.ou.service.ISysDepartmentService.sav*(..))")
public void AfterSaveDept(JoinPoint point) throws Exception {
ouModelService.refreshModel();
}
}
package cn.ibizlab.core.ou.extensions.domain;
import cn.ibizlab.core.ou.domain.SysDepartment;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.LinkedHashSet;
import java.util.Set;
@Data
public class DeptMap {
private String deptid;
private SysDepartment 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.ou.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.ou.extensions.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.sql.Timestamp;
@Data
public class EmpNode {
@JSONField(name = "id")
@JsonProperty("id")
private String userid;
@JSONField(name = "label")
@JsonProperty("label")
private String personname;
@JSONField(name = "code")
@JsonProperty("code")
private String usercode;
private String loginname;
private String domains;
private String username;
private String bcode;
private String mdeptid;
private String mdeptcode;
private String mdeptname;
private String postid;
private String postcode;
private String postname;
private String orgid;
private String orgcode;
private String orgname;
private String nickname;
private String sex;
private String certcode;
private String phone;
@JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8")
@JSONField(format="yyyy-MM-dd")
private Timestamp birthday;
private String email;
private String avatar;
private String addr;
public String getGroup()
{
return mdeptname;
}
}
package cn.ibizlab.core.ou.extensions.domain;
import cn.ibizlab.core.ou.domain.SysOrganization;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.LinkedHashSet;
import java.util.Set;
@Data
public class OrgMap {
private String orgid;
private SysOrganization 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.ou.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.ou.extensions.mapping;
import cn.ibizlab.core.ou.domain.SysDepartment;
import cn.ibizlab.core.ou.extensions.domain.DeptNode;
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 SysDept2NodeMapping extends MappingBase<DeptNode, SysDepartment>
{
}
package cn.ibizlab.core.ou.extensions.mapping;
import cn.ibizlab.core.ou.domain.SysEmployee;
import cn.ibizlab.core.ou.extensions.domain.EmpNode;
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 SysEmp2NodeMapping extends MappingBase<EmpNode, SysEmployee>
{
}
package cn.ibizlab.core.ou.extensions.mapping;
import cn.ibizlab.core.ou.domain.SysEmployee;
import cn.ibizlab.util.domain.IBZUSER;
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 SysEmp2UserMapping extends MappingBase<IBZUSER, SysEmployee>
{
}
package cn.ibizlab.core.ou.extensions.mapping;
import cn.ibizlab.core.ou.domain.SysOrganization;
import cn.ibizlab.core.ou.extensions.domain.OrgNode;
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 SysOrg2NodeMapping extends MappingBase<OrgNode, SysOrganization>
{
}
package cn.ibizlab.core.ou.extensions.service;
import cn.ibizlab.core.ou.domain.SysDepartment;
import cn.ibizlab.core.ou.domain.SysEmployee;
import cn.ibizlab.core.ou.domain.SysOrganization;
import cn.ibizlab.core.ou.extensions.domain.*;
import cn.ibizlab.core.ou.extensions.mapping.SysDept2NodeMapping;
import cn.ibizlab.core.ou.extensions.mapping.SysEmp2NodeMapping;
import cn.ibizlab.core.ou.extensions.mapping.SysOrg2NodeMapping;
import cn.ibizlab.core.ou.service.ISysEmployeeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
@Service
public class OUCoreService
{
@Autowired
@Lazy
private OUModelService ouModelService;
@Autowired
@Lazy
private ISysEmployeeService iibzEmployeeService;
public List<SysEmployee> getEmpByOrg(String orgid)
{
if(StringUtils.isEmpty(orgid) || "nullorgid".equals(orgid))
return new ArrayList<>();
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().eq("orgid",orgid).orderByAsc("showorder"));
}
public List<SysEmployee> getEmpByDept(String deptid)
{
if(StringUtils.isEmpty(deptid) || "nulldeptid".equals(deptid))
return new ArrayList<>();
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().eq("mdeptid",deptid).orderByAsc("showorder"));
}
public List<SysEmployee> getSubEmpByOrg(String orgid)
{
if(StringUtils.isEmpty(orgid) || "nullorgid".equals(orgid))
return new ArrayList<>();
Map<String, OrgMap> store=ouModelService.getOrgModel();
OrgMap orgmodel=this.getOrgModel(orgid);
if(orgmodel.getSub().size()==store.size())
return iibzEmployeeService.list();
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().in("orgid",orgmodel.getSub()));
}
public List<SysEmployee> getSubEmpByDept(String deptid)
{
if(StringUtils.isEmpty(deptid) || "nulldeptid".equals(deptid))
return new ArrayList<>();
DeptMap deptmodel=this.getDeptModel(deptid);
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().in("mdeptid",deptmodel.getSub()));
}
public List<SysEmployee> getParentEmpByOrg(String orgid,boolean bRecurrence)
{
if(StringUtils.isEmpty(orgid) || "nullorgid".equals(orgid))
return new ArrayList<>();
OrgMap orgmodel=this.getOrgModel(orgid);
List<String> parent=new ArrayList<>();
for(String str:orgmodel.getParent())
{
parent.add(str);
if(!bRecurrence)
break;
}
if(parent.size()==0)
return new ArrayList<>();
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().in("orgid",parent));
}
public List<SysEmployee> getParentEmpByDept(String deptid,boolean bRecurrence)
{
if(StringUtils.isEmpty(deptid) || "nulldeptid".equals(deptid))
return new ArrayList<>();
DeptMap deptmodel=this.getDeptModel(deptid);
List<String> parent=new ArrayList<>();
for(String str:deptmodel.getParent())
{
parent.add(str);
if(!bRecurrence)
break;
}
if(parent.size()==0)
return new ArrayList<>();
return iibzEmployeeService.list(new QueryWrapper<SysEmployee>().in("mdeptid",parent));
}
public OrgMap getOrgModel(String orgid)
{
Map<String, OrgMap> store=ouModelService.getOrgModel();
if(store.containsKey(orgid))
{
OrgMap map = store.get(orgid);
return map;
}
else
{
OrgMap map = new OrgMap();
map.setOrgid(orgid);
return map;
}
}
public DeptMap getDeptModel(String deptid)
{
Map<String, DeptMap> store=ouModelService.getDeptModel(ouModelService.getOrgModel());
if(store.containsKey(deptid))
{
DeptMap map = store.get(deptid);
return map;
}
else
{
DeptMap map = new DeptMap();
map.setDeptid(deptid);
return map;
}
}
@Autowired
private SysOrg2NodeMapping org2NodeMapping;
public List<OrgNode> getOrgNode(String root)
{
if(StringUtils.isEmpty(root))
root="alls";
List<OrgNode> list=new ArrayList<>();
Map<String,OrgMap> store=ouModelService.getOrgModel();
if(root.equals("alls"))
{
int rootcnt=0;
String tmp="";
for(OrgMap map:store.values()) {
SysOrganization org = map.getOrg();
if(StringUtils.isEmpty(org.getParentorgid())) {
rootcnt++;
tmp=org.getOrgid();
}
}
if(rootcnt==1)
root=tmp;
}
for(OrgMap map:store.values())
{
SysOrganization 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 SysDept2NodeMapping 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())
{
SysDepartment 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())
{
SysDepartment 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;
}
@Autowired
private SysEmp2NodeMapping emp2NodeMapping;
public List<EmpNode> getEmpNode(String orgid)
{
List<EmpNode> listemp=new ArrayList<>();
List<String> list=new ArrayList<>();
if(StringUtils.isEmpty(orgid))
return listemp;
Map<String,DeptMap> store=ouModelService.getDeptModel(ouModelService.getOrgModel());
for(DeptMap map:store.values())
{
SysDepartment dept=map.getDept();
if(StringUtils.isEmpty(dept.getParentdeptid())&&orgid.equals(dept.getOrgid()))
{
list.add(dept.getDeptid());
loopdept(dept.getDeptid(),store,list);
}
}
LinkedHashMap<String,List<EmpNode>> empmap=new LinkedHashMap<>();
for(String deptid:list)
{
empmap.put(deptid,new ArrayList<>());
}
for(EmpNode node:emp2NodeMapping.toDto(this.getEmpByOrg(orgid)))
{
if(empmap.containsKey(node.getMdeptid()))
empmap.get(node.getMdeptid()).add(node);
}
for(String deptid:list)
{
listemp.addAll(empmap.get(deptid));
}
return listemp;
}
private void loopdept(String node,Map<String,DeptMap> store,List<String> list)
{
Set<String> children=store.get(node).getChildren();
for(String child:children)
{
list.add(child);
loopdept(child,store,list);
}
}
}
package cn.ibizlab.core.ou.extensions.service;
import cn.ibizlab.core.ou.domain.SysDepartment;
import cn.ibizlab.core.ou.domain.SysOrganization;
import cn.ibizlab.core.ou.extensions.domain.DeptMap;
import cn.ibizlab.core.ou.extensions.domain.OrgMap;
import cn.ibizlab.core.ou.service.ISysDepartmentService;
import cn.ibizlab.core.ou.service.ISysOrganizationService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
@Service
public class OUModelService
{
@Autowired
private ISysOrganizationService iibzOrganizationService;
@Autowired
private ISysDepartmentService iibzDepartmentService;
private Map<String, OrgMap> orgmap=null;
private Object lockOrg=new Object();
//@Cacheable( value="ibzou-model",key = "'orgmap'")
public Map<String, OrgMap> getOrgModel()
{
if(orgmap!=null)
return orgmap;
synchronized(lockOrg)
{
if(orgmap!=null)
return orgmap;
Map<String, OrgMap> store=new LinkedHashMap<>();
List<SysOrganization> listOrg=iibzOrganizationService.list(new QueryWrapper<SysOrganization>().orderByAsc("showorder","orgcode"));
for(SysOrganization org:listOrg)
{
OrgMap map=new OrgMap();
map.setOrg(org);
store.put(org.getOrgid(),map);
}
for(SysOrganization org:listOrg)
{
loopOrg(org,store);
if(!StringUtils.isEmpty(org.getParentorgid())) {
if (store.containsKey(org.getParentorgid())) {
store.get(org.getParentorgid()).getChildren().add(org.getOrgid());
}
}
}
for(SysOrganization org:listOrg)
{
for(String sub:store.get(org.getOrgid()).getSub())
{
if(!org.getOrgid().equals(sub))
store.get(sub).getParent().add(org.getOrgid());
}
}
orgmap=store;
}
return orgmap;
}
public void loopOrg(SysOrganization org,Map<String, OrgMap> store)
{
if(!StringUtils.isEmpty(org.getParentorgid()))
{
if(store.containsKey(org.getParentorgid()))
{
store.get(org.getParentorgid()).getSub().add(org.getOrgid());
loopOrg(store.get(org.getParentorgid()).getOrg(),store);
}
}
}
private Map<String, DeptMap> deptmap=null;
private Object lockDept=new Object();
//@Cacheable( value="ibzou-model",key = "'deptmap'")
public Map<String, DeptMap> getDeptModel(Map<String, OrgMap> orgstore)
{
if(deptmap!=null)
return deptmap;
synchronized(lockDept)
{
if(deptmap!=null)
return deptmap;
if(orgstore==null)
orgstore=this.getOrgModel();
Map<String, DeptMap> store=new LinkedHashMap<>();
Map<String, Set<String>> bcmap=new HashMap<>();
List<SysDepartment> listDept=iibzDepartmentService.list(new QueryWrapper<SysDepartment>().orderByAsc("showorder","deptcode"));
for(SysDepartment dept:listDept)
{
DeptMap map=new DeptMap();
map.setDept(dept);
store.put(dept.getDeptid(),map);
String bc=dept.getBcode();
if(!StringUtils.isEmpty(bc))
{
bc=bc.replace(";",",").replace(";",",").replace(",",",");
String[] bcs=bc.split(",");
for(String strbc:bcs)
{
strbc=strbc.trim();
if(!StringUtils.isEmpty(strbc))
{
if(!bcmap.containsKey(strbc))
{
Set<String> bcset=new HashSet<>();
bcmap.put(strbc,bcset);
}
bcmap.get(strbc).add(dept.getDeptid()+":"+dept.getOrgid());
}
}
}
}
for(SysDepartment dept:listDept)
{
loopDept(dept,store);
if(!StringUtils.isEmpty(dept.getParentdeptid())) {
if (store.containsKey(dept.getParentdeptid())) {
store.get(dept.getParentdeptid()).getChildren().add(dept.getDeptid());
}
}
}
for(SysDepartment dept:listDept)
{
for(String sub:store.get(dept.getDeptid()).getSub())
{
if(!dept.getDeptid().equals(sub))
store.get(sub).getParent().add(dept.getDeptid());
}
}
for(SysDepartment dept:listDept)
{
String orgid=dept.getOrgid();
if(StringUtils.isEmpty(orgid)||(!orgstore.containsKey(orgid)))
continue;
String bc=dept.getBcode();
if(!StringUtils.isEmpty(bc))
{
bc = bc.replace(";", ",").replace(";", ",").replace(",", ",");
String[] bcs = bc.split(",");
for (String strbc : bcs)
{
strbc = strbc.trim();
if (!StringUtils.isEmpty(strbc))
{
if(bcmap.containsKey(strbc))
{
Set<String> bcset=bcmap.get(strbc);
for(String bcstring:bcset)
{
String[] bcstringarr=bcstring.split(":");
if(bcstringarr.length==2)
{
String bcdept=bcstringarr[0];
String bcorg=bcstringarr[1];
for(String porg:orgstore.get(orgid).getParent())
{
if(bcorg.equals(porg))
store.get(dept.getDeptid()).getParent().add(bcdept);
}
for(String sorg:orgstore.get(orgid).getSub())
{
if(bcorg.equals(sorg))
store.get(dept.getDeptid()).getSub().add(bcdept);
}
}
}
}
}
}
}
}
deptmap=store;
}
return deptmap;
}
public void loopDept(SysDepartment dept,Map<String,DeptMap> store)
{
if(!StringUtils.isEmpty(dept.getParentdeptid()))
{
if(store.containsKey(dept.getParentdeptid()))
{
store.get(dept.getParentdeptid()).getSub().add(dept.getDeptid());
loopDept(store.get(dept.getParentdeptid()).getDept(),store);
}
}
}
@CacheEvict( value="ibzou-model",allEntries = true)
public synchronized void refreshModel()
{
synchronized (lockDept)
{
this.deptmap = null;
}
synchronized (lockOrg)
{
this.orgmap = null;
}
}
}
package cn.ibizlab.core.ou.extensions.service;
import cn.ibizlab.util.domain.IBZUSER;
import cn.ibizlab.util.mapper.IBZUSERMapper;
import cn.ibizlab.util.service.IBZUSERService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* 实体[IBZUSER] 服务对象接口实现
*/
@Service("userservice")
public class SysUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> implements IBZUSERService{
}
\ No newline at end of file
...@@ -119,6 +119,11 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -119,6 +119,11 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/"+downloadpath+"/**").permitAll() .antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll() .antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll() .antMatchers("/"+previewpath+"/**").permitAll()
//开放组织机构关系查询
.antMatchers("/ibzemployees/**/oumaps").permitAll()
.antMatchers("/ibzorganizations/**/suborg/picker").permitAll()
.antMatchers("/dictionarys/**").permitAll()
.antMatchers("/sysemployees/**/oumaps").permitAll()
// 所有请求都需要认证 // 所有请求都需要认证
.anyRequest().authenticated() .anyRequest().authenticated()
// 防止iframe 造成跨域 // 防止iframe 造成跨域
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册