Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
online-edu-backend
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Redmine
Redmine
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
online-edu
online-edu-backend
Commits
94585bef
Commit
94585bef
authored
Aug 16, 2021
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改推荐课程加载慢的问题
parent
0ca5b5cc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
CourseService.java
...java/com/qkdata/biz/management/service/CourseService.java
+10
-5
No files found.
src/main/java/com/qkdata/biz/management/service/CourseService.java
View file @
94585bef
...
@@ -236,12 +236,16 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
...
@@ -236,12 +236,16 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
baseMapper
.
updateStatusById
(
model
.
getId
(),
model
.
getStatus
());
baseMapper
.
updateStatusById
(
model
.
getId
(),
model
.
getStatus
());
}
}
public
List
<
CourseChaperModel
>
chaperList
(
Long
courseId
)
{
return
chaperList
(
courseId
,
true
);
}
/**
/**
* 获取课程章节列表
* 获取课程章节列表
* @param courseId
* @param courseId
* @param needCoverUrl
* @return
* @return
*/
*/
public
List
<
CourseChaperModel
>
chaperList
(
Long
courseId
)
{
public
List
<
CourseChaperModel
>
chaperList
(
Long
courseId
,
boolean
needCoverUrl
)
{
List
<
CourseChaperModel
>
list
=
Lists
.
newArrayList
();
List
<
CourseChaperModel
>
list
=
Lists
.
newArrayList
();
List
<
CourseChapterPO
>
poList
=
chapterMapper
.
selectList
(
Wrappers
.<
CourseChapterPO
>
lambdaQuery
().
eq
(
CourseChapterPO:
:
getCourseId
,
courseId
).
orderByAsc
(
CourseChapterPO:
:
getSortNo
));
List
<
CourseChapterPO
>
poList
=
chapterMapper
.
selectList
(
Wrappers
.<
CourseChapterPO
>
lambdaQuery
().
eq
(
CourseChapterPO:
:
getCourseId
,
courseId
).
orderByAsc
(
CourseChapterPO:
:
getSortNo
));
if
(
CollUtil
.
isNotEmpty
(
poList
))
{
if
(
CollUtil
.
isNotEmpty
(
poList
))
{
...
@@ -252,7 +256,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
...
@@ -252,7 +256,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
model
.
setCourseId
(
po
.
getCourseId
());
model
.
setCourseId
(
po
.
getCourseId
());
model
.
setSortNo
(
po
.
getSortNo
());
model
.
setSortNo
(
po
.
getSortNo
());
Long
resourceId
=
po
.
getResourceId
();
Long
resourceId
=
po
.
getResourceId
();
setVideoInfo
(
resourceId
,
model
);
setVideoInfo
(
resourceId
,
model
,
needCoverUrl
);
list
.
add
(
model
);
list
.
add
(
model
);
}
}
}
}
...
@@ -264,7 +268,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
...
@@ -264,7 +268,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
* @param resourceId
* @param resourceId
* @param model
* @param model
*/
*/
private
void
setVideoInfo
(
Long
resourceId
,
CourseChaperModel
model
)
{
private
void
setVideoInfo
(
Long
resourceId
,
CourseChaperModel
model
,
boolean
needCoverUrl
)
{
ResourcePO
resourcePO
=
resourceService
.
getById
(
resourceId
);
ResourcePO
resourcePO
=
resourceService
.
getById
(
resourceId
);
if
(
resourcePO
!=
null
)
{
if
(
resourcePO
!=
null
)
{
String
videoId
=
resourcePO
.
getVideoId
();
String
videoId
=
resourcePO
.
getVideoId
();
...
@@ -272,6 +276,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
...
@@ -272,6 +276,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
model
.
setDuration
(
resourcePO
.
getVideoDuration
());
model
.
setDuration
(
resourcePO
.
getVideoDuration
());
model
.
setSize
(
resourcePO
.
getSize
());
model
.
setSize
(
resourcePO
.
getSize
());
if
(
needCoverUrl
){
try
{
try
{
GetVideoInfoResponse
response
=
aliyunService
.
getVideoInfo
(
videoId
);
GetVideoInfoResponse
response
=
aliyunService
.
getVideoInfo
(
videoId
);
GetVideoInfoResponse
.
Video
videoInfo
=
response
.
getVideo
();
GetVideoInfoResponse
.
Video
videoInfo
=
response
.
getVideo
();
...
@@ -285,7 +290,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
...
@@ -285,7 +290,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
}
catch
(
ClientException
e
)
{
}
catch
(
ClientException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
}
}
}
}
...
@@ -624,7 +629,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
...
@@ -624,7 +629,7 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
for
(
SearchCourseResultModel
recommend
:
list
){
for
(
SearchCourseResultModel
recommend
:
list
){
List
<
CourseTagsModel
>
tagList
=
tagService
.
findListByCourseId
(
recommend
.
getCourseId
());
List
<
CourseTagsModel
>
tagList
=
tagService
.
findListByCourseId
(
recommend
.
getCourseId
());
recommend
.
setTags
(
tagList
);
recommend
.
setTags
(
tagList
);
List
<
CourseChaperModel
>
chaperList
=
chaperList
(
recommend
.
getCourseId
());
List
<
CourseChaperModel
>
chaperList
=
chaperList
(
recommend
.
getCourseId
()
,
false
);
if
(
CollUtil
.
isNotEmpty
(
chaperList
)){
if
(
CollUtil
.
isNotEmpty
(
chaperList
)){
CourseChaperModel
chaperModel
=
chaperList
.
get
(
0
);
CourseChaperModel
chaperModel
=
chaperList
.
get
(
0
);
ResourcePO
resourcePO
=
resourceService
.
getById
(
chaperModel
.
getResourceId
());
ResourcePO
resourcePO
=
resourceService
.
getById
(
chaperModel
.
getResourceId
());
...
...
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