Browse Source

分部配置教材

zouxuan 11 months ago
parent
commit
2475bc06f5

+ 15 - 28
mec-application/src/main/java/com/ym/mec/web/controller/education/EduMusicScoreController.java

@@ -1,17 +1,15 @@
 package com.ym.mec.web.controller.education;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.dto.MusicScoreQueryInfo;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.entity.Employee;
-import com.ym.mec.biz.dal.entity.TenantConfig;
 import com.ym.mec.biz.dal.enums.ClientTypeEnum;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
+import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.biz.service.SysMusicScoreAccompanimentService;
 import com.ym.mec.biz.service.SysMusicScoreCategoriesService;
-import com.ym.mec.biz.service.TenantConfigService;
+import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -21,6 +19,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import java.util.Arrays;
 import java.util.List;
 
@@ -28,33 +27,24 @@ import java.util.List;
 @Api(tags = "智能陪练")
 @RestController
 public class EduMusicScoreController extends BaseController {
-    @Autowired
+    @Resource
     private SysMusicScoreCategoriesService sysMusicScoreCategoriesService;
-    @Autowired
+    @Resource
     private SysMusicScoreAccompanimentService sysMusicScoreAccompanimentService;
-    @Autowired
-    private SysUserFeignService sysUserFeignService;
-    @Autowired
+    @Resource
+    private SysUserService sysUserService;
+    @Resource
     private EmployeeDao employeeDao;
-    
-    @Autowired
-    private TenantConfigService tenantConfigService;
+    @Resource
+    private OrganizationService organizationService;
 
     @ApiOperation(value = "树状列表")
     @GetMapping("/queryTree")
     public Object queryTree(MusicScoreQueryInfo queryInfo) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed("用户信息获取失败");
-        }
-        
-        TenantConfig tenantConfig = tenantConfigService.getOne(new QueryWrapper<TenantConfig>().eq("tenant_id_", sysUser.getTenantId()));
-        
-        if(tenantConfig == null){
-        	return failed("当前用户所在机构信息查询失败");
-        }
-        
-        return succeed(sysMusicScoreCategoriesService.queryCategoriesTreeList(tenantConfig.getTeachingMaterialId(), queryInfo.getEnable()));
+        SysUser sysUser = sysUserService.getUser();
+        String organId = organizationService.getEmployeeOrgan(sysUser.getId(), null, sysUser.getIsSuperAdmin() && sysUser.getTenantId() == -1);
+        String teachingMaterialIds = organizationService.getTeachingMaterialIds(organId, sysUser.getTenantId());
+        return succeed(sysMusicScoreCategoriesService.queryCategoriesTreeList(teachingMaterialIds, queryInfo.getEnable()));
     }
 
     @ApiOperation(value = "分页查询")
@@ -67,10 +57,7 @@ public class EduMusicScoreController extends BaseController {
     @ApiOperation(value = "分页查询")
     @GetMapping("/queryPageLimit")
     public Object queryPageLimit(SysExamSongQueryInfo queryInfo) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed("用户信息获取失败");
-        }
+        SysUser sysUser = sysUserService.getUser();
         String type = queryInfo.getType();
         if(StringUtils.isEmpty(type)){
             queryInfo.setType("ALL");