Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
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
李丛阳
education
Commits
ee9301d0
Commit
ee9301d0
authored
Nov 06, 2019
by
王淑君
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增删改章节 修改对应进度
parent
8c48bc94
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
3 deletions
+60
-3
BChapterRepository.java
...org/rcisoft/business/bchapter/dao/BChapterRepository.java
+2
-2
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+52
-0
BLessonPersonRepository.java
...rcisoft/business/blesson/dao/BLessonPersonRepository.java
+6
-1
No files found.
src/main/java/org/rcisoft/business/bchapter/dao/BChapterRepository.java
View file @
ee9301d0
...
...
@@ -144,8 +144,8 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"AND t1.del_flag = 0 and t1.flag = 1</script>"
)
List
<
StuScoreDTO
>
selectScoreListBySlIdAndStuId
(
@Param
(
"slid"
)
String
slid
,
@Param
(
"stuid"
)
String
stuid
);
@Delete
(
"<script>delete from b_r_student_chapter where chapter_id = #{chapterId}</script>"
)
int
deleteStudentChapter
(
String
chapterId
);
//
@Delete("<script>delete from b_r_student_chapter where chapter_id = #{chapterId}</script>")
//
int deleteStudentChapter(String chapterId);
/**
* 根据章节id和学生id获取主键
...
...
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
ee9301d0
...
...
@@ -21,6 +21,7 @@ import org.rcisoft.business.bfile.util.GetVideoTime;
import
org.rcisoft.business.blesson.dao.BCollectRepository
;
import
org.rcisoft.business.blesson.dao.BLessonPersonRepository
;
import
org.rcisoft.business.blesson.dao.BLessonRepository
;
import
org.rcisoft.business.blesson.dto.AppointLessonDTO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.bfile.dao.BFileRepository
;
import
org.rcisoft.business.bfile.entity.BFile
;
...
...
@@ -285,9 +286,12 @@ public class BChapterServiceImpl implements BChapterService {
//上传文件数据插入到bfile表中
int
x
=
bFileRepository
.
insertUploadFile
(
bFile
);
bChapterRepository
.
updateClassHourInLesson
(
model
.
getLessonId
());
//更新b_lesson表中 class_hour
// 更新课程总进度
this
.
updateLessonProgress
(
chapterDTO
.
getLessonId
(),
true
);
log
.
debug
(
"-----------------------------更新课时成功-------------------"
);
}
}
else
{
BFile
bFileOld
=
bFileRepository
.
selectInfoByChapterId
(
chapterDTO
.
getBusinessId
());
UserUtil
.
setCurrentMergeOperation
(
model
);
bFile
.
setChapterId
(
model
.
getBusinessId
());
UserUtil
.
setCurrentMergeOperation
(
bFile
);
...
...
@@ -308,6 +312,27 @@ public class BChapterServiceImpl implements BChapterService {
line
=
bChapterRepository
.
updateByPrimaryKeySelective
(
model
);
int
x
=
bFileRepository
.
updateUploadFile
(
bFile
);
// 判断 新文件 更新 课程学习进度(总进度 此章节进度)
if
(!(
bFileOld
.
getVideoUrl
().
equals
(
dto
.
getVideoUrl
()))
)
{
// 所有学习过此课程的 学生课程信息
List
<
BLessonPerson
>
bLessonPersonList
=
bLessonPersonRepository
.
selectByLessonId
(
chapterDTO
.
getLessonId
());
BLesson
bLesson
=
bLessonRepository
.
selectByPrimaryKey
(
chapterDTO
.
getLessonId
());
for
(
BLessonPerson
lessonPerson:
bLessonPersonList
){
// 更新 学生针对此章节的中间表
List
<
BRStudentChapter
>
brStudentChapterList
=
brStudentChapterRepository
.
queryByStuIdAndChapter
(
chapterDTO
.
getBusinessId
(),
""
);
for
(
BRStudentChapter
studentChapter:
brStudentChapterList
){
double
learnProgress
=
Double
.
parseDouble
(
lessonPerson
.
getLearnProgress
().
split
(
"%"
)[
0
])
/
100
;
double
newLearnProgress
=
Math
.
floor
((
learnProgress
*
Integer
.
parseInt
(
bLesson
.
getClassHour
())
-
studentChapter
.
getProgress
())
/
Integer
.
parseInt
(
bLesson
.
getClassHour
()));
if
(
learnProgress
>
0
&&
newLearnProgress
<
0.01
){
newLearnProgress
=
0.01f
;
}
lessonPerson
.
setLearnProgress
(
newLearnProgress
*
100
+
"%"
);
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
lessonPerson
);
studentChapter
.
setProgress
(
0
);
brStudentChapterRepository
.
updateById
(
studentChapter
);
}
}
}
}
//不是为添加章时插入资料表
...
...
@@ -333,6 +358,31 @@ public class BChapterServiceImpl implements BChapterService {
return
new
PersistModel
(
line
);
}
/**
*
* @param lessonId
* @param add true: 新增 false 删除
*/
// 新增章节 - 更新学生观看课程总进度
private
void
updateLessonProgress
(
String
lessonId
,
boolean
add
){
List
<
BLessonPerson
>
bLessonPersonList
=
bLessonPersonRepository
.
selectByLessonId
(
lessonId
);
BLesson
bLesson
=
bLessonRepository
.
selectByPrimaryKey
(
lessonId
);
for
(
BLessonPerson
lessonPerson:
bLessonPersonList
){
float
newLearnProgress
;
float
learnProgress
=
Float
.
parseFloat
(
lessonPerson
.
getLearnProgress
().
split
(
"%"
)[
0
])
/
100
;
if
(
add
){
newLearnProgress
=
(
float
)
Math
.
floor
(
learnProgress
*
Integer
.
parseInt
(
bLesson
.
getClassHour
())
/
(
Integer
.
parseInt
(
bLesson
.
getClassHour
())
+
1
));
}
else
{
newLearnProgress
=
Integer
.
parseInt
(
bLesson
.
getClassHour
())
==
0
?
0
:
(
float
)
Math
.
floor
(
learnProgress
*
Integer
.
parseInt
(
bLesson
.
getClassHour
()
+
1
)
/
(
Integer
.
parseInt
(
bLesson
.
getClassHour
())));
}
if
(
learnProgress
>
0
&&
newLearnProgress
<
0.01
){
newLearnProgress
=
0.01f
;
}
lessonPerson
.
setLearnProgress
(
newLearnProgress
*
100
+
"%"
);
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
lessonPerson
);
}
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
public
PersistModel
update
(
BChapter
model
)
{
...
...
@@ -363,6 +413,8 @@ public class BChapterServiceImpl implements BChapterService {
String
time
=
bChapterRepository
.
getTimeByChapterId
(
secondId
);
//更新到b_lesson 表
bChapterRepository
.
updateCourseTimeForLesson
(
time
,
lessonId
);
// 更新学生 对应章节总进度
this
.
updateLessonProgress
(
lessonId
,
false
);
//删除student_chapter表中数据
bChapterRepository
.
deleteStudentChapter
(
id
,
userId
);
...
...
src/main/java/org/rcisoft/business/blesson/dao/BLessonPersonRepository.java
View file @
ee9301d0
...
...
@@ -143,7 +143,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
* @param param
* @return
*/
@Select
(
"<script>select business_id,person_id from b_lesson_person where 1=1 "
+
@Select
(
"<script>select business_id,person_id
,lesson_id
from b_lesson_person where 1=1 "
+
// "and del_flag = 0 and flag = 1 " +
"AND person_id IN"
+
"<foreach item='item' collection='appointPersonList' open='(' close=')' separator=','> "
+
...
...
@@ -153,6 +153,11 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLessonPerson
>
selectPersonIdByLessonId
(
AppointLessonDTO
param
);
@Select
(
"<script>select business_id,person_id,lesson_id , learn_progress from b_lesson_person where 1=1 "
+
"and lesson_id = #{lessonId}</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLessonPerson
>
selectByLessonId
(
@Param
(
"lessonId"
)
String
lessonId
);
/**
* 按课程id删除指派未开始
* @param param
...
...
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