Commit d271d6a6 authored by 王淑君's avatar 王淑君

修改bug

parent f32416d5
...@@ -323,12 +323,13 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -323,12 +323,13 @@ public class BChapterServiceImpl implements BChapterService {
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(chapterDTO.getBusinessId(), ""); List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(chapterDTO.getBusinessId(), "");
for (BRStudentChapter studentChapter: brStudentChapterList){ for (BRStudentChapter studentChapter: brStudentChapterList){
double learnProgress = Double.parseDouble(lessonPerson.getLearnProgress().split("%")[0]) / 100 ; double learnProgress = Double.parseDouble(lessonPerson.getLearnProgress().split("%")[0]) / 100 ;
double newLearnProgress = Math.floor((learnProgress * Integer.parseInt(bLesson.getClassHour()) - studentChapter.getProgress()) / Integer.parseInt(bLesson.getClassHour())); double newLearnProgress = (learnProgress * Integer.parseInt(bLesson.getClassHour()) - studentChapter.getProgress()) / Double.parseDouble(bLesson.getClassHour());
if (learnProgress > 0 && newLearnProgress < 0.01){ if (learnProgress > 0 && newLearnProgress < 0.01){
newLearnProgress = 0.01f; newLearnProgress = 0.01;
} }
if ("2".equals(lessonPerson.getIsFinish()) && newLearnProgress < 1){ if ("2".equals(lessonPerson.getIsFinish()) && newLearnProgress < 1){
lessonPerson.setIsFinish("1"); lessonPerson.setIsFinish("1");
lessonPerson.setFinishDate(null);
} }
lessonPerson.setLearnProgress(newLearnProgress*100 + "%"); lessonPerson.setLearnProgress(newLearnProgress*100 + "%");
bLessonPersonRepository.updateByPrimaryKeySelective(lessonPerson); bLessonPersonRepository.updateByPrimaryKeySelective(lessonPerson);
...@@ -372,19 +373,20 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -372,19 +373,20 @@ public class BChapterServiceImpl implements BChapterService {
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){
float newLearnProgress ; double newLearnProgress ;
float learnProgress = Float.parseFloat(lessonPerson.getLearnProgress().split("%")[0]) / 100 ; double learnProgress = Double.parseDouble(lessonPerson.getLearnProgress().split("%")[0]) / 100 ;
if (add){ if (add){
newLearnProgress = (float) Math.floor(learnProgress * Integer.parseInt(bLesson.getClassHour()) / (Integer.parseInt(bLesson.getClassHour()) + 1)); newLearnProgress = (float) Math.floor(learnProgress * Integer.parseInt(bLesson.getClassHour()) / (Double.parseDouble(bLesson.getClassHour()) + 1));
}else { }else {
newLearnProgress = Integer.parseInt(bLesson.getClassHour()) == 0 ? 0 : (float) Math.floor(learnProgress * Integer.parseInt(bLesson.getClassHour() + 1) / (Integer.parseInt(bLesson.getClassHour()))); newLearnProgress = Integer.parseInt(bLesson.getClassHour()) == 0 ? 0 : (float) Math.floor(learnProgress * Integer.parseInt(bLesson.getClassHour() + 1) / Double.parseDouble(bLesson.getClassHour()));
} }
if (learnProgress > 0 && newLearnProgress < 0.01){ if (learnProgress > 0 && newLearnProgress < 0.01){
newLearnProgress = 0.01f; newLearnProgress = 0.01;
} }
if ("2".equals(lessonPerson.getIsFinish()) && newLearnProgress < 1){ if ("2".equals(lessonPerson.getIsFinish()) && newLearnProgress < 1){
lessonPerson.setIsFinish("1"); lessonPerson.setIsFinish("1");
lessonPerson.setFinishDate(null);
} }
if (newLearnProgress >= 1){ if (newLearnProgress >= 1){
newLearnProgress = 1; newLearnProgress = 1;
......
...@@ -42,4 +42,4 @@ public class GetAllRspDTO { ...@@ -42,4 +42,4 @@ public class GetAllRspDTO {
@ApiModelProperty(value = "入职时间", position = 4) @ApiModelProperty(value = "入职时间", position = 4)
private Date createAt; private Date createAt;
} }
\ No newline at end of file
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