Browse Source

Merge branch 'fix/1212_onlineBug' into feature/1210_audio

刘俊驰 3 weeks ago
parent
commit
f957764903

+ 10 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/CourseCoursewareSearch.java

@@ -43,6 +43,16 @@ public class CourseCoursewareSearch extends QueryInfo{
 	@ApiModelProperty(value = "用户类型 STUDENT,TEACHER ",hidden = true)
 	private ClientEnum clientType;
 
+	private boolean vipFlag;
+
+	public boolean isVipFlag() {
+		return vipFlag;
+	}
+
+	public void setVipFlag(boolean vipFlag) {
+		this.vipFlag = vipFlag;
+	}
+
 	public String getIdAndName() {
 		return idAndName;
 	}

+ 15 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseCoursewareServiceImpl.java

@@ -11,11 +11,9 @@ import com.yonge.cooleshow.biz.dal.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.entity.Teacher;
 import com.yonge.cooleshow.biz.dal.enums.AudioTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
+import com.yonge.cooleshow.biz.dal.enums.EVipType;
 import com.yonge.cooleshow.biz.dal.mapper.SysUserMapper;
-import com.yonge.cooleshow.biz.dal.service.CourseCoursewareService;
-import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
-import com.yonge.cooleshow.biz.dal.service.SysUserService;
-import com.yonge.cooleshow.biz.dal.service.TenantAlbumMusicService;
+import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.vo.CourseCoursewareVo;
 import com.yonge.cooleshow.biz.dal.vo.MusicSheetDetailVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
@@ -24,6 +22,7 @@ import com.yonge.toolset.base.exception.BizException;
 import org.apache.commons.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -47,6 +46,9 @@ public class CourseCoursewareServiceImpl extends ServiceImpl<CourseCoursewareDao
     @Resource
     private TenantAlbumMusicService tenantAlbumMusicService;
 
+    @Autowired
+    private TeacherService teacherService;
+
 	@Override
     public CourseCoursewareVo detail(Long id) {
         return baseMapper.detail(id);
@@ -54,6 +56,15 @@ public class CourseCoursewareServiceImpl extends ServiceImpl<CourseCoursewareDao
     
     @Override
     public IPage<CourseCoursewareVo> selectPage(IPage<CourseCoursewareVo> page, CourseCoursewareSearch query){
+
+        // 如果是老师 判断vip
+        if (query.getClientType().equals(ClientEnum.TEACHER)) {
+            TeacherVo detail = teacherService.detail(query.getUserId());
+            if (detail != null) {
+                query.setVipFlag(detail.getUserVip().getVipType() != EVipType.NOT_VIP);
+            }
+        }
+
         IPage<CourseCoursewareVo> courseCoursewareVoIPage = page.setRecords(baseMapper.selectPage(page, query));
         List<CourseCoursewareVo> records = courseCoursewareVoIPage.getRecords();
         if (CollectionUtils.isEmpty(records)) {

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

@@ -56,6 +56,7 @@ import org.joda.time.DateTime;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -150,6 +151,9 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
     @Resource
     private OpenFeignClientConfigProperties openFeignClientConfigProperties;
 
+    @Autowired
+    private SysUserService sysUserService;
+
     @Value("${openfeign-client.app-id:1745637981387108354}")
     public Long applicationId;
 
@@ -1175,7 +1179,39 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
 
     @Override
     public IPage<TeacherMusicSheetVo> selectTeacherPage(IPage<TeacherMusicSheetVo> page, TeacherMusicSheetSearch query) {
-        return page.setRecords(baseMapper.selectTeacherPage(page, query));
+        IPage<TeacherMusicSheetVo> teacherMusicSheetVoIPage = page.setRecords(baseMapper.selectTeacherPage(page, query));
+        List<TeacherMusicSheetVo> records = teacherMusicSheetVoIPage.getRecords();
+        if (CollectionUtils.isEmpty(records)) {
+           return teacherMusicSheetVoIPage;
+        }
+        // 曲目ID
+        List<String> musicIds = records.stream().map(TeacherMusicSheetVo::getMusicSheetId).collect(Collectors.toList());
+
+        List<MusicSheetAuthRecord> list = musicSheetAuthRecordService.lambdaQuery()
+                .in(MusicSheetAuthRecord::getMusicSheetId, musicIds)
+                .eq(MusicSheetAuthRecord::getAuditState, AuthStatusEnum.PASS)
+                .orderByAsc(MusicSheetAuthRecord::getId)
+                .list();
+        if (CollectionUtils.isNotEmpty(list)) {
+            Map<Long, MusicSheetAuthRecord> musicSheetAuthRecordMap = list.stream().collect(Collectors.toMap(MusicSheetAuthRecord::getMusicSheetId, Function.identity(), (o, n) -> n));
+            // 审核人 ID集合
+            List<Long> auditUserIds = list.stream().map(MusicSheetAuthRecord::getVerifyUserId).collect(Collectors.toList());
+            Map<Long, com.yonge.cooleshow.biz.dal.entity.SysUser> mapByIds = sysUserService.getMapByIds(auditUserIds);
+            for (TeacherMusicSheetVo record : records) {
+                MusicSheetAuthRecord musicSheetAuthRecord = musicSheetAuthRecordMap.get(Long.parseLong(record.getMusicSheetId()));
+                if (musicSheetAuthRecord != null && musicSheetAuthRecord.getVerifyUserId() != null) {
+                    com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = mapByIds.get(musicSheetAuthRecord.getVerifyUserId());
+                    if (sysUser != null) {
+                        record.setAuditName(sysUser.getUsername());
+                    }
+
+                }
+            }
+        }
+
+
+        return teacherMusicSheetVoIPage;
+
     }
 
     @Override

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseCoursewareMapper.xml

@@ -63,7 +63,7 @@
                 or  EXISTS (select mspr.music_sheet_id_ from music_sheet_purchase_record mspr
                 left join album_music_relate amr on amr.album_id_ = mspr.music_sheet_id_
                 where mspr.student_id_ = t.user_id_ and mspr.order_status_ = 'PAID' and mspr.purchase_type_ = 'ALBUM' and amr.music_sheet_id_ = ms.id_ and mspr.client_type_ = 'TEACHER' )
-                or (ms.payment_type_ like '%VIP%' and  EXISTS(select 1 from teacher t1 where t1.user_id_ = t.user_id_ and t1.membership_end_time_ > now()))
+                or (ms.payment_type_ like '%VIP%' and  #{param.vipFlag} = 1)
                 )
             </if>
         </where>

+ 4 - 3
cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicSheetMapper.xml

@@ -722,10 +722,10 @@
         ,ms.music_price_ as musicPrice
         ,ms.create_time_ as createTime
         ,ms.audit_status_ as auditStatus
-        ,su.username_ as auditName
+<!--        ,su.username_ as auditName-->
         from music_sheet ms
-        left join music_sheet_auth_record msar on ms.id_ = msar.music_sheet_id_
-        left join sys_user su on msar.verify_user_id_ = su.id_
+<!--        left join music_sheet_auth_record msar on ms.id_ = msar.music_sheet_id_-->
+<!--        left join sys_user su on msar.verify_user_id_ = su.id_-->
         <where>
             <if test="param.idAndName != null and param.idAndName != ''">
                 and (ms.id_ like concat('%',#{param.idAndName} ,'%')
@@ -734,6 +734,7 @@
             </if>
             <if test="param.teacherId != null">
                 and ms.create_by_ = #{param.teacherId} and ms.source_type_ = 'TEACHER'
+                and ms.audit_status_ = 'PASS'
             </if>
             <if test="param.startTime != null">
                 and ms.create_time_ &gt; #{param.startTime}