Browse Source

Merge branch 'dev_1_3_2_20220815'

liujunchi 3 years ago
parent
commit
255b2ee819

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

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.biz.dal.dto.search;
 
+import com.yonge.cooleshow.biz.dal.enums.AccompanimentTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import com.yonge.cooleshow.biz.dal.enums.ChargeTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
@@ -67,6 +68,17 @@ public class MusicSheetSearch  extends QueryInfo{
     @ApiModelProperty(value = "是否审核时可见 (0:否  1:是)",hidden = true)
     private YesOrNoEnum auditVersion;
 
+    @ApiModelProperty(value = "伴奏类型 HOMEMODE:自制伴奏  COMMON:普通伴奏")
+    private AccompanimentTypeEnum accompanimentType;
+
+    public AccompanimentTypeEnum getAccompanimentType() {
+        return accompanimentType;
+    }
+
+    public void setAccompanimentType(AccompanimentTypeEnum accompanimentType) {
+        this.accompanimentType = accompanimentType;
+    }
+
     public YesOrNoEnum getAuditVersion() {
         return auditVersion;
     }

+ 13 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/MusicSheet.java

@@ -76,6 +76,11 @@ public class MusicSheet implements Serializable {
     @ApiModelProperty(value = "曲谱标签(多个标签用逗号分隔)")
     private String musicTag;  //曲谱标签(多个标签用逗号分隔)
 
+	@NotNull(message = "伴奏类型不能为空!")
+	@TableField("accompaniment_type_")
+	@ApiModelProperty(value = "伴奏类型 HOMEMODE:自制伴奏  COMMON:普通伴奏")
+	private AccompanimentTypeEnum accompanimentType;
+
     @TableField("play_speed_")
 	// @NotNull(message = "默认播放速度不能为空!")
     @ApiModelProperty(value = "默认播放速度")
@@ -189,6 +194,14 @@ public class MusicSheet implements Serializable {
 	@ApiModelProperty(value = "假删除标识 0:未删除 1:已删除")
 	private Boolean delFlag;
 
+	public AccompanimentTypeEnum getAccompanimentType() {
+		return accompanimentType;
+	}
+
+	public void setAccompanimentType(AccompanimentTypeEnum accompanimentType) {
+		this.accompanimentType = accompanimentType;
+	}
+
 	public String getTitleImg() {
 		return titleImg;
 	}

+ 17 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/StudentTime.java

@@ -52,11 +52,27 @@ public class StudentTime implements Serializable {
     private Date firstMallTime;
 
     @ApiModelProperty("第一次购买时间 ")
-    @TableField(value = "first_activity_time_")
+    @TableField(value = "first_pay_time_")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     private Date firstPayTime;
 
+
+
+    @ApiModelProperty("第一次活动购买时间 ")
+    @TableField(value = "first_activity_time_")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date firstActivityTime;
+
+    public Date getFirstActivityTime() {
+        return firstActivityTime;
+    }
+
+    public void setFirstActivityTime(Date firstActivityTime) {
+        this.firstActivityTime = firstActivityTime;
+    }
+
     public Date getFirstPayTime() {
         return firstPayTime;
     }

+ 35 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/AccompanimentTypeEnum.java

@@ -0,0 +1,35 @@
+package com.yonge.cooleshow.biz.dal.enums;
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.yonge.toolset.base.enums.BaseEnum;
+
+/**
+ * Description 曲目音频类型 1:mp3,2:midi,3:mp3_metronome
+ *
+ * @author liujunchi
+ * @date 2022-04-01
+ */
+public enum AccompanimentTypeEnum implements BaseEnum<String, AccompanimentTypeEnum> {
+
+
+    HOMEMODE("HOMEMODE"), // 自制
+    COMMON("COMMON"), //普通
+     ;
+    @EnumValue
+    private String code;
+    private String msg;
+
+    AccompanimentTypeEnum(String msg) {
+        this.code = this.name();
+        this.msg = msg;
+    }
+
+    @Override
+    public String getCode() {
+        return this.code;
+    }
+
+    public String getMsg() {
+        return this.msg;
+    }
+}

+ 10 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/PianoRoomChangeRecordService.java

@@ -2,6 +2,7 @@ package com.yonge.cooleshow.biz.dal.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
 import com.yonge.cooleshow.biz.dal.vo.PianoRoomChangeRecordVo;
 import com.yonge.cooleshow.biz.dal.dto.search.PianoRoomChangeRecordSearch;
 import com.yonge.cooleshow.biz.dal.entity.PianoRoomChangeRecord;
@@ -28,4 +29,13 @@ public interface PianoRoomChangeRecordService extends IService<PianoRoomChangeRe
     IPage<PianoRoomChangeRecordVo> selectPage(IPage<PianoRoomChangeRecordVo> page, PianoRoomChangeRecordSearch query);
 
 	boolean add(PianoRoomChangeRecord pianoRoomChangeRecord);
+
+	/**
+	 * 增/减老师琴房课时长
+	 *
+	 * @param userId 老师id
+	 * @param times 时长
+	 * @param inOrOut 增/减
+	 */
+	void setPianoRoomTime(Long userId, Integer times, InOrOutEnum inOrOut);
 }

+ 19 - 18
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java

@@ -898,25 +898,26 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
                     teacherInfo.getUsername(), courseGroup.getName(), smsLiveBuyUrl);
             log.info("buyLiveCourseSuccess buyLiveSendMessage SMS_BUY_LIVE ok");
 
-            //极光-消息推送-老师端-通知老师有学生购买课程-跳转到APP
-            MessageTypeEnum studentBuyLive = MessageTypeEnum.STUDENT_BUY_LIVE;
-            //查询推送跳转的url
-            String studentBuyLiveUrl = sysMessageService.selectConfigUrl(studentBuyLive.getCode(), courseGroup.getId());
-            Map<Long, String> teacherReceivers = new HashMap<>();
-            teacherReceivers.put(teacherInfo.getId(), teacherInfo.getPhone());
-            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, studentBuyLive,
-                    teacherReceivers, null, 0, studentBuyLiveUrl, ClientEnum.TEACHER.getCode(),
-                    studentInfo.getUsername(), courseGroup.getName());
-            log.info("buyLiveCourseSuccess buyLiveSendMessage STUDENT_BUY_LIVE ok");
-
-            //短信-消息推送-老师端-通知老师有学生购买课程-无需跳转到APP
-            Map<Long, String> smsTeacherReceivers = new HashMap<>();
-            smsTeacherReceivers.put(teacherInfo.getId(), teacherInfo.getPhone());
-            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.SMS_BUY_LIVE,
-                    smsTeacherReceivers, null, 0, null, null,
-                    studentInfo.getUsername(), courseGroup.getName());
-            log.info("buyLiveCourseSuccess buyLiveSendMessage SMS_BUY_LIVE ok");
+            if (studentPayment.getActualPrice().compareTo(BigDecimal.ZERO) >0) {
+                //极光-消息推送-老师端-通知老师有学生购买课程-跳转到APP
+                MessageTypeEnum studentBuyLive = MessageTypeEnum.STUDENT_BUY_LIVE;
+                //查询推送跳转的url
+                String studentBuyLiveUrl = sysMessageService.selectConfigUrl(studentBuyLive.getCode(), courseGroup.getId());
+                Map<Long, String> teacherReceivers = new HashMap<>();
+                teacherReceivers.put(teacherInfo.getId(), teacherInfo.getPhone());
+                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, studentBuyLive,
+                                                   teacherReceivers, null, 0, studentBuyLiveUrl, ClientEnum.TEACHER.getCode(),
+                                                   studentInfo.getUsername(), courseGroup.getName());
+                log.info("buyLiveCourseSuccess buyLiveSendMessage STUDENT_BUY_LIVE ok");
+
+                //短信-消息推送-老师端-通知老师有学生购买课程-无需跳转到APP
+                Map<Long, String> smsTeacherReceivers = new HashMap<>();
+                smsTeacherReceivers.put(teacherInfo.getId(), teacherInfo.getPhone());
+                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.SMS_BUY_LIVE,
+                                                   smsTeacherReceivers, null, 0, null, null, studentInfo.getUsername(), courseGroup.getName());
+                log.info("buyLiveCourseSuccess buyLiveSendMessage SMS_BUY_LIVE ok");
 
+            }
             //判断是否到达最低成课人数
             if (Objects.equals(courseGroup.getPreStudentNum(), courseGroup.getMixStudentNum())) {
                 //极光-消息推送-老师端-通知老师课程最小开课人数已达标

+ 38 - 28
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/PianoRoomChangeRecordServiceImpl.java

@@ -11,8 +11,6 @@ import com.yonge.cooleshow.biz.dal.enums.InOrOutEnum;
 import com.yonge.cooleshow.biz.dal.enums.MessageTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.PianoRoomTimeService;
 import com.yonge.cooleshow.biz.dal.service.SysMessageService;
-import com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupVo;
-import com.yonge.cooleshow.biz.dal.vo.VideoLessonShelvesVo;
 import com.yonge.cooleshow.common.enums.CacheNameEnum;
 import com.yonge.toolset.base.exception.BizException;
 import com.yonge.toolset.payment.util.DistributedLock;
@@ -63,36 +61,48 @@ public class PianoRoomChangeRecordServiceImpl extends ServiceImpl<PianoRoomChang
         //保存记录
         save(pianoRoomChangeRecord);
         //入琴房账户
+        setPianoRoomTime(pianoRoomChangeRecord.getUserId(), pianoRoomChangeRecord.getTimes(), pianoRoomChangeRecord.getInOrOut());
+        //琴房推送
+        sendMessage(pianoRoomChangeRecord);
+        return true;
+    }
+
+    /**
+     * 增/减老师琴房课时长
+     *
+     * @param userId 老师id
+     * @param times 时长
+     * @param inOrOut 增/减
+     */
+    @Override
+    public void setPianoRoomTime(Long userId, Integer times, InOrOutEnum inOrOut) {
         DistributedLock.of(redissonClient)
-                .runIfLockToFunction(CacheNameEnum.LOCK_CHANGE_PIANO_ROOM_ACCOUNT.getRedisKey(pianoRoomChangeRecord.getUserId())
-                        , (o) -> {
-                            PianoRoomTime pianoRoomTime = pianoRoomTimeService.getOne(Wrappers.<PianoRoomTime>lambdaQuery()
-                                    .eq(PianoRoomTime::getTeacherId, pianoRoomChangeRecord.getUserId()));
+                       .runIfLockToFunction(CacheNameEnum.LOCK_CHANGE_PIANO_ROOM_ACCOUNT.getRedisKey(userId)
+                               , (o) -> {
+                                        PianoRoomTime pianoRoomTime = pianoRoomTimeService.getOne(Wrappers.<PianoRoomTime>lambdaQuery()
+                                                .eq(PianoRoomTime::getTeacherId, userId));
 
-                            if (null == pianoRoomTime) {
-                                pianoRoomTime = new PianoRoomTime();
-                                pianoRoomTime.setRemainTime(0);
-                                pianoRoomTime.setFrozenTime(0);
-                                pianoRoomTime.setTeacherId(pianoRoomChangeRecord.getUserId());
-                                pianoRoomTimeService.save(pianoRoomTime);
-                            }
+                                        if (null == pianoRoomTime) {
+                                            pianoRoomTime = new PianoRoomTime();
+                                            pianoRoomTime.setRemainTime(0);
+                                            pianoRoomTime.setFrozenTime(0);
+                                            pianoRoomTime.setTeacherId(userId);
+                                            pianoRoomTimeService.save(pianoRoomTime);
+                                        }
 
-                            if (InOrOutEnum.IN.equals(pianoRoomChangeRecord.getInOrOut())) {
-                                pianoRoomTime.setRemainTime(pianoRoomTime.getRemainTime() + pianoRoomChangeRecord.getTimes());
-                            } else {
-                                pianoRoomTime.setRemainTime(pianoRoomTime.getRemainTime() - pianoRoomChangeRecord.getTimes());
-                            }
+                                        if (InOrOutEnum.IN.equals(inOrOut)) {
+                                            pianoRoomTime.setRemainTime(pianoRoomTime.getRemainTime() + times);
+                                        } else {
+                                            pianoRoomTime.setRemainTime(pianoRoomTime.getRemainTime() - times);
+                                        }
 
-                            if (pianoRoomTime.getRemainTime() < 0) {
-                                throw new BizException("扣除时长超过老师可用时长");
-                            }
-                            pianoRoomTime.setUpdateTime(new Date());
-                            pianoRoomTimeService.updateById(pianoRoomTime);
-                            return null;
-                        }, null, 10l);
-        //琴房推送
-        sendMessage(pianoRoomChangeRecord);
-        return true;
+                                        if (pianoRoomTime.getRemainTime() < 0) {
+                                            throw new BizException("扣除时长超过老师可用时长");
+                                        }
+                                        pianoRoomTime.setUpdateTime(new Date());
+                                        pianoRoomTimeService.updateById(pianoRoomTime);
+                                        return null;
+                               }, null, 10l);
     }
 
 

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/StudentTimeServiceImpl.java

@@ -89,8 +89,8 @@ public class StudentTimeServiceImpl extends ServiceImpl<StudentTimeDao, StudentT
                 if (null == studentTime.getFirstMusicTime() && GoodTypeEnum.MUSIC.equals(detailVo.getGoodType())) {
                     studentTime.setFirstMusicTime(now);
                 }
-                if (null == studentTime.getFirstPayTime() && GoodTypeEnum.ACTI_REGIST.equals(detailVo.getGoodType())) {
-                    studentTime.setFirstPayTime(now);
+                if (null == studentTime.getFirstActivityTime() && GoodTypeEnum.ACTI_REGIST.equals(detailVo.getGoodType())) {
+                    studentTime.setFirstActivityTime(now);
                 }
             }
 

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

@@ -224,10 +224,12 @@ public class VideoLessonPurchaseRecordServiceImpl extends ServiceImpl<VideoLesso
 
         //老师端-学生购买视频课
         try {
-            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_BUY_VIDEO,
-                    teacherReceivers, null, 0, null, ClientEnum.TEACHER.getCode(),
-                    student.getUsername(), lesson.getLessonName());
-            log.info("send success {}", MessageTypeEnum.STUDENT_BUY_VIDEO);
+            if (lesson.getLessonPrice().compareTo(BigDecimal.ZERO) >0) {
+                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_BUY_VIDEO,
+                                                   teacherReceivers, null, 0, null, ClientEnum.TEACHER.getCode(),
+                                                   student.getUsername(), lesson.getLessonName());
+                log.info("send success {}", MessageTypeEnum.STUDENT_BUY_VIDEO);
+            }
         } catch (Exception e) {
             log.error("send fail {}", MessageTypeEnum.STUDENT_BUY_VIDEO);
             e.printStackTrace();

+ 10 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherMusicSheetVo.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.biz.dal.vo;
 
+import com.yonge.cooleshow.biz.dal.enums.AccompanimentTypeEnum;
 import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -38,6 +39,8 @@ public class TeacherMusicSheetVo {
     @ApiModelProperty(value = "音乐家")
     private String composer;  //音乐家
 
+    @ApiModelProperty(value = "伴奏类型 HOMEMODE:自制伴奏  COMMON:普通伴奏")
+    private AccompanimentTypeEnum accompanimentType;
 
     @ApiModelProperty(value = "曲谱标签(多个标签用逗号分隔)")
     private String musicTag;  //曲谱标签(多个标签用逗号分隔)
@@ -60,6 +63,13 @@ public class TeacherMusicSheetVo {
     @ApiModelProperty("审批人姓名")
     private String auditName;
 
+    public AccompanimentTypeEnum getAccompanimentType() {
+        return accompanimentType;
+    }
+
+    public void setAccompanimentType(AccompanimentTypeEnum accompanimentType) {
+        this.accompanimentType = accompanimentType;
+    }
 
     public String getTitleImg() {
         return titleImg;

+ 8 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/MusicSheetMapper.xml

@@ -28,6 +28,7 @@
         <result column="update_by_" jdbcType="BIGINT" property="updateBy"/>
         <result column="remark_" jdbcType="VARCHAR" property="remark"/>
         <result column="notation_" jdbcType="VARCHAR" property="notation"/>
+        <result column="accompaniment_type_" jdbcType="VARCHAR" property="accompanimentType"/>
         <result column="title_img_" jdbcType="VARCHAR" property="titleImg"/>
     </resultMap>
 
@@ -62,6 +63,7 @@
         t.audit_version_ as auditVersion,
         t.source_type_ as sourceType,
         t.submit_audit_time_ as submitAuditTime,
+        t.accompaniment_type_ as accompanimentType,
         t.remark_ as remark,
         t.title_img_ as titleImg,
         t.reason_ as reason,
@@ -132,6 +134,9 @@
         <if test="param.topFlag != null">
             and t.top_flag_ = #{param.topFlag}
         </if>
+        <if test="param.accompanimentType != null">
+            and t.accompaniment_type_ = #{param.accompanimentType}
+        </if>
 
     </sql>
 
@@ -254,6 +259,7 @@
         <result column="auditVersion" jdbcType="VARCHAR" property="auditVersion"/>
         <result column="code" jdbcType="VARCHAR" property="code"/>
         <result column="reason" jdbcType="VARCHAR" property="reason"/>
+        <result column="accompanimentType" jdbcType="VARCHAR" property="accompanimentType"/>
         <result column="notation" jdbcType="VARCHAR" property="notation"/>
         <result column="aiDefaultFrequency" jdbcType="VARCHAR" property="aiDefaultFrequency"/>
         <collection property="background" ofType="com.yonge.cooleshow.biz.dal.entity.MusicSheetAccompaniment">
@@ -438,6 +444,7 @@
         ,ms.music_sheet_name_ as musicSheetName
         ,ms.composer_ as composer
         ,ms.title_img_ as titleImg
+        ,ms.accompaniment_type_ as accompanimentType
         ,ms.music_tag_ as musicTag
         ,(select group_concat(mt.name_) from music_tag mt
         where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0  and mt.state_ = 1) as musicTagNames
@@ -475,6 +482,7 @@
         select
         ms.create_by_ as teacherId
         ,ms.title_img_ as titleImg
+        ,ms.accompaniment_type_ as accompanimentType
         ,su.username_ as username
         ,su.real_name_ as realName
         ,su.phone_ as phone

+ 4 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/StudentTimeMapper.xml

@@ -9,6 +9,8 @@
         <result column="first_live_time_" property="firstLiveTime" />
         <result column="first_music_time_" property="firstMusicTime" />
         <result column="first_mall_time_" property="firstMallTime" />
+        <result column="first_activity_time_" property="firstActivityTime" />
+        <result column="first_pay_time_" property="firstPayTime" />
     </resultMap>
 
     <!-- 表字段 -->
@@ -20,5 +22,7 @@
         , t.first_live_time_ as firstLiveTime
         , t.first_music_time_ as firstMusicTime
         , t.first_mall_time_ as firstMallTime
+        , t.first_activity_time_ as firstActivityTime
+        , t.first_pay_time_ as firstPayTime
         </sql>
 </mapper>

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

@@ -236,6 +236,7 @@
                 (st.first_practice_time_ is null and od.good_type_ = 'PRACTICE') or
                 (st.first_video_time_ is null and od.good_type_ = 'VIDEO') or
                 (st.first_live_time_ is null and od.good_type_ = 'LIVE') or
+                (st.first_activity_time_ is null and od.good_type_ = 'ACTI_REGIST') or
                 (st.first_music_time_ is null and od.good_type_ = 'MUSIC')
             )
         )