From f0f00e9ba8a755e4317e029d73b69a92ad9f9df1 Mon Sep 17 00:00:00 2001 From: kongzy <kongzy> Date: 星期六, 14 九月 2024 17:02:41 +0800 Subject: [PATCH] update --- exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentStudyServiceImpl.java | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentStudyServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentStudyServiceImpl.java index 05217ea..428e5ee 100644 --- a/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentStudyServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentStudyServiceImpl.java @@ -51,10 +51,11 @@ row=baseMapper.updateById(existStudentStudy); }else{ row=baseMapper.insert(studentStudy); + if(row<1){ + throw new ApiException("新增学习记录失败"); + } } - if(row<1){ - throw new ApiException("新增学习记录失败"); - } + System.out.println("student_study id:"+studentStudy.getId()); return studentStudy.getId(); } @@ -82,6 +83,7 @@ studentStudyPeriodVO.setPeriodId(courseChapterPeriod.getId()); studentStudyPeriodVO.setPeriod(courseChapterPeriod.getPeriod()); studentStudyPeriodVO.setResourceId(courseChapterPeriod.getResourceId()); + studentStudyPeriodVO.setResourceType(courseChapterPeriod.getResource()!=null?courseChapterPeriod.getResource().getResourceType():null); ExStudentStudy exStudentStudy=studentStudyMap.get(courseChapterPeriod.getId()); if(exStudentStudy!=null){ studentStudyPeriodVO.setProgress(exStudentStudy.getProgress()); @@ -100,7 +102,7 @@ @Override public void progress(ExStudentStudy studentStudy) { - if(studentStudy.getPhaseId()==null||studentStudy.getPeriodId()==null||studentStudy.getStudentId()==null||studentStudy.getResourceId()==null){ + if(studentStudy.getId()==null||studentStudy.getPhaseId()==null||studentStudy.getPeriodId()==null||studentStudy.getStudentId()==null||studentStudy.getResourceId()==null){ throw new ApiException("参数传参错误"); } ExResource resource=resourceMapper.selectById(studentStudy.getResourceId()); @@ -112,10 +114,12 @@ } } else if (ResourceTypeEnum.DOC.getCode().equals(resource.getResourceType())) { // 文档类型处理 - if (studentStudy.getCurrentPage().compareTo(resource.getDocPage()) >= 0) { - // 学习完成 - completeStudy(studentStudy); - } +// if (studentStudy.getCurrentPage().compareTo(resource.getDocPage()) >= 0) { +// // 学习完成 +// completeStudy(studentStudy); +// } + // 学习完成 + completeStudy(studentStudy); } redisUtils.set(CacheConstant.STUDY_PROCESS_KEY + studentStudy.getId(), studentStudy, 1, TimeUnit.DAYS); } -- Gitblit v1.9.2