Commit 2081ddca authored by zhangqingle's avatar zhangqingle

Merge branch 'meiteng' of ssh://103.249.252.28:10022/lcy/education into meiteng

parents 92804c46 ee87005e
...@@ -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,28 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService { ...@@ -163,6 +165,28 @@ 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{
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 * 根据id查询 bRStudentChapter
* @param id * @param id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment