| | |
| | | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | private ExCourseChapterPeriodMapper courseChapterPeriodMapper; |
| | | @Autowired |
| | | private ExCourseMapper courseMapper; |
| | | |
| | | @Autowired |
| | | private MinioConfig minioConfig; |
| | | |
| | | @Override |
| | | public CommonPage selectChapterList(ExCourseChapter chapter) { |
| | |
| | | |
| | | @Override |
| | | public List<ExCourseChapter> selectChapterByCourseId(Long courseId,Integer status) { |
| | | return baseMapper.selectChapterByCourseId(courseId,null); |
| | | 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; |
| | | } |
| | | |
| | | |
| | |
| | | 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("待审批的课程不能再操作"); |
| | | } |
| | | |
| | | } |
| | | } |