Browse Source

Merge branch 'feature/1113-vipCourse' into test

刘俊驰 9 months ago
parent
commit
be0183987e

+ 7 - 7
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/ExposureReportController.java → cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/ExposureRecordController.java

@@ -1,7 +1,7 @@
 package com.yonge.cooleshow.student.controller;
 
-import com.yonge.cooleshow.biz.dal.service.ExposureReportService;
-import com.yonge.cooleshow.biz.dal.wrapper.ExposureReportWrapper;
+import com.yonge.cooleshow.biz.dal.service.ExposureRecordService;
+import com.yonge.cooleshow.biz.dal.wrapper.ExposureRecordWrapper;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
@@ -17,16 +17,16 @@ import java.util.List;
 @Api(tags = "曝光记录")
 @RestController
 @RequestMapping("${app-config.url.student:}/exposure")
-public class ExposureReportController extends BaseController {
+public class ExposureRecordController extends BaseController {
 
     @Resource
-    private ExposureReportService exposureReportService;
+    private ExposureRecordService exposureRecordService;
 
 
     @ApiOperation(value = "记录曝光信息")
-    @PostMapping("/report")
-    public HttpResponseResult report(@RequestBody List<ExposureReportWrapper.SaveExposureReportDto> exposureReportDto) {
-        exposureReportService.report(exposureReportDto);
+    @PostMapping("/record")
+    public HttpResponseResult record(@RequestBody List<ExposureRecordWrapper.SaveExposureRecordDto> exposureReportDto) {
+        exposureRecordService.record(exposureReportDto);
         return succeed();
     }
 

+ 13 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/ExposureRecordDao.java

@@ -0,0 +1,13 @@
+package com.yonge.cooleshow.biz.dal.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yonge.cooleshow.biz.dal.entity.ExposureRecord;
+import com.yonge.cooleshow.biz.dal.wrapper.ExposureRecordWrapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface ExposureRecordDao extends BaseMapper<ExposureRecord> {
+    void saveExposureRecord(@Param("beans") List<ExposureRecordWrapper.SaveExposureRecordDto> exposureRecordDto);
+}
+

+ 0 - 13
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/ExposureReportDao.java

@@ -1,13 +0,0 @@
-package com.yonge.cooleshow.biz.dal.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.yonge.cooleshow.biz.dal.entity.ExposureReport;
-import com.yonge.cooleshow.biz.dal.wrapper.ExposureReportWrapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface ExposureReportDao extends BaseMapper<ExposureReport> {
-    void saveExposureReport(@Param("beans") List<ExposureReportWrapper.SaveExposureReportDto> exposureReportDto);
-}
-

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/ExposureReport.java → cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/ExposureRecord.java

@@ -12,7 +12,7 @@ import java.util.Date;
 
 @Data
 @ApiModel(value = "exposure_record-曝光记录表")
-public class ExposureReport implements Serializable {
+public class ExposureRecord implements Serializable {
     @TableId(value = "id_", type = IdType.AUTO)
     @ApiModelProperty(value = "主键")
     private Long id;

+ 12 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/ExposureRecordService.java

@@ -0,0 +1,12 @@
+package com.yonge.cooleshow.biz.dal.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.yonge.cooleshow.biz.dal.entity.ExposureRecord;
+import com.yonge.cooleshow.biz.dal.wrapper.ExposureRecordWrapper;
+
+import java.util.List;
+
+public interface ExposureRecordService extends IService<ExposureRecord> {
+
+    void record(List<ExposureRecordWrapper.SaveExposureRecordDto> exposureRecordDto);
+}

+ 0 - 12
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/ExposureReportService.java

@@ -1,12 +0,0 @@
-package com.yonge.cooleshow.biz.dal.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.yonge.cooleshow.biz.dal.entity.ExposureReport;
-import com.yonge.cooleshow.biz.dal.wrapper.ExposureReportWrapper;
-
-import java.util.List;
-
-public interface ExposureReportService extends IService<ExposureReport> {
-
-    void report(List<ExposureReportWrapper.SaveExposureReportDto> exposureReportDto);
-}

+ 13 - 13
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ExposureReportServiceImpl.java → cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ExposureRecordServiceImpl.java

@@ -1,13 +1,13 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.yonge.cooleshow.biz.dal.dao.ExposureReportDao;
-import com.yonge.cooleshow.biz.dal.entity.ExposureReport;
+import com.yonge.cooleshow.biz.dal.dao.ExposureRecordDao;
+import com.yonge.cooleshow.biz.dal.entity.ExposureRecord;
 import com.yonge.cooleshow.biz.dal.service.CourseGroupService;
-import com.yonge.cooleshow.biz.dal.service.ExposureReportService;
+import com.yonge.cooleshow.biz.dal.service.ExposureRecordService;
 import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
 import com.yonge.cooleshow.biz.dal.service.VideoLessonGroupService;
-import com.yonge.cooleshow.biz.dal.wrapper.ExposureReportWrapper;
+import com.yonge.cooleshow.biz.dal.wrapper.ExposureRecordWrapper;
 import com.yonge.toolset.utils.date.DateUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -21,8 +21,8 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 @Service
-public class ExposureReportServiceImpl extends ServiceImpl<ExposureReportDao, ExposureReport> implements ExposureReportService {
-    private final static Logger log = LoggerFactory.getLogger(ExposureReportServiceImpl.class);
+public class ExposureRecordServiceImpl extends ServiceImpl<ExposureRecordDao, ExposureRecord> implements ExposureRecordService {
+    private final static Logger log = LoggerFactory.getLogger(ExposureRecordServiceImpl.class);
 
     @Resource
     private CourseGroupService courseGroupService;
@@ -31,23 +31,23 @@ public class ExposureReportServiceImpl extends ServiceImpl<ExposureReportDao, Ex
     @Resource
     private VideoLessonGroupService videoLessonGroupService;
 
-    public ExposureReportDao getDao() {
+    public ExposureRecordDao getDao() {
         return baseMapper;
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void report(List<ExposureReportWrapper.SaveExposureReportDto> exposureReportDto) {
+    public void record(List<ExposureRecordWrapper.SaveExposureRecordDto> exposureRecordDto) {
         Date now = new Date();
         String exposureTime = DateUtil.format(now, DateUtil.DEFAULT_PATTERN);
-        exposureReportDto.forEach(e->e.setExposureTime(exposureTime));
-        baseMapper.saveExposureReport(exposureReportDto);
+        exposureRecordDto.forEach(e->e.setExposureTime(exposureTime));
+        baseMapper.saveExposureRecord(exposureRecordDto);
         //按类型分组
-        Map<String, List<ExposureReportWrapper.SaveExposureReportDto>> typeMap = exposureReportDto.stream().collect(Collectors.groupingBy(ExposureReportWrapper.SaveExposureReportDto::getObjectType));
+        Map<String, List<ExposureRecordWrapper.SaveExposureRecordDto>> typeMap = exposureRecordDto.stream().collect(Collectors.groupingBy(ExposureRecordWrapper.SaveExposureRecordDto::getObjectType));
         typeMap.forEach((k,v)->{
-            List<ExposureReportWrapper.SaveExposureReportDto> saveExposureReportDtos = typeMap.get(k);
+            List<ExposureRecordWrapper.SaveExposureRecordDto> saveExposureReportDtos = typeMap.get(k);
             //按对象id分组,并获取集合数量
-            Map<Long, Integer> exposureNumMap = saveExposureReportDtos.stream().collect(Collectors.groupingBy(ExposureReportWrapper.SaveExposureReportDto::getObjectId, Collectors.summingInt(e -> 1)));
+            Map<Long, Integer> exposureNumMap = saveExposureReportDtos.stream().collect(Collectors.groupingBy(ExposureRecordWrapper.SaveExposureRecordDto::getObjectId, Collectors.summingInt(e -> 1)));
             exposureNumMap.forEach((objectId,exposureNum)-> {
                 if ("LIVE".equals(k)) {
                     courseGroupService.getDao().updateExposureNum(objectId, exposureNum);

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

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -14,10 +15,12 @@ import com.yonge.cooleshow.biz.dal.service.UserAccountService;
 import com.yonge.cooleshow.biz.dal.vo.TeacherEarningVo;
 import com.yonge.cooleshow.biz.dal.vo.UserAccountVo;
 import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo;
+import com.yonge.cooleshow.biz.dal.wrapper.UserPaymentOrderWrapper;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.enums.EPaymentVersion;
 import com.yonge.cooleshow.common.enums.PostStatusEnum;
 import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext;
+import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -151,6 +154,16 @@ public class UserAccountRecordServiceImpl extends ServiceImpl<UserAccountRecordD
 
     @Override
     public List<UserAccountRecord> selectRecordByOrderDetail(UserOrderDetailVo userOrderDetailVo) {
+
+        String userAccountConfig = userOrderDetailVo.getAccountConfig();
+        UserPaymentOrderWrapper.AccountTenantTo accountTenantTo;
+        if (StringUtils.isBlank(userAccountConfig)) {
+            accountTenantTo = new UserPaymentOrderWrapper.AccountTenantTo();
+        } else {
+            accountTenantTo = JSON.parseObject(userAccountConfig, UserPaymentOrderWrapper.AccountTenantTo.class);
+        }
+        boolean tenantFlag =accountTenantTo.getIncomeTenant() !=null &&  accountTenantTo.getIncomeTenant() > 0;
+
         List<UserAccountRecord> records = new ArrayList<>();
         //订单类型: 学生端( VIP、开通会员  PRACTICE、趣纠课购买  LIVE、直播课购买 VIDEO、视频课购买 MUSIC、单曲点播 ) 老师端(VIP、开通会员 PIANO_ROOM、琴房时长)
         //获取业务id
@@ -173,7 +186,7 @@ public class UserAccountRecordServiceImpl extends ServiceImpl<UserAccountRecordD
             records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(),AccountBizTypeEnum.MUSIC_SHARE, bizIds));
         }else if(GoodTypeEnum.PRACTICE.equals(userOrderDetailVo.getGoodType())){
             //查询课程组下所有课程id
-            if (userOrderDetailVo.getPaymentVersion().equals(EPaymentVersion.V1)) {
+            if (userOrderDetailVo.getPaymentVersion().equals(EPaymentVersion.V1) || !tenantFlag) {
                 List<CourseSchedule> cancel = courseScheduleService.list(Wrappers.<CourseSchedule>lambdaQuery()
                         .eq(CourseSchedule::getCourseGroupId, userOrderDetailVo.getBizId())
                 );
@@ -187,7 +200,7 @@ public class UserAccountRecordServiceImpl extends ServiceImpl<UserAccountRecordD
             List<Long> groupId = Arrays.asList(userOrderDetailVo.getBizId());
             records.addAll(baseMapper.selectRecordByOrderDetail(userOrderDetailVo.getOrderNo(), AccountBizTypeEnum.LIVE_SHARE, groupId));
 
-            if (userOrderDetailVo.getPaymentVersion().equals(EPaymentVersion.V1)) {
+            if (userOrderDetailVo.getPaymentVersion().equals(EPaymentVersion.V1)  || !tenantFlag) {
                 //查询课程组下所有课程id
                 List<CourseSchedule> cancel = courseScheduleService.list(Wrappers.<CourseSchedule>lambdaQuery()
                         .eq(CourseSchedule::getCourseGroupId, userOrderDetailVo.getBizId())

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/ExposureReportWrapper.java → cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/ExposureRecordWrapper.java

@@ -12,13 +12,13 @@ import lombok.NoArgsConstructor;
  * 2022-12-07 10:16:58
  */
 @ApiModel(value = "ExposureReportWrapper", description = "曝光记录")
-public class ExposureReportWrapper {
+public class ExposureRecordWrapper {
 
     @Data
     @Builder
     @NoArgsConstructor
     @AllArgsConstructor
-    public static class SaveExposureReportDto {
+    public static class SaveExposureRecordDto {
         @ApiModelProperty("分类")
         private String objectType;
 

+ 3 - 3
cooleshow-user/user-biz/src/main/resources/config/mybatis/ExposureReportMapper.xml → cooleshow-user/user-biz/src/main/resources/config/mybatis/ExposureRecordDao.xml

@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
-<mapper namespace="com.yonge.cooleshow.biz.dal.dao.ExposureReportDao">
+<mapper namespace="com.yonge.cooleshow.biz.dal.dao.ExposureRecordDao">
 
-	<update id="saveExposureReport">
-		insert into exposure_report (exposure_time_, exposure_num_, object_id_, object_type_, platform_)
+	<update id="saveExposureRecord">
+		insert into exposure_record (exposure_time_, exposure_num_, object_id_, object_type_, platform_)
 		values
 		<foreach collection="beans" item="bean" separator="," >
 			(#{bean.exposureTime}, 1, #{bean.objectId}, #{bean.objectType}, #{bean.platform})