Browse Source

Merge branch 'feature/0712_vip' into develop-new

刘俊驰 8 months ago
parent
commit
07a58e52e4

+ 0 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/AccountBizTypeEnum.java

@@ -29,7 +29,6 @@ public enum AccountBizTypeEnum implements BaseEnum<String, AccountBizTypeEnum> {
     MUSIC_SHARE("乐谱分润"),
     ALBUM_SHARE("专辑分润"),
     VIP_SHARE("会员分润"),
-    SVIP_SHARE("会员分润"),
     MALL_SHARE("商品分润"),
     ACTI_REGIST_SHARE("活动报名分润"),
 

+ 12 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/PaymentDivMemberRecordServiceImpl.java

@@ -956,7 +956,12 @@ public class PaymentDivMemberRecordServiceImpl extends ServiceImpl<PaymentDivMem
     private void teacherShare(UserOrderDetailVo userPaymentOrder, BigDecimal shareFee) {
         //获取账期时间
         Date accountPeriodTime = userOrderService.getAccountPeriodTime(userPaymentOrder);
-        AccountBizTypeEnum bizTypeEnum = AccountBizTypeEnum.valueOf(userPaymentOrder.getGoodType().getCode() + "_SHARE");
+        AccountBizTypeEnum bizTypeEnum;
+        if (userPaymentOrder.getGoodType() == GoodTypeEnum.SVIP) {
+            bizTypeEnum = AccountBizTypeEnum.VIP_SHARE;
+        } else {
+            bizTypeEnum = AccountBizTypeEnum.valueOf(userPaymentOrder.getGoodType().getCode() + "_SHARE");
+        }
         if (null != bizTypeEnum) {
             //插入分润老师账户变更记录-分润老师预收
             HttpResponseResult<UserAccountRecord> recomRecordRes = userAccountService.accountRecord(
@@ -1031,8 +1036,12 @@ public class PaymentDivMemberRecordServiceImpl extends ServiceImpl<PaymentDivMem
                 continue;
             }
             String type = userPaymentOrder.getGoodType().getCode();
-            if (share) {
-                type = type + "_SHARE";
+            if (share ) {
+                if (type.equals(GoodTypeEnum.SVIP.name())) {
+                    type = AccountBizTypeEnum.VIP_SHARE.name();
+                } else {
+                    type = type + "_SHARE";
+                }
             }
 
             AccountBizTypeEnum bizTypeEnum = AccountBizTypeEnum.valueOf(type);

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

@@ -77,7 +77,6 @@ public class PlatformCashAccountRecordServiceImpl extends ServiceImpl<PlatformCa
         paramNames.add(AccountBizTypeEnum.VIP.getCode());
         paramNames.add(AccountBizTypeEnum.SVIP.getCode());
         paramNames.add(AccountBizTypeEnum.VIP_SHARE.getCode());
-        paramNames.add(AccountBizTypeEnum.SVIP_SHARE.getCode());
         paramNames.add(AccountBizTypeEnum.ACTI_REGIST.getCode());
         paramNames.add(AccountBizTypeEnum.ACTI_REGIST_SHARE.getCode());
 

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

@@ -161,7 +161,26 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
 
     @Override
     public IPage<StudentVo> selectPage(IPage<StudentVo> page, StudentSearch studentSearch) {
-        return page.setRecords(baseMapper.selectPage(page, studentSearch));
+        List<StudentVo> records = baseMapper.selectPage(page, studentSearch);
+        for (StudentVo record : records) {
+            EUserVipType vipType = record.getVipType();
+            if (EUserVipType.NORMAL.equals(vipType)) {
+                record.setMembershipEndTime(Optional.ofNullable(record.getSvipEndTime()).orElse(record.getVipEndTime()));
+            }
+            if (EUserVipType.SVIP.equals(vipType)) {
+                Date perSvipEndTime = record.getPerSvipEndTime();
+                if (perSvipEndTime != null) {
+                    // 永久会员
+                    record.setMembershipEndTime(null);
+                } else {
+                    record.setMembershipEndTime(record.getSvipEndTime());
+                }
+            }
+            if (EUserVipType.VIP.equals(vipType)) {
+                record.setMembershipEndTime(record.getVipEndTime());
+            }
+        }
+        return page.setRecords(records);
     }
 
     @Override

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

@@ -54,6 +54,7 @@ import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.vo.HotTeacherVo;
 import com.yonge.cooleshow.biz.dal.vo.MusicSheetUploadCountVo;
 import com.yonge.cooleshow.biz.dal.vo.MyFens;
+import com.yonge.cooleshow.biz.dal.vo.StudentVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherHomeVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
@@ -257,6 +258,25 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
     public IPage<TeacherVo> selectPage(IPage<TeacherVo> page, TeacherSearch search) {
         List<TeacherVo> teacherVos = baseMapper.selectPage(page, search);
 
+        for (TeacherVo record : teacherVos) {
+            EUserVipType vipType = record.getVipType();
+            if (EUserVipType.NORMAL.equals(vipType)) {
+                record.setMembershipEndTime(Optional.ofNullable(record.getSvipEndTime()).orElse(record.getVipEndTime()));
+            }
+            if (EUserVipType.SVIP.equals(vipType)) {
+                Date perSvipEndTime = record.getPerSvipEndTime();
+                if (perSvipEndTime != null) {
+                    // 永久会员
+                    record.setMembershipEndTime(null);
+                } else {
+                    record.setMembershipEndTime(record.getSvipEndTime());
+                }
+            }
+            if (EUserVipType.VIP.equals(vipType)) {
+                record.setMembershipEndTime(record.getVipEndTime());
+            }
+        }
+
         if (CollectionUtils.isEmpty(teacherVos)) {
             return page.setRecords(teacherVos);
         }

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

@@ -105,7 +105,6 @@ public class UserAccountRecordServiceImpl extends ServiceImpl<UserAccountRecordD
         paramNames.add(AccountBizTypeEnum.VIP.getCode());
         paramNames.add(AccountBizTypeEnum.SVIP.getCode());
         paramNames.add(AccountBizTypeEnum.VIP_SHARE.getCode());
-        paramNames.add(AccountBizTypeEnum.SVIP_SHARE.getCode());
         List<UserAccountRecord> accountRecords = baseMapper.queryCanAccountByBizType(paramNames);
         for (UserAccountRecord accountRecord : accountRecords) {
             userAccountService.accountChange(accountRecord, PostStatusEnum.RECORDED);
@@ -163,7 +162,7 @@ public class UserAccountRecordServiceImpl extends ServiceImpl<UserAccountRecordD
         }else if (GoodTypeEnum.SVIP.equals(userOrderDetailVo.getGoodType())){
             bizIds.add(userOrderDetailVo.getBizId());
             records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.SVIP, bizIds));
-            records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.SVIP_SHARE, bizIds));
+            records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.VIP_SHARE, bizIds));
         }else if(GoodTypeEnum.VIDEO.equals(userOrderDetailVo.getGoodType())){
             bizIds.add(userOrderDetailVo.getBizId());
             records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.VIDEO, bizIds));

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

@@ -1285,7 +1285,12 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
                 //入老师账户
                 BigDecimal shareFee = platformFee.multiply(shareFeeRate).setScale(2, RoundingMode.HALF_UP);
                 if (shareFee.compareTo(BigDecimal.ZERO) > 0) {
-                    AccountBizTypeEnum bizTypeEnum = AccountBizTypeEnum.valueOf(orderDetailVo.getGoodType().getCode() + "_SHARE");
+                    AccountBizTypeEnum bizTypeEnum;
+                    if (orderDetailVo.getGoodType() == GoodTypeEnum.SVIP || orderDetailVo.getGoodType() == GoodTypeEnum.VIP) {
+                        bizTypeEnum= AccountBizTypeEnum.VIP_SHARE;
+                    } else {
+                        bizTypeEnum = AccountBizTypeEnum.valueOf(orderDetailVo.getGoodType().getCode() + "_SHARE");
+                    }
                     if (null != bizTypeEnum) {
                         //插入分润老师账户变更记录-分润老师预收
                         HttpResponseResult<UserAccountRecord> recomRecordRes = userAccountService.accountRecord(

+ 9 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/StudentVo.java

@@ -90,6 +90,15 @@ public class StudentVo extends Student {
     @ApiModelProperty(value = "用户会员类型,普通用户:NORMAL,会员:VIP,SVIP:SVIP")
     private EUserVipType vipType;
 
+   @ApiModelProperty("vip结束时间")
+    private Date vipEndTime;
+
+    @ApiModelProperty("svip结束时间")
+    private Date svipEndTime;
+
+    @ApiModelProperty("svip结束时间")
+    private Date perSvipEndTime;
+
     public YesOrNoEnum getDelFlag() {
         return delFlag;
     }

+ 9 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherVo.java

@@ -110,6 +110,15 @@ public class TeacherVo extends Teacher {
     @ApiModelProperty(value = "用户会员类型,普通用户:NORMAL,会员:VIP,SVIP:SVIP")
     private EUserVipType vipType;
 
+    @ApiModelProperty("vip结束时间")
+    private Date vipEndTime;
+
+    @ApiModelProperty("svip结束时间")
+    private Date svipEndTime;
+
+    @ApiModelProperty("svip结束时间")
+    private Date perSvipEndTime;
+
 
     public YesOrNoEnum getDelFlag() {
         return delFlag;

+ 11 - 10
cooleshow-user/user-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -106,7 +106,8 @@
             ifnull(vcr2.vip_type_,'NORMAL') as vipType,
 <!--            if(vcr.type_ = 'PERMANENT',null,vcr.end_time_) as membershipEndTime,-->
             max(if(vcr.vip_type_ = 'VIP', vcr.end_time_, null)) vipEndTime,
-            max(if(vcr.type_='PERPETUAL', null , vcr.end_time_)) svipEndTime,
+            max(if(vcr.vip_type_ = 'SVIP' and vcr.type_ = 'PERPETUAL', vcr.end_time_ , null)) perSvipEndTime,
+            max(if(vcr.vip_type_ = 'SVIP' and vcr.type_ != 'PERPETUAL', vcr.end_time_, null)) svipEndTime,
 <!--            (!isnull(membership_end_time_) and membership_end_time_ > now()) as isVip,-->
             (
             SELECT GROUP_CONCAT(name_ ORDER by locate(id_,t.subject_id_)) FROM subject WHERE FIND_IN_SET(id_,t.subject_id_)
@@ -115,8 +116,8 @@
         FROM student t
         left join sys_user u on t.user_id_ = u.id_
         left join tenant_info ti on t.tenant_id_ = ti.id_
-        left join vip_card_record vcr on t.user_id_ = vcr.user_id_ and vcr.efficient_flag_ = 1  and (vcr.vip_type_ = 'VIP' or vcr.vip_type_ = 'SVIP') and client_type_='STUDENT'
-        left join vip_card_record vcr2 on t.user_id_ = vcr2.user_id_ and vcr2.efficient_flag_ = 1 and vcr2.end_time_ > now() and now() >= vcr2.start_time_ and client_type_='STUDENT'
+        left join vip_card_record vcr on t.user_id_ = vcr.user_id_ and vcr.efficient_flag_ = 1  and (vcr.vip_type_ = 'VIP' or vcr.vip_type_ = 'SVIP') and vcr.client_type_='STUDENT'
+        left join vip_card_record vcr2 on t.user_id_ = vcr2.user_id_ and vcr2.efficient_flag_ = 1 and vcr2.end_time_ > now() and now() >= vcr2.start_time_ and vcr2.client_type_='STUDENT'
         <where>
             <if test="null != param.search and '' != param.search">
                 AND (
@@ -133,10 +134,10 @@
                 AND FIND_IN_SET(t.subject_id_, #{param.subjectId})
             </if>
             <if test="param.vipType != null">
-                <if test="param.vipType == 'NORMAL'">
+                <if test="param.vipType.code == 'NORMAL'">
                     and vcr2.id_ is null
                 </if>
-                <if test="param.vipType != 'NORMAL'">
+                <if test="param.vipType.code != 'NORMAL'">
                     and vcr2.vip_type_ = #{param.vipType}
                 </if>
             </if>
@@ -198,13 +199,13 @@
             </if>
         </where>
         group by t.user_id_
-        <if test="param.vipStartTime != null and param.vipEndTime != null">
+        <if test="param.vipStartTime != null and param.vipEndTime != null and param.vipType != null">
             having
-            <if test="param.vipType == 'VIP'">
-                and vipEndTime >= #{param.vipStartTime} and #{param.vipEndTime}> vipEndTime
+            <if test="param.vipType.code == 'VIP'">
+                 vipEndTime >= #{param.vipStartTime} and #{param.vipEndTime}> vipEndTime
             </if>
-            <if test="param.vipType == 'SVIP'">
-                and svipEndTime >= #{param.vipStartTime} and #{param.vipEndTime}> svipEndTime
+            <if test="param.vipType.code == 'SVIP'">
+                 svipEndTime >= #{param.vipStartTime} and #{param.vipEndTime}> svipEndTime
             </if>
         </if>
         <choose>

+ 20 - 8
cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -107,8 +107,10 @@
 <!--        (case when t.membership_end_time_ &gt;= now() then 1 else 0 end) isVip,-->
         <!--            t.tag_ tag,-->
         u.del_flag_ as delFlag,
-        ifnull(vcr.vip_type_,'NORMAL') as vipType,
-        if(vcr.type_ = 'PERMANENT',null,vcr.end_time_) as membershipEndTime,
+        ifnull(vcr2.vip_type_,'NORMAL') as vipType,
+        max(if(vcr.vip_type_ = 'VIP', vcr.end_time_, null)) vipEndTime,
+        max(if(vcr.vip_type_ = 'SVIP' and vcr.type_ = 'PERPETUAL', vcr.end_time_ , null)) perSvipEndTime,
+        max(if(vcr.vip_type_ = 'SVIP' and vcr.type_ != 'PERPETUAL', vcr.end_time_, null)) svipEndTime,
         (case when isnull(u.id_card_no_) then 0 else 1 end) as isReal,
         (case when isnull(b.user_id_) then 0 else 1 end) as isBank,
         (case when t.tenant_id_ = -1 then '平台' else ti.name_ end) as tenantName
@@ -118,8 +120,8 @@
         select distinct user_id_ from user_bank_card where del_flag_ = 0
         ) b on t.user_id_ = b.user_id_
         left join tenant_info ti on t.tenant_id_ = ti.id_
-        left join vip_card_record vcr on t.user_id_ = vcr.user_id_ and cvr.client_type_ = 'TEACHER'
-        and vcr.efficient_flag_ = 1 and vcr.end_time_ >= now() and now() > vcr.start_time_ and (vcr.vip_type_ = 'VIP' or vcr.vip_type_ = 'SVIP')
+        left join vip_card_record vcr on t.user_id_ = vcr.user_id_ and vcr.efficient_flag_ = 1  and (vcr.vip_type_ = 'VIP' or vcr.vip_type_ = 'SVIP') and vcr.client_type_='STUDENT'
+        left join vip_card_record vcr2 on t.user_id_ = vcr2.user_id_ and vcr2.efficient_flag_ = 1 and vcr2.end_time_ > now() and now() >= vcr2.start_time_ and vcr2.client_type_='STUDENT'
         <where>
             <if test="null != param.search and '' != param.search">
                 AND (
@@ -144,11 +146,11 @@
                 )
             </if>
             <if test="param.vipType != null">
-                <if test="param.vipType == 'NORMAL'">
-                    and vcr.id_ is null
+                <if test="param.vipType.code == 'NORMAL'">
+                    and vcr2.id_ is null
                 </if>
-                <if test="param.vipType != 'NORMAL'">
-                    and vcr.vip_type_ = #{param.vipType}
+                <if test="param.vipType.code != 'NORMAL'">
+                    and vcr2.vip_type_ = #{param.vipType}
                 </if>
             </if>
 <!--            <if test="param.isVip != null">-->
@@ -205,6 +207,16 @@
                 and ti.name_ like concat('%',#{param.tenantName},'%')
             </if>
         </where>
+        group by t.user_id_
+        <if test="param.vipStartTime != null and param.vipEndTime != null and param.vipType != null">
+            having
+            <if test="param.vipType.code == 'VIP'">
+                vipEndTime >= #{param.vipStartTime} and #{param.vipEndTime}> vipEndTime
+            </if>
+            <if test="param.vipType.code == 'SVIP'">
+                svipEndTime >= #{param.vipStartTime} and #{param.vipEndTime}> svipEndTime
+            </if>
+        </if>
         <choose>
             <when test="param.orderBy != null and param.orderBy.trim() != ''">
                 order by ${param.orderBy}