Commit 4e51cb2c authored by zhangqingle's avatar zhangqingle

Merge remote-tracking branch 'origin/meiteng' into zql

parents 9123e7d1 dfd8fd8b
...@@ -435,5 +435,8 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -435,5 +435,8 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"</foreach>" + "</foreach>" +
"</script>") "</script>")
int updateSort(@Param("map") List<Map<String,Object>> map); int updateSort(@Param("map") List<Map<String,Object>> map);
@Update("update b_chapter set chapter_name = #{name} where business_id = #{id}")
int updateChapterName(@Param("name")String name,@Param("id") String id);
} }
...@@ -308,12 +308,19 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -308,12 +308,19 @@ public class BChapterServiceImpl implements BChapterService {
//上传文件数据插入到bfile表中 //上传文件数据插入到bfile表中
int x = bFileRepository.insertUploadFile(bFile); int x = bFileRepository.insertUploadFile(bFile);
bChapterRepository.updateClassHourInLesson(model.getLessonId());//更新b_lesson表中 class_hour bChapterRepository.updateClassHourInLesson(model.getLessonId());//更新b_lesson表中 class_hour
// 更新课程总进度 // 新增节 才更新进度
this.updateLessonProgress(chapterDTO.getLessonId(), true, 0); if (2 == chapterDTO.getChapterLevel()){
// 更新课程总进度
this.updateLessonProgress(chapterDTO.getLessonId(), true, 0);
}
log.debug("-----------------------------更新课时成功-------------------"); log.debug("-----------------------------更新课时成功-------------------");
} }
} else { } else {
BFile bFileOld = bFileRepository.selectInfoByChapterId(chapterDTO.getBusinessId()); BFile bFileOld = bFileRepository.selectInfoByChapterId(chapterDTO.getBusinessId());
if(model.getChapterLevel()==1){
int x = bChapterRepository.updateChapterName(model.getChapterName(),model.getBusinessId());
return new PersistModel(x);
}
UserUtil.setCurrentMergeOperation(model); UserUtil.setCurrentMergeOperation(model);
bFile.setChapterId(model.getBusinessId()); bFile.setChapterId(model.getBusinessId());
UserUtil.setCurrentMergeOperation(bFile); UserUtil.setCurrentMergeOperation(bFile);
...@@ -396,6 +403,9 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -396,6 +403,9 @@ public class BChapterServiceImpl implements BChapterService {
// lessonPerson.setFinishDate(null); // lessonPerson.setFinishDate(null);
lessonPerson.setFinishDateSetNull("1"); lessonPerson.setFinishDateSetNull("1");
} }
// 规避 复数 和超100% 的情况
newLearnProgress = newLearnProgress > 1 ? 1: newLearnProgress < 0 ? 0 : newLearnProgress;
lessonPerson.setLearnProgress(newLearnProgress * 100 + "%"); lessonPerson.setLearnProgress(newLearnProgress * 100 + "%");
bLessonPersonRepository.updateAtChapter(lessonPerson); bLessonPersonRepository.updateAtChapter(lessonPerson);
studentChapter.setProgress(0); studentChapter.setProgress(0);
...@@ -452,7 +462,6 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -452,7 +462,6 @@ public class BChapterServiceImpl implements BChapterService {
}else { }else {
int oldClassHour = Integer.parseInt(bLesson.getClassHour()) + 1; int oldClassHour = Integer.parseInt(bLesson.getClassHour()) + 1;
newLearnProgress = numberFormat.format((learnProgress * oldClassHour - delProgress)/(oldClassHour -1) ); newLearnProgress = numberFormat.format((learnProgress * oldClassHour - delProgress)/(oldClassHour -1) );
// newLearnProgress = numberFormat.format(learnProgress - delProgress/ (Integer.parseInt(bLesson.getClassHour()) + 1));
} }
if (0 == Double.parseDouble(newLearnProgress)){ if (0 == Double.parseDouble(newLearnProgress)){
lessonPerson.setIsFinish("0"); lessonPerson.setIsFinish("0");
...@@ -479,6 +488,9 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -479,6 +488,9 @@ public class BChapterServiceImpl implements BChapterService {
bLessonServiceImpl.addValueEvent(lessonPerson.getPersonId(),bPersonValue,null); bLessonServiceImpl.addValueEvent(lessonPerson.getPersonId(),bPersonValue,null);
lessonPerson.setEverFinished("1"); lessonPerson.setEverFinished("1");
} }
// 规避 复数 和超100% 的情况
float tempTotalProgress = Float.parseFloat(newLearnProgress);
newLearnProgress = String.valueOf(tempTotalProgress > 1 ? 1: tempTotalProgress < 0 ? 0 : tempTotalProgress);
lessonPerson.setLearnProgress(Float.parseFloat(newLearnProgress)*100+"%"); lessonPerson.setLearnProgress(Float.parseFloat(newLearnProgress)*100+"%");
bLessonPersonRepository.updateAtChapter(lessonPerson); bLessonPersonRepository.updateAtChapter(lessonPerson);
...@@ -537,12 +549,16 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -537,12 +549,16 @@ public class BChapterServiceImpl implements BChapterService {
bChapterRepository.updateSort(params); bChapterRepository.updateSort(params);
} }
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(id, userId); List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(id, userId);
double oldProgress = 0;
if (null !=brStudentChapterList && brStudentChapterList.size()>0){ // 判断 2-节 才重新计算进度
oldProgress = brStudentChapterList.get(0).getProgress(); if (2 == bChapter.getChapterLevel()){
double oldProgress = 0;
if (null !=brStudentChapterList && brStudentChapterList.size()>0){
oldProgress = brStudentChapterList.get(0).getProgress();
}
// 更新学生 对应章节总进度
this.updateLessonProgress(lessonId, false, oldProgress);
} }
// 更新学生 对应章节总进度
this.updateLessonProgress(lessonId, false, oldProgress);
//删除student_chapter表中数据 //删除student_chapter表中数据
bChapterRepository.deleteBStudentChapter(id,userId); bChapterRepository.deleteBStudentChapter(id,userId);
......
...@@ -67,7 +67,6 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService { ...@@ -67,7 +67,6 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
@Override @Override
public PersistModel save(BRStudentChapterDto brStudentChapterDto, CurUser curUser){ public PersistModel save(BRStudentChapterDto brStudentChapterDto, CurUser curUser){
int line = 0; int line = 0;
// DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
NumberFormat numberFormat = NumberFormat.getInstance(); NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(0); numberFormat.setMaximumFractionDigits(0);
// 查詢是否已經開始觀看此章節 // 查詢是否已經開始觀看此章節
...@@ -124,8 +123,10 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService { ...@@ -124,8 +123,10 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
if (i == 0){ if (i == 0){
totalProgress = "0%"; totalProgress = "0%";
}else { }else {
totalProgress = numberFormat.format((float) percent / (float) i * 100) + "%"; // 规避 复数 和超100% 的情况
// totalProgress = df.format((float) ((percent / i) * 100)) + "%"; float tempTotalProgress = Float.parseFloat(numberFormat.format((float) percent / (float) i * 100));
totalProgress = tempTotalProgress > 100 ? "100%" : tempTotalProgress < 0 ? "0%" : tempTotalProgress + "%";
// totalProgress = tempTotalProgress + "%";
}; };
// 判斷是否已經開始觀看此課程 // 判斷是否已經開始觀看此課程
if (null != bLessonPersonList && bLessonPersonList.size() >0 && bLessonPersonList.get(0) != null){ if (null != bLessonPersonList && bLessonPersonList.size() >0 && bLessonPersonList.get(0) != null){
......
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