From 8458e64aab474c0fc2f49ae4ff22fb11ce5cf6e2 Mon Sep 17 00:00:00 2001 From: “djh” <“3298565835@qq.com”> Date: 星期一, 11 十一月 2024 16:55:28 +0800 Subject: [PATCH] 批次新增学员查询条件,新增题目导入接口 --- exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExStudentStudyServiceImpl.java | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 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 60caf9f..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(); } @@ -64,12 +65,12 @@ } @Override - public List<StudentStudyVO> selectStudyByPhaseAndStundentId(Long phaseId,Long studentId) { + public List<StudentStudyVO> selectStudyByPhaseAndStundentId(Long phaseId,Long studentId,Integer status) { ExCoursePhase coursePhase=coursePhaseMapper.selectById(phaseId); Long courseId=coursePhase.getCourseId(); List<ExStudentStudy> studentStudyList= baseMapper.selectStudyByPhaseAndStudentId(phaseId,courseId,studentId); Map<Long,ExStudentStudy> studentStudyMap=studentStudyList.stream().collect(Collectors.toMap(ExStudentStudy::getPeriodId, item->item)); - List<ExCourseChapter> courseChapterList=courseChapterService.selectChapterByCourseId(courseId); + List<ExCourseChapter> courseChapterList=courseChapterService.selectChapterByCourseId(courseId, status); List<StudentStudyVO> studentStudyVOList=courseChapterList.stream().map(item ->{ StudentStudyVO studentStudyVO=new StudentStudyVO(); studentStudyVO.setChapterId(item.getId()); @@ -81,6 +82,8 @@ studentStudyPeriodVO.setPeriodName(courseChapterPeriod.getName()); 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()); @@ -99,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()); @@ -111,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