Browse Source

Merge branch 'zx_saas_cbs_category' of http://git.dayaedu.com/yonge/mec into test

zouxuan 11 months ago
parent
commit
b7d8f88481

+ 11 - 1
mec-application/src/main/java/com/ym/mec/student/controller/LessonCoursewareController.java

@@ -6,9 +6,12 @@ import com.dayaedu.cbs.openfeign.client.CoursewareFeignService;
 import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareDetailWrapper;
 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.wrapper.LessonCoursewareWrapper;
+import com.ym.mec.biz.service.CbsMusicScoreCategoriesService;
 import com.ym.mec.biz.service.LessonCoursewareService;
+import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -34,6 +37,10 @@ public class LessonCoursewareController extends BaseController {
 	private LessonCoursewareService lessonCoursewareService;
 	@Resource
 	private SysUserService sysUserService;
+	@Resource
+	private OrganizationService organizationService;
+	@Resource
+	private CbsMusicScoreCategoriesService cbsMusicScoreCategoriesService;
 
 	@ApiOperation(value = "分页查询已添加的课件")
 	@PostMapping("/queryLessonCourseware")
@@ -65,7 +72,10 @@ public class LessonCoursewareController extends BaseController {
 	@ApiOperation(value = "获取课程详情")
 	@GetMapping("/getLessonCourseDetail/{id}")
 	public HttpResponseResult<CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail> getLessonCourseDetail(@PathVariable("id") Long id){
-		return succeed(lessonCoursewareService.getLessonCourseDetail(id));
+		SysUser sysUser = sysUserService.getUser();
+		String teachingMaterialIds = organizationService.getTeachingMaterialIds(sysUser.getOrganId().toString(),sysUser.getTenantId());
+		List<Integer> categoryIdList = cbsMusicScoreCategoriesService.getAllCategoryIdList(teachingMaterialIds);
+		return succeed(lessonCoursewareService.getLessonCourseDetail(id,categoryIdList));
 	}
 
 	@ApiOperation(value = "获取课件关联的声部列表")

+ 11 - 1
mec-application/src/main/java/com/ym/mec/teacher/controller/LessonCoursewareController.java

@@ -6,9 +6,12 @@ import com.dayaedu.cbs.openfeign.client.CoursewareFeignService;
 import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareDetailWrapper;
 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.wrapper.LessonCoursewareWrapper;
+import com.ym.mec.biz.service.CbsMusicScoreCategoriesService;
 import com.ym.mec.biz.service.LessonCoursewareService;
+import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -34,6 +37,10 @@ public class LessonCoursewareController extends BaseController {
 	private SysUserService sysUserService;
 	@Resource
 	private LessonCoursewareService lessonCoursewareService;
+	@Resource
+	private OrganizationService organizationService;
+	@Resource
+	private CbsMusicScoreCategoriesService cbsMusicScoreCategoriesService;
 
 	@ApiOperation(value = "分页查询已添加的课件")
 	@PostMapping("/queryLessonCourseware")
@@ -65,7 +72,10 @@ public class LessonCoursewareController extends BaseController {
 	@ApiOperation(value = "获取课程详情")
 	@GetMapping("/getLessonCourseDetail/{id}")
 	public HttpResponseResult<CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail> getLessonCourseDetail(@PathVariable("id") Long id){
-		return succeed(lessonCoursewareService.getLessonCourseDetail(id));
+		SysUser sysUser = sysUserService.getUser();
+		String teachingMaterialIds = organizationService.getTeachingMaterialIds(sysUser.getOrganId().toString(),sysUser.getTenantId());
+		List<Integer> categoryIdList = cbsMusicScoreCategoriesService.getAllCategoryIdList(teachingMaterialIds);
+		return succeed(lessonCoursewareService.getLessonCourseDetail(id,categoryIdList));
 	}
 
 	@ApiOperation(value = "获取课件关联的声部列表")

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/LessonCoursewareService.java

@@ -7,6 +7,8 @@ import com.ym.mec.biz.dal.mapper.LessonCoursewareMapper;
 import com.ym.mec.biz.dal.entity.LessonCourseware;
 import com.ym.mec.biz.dal.wrapper.LessonCoursewareWrapper;
 
+import java.util.List;
+
 public interface LessonCoursewareService extends IService<LessonCourseware> {
 
     LessonCoursewareMapper getDao();
@@ -20,6 +22,6 @@ public interface LessonCoursewareService extends IService<LessonCourseware> {
     //获取课件适用范围
     LessonCoursewareWrapper.UpdateRangeDetail getRangeType(Integer lessonCoursewareId);
 
-    CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail getLessonCourseDetail(Long id);
+    CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail getLessonCourseDetail(Long id, List<Integer> categoryIdList);
 }
 

+ 15 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/LessonCoursewareServiceImpl.java

@@ -191,42 +191,45 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
     }
 
     @Override
-    public CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail getLessonCourseDetail(Long id) {
+    public CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail getLessonCourseDetail(Long id,List<Integer> categoryIdList) {
         CbsLessonCoursewareDetailWrapper.LessonCoursewareDetail detail = coursewareFeignService.lessonCoursewareDetailDetail(id).feignData();
         if (detail == null) {
             return null;
         }
         //获取知识点下的素材列表、下面关联的资源列表,如果applicationIdList是空的,那么把他剔除掉
-        this.setTreeResourceId(detail.getKnowledgePointList());
+        this.setTreeResourceId(detail.getKnowledgePointList(),categoryIdList);
         return detail;
     }
 
     //递归处理CbsLessonCoursewareDetailWrapper.KnowledgePointSmall
-    private void setTreeResourceId(List<CbsLessonCoursewareDetailWrapper.KnowledgePointSmall> knowledgePointList){
+    private void setTreeResourceId(List<CbsLessonCoursewareDetailWrapper.KnowledgePointSmall> knowledgePointList,List<Integer> categoryIdList){
         if(CollectionUtils.isNotEmpty(knowledgePointList)){
             knowledgePointList.forEach(knowledgePointSmall -> {
-                this.setResourceId(knowledgePointSmall);
+                this.setResourceId(knowledgePointSmall,categoryIdList);
                 List<CbsLessonCoursewareDetailWrapper.KnowledgePointSmall> children = knowledgePointSmall.getChildren();
                 if(CollectionUtils.isNotEmpty(children)){
-                    this.setTreeResourceId(children);
+                    this.setTreeResourceId(children,categoryIdList);
                 }
             });
         }
     }
 
 
-    private void setResourceId(CbsLessonCoursewareDetailWrapper.KnowledgePointSmall knowledgePointSmall){
+    private void setResourceId(CbsLessonCoursewareDetailWrapper.KnowledgePointSmall knowledgePointSmall,List<Integer> categoryIdList){
         List<CbsLessonCoursewareDetailWrapper.MaterialSmall> materialList = knowledgePointSmall.getMaterialList();
         if(CollectionUtils.isNotEmpty(materialList)){
             for (CbsLessonCoursewareDetailWrapper.MaterialSmall materialSmall : materialList) {
                 if(materialSmall.getType() == EMaterialType.SONG){
                     SysMusicScore musicScore = sysMusicScoreService.getDao().getCbsId(Long.parseLong(materialSmall.getContent()));
-                    if(musicScore != null && musicScore.getShowFlag() == 1) {
+                    //没有启用的曲目不显示
+                    if(musicScore != null && musicScore.getShowFlag() == 1 && musicScore.getClientShowFlag() == 1
+                            && categoryIdList.contains(musicScore.getCbsMusicCategoriesId())) {
                         materialSmall.setContent(musicScore.getId().toString());
                     }else {
                         materialSmall.setContent(null);
                     }
                 }
+                //
                 List<CbsMaterialRefWrapper.AddMaterialRef> materialRefs = materialSmall.getMaterialRefs();
                 if (CollectionUtils.isNotEmpty(materialRefs)){
                     for (CbsMaterialRefWrapper.AddMaterialRef materialRef : materialRefs) {
@@ -234,15 +237,17 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
                         if(relateMaterialInfo != null && StringUtils.equals(relateMaterialInfo.getType(),"SONG")
                                 && CollectionUtils.isNotEmpty(relateMaterialInfo.getApplicationIdList())){
                             SysMusicScore musicScore = sysMusicScoreService.getDao().getCbsId(relateMaterialInfo.getId());
-                            if(musicScore != null && musicScore.getShowFlag() == 1) {
+                            if(musicScore != null && musicScore.getShowFlag() == 1 && musicScore.getClientShowFlag() == 1
+                                    && categoryIdList.contains(musicScore.getCbsMusicCategoriesId())) {
                                 materialRef.setResourceIdStr(musicScore.getId().toString());
                             }
                         }
                     }
                 }
             }
-            //剔除掉视频素材,且没有content的数据
-            materialList.removeIf(materialSmall -> materialSmall.getType() == EMaterialType.SONG && StringUtils.isEmpty(materialSmall.getContent()));
+            //剔除掉视频素材,且没有content的数据,且不在可见分类内的数据
+            materialList.removeIf(materialSmall -> materialSmall.getType() == EMaterialType.SONG
+                    && StringUtils.isEmpty(materialSmall.getContent()));
         }
     }
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationServiceImpl.java

@@ -113,7 +113,7 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 			Integer tenantId = TenantContextHolder.getTenantId();
 			TenantInfo tenantInfo = tenantInfoService.get(tenantId);
 			//如果是超管,或者是机构管理员,可以查看当前机构所有分部数据
-			if(isSuper || (tenantInfo.getUserId() != null && tenantInfo.getUserId().equals(userId))){
+			if(isSuper || (tenantInfo != null && tenantInfo.getUserId() != null && tenantInfo.getUserId().equals(userId))){
 				Map<String,Object> param = new HashMap<>();
 				param.put("tenantId",tenantId);
 				List<Organization> all = this.findAll(param);