Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
roncoo
roncoo-education
提交
a8d6c7e6
R
roncoo-education
项目概览
roncoo
/
roncoo-education
大约 1 年 前同步成功
通知
146
Star
5
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roncoo-education
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a8d6c7e6
编写于
10月 01, 2022
作者:
F
fengyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
架构功能升级
上级
e2e0b204
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
3 deletion
+20
-3
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/dao/UserStudyDao.java
...in/java/com/roncoo/education/course/dao/UserStudyDao.java
+2
-0
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/dao/impl/UserStudyDaoImpl.java
...om/roncoo/education/course/dao/impl/UserStudyDaoImpl.java
+7
-0
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/service/admin/biz/AdminCourseChapterBiz.java
...ation/course/service/admin/biz/AdminCourseChapterBiz.java
+7
-0
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/service/auth/biz/AuthUserCourseBiz.java
.../education/course/service/auth/biz/AuthUserCourseBiz.java
+4
-3
未找到文件。
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/dao/UserStudyDao.java
浏览文件 @
a8d6c7e6
...
...
@@ -88,4 +88,6 @@ public interface UserStudyDao {
List
<
UserStudy
>
listByUserIdAndCourseIdsForSumProgress
(
Long
userId
,
List
<
Long
>
courseIdList
);
List
<
UserStudy
>
listByUserIdAndCourseId
(
Long
userId
,
Long
courseId
);
int
deleteByPeriodId
(
Long
periodId
);
}
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/dao/impl/UserStudyDaoImpl.java
浏览文件 @
a8d6c7e6
...
...
@@ -124,4 +124,11 @@ public class UserStudyDaoImpl extends AbstractBaseJdbc implements UserStudyDao {
example
.
createCriteria
().
andUserIdEqualTo
(
userId
).
andCourseIdEqualTo
(
courseId
);
return
this
.
mapper
.
selectByExample
(
example
);
}
@Override
public
int
deleteByPeriodId
(
Long
periodId
)
{
UserStudyExample
example
=
new
UserStudyExample
();
example
.
createCriteria
().
andPeriodIdEqualTo
(
periodId
);
return
this
.
mapper
.
deleteByExample
(
example
);
}
}
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/service/admin/biz/AdminCourseChapterBiz.java
浏览文件 @
a8d6c7e6
...
...
@@ -10,6 +10,7 @@ import com.roncoo.education.common.service.BaseBiz;
import
com.roncoo.education.course.dao.CourseChapterDao
;
import
com.roncoo.education.course.dao.CourseChapterPeriodDao
;
import
com.roncoo.education.course.dao.ResourceDao
;
import
com.roncoo.education.course.dao.UserStudyDao
;
import
com.roncoo.education.course.dao.impl.mapper.entity.CourseChapter
;
import
com.roncoo.education.course.dao.impl.mapper.entity.CourseChapterExample
;
import
com.roncoo.education.course.dao.impl.mapper.entity.CourseChapterExample.Criteria
;
...
...
@@ -24,6 +25,7 @@ import com.roncoo.education.course.service.admin.resp.AdminCourseChapterViewResp
import
com.roncoo.education.course.service.admin.resp.AdminResourceViewResp
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
...
...
@@ -45,6 +47,8 @@ public class AdminCourseChapterBiz extends BaseBiz {
private
final
CourseChapterPeriodDao
courseChapterPeriodDao
;
@NotNull
private
final
ResourceDao
resourceDao
;
@NotNull
private
final
UserStudyDao
userStudyDao
;
/**
* 章节信息分页
...
...
@@ -125,6 +129,7 @@ public class AdminCourseChapterBiz extends BaseBiz {
* @param id ID主键
* @return 删除结果
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
String
>
delete
(
Long
id
)
{
List
<
CourseChapterPeriod
>
periodList
=
courseChapterPeriodDao
.
listByChapterId
(
id
);
if
(
CollUtil
.
isNotEmpty
(
periodList
)
&&
periodList
.
size
()
>
0
){
...
...
@@ -134,6 +139,8 @@ public class AdminCourseChapterBiz extends BaseBiz {
return
Result
.
success
(
"操作成功"
);
}
if
(
courseChapterPeriodDao
.
deleteById
(
id
)
>
0
)
{
// 删除课时,也需要删除对应的学习记录,否则统计进度出现数据异常
userStudyDao
.
deleteByPeriodId
(
id
);
return
Result
.
success
(
"操作成功"
);
}
return
Result
.
error
(
"操作失败"
);
...
...
roncoo-education-course/roncoo-education-course-service/src/main/java/com/roncoo/education/course/service/auth/biz/AuthUserCourseBiz.java
浏览文件 @
a8d6c7e6
...
...
@@ -52,16 +52,16 @@ public class AuthUserCourseBiz extends BaseBiz {
Page
<
AuthUserCourseResp
>
respPage
=
PageUtil
.
transform
(
userCoursePage
,
AuthUserCourseResp
.
class
);
if
(
CollUtil
.
isNotEmpty
(
respPage
.
getList
()))
{
List
<
Long
>
courseIdList
=
respPage
.
getList
().
stream
().
map
(
AuthUserCourseResp:
:
getCourseId
).
collect
(
Collectors
.
toList
());
// 用户学习记录
// 用户学习记录
,获取每个课程里面最新学习的课时
Map
<
Long
,
UserStudy
>
userStudyMap
=
new
HashMap
<>();
List
<
UserStudy
>
userStudyList
=
userStudyDao
.
listByUserIdAndCourseIdsForMax
(
ThreadContext
.
userId
(),
courseIdList
);
if
(
CollUtil
.
isNotEmpty
(
userStudyList
))
{
userStudyMap
=
userStudyList
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getCourseId
(),
item
->
item
));
}
// 课时
信息
// 课时
名称
Map
<
Long
,
String
>
periodNameMap
=
new
HashMap
<>();
// 课时数
//
每个课程的
课时数
Map
<
Long
,
Long
>
periodSumMap
=
new
HashMap
<>();
List
<
CourseChapterPeriod
>
courseChapterPeriodList
=
courseChapterPeriodDao
.
listByCourseIds
(
courseIdList
);
if
(
CollUtil
.
isNotEmpty
(
courseChapterPeriodList
))
{
...
...
@@ -69,6 +69,7 @@ public class AuthUserCourseBiz extends BaseBiz {
periodSumMap
=
courseChapterPeriodList
.
stream
().
collect
(
Collectors
.
groupingBy
(
item
->
item
.
getCourseId
(),
Collectors
.
counting
()));
}
// 每个课程的学习进度汇总
Map
<
Long
,
BigDecimal
>
userStudySumMap
=
new
HashMap
<>();
List
<
UserStudy
>
userStudySumList
=
userStudyDao
.
listByUserIdAndCourseIdsForSumProgress
(
ThreadContext
.
userId
(),
courseIdList
);
if
(
CollUtil
.
isNotEmpty
(
userStudySumList
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录