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/ExCourseChapterServiceImpl.java | 34 ++++++++++++++++++++++++++++------ 1 files changed, 28 insertions(+), 6 deletions(-) diff --git a/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterServiceImpl.java index 9692cd0..e74deb4 100644 --- a/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterServiceImpl.java +++ b/exam-system/src/main/java/com/gkhy/exam/system/service/impl/ExCourseChapterServiceImpl.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.exam.common.api.CommonPage; +import com.gkhy.exam.common.config.MinioConfig; import com.gkhy.exam.common.constant.UserConstant; import com.gkhy.exam.common.domain.entity.SysUser; import com.gkhy.exam.common.enums.ApproveStatusEnum; @@ -10,6 +11,8 @@ import com.gkhy.exam.common.utils.PageUtils; import com.gkhy.exam.common.utils.SecurityUtils; import com.gkhy.exam.system.domain.ExCourseChapter; +import com.gkhy.exam.system.domain.ExCourseChapterPeriod; +import com.gkhy.exam.system.domain.ExResource; import com.gkhy.exam.system.mapper.ExCourseChapterMapper; import com.gkhy.exam.system.mapper.ExCourseChapterPeriodMapper; import com.gkhy.exam.system.mapper.ExCourseMapper; @@ -34,6 +37,9 @@ private ExCourseChapterPeriodMapper courseChapterPeriodMapper; @Autowired private ExCourseMapper courseMapper; + + @Autowired + private MinioConfig minioConfig; @Override public CommonPage selectChapterList(ExCourseChapter chapter) { @@ -75,7 +81,7 @@ if(!checkNameUnique(chapter)){ throw new ApiException("章节名称已存在"); } - SysUser user= SecurityUtils.getLoginUser().getUser(); + chapter.setUpdateBy(SecurityUtils.getUsername()); int row=baseMapper.updateById(chapter); if(row<1){ throw new ApiException("更新章节失败"); @@ -87,7 +93,7 @@ @Transactional(rollbackFor = RuntimeException.class) public int deleteChapterById(Long chapterId) { //校验课程是否已被分配 ,章节下面是否存在课时 - checkUserAllowed(baseMapper.selectChapterById(chapterId)); + checkUserAllowed(baseMapper.selectById(chapterId)); int periodCount=baseMapper.selectPeriodCountById(chapterId); if(periodCount>0){ @@ -115,8 +121,20 @@ } @Override - public List<ExCourseChapter> selectChapterByCourseId(Long courseId) { - return baseMapper.selectChapterByCourseId(courseId); + public List<ExCourseChapter> selectChapterByCourseId(Long courseId,Integer status) { + List<ExCourseChapter> courseChapterList= baseMapper.selectChapterByCourseId(courseId,null); + for(ExCourseChapter courseChapter:courseChapterList){ + if(courseChapter.getChapterPeriods()!=null&& !courseChapter.getChapterPeriods().isEmpty()){ + List<ExCourseChapterPeriod> courseChapterPeriodList=courseChapter.getChapterPeriods(); + for(ExCourseChapterPeriod courseChapterPeriod:courseChapterPeriodList){ + if(courseChapterPeriod.getResource()!=null){ + ExResource resource=courseChapterPeriod.getResource(); + resource.setResourcePath(minioConfig.getEndpoint()+minioConfig.getBucketName()+"/"+resource.getResourcePath()); + } + } + } + } + return courseChapterList; } @@ -128,12 +146,16 @@ if(currentUser.getUserType().equals(UserTypeEnum.STUDENT.getCode())){ throw new ApiException("没有权限操作"); } - if(!currentUser.getCompanyId().equals(courseChapter.getCompanyId())){ + if(courseChapter.getCompanyId()!=null&&!currentUser.getCompanyId().equals(courseChapter.getCompanyId())){ throw new ApiException("没有权限操作其他企业课程"); } int state=courseMapper.selectCourseState(courseChapter.getCourseId()); if(state==ApproveStatusEnum.APPROVED.getCode()){ - throw new ApiException("已审批的课程不能再修改"); + throw new ApiException("已审批的课程不能再操作"); } + if(state==ApproveStatusEnum.APPROVING.getCode()){ + throw new ApiException("待审批的课程不能再操作"); + } + } } -- Gitblit v1.9.2