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
2426ac2a
Commit
2426ac2a
authored
Dec 11, 2019
by
luzhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
75fec82e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+21
-10
No files found.
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
2426ac2a
...
@@ -312,7 +312,7 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -312,7 +312,7 @@ public class BChapterServiceImpl implements BChapterService {
// 新增节 才更新进度
// 新增节 才更新进度
if
(
2
==
chapterDTO
.
getChapterLevel
()){
if
(
2
==
chapterDTO
.
getChapterLevel
()){
// 更新课程总进度
// 更新课程总进度
this
.
updateLessonProgress
(
chapterDTO
.
getLessonId
(),
true
,
0
,
""
);
this
.
updateLessonProgress
(
chapterDTO
.
getLessonId
(),
true
,
""
);
}
}
log
.
debug
(
"-----------------------------更新课时成功-------------------"
);
log
.
debug
(
"-----------------------------更新课时成功-------------------"
);
}
}
...
@@ -447,11 +447,13 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -447,11 +447,13 @@ public class BChapterServiceImpl implements BChapterService {
* @param add true: 新增 false 删除
* @param add true: 新增 false 删除
*/
*/
// 新增章节 - 更新学生观看课程总进度
// 新增章节 - 更新学生观看课程总进度
private
void
updateLessonProgress
(
String
lessonId
,
boolean
add
,
double
delProgress
,
String
chapterId
){
private
void
updateLessonProgress
(
String
lessonId
,
boolean
add
,
String
chapterId
){
NumberFormat
numberFormat
=
NumberFormat
.
getInstance
();
NumberFormat
numberFormat
=
NumberFormat
.
getInstance
();
numberFormat
.
setMaximumFractionDigits
(
2
);
numberFormat
.
setMaximumFractionDigits
(
2
);
List
<
BLessonPerson
>
bLessonPersonList
=
bLessonPersonRepository
.
selectByLessonId
(
lessonId
,
""
);
List
<
BLessonPerson
>
bLessonPersonList
=
bLessonPersonRepository
.
selectByLessonId
(
lessonId
,
""
);
BLesson
bLesson
=
bLessonRepository
.
selectByPrimaryKey
(
lessonId
);
BLesson
bLesson
=
bLessonRepository
.
selectByPrimaryKey
(
lessonId
);
for
(
BLessonPerson
lessonPerson:
bLessonPersonList
){
for
(
BLessonPerson
lessonPerson:
bLessonPersonList
){
if
(!
add
&&
null
!=
lessonPerson
.
getChapterId
()
&&
lessonPerson
.
getChapterId
().
equals
(
chapterId
)){
if
(!
add
&&
null
!=
lessonPerson
.
getChapterId
()
&&
lessonPerson
.
getChapterId
().
equals
(
chapterId
)){
bLessonPersonRepository
.
clearChapterId
(
lessonPerson
.
getBusinessId
());
bLessonPersonRepository
.
clearChapterId
(
lessonPerson
.
getBusinessId
());
...
@@ -460,12 +462,18 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -460,12 +462,18 @@ public class BChapterServiceImpl implements BChapterService {
if
(
lessonPerson
.
getLearnProgress
()
==
null
){
if
(
lessonPerson
.
getLearnProgress
()
==
null
){
break
;
break
;
}
}
List
<
BRStudentChapter
>
brStudentChapterList
=
brStudentChapterRepository
.
queryByStuIdAndChapter
(
chapterId
,
lessonPerson
.
getPersonId
());
double
oldProgress
=
0
;
if
(
null
!=
brStudentChapterList
&&
brStudentChapterList
.
size
()>
0
){
oldProgress
=
brStudentChapterList
.
get
(
0
).
getProgress
();
}
double
learnProgress
=
Double
.
parseDouble
(
lessonPerson
.
getLearnProgress
().
split
(
"%"
)[
0
])
/
100
;
double
learnProgress
=
Double
.
parseDouble
(
lessonPerson
.
getLearnProgress
().
split
(
"%"
)[
0
])
/
100
;
if
(
add
){
if
(
add
){
newLearnProgress
=
Integer
.
parseInt
(
bLesson
.
getClassHour
())
-
1
==
0
?
"0"
:
numberFormat
.
format
(
learnProgress
*
(
Integer
.
parseInt
(
bLesson
.
getClassHour
())
-
1
)
/
(
Double
.
parseDouble
(
bLesson
.
getClassHour
()))
);
newLearnProgress
=
Integer
.
parseInt
(
bLesson
.
getClassHour
())
-
1
==
0
?
"0"
:
numberFormat
.
format
(
learnProgress
*
(
Integer
.
parseInt
(
bLesson
.
getClassHour
())
-
1
)
/
(
Double
.
parseDouble
(
bLesson
.
getClassHour
()))
);
}
else
{
}
else
{
int
oldClassHour
=
Integer
.
parseInt
(
bLesson
.
getClassHour
())
+
1
;
int
oldClassHour
=
Integer
.
parseInt
(
bLesson
.
getClassHour
())
+
1
;
newLearnProgress
=
numberFormat
.
format
((
learnProgress
*
oldClassHour
-
del
Progress
)/(
oldClassHour
-
1
)
);
newLearnProgress
=
numberFormat
.
format
((
learnProgress
*
oldClassHour
-
old
Progress
)/(
oldClassHour
-
1
)
);
}
}
if
(
0
==
Double
.
parseDouble
(
newLearnProgress
)){
if
(
0
==
Double
.
parseDouble
(
newLearnProgress
)){
lessonPerson
.
setIsFinish
(
"0"
);
lessonPerson
.
setIsFinish
(
"0"
);
...
@@ -485,6 +493,7 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -485,6 +493,7 @@ public class BChapterServiceImpl implements BChapterService {
lessonPerson
.
setIsFinish
(
"2"
);
lessonPerson
.
setIsFinish
(
"2"
);
}
}
}
}
//TODO 判断 曾经是否学完过 奖励积分
//TODO 判断 曾经是否学完过 奖励积分
if
(
"2"
.
equals
(
lessonPerson
.
getIsFinish
())
&&
!(
"1"
.
equals
(
lessonPerson
.
getEverFinished
()))){
if
(
"2"
.
equals
(
lessonPerson
.
getIsFinish
())
&&
!(
"1"
.
equals
(
lessonPerson
.
getEverFinished
()))){
//查询课程信息
//查询课程信息
...
@@ -498,6 +507,8 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -498,6 +507,8 @@ public class BChapterServiceImpl implements BChapterService {
lessonPerson
.
setLearnProgress
(
Float
.
parseFloat
(
newLearnProgress
)*
100
+
"%"
);
lessonPerson
.
setLearnProgress
(
Float
.
parseFloat
(
newLearnProgress
)*
100
+
"%"
);
bLessonPersonRepository
.
updateAtChapter
(
lessonPerson
);
bLessonPersonRepository
.
updateAtChapter
(
lessonPerson
);
// 根据chapter_id 删除b_r_student_chapter
brStudentChapterRepository
.
deleteBatchByChapterId
(
chapterId
);
}
}
}
}
...
@@ -564,18 +575,18 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -564,18 +575,18 @@ public class BChapterServiceImpl implements BChapterService {
//更新表中sort
//更新表中sort
bChapterRepository
.
updateSort
(
params
);
bChapterRepository
.
updateSort
(
params
);
}
}
List
<
BRStudentChapter
>
brStudentChapterList
=
brStudentChapterRepository
.
queryByStuIdAndChapter
(
id
,
curUser
.
getUserId
());
//
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(id, curUser.getUserId());
// 判断 2-节 才重新计算进度
// 判断 2-节 才重新计算进度
if
(
2
==
bChapter
.
getChapterLevel
()){
if
(
2
==
bChapter
.
getChapterLevel
()){
// double oldProgress = 0;
// if (null !=brStudentChapterList && brStudentChapterList.size()>0){
// oldProgress = brStudentChapterList.get(0).getProgress();
// }
// 根据chapter_id 删除b_r_student_chapter
// 根据chapter_id 删除b_r_student_chapter
brStudentChapterRepository
.
deleteBatchByChapterId
(
id
);
// brStudentChapterRepository.deleteBatchByChapterId(id);
double
oldProgress
=
0
;
if
(
null
!=
brStudentChapterList
&&
brStudentChapterList
.
size
()>
0
){
oldProgress
=
brStudentChapterList
.
get
(
0
).
getProgress
();
}
// 更新学生 对应章节总进度
// 更新学生 对应章节总进度
this
.
updateLessonProgress
(
lessonId
,
false
,
oldProgress
,
id
);
this
.
updateLessonProgress
(
lessonId
,
false
,
id
);
}
}
//删除student_chapter表中数据
//删除student_chapter表中数据
...
...
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