瀏覽代碼

教学伴奏调整

zouxuan 3 年之前
父節點
當前提交
836fec6ed4

+ 3 - 3
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/dto/MusicScoreQueryInfo.java

@@ -6,13 +6,13 @@ public class MusicScoreQueryInfo {
     @ApiModelProperty(value = "父节点编号,默认0",required = false)
     private Integer parentId = 0;
 
-    private Integer organId;
+    private String organId;
 
-    public Integer getOrganId() {
+    public String getOrganId() {
         return organId;
     }
 
-    public void setOrganId(Integer organId) {
+    public void setOrganId(String organId) {
         this.organId = organId;
     }
 

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicScoreCategoriesDao.java

@@ -11,7 +11,7 @@ import java.util.List;
 
 public interface SysMusicScoreCategoriesDao extends BaseDAO<Integer, SysMusicScoreCategories> {
 
-    List<SysMusicScoreCategories> findByParentId(@Param("parentId") Integer parentId,@Param("organId") Integer organId);
+    List<SysMusicScoreCategories> findByParentId(@Param("parentId") Integer parentId,@Param("organId") String organId);
 
     void batchInsert(@Param("categoriesList") List<SysMusicScoreCategories> sysMusicScoreCategoriesList, @Param("organId") String organId, @Param("enable") Boolean enable);
 

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/SysMusicScoreCategoriesMapper.xml

@@ -155,7 +155,7 @@
 				AND sm.parent_id_ = #{parentId}
 			</if>
 			<if test="organId != null">
-				AND FIND_IN_SET(#{organId},sm.organ_id_)
+				AND INTE_ARRAY(#{organId},sm.organ_id_)
 			</if>
 		</where>
 	</sql>

+ 9 - 1
mec-student/src/main/java/com/ym/mec/student/controller/SysMusicScoreAccompanimentController.java

@@ -1,5 +1,7 @@
 package com.ym.mec.student.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.enums.ClientTypeEnum;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
 import com.ym.mec.biz.service.SysMusicScoreAccompanimentService;
@@ -7,7 +9,9 @@ import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 @RequestMapping("sysMusicScoreAccompaniment")
 @Api(tags = "曲库服务")
@@ -16,6 +20,8 @@ public class SysMusicScoreAccompanimentController extends BaseController {
 
     @Autowired
     private SysMusicScoreAccompanimentService sysMusicScoreAccompanimentService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
     @ApiOperation(value = "分页查询")
     @GetMapping("/queryPage")
@@ -31,11 +37,13 @@ public class SysMusicScoreAccompanimentController extends BaseController {
     @ApiOperation(value = "分页查询")
     @GetMapping("/queryPageLimit")
     public Object queryPageLimit(SysExamSongQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
         queryInfo.setType("COMMON");
         if(queryInfo.getClientType() == null){
             queryInfo.setClientType(ClientTypeEnum.NETWORK_ROOM);
         }
         queryInfo.setShowFlag(1);
+        queryInfo.setOrganId(sysUser.getOrganId().toString());
         return succeed(sysMusicScoreAccompanimentService.queryScorePage(queryInfo));
     }
 

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/controller/SysMusicScoreCategoriesController.java

@@ -35,7 +35,7 @@ public class SysMusicScoreCategoriesController extends BaseController {
     @GetMapping("/queryTree")
     public Object queryTree(MusicScoreQueryInfo queryInfo) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-        queryInfo.setOrganId(sysUser.getOrganId());
+        queryInfo.setOrganId(sysUser.getOrganId().toString());
         return succeed(sysMusicScoreCategoriesService.queryTree(queryInfo));
     }
 

+ 12 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/SysMusicScoreAccompanimentController.java

@@ -3,15 +3,18 @@ package com.ym.mec.teacher.controller;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.SysMusicScoreAccompaniment;
+import com.ym.mec.biz.dal.entity.Teacher;
 import com.ym.mec.biz.dal.enums.ClientTypeEnum;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
 import com.ym.mec.biz.service.SysMusicScoreAccompanimentService;
+import com.ym.mec.biz.service.TeacherService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
 @RequestMapping("sysMusicScoreAccompaniment")
@@ -23,6 +26,8 @@ public class SysMusicScoreAccompanimentController extends BaseController {
     private SysMusicScoreAccompanimentService sysMusicScoreAccompanimentService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private TeacherService teacherService;
 
     @ApiOperation(value = "修改")
     @PostMapping("/update")
@@ -74,6 +79,13 @@ public class SysMusicScoreAccompanimentController extends BaseController {
         if(sysUser == null){
             throw new BizException("请登录");
         }
+        Teacher teacher = teacherService.get(sysUser.getId());
+        if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(teacher.getTeacherOrganId() + "");
+        }
+        if(org.apache.commons.lang3.StringUtils.isNotBlank(teacher.getFlowOrganRange())){
+            queryInfo.setOrganId(queryInfo.getOrganId() + "," + teacher.getFlowOrganRange());
+        }
         if(queryInfo.getClientType() == null){
             queryInfo.setClientType(ClientTypeEnum.NETWORK_ROOM);
         }

+ 21 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/SysMusicScoreCategoriesController.java

@@ -1,12 +1,18 @@
 package com.ym.mec.teacher.controller;
 
+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.entity.Teacher;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
 import com.ym.mec.biz.service.SysMusicScoreCategoriesService;
+import com.ym.mec.biz.service.TeacherService;
 import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,6 +25,10 @@ public class SysMusicScoreCategoriesController extends BaseController {
 
     @Autowired
     private SysMusicScoreCategoriesService sysMusicScoreCategoriesService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private TeacherService teacherService;
 
 
     @ApiOperation(value = "分页查询")
@@ -30,6 +40,17 @@ public class SysMusicScoreCategoriesController extends BaseController {
     @ApiOperation(value = "树状列表")
     @GetMapping("/queryTree")
     public Object queryTree(MusicScoreQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        Teacher teacher = teacherService.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(teacher.getTeacherOrganId() + "");
+        }
+        if(StringUtils.isNotBlank(teacher.getFlowOrganRange())){
+            queryInfo.setOrganId(queryInfo.getOrganId() + "," + teacher.getFlowOrganRange());
+        }
         return succeed(sysMusicScoreCategoriesService.queryTree(queryInfo));
     }
 

+ 27 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SysMusicScoreCategoriesController.java

@@ -1,6 +1,10 @@
 package com.ym.mec.web.controller;
 
+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.SysMusicScoreCategories;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
 import com.ym.mec.biz.service.SysMusicScoreCategoriesService;
@@ -8,10 +12,14 @@ import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Arrays;
+import java.util.List;
+
 @RequestMapping("sysMusicScoreCategories")
 @Api(tags = "曲库分类服务")
 @RestController
@@ -19,6 +27,10 @@ public class SysMusicScoreCategoriesController extends BaseController {
 
     @Autowired
     private SysMusicScoreCategoriesService sysMusicScoreCategoriesService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     @ApiOperation(value = "分页查询")
     @GetMapping("/queryPage")
@@ -64,6 +76,21 @@ public class SysMusicScoreCategoriesController extends BaseController {
     @GetMapping("/queryTree")
     @PreAuthorize("@pcs.hasPermissions('sysMusicScoreCategories/queryTree')")
     public Object queryTree(MusicScoreQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+            return failed("用户所在分部异常");
+        }else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+                return failed("非法请求");
+            }
+        }
         return succeed(sysMusicScoreCategoriesService.queryTree(queryInfo));
     }
 

+ 26 - 0
mec-web/src/main/java/com/ym/mec/web/controller/education/EduMusicScoreController.java

@@ -1,6 +1,10 @@
 package com.ym.mec.web.controller.education;
 
+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.enums.ClientTypeEnum;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
 import com.ym.mec.biz.service.SysMusicScoreAccompanimentService;
@@ -14,6 +18,9 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Arrays;
+import java.util.List;
+
 @RequestMapping("eduMusicScore")
 @Api(tags = "智能陪练")
 @RestController
@@ -22,6 +29,10 @@ public class EduMusicScoreController extends BaseController {
     private SysMusicScoreCategoriesService sysMusicScoreCategoriesService;
     @Autowired
     private SysMusicScoreAccompanimentService sysMusicScoreAccompanimentService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     @ApiOperation(value = "树状列表")
     @GetMapping("/queryTree")
@@ -39,6 +50,10 @@ public class EduMusicScoreController extends BaseController {
     @ApiOperation(value = "分页查询")
     @GetMapping("/queryPageLimit")
     public Object queryPageLimit(SysExamSongQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
         String type = queryInfo.getType();
         if(StringUtils.isEmpty(type)){
             queryInfo.setType("ALL");
@@ -47,6 +62,17 @@ public class EduMusicScoreController extends BaseController {
             queryInfo.setClientType(ClientTypeEnum.SMART_PRACTICE);
         }
         queryInfo.setShowFlag(1);
+        Employee employee = employeeDao.get(sysUser.getId());
+        if (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganId())) {
+            queryInfo.setOrganId(employee.getOrganIdList());
+        }else if(org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())){
+            return failed("用户所在分部异常");
+        }else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+                return failed("非法请求");
+            }
+        }
         return succeed(sysMusicScoreAccompanimentService.queryScorePage(queryInfo));
     }