浏览代码

收藏和最近练习

liujc 7 月之前
父节点
当前提交
83b729300f

+ 13 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/MusicSheetController.java

@@ -267,6 +267,11 @@ public class MusicSheetController extends BaseController {
         }
         StudentMusicSheetSearch search = new StudentMusicSheetSearch();
         search.setStudentId(sysUser.getId());
+        // 查询学生时机构还是平台
+        Student student = studentService.getById(search.getStudentId());
+        if (student != null && student.getTenantId() != null && student.getTenantId()>0) {
+            search.setProviderType(SourceTypeEnum.TENANT);
+        }
         search.setState(YesOrNoEnum.YES);
         search.setAuditStatus(null);
         IPage<MusicSheetVo> sheetVoIPage = musicSheetService.favoriteMusic(PageUtil.getPage(query),search, ClientEnum.STUDENT);
@@ -288,6 +293,12 @@ public class MusicSheetController extends BaseController {
         search.setStudentId(sysUser.getId());
         search.setState(YesOrNoEnum.YES);
         search.setAuditStatus(null);
+        search.setClientType(ClientEnum.STUDENT);
+        // 查询学生时机构还是平台
+        Student student = studentService.getById(search.getStudentId());
+        if (student != null && student.getTenantId() != null && student.getTenantId()>0) {
+            search.setProviderType(SourceTypeEnum.TENANT);
+        }
         IPage<MusicSheetVo> sheetVoIPage = musicSheetService.practiceMusic(PageUtil.getPage(query),search);
         return succeed(PageUtil.pageInfo(sheetVoIPage));
     }
@@ -314,6 +325,7 @@ public class MusicSheetController extends BaseController {
             search.setProviderType(SourceTypeEnum.TENANT);
         }
         search.setStudentId(userId);
+        search.setClientType(ClientEnum.STUDENT);
         search.setState(YesOrNoEnum.YES);
         search.setAuditStatus(null);
         search.setRows(3);
@@ -459,6 +471,7 @@ public class MusicSheetController extends BaseController {
             throw new BizException("用户信息获取失败");
         }
         queryInfo.setSubjectId(Integer.parseInt(student.getSubjectId()));
+        queryInfo.setProviderType(SourceTypeEnum.TENANT);
         return succeed(musicSheetService.searchTenant(queryInfo));
     }
 

+ 15 - 10
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/MusicSheetController.java

@@ -1,17 +1,13 @@
 package com.yonge.cooleshow.teacher.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.dayaedu.cbs.common.enums.music.EMusicSourceType;
-import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
-import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.AppMusicSheetVo;
 import com.yonge.cooleshow.biz.dal.dto.MusicSheetRenderDto;
-import com.yonge.cooleshow.biz.dal.dto.ReasonDto;
 import com.yonge.cooleshow.biz.dal.dto.search.MusicSheetRelatedQueryInfo;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentMusicSheetSearch;
 import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
-import com.yonge.cooleshow.biz.dal.entity.MusicSheetAuthRecord;
+import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.Teacher;
 import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
@@ -19,7 +15,6 @@ import com.yonge.cooleshow.biz.dal.enums.MusicSortType;
 import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.album.PurchaseRecordTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.*;
-import com.yonge.cooleshow.biz.dal.service.cbs.CbsMusicScoreService;
 import com.yonge.cooleshow.biz.dal.vo.MusicSheetDetailVo;
 import com.yonge.cooleshow.biz.dal.vo.MusicSheetShareVo;
 import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
@@ -35,19 +30,15 @@ import com.yonge.toolset.mybatis.support.PageUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.List;
 import java.util.Optional;
-import java.util.stream.Collectors;
 
 /**
  * 曲谱表 web 控制层
@@ -70,6 +61,9 @@ public class MusicSheetController extends BaseController {
     @Resource
     private TeacherService teacherService;
 
+    @Autowired
+    private StudentService studentService;
+
     /**
      * 查询单条
      */
@@ -233,9 +227,14 @@ public class MusicSheetController extends BaseController {
     public HttpResponseResult<PageInfo<MusicSheetVo>> favoriteMusic(QueryInfo query) {
         SysUser sysUser = sysUserService.getUser();
         StudentMusicSheetSearch search = new StudentMusicSheetSearch();
+        Teacher teacher = teacherService.getById(sysUser.getId());
+        if (teacher.getTenantId() !=null && teacher.getTenantId() >0) {
+            search.setTenantId(teacher.getTenantId());
+        }
         search.setStudentId(sysUser.getId());
         search.setState(YesOrNoEnum.YES);
         search.setAuditStatus(null);
+        search.setProviderType(null);
         IPage<MusicSheetVo> sheetVoIPage = musicSheetService.favoriteMusic(PageUtil.getPage(query),search, ClientEnum.TEACHER);
         return succeed(PageUtil.pageInfo(sheetVoIPage));
     }
@@ -323,9 +322,15 @@ public class MusicSheetController extends BaseController {
         }
         StudentMusicSheetSearch search = new StudentMusicSheetSearch();
         search.setStudentId(userId);
+        search.setClientType(ClientEnum.STUDENT);
         search.setState(YesOrNoEnum.YES);
         search.setAuditStatus(null);
         search.setRows(3);
+        // 查询学生时机构还是平台
+        Student student = studentService.getById(search.getStudentId());
+        if (student != null && student.getTenantId() != null && student.getTenantId()>0) {
+            search.setProviderType(SourceTypeEnum.TENANT);
+        }
         IPage<MusicSheetVo> sheetVoIPage = musicSheetService.practiceMusic(PageUtil.getPage(search),search);
         return succeed(PageUtil.pageInfo(sheetVoIPage));
     }

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/StudentMusicSheetSearch.java

@@ -5,8 +5,6 @@ import com.yonge.cooleshow.biz.dal.enums.album.PurchaseRecordTypeEnum;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import java.util.List;
-
 /**
  * Description 学生查询乐谱
  *
@@ -45,6 +43,8 @@ public class StudentMusicSheetSearch  extends MusicSheetSearch{
     // 客户端类型
     private ClientEnum clientType;
 
+    private Long tenantId;
+
 
     public ClientEnum getUserType() {
         return userType;

+ 1 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java

@@ -442,6 +442,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
                 detailVo.setUserAvatar(sysUser.getAvatar());
             }
         }
+        detailVo.setCategoryId(musicSheet1.getMusicCategoryId()!=null?musicSheet1.getMusicCategoryId().toString():"");
         detailVo.setMusicPrice(musicSheet1.getMusicPrice());
         detailVo.setSubjectNames(musicSheet1.getSubjectNames());
         detailVo.setCode(musicSheet1.getSubjectCodes());

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/MusicSheetDetailVo.java

@@ -87,5 +87,8 @@ public class MusicSheetDetailVo extends MusicSheet {
 
     @ApiModelProperty("曲目json文件")
     private String musicSheetJson;
+
+    @ApiModelProperty("内容平台分类ID")
+    private String categoryId;
 }
 

+ 28 - 6
cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicSheetMapper.xml

@@ -596,11 +596,24 @@
             left join music_sheet_auth_record msar ON msar.music_sheet_id_ = t.id_
         </if>
         <where>
-            1=1
-            <include refid="QueryInfo"/>
-            <if test="clientType != null">
-                AND mf.client_type_ = #{clientType}
+
+            mf.client_type_ = #{clientType}
+            <if test="clientType.code == 'STUDENT'">
+                and t.del_flag_=0 and t.state_ =1 and find_in_set('PLATFORM',t.provider_type_)
+            </if>
+            <if test="clientType.code == 'TEACHER'">
+                and ((t.del_flag_=0 and t.state_ =1 and find_in_set('PLATFORM',t.provider_type_))
+                    <if test="param.tenantId !=null">
+                        or (t.tenant_del_flag_=0 and t.tenant_state_ =1 and find_in_set('TENANT',t.provider_type_)
+                            and t.id_ in (select s.music_sheet_id_ from tenant_album_music s left join tenant_album s1 on s.tenant_album_id_ = s1.id_ where s.tenant_id_ = #{param.tenantId}
+                                        and s.del_flag_ = 0 and s.subject_type_ in ('ENSEMBLE','MUSIC','SUBJECT') and s1.del_flag_= 0 and s1.status_ = 1
+
+                            )
+                        )
+                    </if>
+                )
             </if>
+
             <if test="param.studentId != null">
                 and mf.user_id_ = #{param.studentId}
             </if>
@@ -1043,7 +1056,6 @@
             left join tenant_album_music tam on t.id_ = tam.music_sheet_id_
         </if>
             <where>
-                t.state_=1 and t.audit_version_ = 0 and t.del_flag_ = 0 and t.audit_status_ = 'PASS'
                 <if test="param.subjectId != null">
                     and ( t.music_subject_ = #{param.subjectId} or t.music_subject_ is null or t.music_subject_ = '' OR t.is_all_subject_)
                 </if>
@@ -1060,6 +1072,15 @@
                 </if>
                 <if test="param.providerType != null">
                     and find_in_set(#{param.providerType},t.provider_type_)
+                    <if test="param.providerType != null">
+                        <if test="param.providerType.code == 'TENANT'">
+                            and t.tenant_state_ = true and t.tenant_del_flag_ = 0
+                        </if>
+
+                        <if test="param.providerType.code == 'PLATFORM'">
+                            and t.state_=1 and t.audit_version_ = 0 and t.del_flag_ = 0 and t.audit_status_ = 'PASS'
+                        </if>
+                    </if>
                 </if>
             </where>
         order by t.top_flag_ desc, t.sort_number_ desc, t.favorite_count_ desc
@@ -1219,7 +1240,7 @@
 
     <insert id="tenantInsert">
         insert into music_sheet
-        (cbs_music_sheet_id_,tenant_sort_number_,tenant_score_type_,tenant_state_,tenant_notation_,tenant_category_id_
+        (cbs_music_sheet_id_,tenant_sort_number_,tenant_score_type_,tenant_state_,tenant_notation_,tenant_category_id_,tenant_del_flag_
         ,music_sheet_name_,music_subject_,music_svg_,composer_,accompaniment_type_,play_speed_,
         music_sheet_type_,provider_type_,audio_type_,show_fingering_,
         can_evaluate_,create_by_,user_id_,audit_status_,upload_time_,source_type_
@@ -1228,6 +1249,7 @@
             (#{item.musicSheetId},
         #{item.sortNo},#{item.scoreType},#{item.status},#{item.isConvertibleScore}
         ,#{item.musicSheetUpdate.musicCategoryId}
+            ,#{item.delFlag}
             ,#{item.musicSheetUpdate.name},
             #{item.musicSheetUpdate.subjectIds},
             #{item.musicSheetUpdate.musicSvg},

+ 3 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicSheetPracticeRecordMapper.xml

@@ -28,6 +28,9 @@
             <if test="param.auditStatus != null">
                 and msar.last_audit_state_ = #{param.auditStatus}
             </if>
+            <if test="param.clientType != null">
+                and mspr.client_id_ = #{param.clientType}
+            </if>
             <if test="param.providerType.code == 'TENANT'">
                 and find_in_set('TENANT',ms.provider_type_)