Parcourir la source

Merge branch 'feature/1101_ref' into saas

刘俊驰 il y a 1 semaine
Parent
commit
c00ba11b50

+ 9 - 0
mec-application/src/main/java/com/ym/mec/student/controller/LessonCoursewareController.java

@@ -8,6 +8,7 @@ import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareWrapper;
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.Subject;
+import com.ym.mec.biz.dal.enums.ClientEnum;
 import com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper;
 import com.ym.mec.biz.service.CbsMusicScoreCategoriesService;
 import com.ym.mec.biz.service.LessonCoursewareService;
@@ -83,4 +84,12 @@ public class LessonCoursewareController extends BaseController {
 	public HttpResponseResult<List<Subject>> getLessonCoursewareSubjectList(){
 		return succeed(lessonCoursewareService.getDao().getLessonCoursewareSubjectList());
 	}
+
+    @ApiOperation(value = "关联课程类型")
+    @PostMapping("/refLevel")
+    public HttpResponseResult<List<LessonCoursewareWrapper.RefLevelDetailInfo>> refLevel(@RequestBody LessonCoursewareWrapper.RefLevelQuery query) {
+        query.setTeacherId(sysUserService.getUserId());
+        query.setClient(ClientEnum.STUDENT);
+        return succeed(lessonCoursewareService.refLevel(query));
+    }
 }

+ 2 - 0
mec-application/src/main/java/com/ym/mec/teacher/controller/LessonCoursewareController.java

@@ -12,6 +12,7 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.Teacher;
+import com.ym.mec.biz.dal.enums.ClientEnum;
 import com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper;
 import com.ym.mec.biz.service.CbsMusicScoreCategoriesService;
 import com.ym.mec.biz.service.LessonCoursewareService;
@@ -107,6 +108,7 @@ public class LessonCoursewareController extends BaseController {
 	@PostMapping("/refLevel")
 	public HttpResponseResult<List<LessonCoursewareWrapper.RefLevelDetailInfo>> refLevel(@RequestBody LessonCoursewareWrapper.RefLevelQuery query) {
 		query.setTeacherId(sysUserService.getUserId());
+        query.setClient(ClientEnum.TEACHER);
 		return succeed(lessonCoursewareService.refLevel(query));
 	}
 }

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/wrapper/LessonCoursewareWrapper.java

@@ -5,6 +5,7 @@ import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareDetailWra
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.dto.im.BasicUserInfo;
+import com.ym.mec.biz.dal.enums.ClientEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.models.auth.In;
@@ -223,6 +224,8 @@ public class LessonCoursewareWrapper {
 
         @ApiModelProperty(value = "老师ID",hidden = true)
         private Integer teacherId;
+
+        private ClientEnum client;
     }
 
 }

+ 20 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/LessonCoursewareServiceImpl.java

@@ -15,6 +15,7 @@ import com.ym.mec.biz.dal.entity.LessonCourseware;
 import com.ym.mec.biz.dal.entity.LessonCoursewareUserMapper;
 import com.ym.mec.biz.dal.entity.SysMusicScore;
 import com.ym.mec.biz.dal.entity.Teacher;
+import com.ym.mec.biz.dal.enums.ClientEnum;
 import com.ym.mec.biz.dal.mapper.LessonCoursewareMapper;
 import com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper;
 import com.ym.mec.biz.service.LessonCoursewareService;
@@ -217,18 +218,29 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
         if (lessonCourseware == null) {
             throw new BizException("课件未找到");
         }
-        Teacher teacher = teacherDao.get(query.getTeacherId());
-        if (teacher == null) {
-            throw new BizException("老师信息不存在");
-        }
-        if (lessonCoursewareDetail.getLevel() == null || teacher.getCoursewareFlag()) {
-            result.add(this.initRefLevelDetailInfo(lessonCoursewareDetail,lessonCourseware));
-            return result;
+        if (query.getClient() == ClientEnum.TEACHER) {
+            Teacher teacher = teacherDao.get(query.getTeacherId());
+            if (teacher == null) {
+                throw new BizException("老师信息不存在");
+            }
+            if (lessonCoursewareDetail.getLevel() == null || teacher.getCoursewareFlag()) {
+                result.add(this.initRefLevelDetailInfo(lessonCoursewareDetail, lessonCourseware));
+                return result;
+            }
+        } else {
+            if (lessonCoursewareDetail.getLevel() == null) {
+                result.add(this.initRefLevelDetailInfo(lessonCoursewareDetail, lessonCourseware));
+                return result;
+            }
         }
         LessonCoursewareWrapper.LessonCoursewareQuery query1 = new LessonCoursewareWrapper.LessonCoursewareQuery();
         query1.setPage(1);
         query1.setRows(9999);
-        query1.setTeacherId(query.getTeacherId());
+        if (query.getClient() == ClientEnum.STUDENT) {
+            query1.setStudentId(query.getTeacherId());
+        } else {
+            query1.setTeacherId(query.getTeacherId());
+        }
         query1.setEnable(true);
         List<LessonCoursewareWrapper.LessonCoursewareDto> dtos = baseMapper.list(query1);
         if(CollectionUtils.isEmpty(dtos)){