Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzou
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzou
提交
39028b22
提交
39028b22
编写于
5月 18, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
单位部门选择接口
上级
23c32b0e
变更
9
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
461 行增加
和
92 行删除
+461
-92
DeptMap.java
.../main/java/cn/ibizlab/core/extensions/domain/DeptMap.java
+47
-0
DeptNode.java
...main/java/cn/ibizlab/core/extensions/domain/DeptNode.java
+45
-0
OrgMap.java
...c/main/java/cn/ibizlab/core/extensions/domain/OrgMap.java
+46
-0
OrgNode.java
.../main/java/cn/ibizlab/core/extensions/domain/OrgNode.java
+43
-0
IBZDept2NodeMapping.java
.../ibizlab/core/extensions/mapping/IBZDept2NodeMapping.java
+18
-0
IBZOrg2NodeMapping.java
...n/ibizlab/core/extensions/mapping/IBZOrg2NodeMapping.java
+18
-0
OUCoreService.java
...ava/cn/ibizlab/core/extensions/service/OUCoreService.java
+161
-26
OUModelService.java
...va/cn/ibizlab/core/extensions/service/OUModelService.java
+43
-45
OUCoreResource.java
...n/java/cn/ibizlab/api/rest/extensions/OUCoreResource.java
+40
-21
未找到文件。
ibzou-core/src/main/java/cn/ibizlab/core/extensions/domain/DeptMap.java
0 → 100644
浏览文件 @
39028b22
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
;
}
}
ibzou-core/src/main/java/cn/ibizlab/core/extensions/domain/DeptNode.java
0 → 100644
浏览文件 @
39028b22
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
;
}
}
ibzou-core/src/main/java/cn/ibizlab/core/extensions/domain/OrgMap.java
0 → 100644
浏览文件 @
39028b22
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
;
}
}
ibzou-core/src/main/java/cn/ibizlab/core/extensions/domain/OrgNode.java
0 → 100644
浏览文件 @
39028b22
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
;
}
}
ibzou-core/src/main/java/cn/ibizlab/core/extensions/mapping/IBZDept2NodeMapping.java
0 → 100644
浏览文件 @
39028b22
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
>
{
}
ibzou-core/src/main/java/cn/ibizlab/core/extensions/mapping/IBZOrg2NodeMapping.java
0 → 100644
浏览文件 @
39028b22
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
>
{
}
ibzou-core/src/main/java/cn/ibizlab/core/extensions/service/OUCoreService.java
浏览文件 @
39028b22
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
.
get
Sub
(
).
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
.
get
Sub
(
)));
}
}
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
.
get
Sub
(
)));
}
}
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
.
get
Parent
(
))
{
{
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
.
get
Parent
(
))
{
{
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
;
}
}
}
ibzou-core/src/main/java/cn/ibizlab/core/extensions/service/OUModelService.java
浏览文件 @
39028b22
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
()).
get
Sub
(
))
{
{
if
(!
org
.
getOrgid
().
equals
(
sub
))
if
(!
org
.
getOrgid
().
equals
(
sub
))
store
.
get
(
sub
).
get
(
"parent"
).
add
(
org
.
getOrgid
());
store
.
get
(
sub
).
get
Parent
(
).
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
()).
get
Sub
(
).
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
()).
get
Sub
(
))
{
{
if
(!
dept
.
getDeptid
().
equals
(
sub
))
if
(!
dept
.
getDeptid
().
equals
(
sub
))
store
.
get
(
sub
).
get
(
"parent"
).
add
(
dept
.
getDeptid
());
store
.
get
(
sub
).
get
Parent
(
).
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
).
get
Parent
(
))
{
{
if
(
bcorg
.
equals
(
porg
))
if
(
bcorg
.
equals
(
porg
))
store
.
get
(
dept
.
getDeptid
()).
get
(
"parent"
).
add
(
bcdept
);
store
.
get
(
dept
.
getDeptid
()).
get
Parent
(
).
add
(
bcdept
);
}
}
for
(
String
sorg:
orgstore
.
get
(
orgid
).
get
(
"sub"
))
for
(
String
sorg:
orgstore
.
get
(
orgid
).
get
Sub
(
))
{
{
if
(
bcorg
.
equals
(
sorg
))
if
(
bcorg
.
equals
(
sorg
))
store
.
get
(
dept
.
getDeptid
()).
get
(
"sub"
).
add
(
bcdept
);
store
.
get
(
dept
.
getDeptid
()).
get
Sub
(
).
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
()).
get
Sub
(
).
add
(
dept
.
getDeptid
());
loopDept
(
deptset
.
get
(
dept
.
getParentdeptid
()),
deptset
,
store
);
loopDept
(
store
.
get
(
dept
.
getParentdeptid
()).
getDept
()
,
store
);
}
}
}
}
...
...
ibzou-provider/ibzou-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/OUCoreResource.java
浏览文件 @
39028b22
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
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录