|
|
@@ -9,14 +9,12 @@ import cn.iocoder.byzs.module.bjdx.service.course.CourseService;
|
|
|
import cn.iocoder.byzs.module.bjdx.service.courseconfig.CourseConfigService;
|
|
|
import cn.iocoder.byzs.module.web.controller.admin.course.vo.WebCourseVO;
|
|
|
import cn.iocoder.byzs.module.web.dal.mysql.course.WebCourseMapper;
|
|
|
+import cn.iocoder.byzs.module.web.service.role.WebAuthRoleServiceImpl;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -34,6 +32,8 @@ public class WebCourseServiceImpl{
|
|
|
private CourseConfigService courseConfigService;
|
|
|
@Resource
|
|
|
private WebCourseMapper webCourseMapper;
|
|
|
+ @Resource
|
|
|
+ private WebAuthRoleServiceImpl webAuthRoleService;
|
|
|
|
|
|
|
|
|
public List<WebCourseVO> getCourseVoByTypeId(Long typeId) {
|
|
|
@@ -49,16 +49,31 @@ public class WebCourseServiceImpl{
|
|
|
Map<Long, List<CourseConfigRespVO>> configMap = courseConfigQuestionList.stream()
|
|
|
.collect(Collectors.groupingBy(CourseConfigRespVO::getCcCourseId));
|
|
|
|
|
|
+ //获得blockly数据权限
|
|
|
+ Set<Long> courseAuthRoleVO = webAuthRoleService.getCourseAuthRoleVO();
|
|
|
+
|
|
|
//重新组装
|
|
|
List<WebCourseVO> courseVoList = new ArrayList<>();
|
|
|
for (CoursePageReqVO course : courseList) {
|
|
|
+
|
|
|
+ WebCourseVO webCourseVo = BeanUtils.toBean(course, WebCourseVO.class);
|
|
|
+
|
|
|
+
|
|
|
+ //根据课程id获得课程配置-试题列表
|
|
|
List<CourseConfigRespVO> courseConfigQuestion = configMap.get(course.getId());
|
|
|
List<CourseConfigRespVO> list = new ArrayList<>();
|
|
|
if (CollUtil.isNotEmpty(courseConfigQuestion)) {
|
|
|
// 根据 ccTime 升序排序(提示时间)
|
|
|
list = courseConfigQuestion.stream().sorted(Comparator.comparing(CourseConfigRespVO::getCcTime)).toList();
|
|
|
}
|
|
|
- courseVoList.add(BeanUtils.toBean(course, WebCourseVO.class).setCourseConfigList(list));
|
|
|
+ webCourseVo.setCourseConfigList(list);
|
|
|
+
|
|
|
+ //判断是否有数据权限
|
|
|
+ if (courseAuthRoleVO.isEmpty()) {
|
|
|
+ webCourseVo.setDataReadonly(false);
|
|
|
+ }else webCourseVo.setDataReadonly(!courseAuthRoleVO.contains(webCourseVo.getId()));
|
|
|
+
|
|
|
+ courseVoList.add(webCourseVo);
|
|
|
}
|
|
|
|
|
|
return courseVoList;
|