瀏覽代碼

Merge remote-tracking branch 'origin/saas' into saas

zouxuan 3 年之前
父節點
當前提交
37faf7a385

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/SysExamSongQueryInfo.java

@@ -19,6 +19,10 @@ public class SysExamSongQueryInfo extends QueryInfo {
 
     @ApiModelProperty(value = "曲库分类",required = true)
     private String categoriesId;
+    
+    private String filterCategoriesIds;
+    
+    private String categoriesIds;
 
     @ApiModelProperty(value = "是否收费",required = true)
     private Integer rankType;
@@ -142,4 +146,20 @@ public class SysExamSongQueryInfo extends QueryInfo {
     public void setType(String type) {
         this.type = type;
     }
+
+	public String getFilterCategoriesIds() {
+		return filterCategoriesIds;
+	}
+
+	public void setFilterCategoriesIds(String filterCategoriesIds) {
+		this.filterCategoriesIds = filterCategoriesIds;
+	}
+
+	public String getCategoriesIds() {
+		return categoriesIds;
+	}
+
+	public void setCategoriesIds(String categoriesIds) {
+		this.categoriesIds = categoriesIds;
+	}
 }

+ 28 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreAccompanimentServiceImpl.java

@@ -110,28 +110,38 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
 
     @Override
     public PageInfo<SysMusicScoreAccompaniment> queryScorePage(SysExamSongQueryInfo queryInfo) {
-		if(queryInfo.getCategoriesId() != null){
+		if(queryInfo.getCategoriesIds() != null){
 			List<Integer> categoriesIdList = new ArrayList<>();
-			MusicScoreQueryInfo musicScoreQueryInfo = new MusicScoreQueryInfo();
-			Integer categoriesId = null;
-			if(StringUtils.isNotEmpty(queryInfo.getCategoriesId())){
-				categoriesId = Integer.parseInt(queryInfo.getCategoriesId());
+			String[] categoriesIds = queryInfo.getCategoriesIds().split(",");
+
+			for(String fc : categoriesIds){
+				SysMusicScoreCategories sysMusicScoreCategories = sysMusicScoreCategoriesService.get(Integer.parseInt(fc));
+				
+				if(sysMusicScoreCategories == null){
+					throw new BizException("分类找不到");
+				}
+				categoriesIdList.add(Integer.parseInt(fc));
+				sysMusicScoreCategories = sysMusicScoreCategoriesService.getChildTree(sysMusicScoreCategories);
+				getAllCategoryIdList(categoriesIdList, sysMusicScoreCategories.getSysMusicScoreCategoriesList());
 			}
-			musicScoreQueryInfo.setParentId(categoriesId);
-			musicScoreQueryInfo.setOrganId(queryInfo.getOrganId());
-			musicScoreQueryInfo.setEnable(queryInfo.getEnable());
-			//List<SysMusicScoreCategories> scoreCategories = sysMusicScoreCategoriesService.queryTree(musicScoreQueryInfo);
-			
-			SysMusicScoreCategories sysMusicScoreCategories = sysMusicScoreCategoriesService.get(categoriesId);
+			queryInfo.setCategoriesIds(categoriesIdList.stream().map(String :: valueOf).collect(Collectors.joining(",")));
+		}
+		if(StringUtils.isNotBlank(queryInfo.getFilterCategoriesIds())){
+			String[] filterCategoriesIds = queryInfo.getFilterCategoriesIds().split(",");
+
+			List<Integer> filterCategoriesIdList = new ArrayList<>();
 			
-			if(sysMusicScoreCategories == null){
-				throw new BizException("分类找不到");
+			for(String fc : filterCategoriesIds){
+				SysMusicScoreCategories sysMusicScoreCategories = sysMusicScoreCategoriesService.get(Integer.parseInt(fc));
+				
+				if(sysMusicScoreCategories == null){
+					throw new BizException("分类找不到");
+				}
+				filterCategoriesIdList.add(Integer.parseInt(fc));
+				sysMusicScoreCategories = sysMusicScoreCategoriesService.getChildTree(sysMusicScoreCategories);
+				getAllCategoryIdList(filterCategoriesIdList, sysMusicScoreCategories.getSysMusicScoreCategoriesList());
 			}
-			categoriesIdList.add(categoriesId);
-			sysMusicScoreCategories = sysMusicScoreCategoriesService.getChildTree(sysMusicScoreCategories);
-			getAllCategoryIdList(categoriesIdList, sysMusicScoreCategories.getSysMusicScoreCategoriesList());
-			
-			queryInfo.setCategoriesIdList(categoriesIdList);
+			queryInfo.setFilterCategoriesIds(filterCategoriesIdList.stream().map(String :: valueOf).collect(Collectors.joining(",")));
 		}
 		return this.queryPage(queryInfo);
     }

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/SysMusicScoreAccompanimentMapper.xml

@@ -234,6 +234,12 @@
 					#{item}
 				</foreach>
 			</if>
+			<if test="filterCategoriesIds != null and filterCategoriesIds != ''">
+				AND find_in_set(sesc.id_,#{filterCategoriesIds}) = 0
+			</if>
+			<if test="categoriesIds != null and categoriesIds != ''">
+				AND find_in_set(sesc.id_,#{categoriesIds}) > 0
+			</if>
 			<if test="parentId != null">
 				AND sesc.parent_id_ = #{parentId}
 			</if>

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

@@ -11,14 +11,17 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 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.entity.TenantConfig;
 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.biz.service.TenantConfigService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
@@ -34,6 +37,9 @@ public class SysMusicScoreAccompanimentController extends BaseController {
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private TeacherService teacherService;
+    
+    @Autowired
+    private TenantConfigService tenantConfigService;
 
     @ApiOperation(value = "修改")
     @PostMapping("/update")
@@ -99,6 +105,13 @@ public class SysMusicScoreAccompanimentController extends BaseController {
         queryInfo.setShowFlag(1);
         queryInfo.setEnable(true);
         
+        TenantConfig tenantConfig = tenantConfigService.getOne(new QueryWrapper<TenantConfig>().eq("tenant_id_", sysUser.getTenantId()));
+        
+        queryInfo.setCategoriesIds(tenantConfig.getTeachingMaterialId());
+        
+        //过滤合奏和考级
+        queryInfo.setFilterCategoriesIds("40,41,42");
+        
         PageInfo<SysMusicScoreAccompaniment> sysMusicScoreAccompanimentList = sysMusicScoreAccompanimentService.queryScorePage(queryInfo);
        
         String url = null,metronomeUrl = null;