Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
chnmuseum-party
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liqin
chnmuseum-party
Commits
ad1620c4
Commit
ad1620c4
authored
May 14, 2021
by
jiawei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG修改====》》单位管理员可以看到平台用户、本单位人员及下属单位创建的学习内容
parent
22d65a7d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
LearningContentController.java
...useum/party/web/controller/LearningContentController.java
+64
-0
No files found.
src/main/java/cn/chnmuseum/party/web/controller/LearningContentController.java
View file @
ad1620c4
...
...
@@ -25,11 +25,13 @@ import io.swagger.annotations.ApiOperation;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresAuthentication
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
...
...
@@ -70,6 +72,8 @@ public class LearningContentController extends BaseController {
private
AuditService
auditService
;
@Resource
private
AssetService
assetService
;
@Autowired
TOrganService
organService
;
@PostMapping
(
"/save"
)
@RequiresAuthentication
//@RequiresPermissions("learning:content:save")
...
...
@@ -250,6 +254,10 @@ public class LearningContentController extends BaseController {
@MethodLog
(
operModule
=
OperModule
.
LEARNCONTENT
,
operType
=
OperType
.
SELECT
)
public
Map
<
String
,
Object
>
getLearningContentPageList
(
GenericPageParam
genericPageParam
,
@RequestParam
(
value
=
"learningProjectId"
,
required
=
false
)
String
learningProjectId
)
{
LambdaQueryWrapper
<
LearningContent
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
List
<
String
>
curUserSubOrgIds
=
getCurUserSubOrgIds
();
if
(!
CollectionUtils
.
isEmpty
(
curUserSubOrgIds
)){
queryWrapper
.
in
(
LearningContent:
:
getOrganCode
,
curUserSubOrgIds
);
}
// 根据创建时间区间检索
if
(
genericPageParam
.
getIsPublished
()
!=
null
)
{
queryWrapper
.
eq
(
LearningContent:
:
getPublished
,
genericPageParam
.
getIsPublished
());
...
...
@@ -307,6 +315,62 @@ public class LearningContentController extends BaseController {
return
getResult
(
page
);
}
/**
* 获取当前用户的所有子机构
*
* @return
*/
public
List
<
String
>
getCurUserSubOrgIds
()
{
TUser
tUser
=
getcurUser
();
if
(
tUser
==
null
||
StringUtils
.
isBlank
(
tUser
.
getOrgId
()))
{
return
null
;
}
//平台管理员、单位管理员、学习内容管理员
List
<
String
>
roleList
=
tUser
.
getRoleList
();
boolean
condition
=
!
CollectionUtils
.
isEmpty
(
roleList
)
//不为空
&&
roleList
.
contains
(
"2"
)
//2是单位管理员
&&
!
roleList
.
contains
(
"1"
)
//不包含 1是平台管理员
&&
!
roleList
.
contains
(
"8"
);
//不包含 8是学习内容管理员
//不是这种情况查询全部
if
(!
condition
)
{
return
null
;
}
String
orgId
=
tUser
.
getOrgId
();
LambdaQueryWrapper
<
TOrgan
>
wrapper
=
new
QueryWrapper
<
TOrgan
>().
lambda
()
.
select
(
TOrgan:
:
getId
,
TOrgan:
:
getParentId
,
TOrgan:
:
getCode
)
.
eq
(
TOrgan:
:
getIsDeleted
,
false
);
List
<
TOrgan
>
tOrgans
=
organService
.
list
(
wrapper
);
ArrayList
<
String
>
strings
=
new
ArrayList
<>();
strings
.
add
(
orgId
);
List
<
String
>
result
=
new
ArrayList
<>();
List
<
String
>
code
=
tOrgans
.
stream
().
filter
(
a
->
a
.
getId
().
equals
(
orgId
)).
map
(
TOrgan:
:
getCode
).
collect
(
Collectors
.
toList
());
if
(
code
!=
null
&&
code
.
size
()
>=
1
)
{
result
.
add
(
code
.
get
(
0
));
}
treeCode
(
strings
,
tOrgans
,
result
);
return
result
;
}
private
void
treeCode
(
List
<
String
>
parentCodes
,
List
<
TOrgan
>
all
,
List
<
String
>
codes
)
{
if
(
CollectionUtils
.
isEmpty
(
parentCodes
))
{
return
;
}
ArrayList
<
String
>
idArray
=
new
ArrayList
<>();
parentCodes
.
stream
().
forEach
(
s
->
{
List
<
TOrgan
>
subOrgans
=
all
.
stream
().
filter
(
a
->
a
.
getParentId
()
!=
null
&&
a
.
getParentId
().
equals
(
s
)).
collect
(
Collectors
.
toList
());
subOrgans
.
stream
().
forEach
(
sub
->
{
String
code
=
sub
.
getCode
();
String
id
=
sub
.
getId
();
codes
.
add
(
code
);
idArray
.
add
(
id
);
});
});
//递归查询
treeCode
(
idArray
,
all
,
codes
);
}
@ApiOperation
(
value
=
"获取学习内容详情"
,
notes
=
"获取学习内容详情"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"标识ID"
,
dataType
=
"String"
,
paramType
=
"path"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment