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
f2f2ac56
Commit
f2f2ac56
authored
Nov 04, 2019
by
王淑君
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改接口
parent
402b695e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
27 deletions
+52
-27
BRStudentChapterServiceImpl.java
...dentchapter/service/impl/BRStudentChapterServiceImpl.java
+52
-27
No files found.
src/main/java/org/rcisoft/business/brstudentchapter/service/impl/BRStudentChapterServiceImpl.java
View file @
f2f2ac56
...
@@ -71,17 +71,12 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
...
@@ -71,17 +71,12 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
String
isFinish
=
"0"
;
String
isFinish
=
"0"
;
// 沒有開始看-新增信息
// 沒有開始看-新增信息
if
(
null
!=
brStudentChapterList
&&
brStudentChapterList
.
size
()
>
0
){
if
(
null
!=
brStudentChapterList
&&
brStudentChapterList
.
size
()
>
0
){
BRStudentChapter
brStudentChapter
=
brStudentChapterList
.
get
(
0
);
double
old
=
brStudentChapterList
.
get
(
0
).
getProgress
();
brStudentChapter
.
setCurrentLocation
(
brStudentChapterDto
.
getCurrent
());
BRStudentChapter
brStudentChapter
=
this
.
dealBrstudentChapter
(
brStudentChapterList
.
get
(
0
),
brStudentChapterDto
);
if
(
brStudentChapterDto
.
getCurrent
().
equals
(
brStudentChapterDto
.
getDuration
())){
if
(
1
==
brStudentChapter
.
getProgress
()){
brStudentChapter
.
setProgress
(
1
);
isFinish
=
"2"
;
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
();
double
now
=
brStudentChapter
.
getProgress
();
if
(
now
>
old
){
if
(
now
>
old
){
line
=
bRStudentChapterRepository
.
updateById
(
brStudentChapter
);
line
=
bRStudentChapterRepository
.
updateById
(
brStudentChapter
);
...
@@ -89,18 +84,23 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
...
@@ -89,18 +84,23 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
}
else
{
// 更新
}
else
{
// 更新
BRStudentChapter
brStudentChapter
=
new
BRStudentChapter
();
BRStudentChapter
brStudentChapter
=
new
BRStudentChapter
();
brStudentChapter
.
setBusinessId
(
IdGen
.
uuid
());
brStudentChapter
.
setBusinessId
(
IdGen
.
uuid
());
brStudentChapter
=
this
.
dealBrstudentChapter
(
brStudentChapter
,
brStudentChapterDto
);
brStudentChapter
.
setStudentId
(
brStudentChapterDto
.
getStudentId
());
brStudentChapter
.
setStudentId
(
brStudentChapterDto
.
getStudentId
());
brStudentChapter
.
setChapterId
(
brStudentChapterDto
.
getChapterId
());
brStudentChapter
.
setChapterId
(
brStudentChapterDto
.
getChapterId
());
brStudentChapter
.
setCurrentLocation
(
brStudentChapterDto
.
getCurrent
());
// 保存當前學習進度
if
(
1
==
brStudentChapter
.
getProgress
()){
if
(
brStudentChapterDto
.
getCurrent
()
==
brStudentChapterDto
.
getDuration
()){
// 判断是否已经完成
brStudentChapter
.
setIsComplete
(
"1"
);
brStudentChapter
.
setProgress
(
1
);
isFinish
=
"2"
;
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
);
line
=
bRStudentChapterRepository
.
insertSelective
(
brStudentChapter
);
}
}
// b_lesson_person
// b_lesson_person
...
@@ -135,23 +135,25 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
...
@@ -135,23 +135,25 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
};
};
// 判斷是否已經開始觀看此課程
// 判斷是否已經開始觀看此課程
if
(
null
!=
bLessonPersonList
&&
bLessonPersonList
.
size
()
>
0
){
if
(
null
!=
bLessonPersonList
&&
bLessonPersonList
.
size
()
>
0
){
BLessonPerson
bLessonPerson
=
bLessonPersonList
.
get
(
0
);
BLessonPerson
bLessonPerson
=
this
.
dealBLessonPerson
(
bLessonPersonList
.
get
(
0
),
brStudentChapterDto
,
totalProgress
,
isFinish
);
bLessonPerson
.
setChapterId
(
brStudentChapterDto
.
getChapterId
());
// BLessonPerson bLessonPerson = bLessonPersonList.get(0);
bLessonPerson
.
setLearnProgress
(
totalProgress
);
// 保存课程学习进度
// bLessonPerson.setChapterId(brStudentChapterDto.getChapterId());
if
(
"2"
.
equals
(
isFinish
))
// bLessonPerson.setLearnProgress(totalProgress); // 保存课程学习进度
bLessonPerson
.
setFinishDate
(
new
Date
());
// if ("2".equals(isFinish))
bLessonPerson
.
setIsFinish
(
isFinish
);
// bLessonPerson.setFinishDate(new Date());
// bLessonPerson.setIsFinish(isFinish);
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
bLessonPerson
);
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
bLessonPerson
);
}
else
{
}
else
{
BLessonPerson
bLessonPerson
=
new
BLessonPerson
();
BLessonPerson
bLessonPerson
=
new
BLessonPerson
();
UserUtil
.
setCurrentPersistOperation
(
bLessonPerson
);
UserUtil
.
setCurrentPersistOperation
(
bLessonPerson
);
bLessonPerson
.
setChapterId
(
brStudentChapterDto
.
getChapterId
()
);
bLessonPerson
=
this
.
dealBLessonPerson
(
bLessonPersonList
.
get
(
0
),
brStudentChapterDto
,
totalProgress
,
isFinish
);
bLessonPerson
.
setPersonId
(
brStudentChapterDto
.
getStudentId
());
bLessonPerson
.
setPersonId
(
brStudentChapterDto
.
getStudentId
());
bLessonPerson
.
setLessonId
(
brStudentChapterDto
.
getLessonId
());
bLessonPerson
.
setLessonId
(
brStudentChapterDto
.
getLessonId
());
bLessonPerson
.
setLearnProgress
(
totalProgress
);
// 保存课程学习进度
// if ("2".equals(isFinish))
if
(
"2"
.
equals
(
isFinish
))
// bLessonPerson.setFinishDate(new Date());
bLessonPerson
.
setFinishDate
(
new
Date
());
// bLessonPerson.setIsFinish(isFinish);
bLessonPerson
.
setIsFinish
(
isFinish
);
// bLessonPerson.setChapterId(brStudentChapterDto.getChapterId());
// bLessonPerson.setLearnProgress(totalProgress); // 保存课程学习进度
line
=
bLessonPersonRepository
.
insertSelective
(
bLessonPerson
)
>
line
?
bLessonPersonRepository
.
insertSelective
(
bLessonPerson
):
line
;
line
=
bLessonPersonRepository
.
insertSelective
(
bLessonPerson
)
>
line
?
bLessonPersonRepository
.
insertSelective
(
bLessonPerson
):
line
;
}
}
// 获取章节总进度 存库
// 获取章节总进度 存库
...
@@ -163,6 +165,29 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
...
@@ -163,6 +165,29 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
return
new
PersistModel
(
line
);
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
{
float
num
=
(
float
)(
Math
.
floor
((
float
)
brStudentChapterDto
.
getCurrent
()/
brStudentChapterDto
.
getDuration
()*
10000
))/
10000
;
brStudentChapter
.
setProgress
(
num
);
}
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
* 根据id查询 bRStudentChapter
* @param id
* @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