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
2081ddca
Commit
2081ddca
authored
Nov 04, 2019
by
zhangqingle
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'meiteng' of
ssh://103.249.252.28:10022/lcy/education
into meiteng
parents
92804c46
ee87005e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
27 deletions
+51
-27
BRStudentChapterServiceImpl.java
...dentchapter/service/impl/BRStudentChapterServiceImpl.java
+51
-27
No files found.
src/main/java/org/rcisoft/business/brstudentchapter/service/impl/BRStudentChapterServiceImpl.java
View file @
2081ddca
...
...
@@ -71,17 +71,12 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
String
isFinish
=
"0"
;
// 沒有開始看-新增信息
if
(
null
!=
brStudentChapterList
&&
brStudentChapterList
.
size
()
>
0
){
BRStudentChapter
brStudentChapter
=
brStudentChapterList
.
get
(
0
);
brStudentChapter
.
setCurrentLocation
(
brStudentChapterDto
.
getCurrent
());
if
(
brStudentChapterDto
.
getCurrent
().
equals
(
brStudentChapterDto
.
getDuration
())){
brStudentChapter
.
setProgress
(
1
);
double
old
=
brStudentChapterList
.
get
(
0
).
getProgress
();
BRStudentChapter
brStudentChapter
=
this
.
dealBrstudentChapter
(
brStudentChapterList
.
get
(
0
),
brStudentChapterDto
);
if
(
1
==
brStudentChapter
.
getProgress
()){
isFinish
=
"2"
;
}
else
{
isFinish
=
"1"
;
brStudentChapter
.
setProgress
(
new
BigDecimal
((
float
)
brStudentChapterDto
.
getCurrent
()/
brStudentChapterDto
.
getDuration
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
());
}
// 判断进度 是否大于数据库已经存在的进度
double
old
=
brStudentChapterList
.
get
(
0
).
getProgress
();
double
now
=
brStudentChapter
.
getProgress
();
if
(
now
>
old
){
line
=
bRStudentChapterRepository
.
updateById
(
brStudentChapter
);
...
...
@@ -89,18 +84,23 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
}
else
{
// 更新
BRStudentChapter
brStudentChapter
=
new
BRStudentChapter
();
brStudentChapter
.
setBusinessId
(
IdGen
.
uuid
());
brStudentChapter
=
this
.
dealBrstudentChapter
(
brStudentChapter
,
brStudentChapterDto
);
brStudentChapter
.
setStudentId
(
brStudentChapterDto
.
getStudentId
());
brStudentChapter
.
setChapterId
(
brStudentChapterDto
.
getChapterId
());
brStudentChapter
.
setCurrentLocation
(
brStudentChapterDto
.
getCurrent
());
// 保存當前學習進度
if
(
brStudentChapterDto
.
getCurrent
()
==
brStudentChapterDto
.
getDuration
()){
// 判断是否已经完成
brStudentChapter
.
setIsComplete
(
"1"
);
brStudentChapter
.
setProgress
(
1
);
if
(
1
==
brStudentChapter
.
getProgress
()){
isFinish
=
"2"
;
}
else
{
isFinish
=
"1"
;
brStudentChapter
.
setIsComplete
(
"0"
);
brStudentChapter
.
setProgress
(
new
BigDecimal
((
float
)
brStudentChapterDto
.
getCurrent
()/
brStudentChapterDto
.
getDuration
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
());
}
// brStudentChapter.setCurrentLocation(brStudentChapterDto.getCurrent()); // 保存當前學習進度
// if (brStudentChapterDto.getCurrent().equals(brStudentChapterDto.getDuration())){ // 判断是否已经完成
// brStudentChapter.setIsComplete("1");
// brStudentChapter.setProgress(1);
// isFinish = "2";
// }else {
// isFinish = "1";
// brStudentChapter.setIsComplete("0");
// brStudentChapter.setProgress((float)brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration());
//// brStudentChapter.setProgress(new BigDecimal((float)brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
// }
line
=
bRStudentChapterRepository
.
insertSelective
(
brStudentChapter
);
}
// b_lesson_person
...
...
@@ -135,23 +135,25 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
};
// 判斷是否已經開始觀看此課程
if
(
null
!=
bLessonPersonList
&&
bLessonPersonList
.
size
()
>
0
){
BLessonPerson
bLessonPerson
=
bLessonPersonList
.
get
(
0
);
bLessonPerson
.
setChapterId
(
brStudentChapterDto
.
getChapterId
());
bLessonPerson
.
setLearnProgress
(
totalProgress
);
// 保存课程学习进度
if
(
"2"
.
equals
(
isFinish
))
bLessonPerson
.
setFinishDate
(
new
Date
());
bLessonPerson
.
setIsFinish
(
isFinish
);
BLessonPerson
bLessonPerson
=
this
.
dealBLessonPerson
(
bLessonPersonList
.
get
(
0
),
brStudentChapterDto
,
totalProgress
,
isFinish
);
// BLessonPerson bLessonPerson = bLessonPersonList.get(0);
// bLessonPerson.setChapterId(brStudentChapterDto.getChapterId());
// bLessonPerson.setLearnProgress(totalProgress); // 保存课程学习进度
// if ("2".equals(isFinish))
// bLessonPerson.setFinishDate(new Date());
// bLessonPerson.setIsFinish(isFinish);
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
bLessonPerson
);
}
else
{
BLessonPerson
bLessonPerson
=
new
BLessonPerson
();
UserUtil
.
setCurrentPersistOperation
(
bLessonPerson
);
bLessonPerson
.
setChapterId
(
brStudentChapterDto
.
getChapterId
()
);
bLessonPerson
=
this
.
dealBLessonPerson
(
bLessonPersonList
.
get
(
0
),
brStudentChapterDto
,
totalProgress
,
isFinish
);
bLessonPerson
.
setPersonId
(
brStudentChapterDto
.
getStudentId
());
bLessonPerson
.
setLessonId
(
brStudentChapterDto
.
getLessonId
());
bLessonPerson
.
setLearnProgress
(
totalProgress
);
// 保存课程学习进度
if
(
"2"
.
equals
(
isFinish
))
bLessonPerson
.
setFinishDate
(
new
Date
());
bLessonPerson
.
setIsFinish
(
isFinish
);
// if ("2".equals(isFinish))
// bLessonPerson.setFinishDate(new Date());
// bLessonPerson.setIsFinish(isFinish);
// bLessonPerson.setChapterId(brStudentChapterDto.getChapterId());
// bLessonPerson.setLearnProgress(totalProgress); // 保存课程学习进度
line
=
bLessonPersonRepository
.
insertSelective
(
bLessonPerson
)
>
line
?
bLessonPersonRepository
.
insertSelective
(
bLessonPerson
):
line
;
}
// 获取章节总进度 存库
...
...
@@ -163,6 +165,28 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
return
new
PersistModel
(
line
);
}
// b_r_student_chapter
private
BRStudentChapter
dealBrstudentChapter
(
BRStudentChapter
brStudentChapter
,
BRStudentChapterDto
brStudentChapterDto
){
brStudentChapter
.
setCurrentLocation
(
brStudentChapterDto
.
getCurrent
());
if
(
brStudentChapterDto
.
getCurrent
().
equals
(
brStudentChapterDto
.
getDuration
())){
brStudentChapter
.
setProgress
(
1
);
}
else
{
brStudentChapter
.
setProgress
((
Math
.
floor
((
float
)
brStudentChapterDto
.
getCurrent
()/
brStudentChapterDto
.
getDuration
()*
100
))/
100
);
}
return
brStudentChapter
;
}
// b_lesson_person
private
BLessonPerson
dealBLessonPerson
(
BLessonPerson
bLessonPerson
,
BRStudentChapterDto
brStudentChapterDto
,
String
totalProgress
,
String
isFinish
){
bLessonPerson
.
setChapterId
(
brStudentChapterDto
.
getChapterId
());
bLessonPerson
.
setLearnProgress
(
totalProgress
);
// 保存课程学习进度
if
(
"2"
.
equals
(
isFinish
))
bLessonPerson
.
setFinishDate
(
new
Date
());
bLessonPerson
.
setIsFinish
(
isFinish
);
return
bLessonPerson
;
}
/**
* 根据id查询 bRStudentChapter
* @param id
...
...
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