This commit is contained in:
wangjinlei
2024-05-28 17:46:39 +08:00
parent af4c961793
commit bda5846153
7 changed files with 44 additions and 26 deletions

View File

@@ -983,11 +983,11 @@ public class BuyOrderController {
userCourseBuyEntity.setCatalogueId(s.getCatalogueId());
userCourseBuyEntity.setDays(s.getDays());
userCourseBuyEntity.setCreateTime(new Date());
userCourseBuyEntity.setStartTime(new Date());
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DAY_OF_MONTH,s.getDays());
userCourseBuyEntity.setEndTime(cal.getTime());
// userCourseBuyEntity.setStartTime(new Date());
// Calendar cal = Calendar.getInstance();
// cal.setTime(new Date());
// cal.add(Calendar.DAY_OF_MONTH,s.getDays());
// userCourseBuyEntity.setEndTime(cal.getTime());
userCourseBuyDao.insert(userCourseBuyEntity);
}
}

View File

@@ -44,4 +44,11 @@ public class TaihuWelfareController {
taihuWelfareService.removeById(id);
return R.ok();
}
@RequestMapping("/getArticleDetail")
public R getArticleDetail(@RequestBody Map<String,Integer> map){
int id = map.get("id");
TaihuWelfareEntity byId = taihuWelfareService.getById(id);
return R.ok().put("result",byId);
}
}

View File

@@ -2,13 +2,14 @@ package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.CourseCatalogueChapterVideoEntity;
import com.peanut.modules.common.to.ParamTo;
public interface CourseCatalogueChapterVideoService extends IService<CourseCatalogueChapterVideoEntity> {
Page getCourseCatalogueChapterVideoList(ParamTo param);
CourseCatalogueChapterVideoEntity checkVideo(CourseCatalogueChapterVideoEntity video) throws Exception;
R checkVideo(CourseCatalogueChapterVideoEntity video) throws Exception;
void saveCoursePosition(int uId,int videoId,int position);
}

View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.common.service.AsyncService;
import com.peanut.common.utils.R;
import com.peanut.common.utils.ShiroUtils;
import com.peanut.common.utils.SpdbUtil;
import com.peanut.modules.common.dao.*;
@@ -33,6 +34,8 @@ public class CourseCatalogueChapterVideoServiceImpl extends ServiceImpl<CourseCa
private UserCourseVideoPositionDao userCourseVideoPositionDao;
@Autowired
private AsyncService asyncService;
@Autowired
private UserCourseBuyDao userCourseBuyDao;
@Override
public Page getCourseCatalogueChapterVideoList(ParamTo param) {
@@ -45,16 +48,27 @@ public class CourseCatalogueChapterVideoServiceImpl extends ServiceImpl<CourseCa
@Override
public CourseCatalogueChapterVideoEntity checkVideo(CourseCatalogueChapterVideoEntity videoEntity) throws Exception {
public R checkVideo(CourseCatalogueChapterVideoEntity videoEntity) throws Exception {
//获取基础数据
CourseCatalogueChapterVideoEntity video = this.getById(videoEntity.getId());
if (video.getDuration() == 0) {
asyncService.pushDurationToVideo(video.getId());//获取mp4总时长
asyncService.pushDurationToVideo(video.getId());//补充视频信息,获取总时长
}
CourseCatalogueChapterEntity courseCatalogueChapterEntity = courseCatalogueChapterDao.selectById(video.getChapterId());
CourseCatalogueEntity courseCatalogueEntity = courseCatalogueDao.selectById(courseCatalogueChapterEntity.getCatalogueId());
Integer uId = ShiroUtils.getUId();
//审查课程观看权限
//处理课程开始计时的逻辑
// if(courseCatalogueChapterEntity.getIsAudition()==0){
// userCourseBuyDao.selectList(new LambdaQueryWrapper<UserCourseBuyEntity>()
// .eq(UserCourseBuyEntity::getUserId,uId)
// .eq())
// }
//处理用户课程足迹
List<UserToCourseEntity> userToCourseEntities = userToCourseDao.selectList(new LambdaQueryWrapper<UserToCourseEntity>().eq(UserToCourseEntity::getUserId, uId).eq(UserToCourseEntity::getCourseId, courseCatalogueEntity.getCourseId()));
//用户课程足迹
if (userToCourseEntities.size() != 0) {
UserToCourseEntity userToCourseEntity = userToCourseEntities.get(0);
userToCourseEntity.setUpdateTime(new Date());
@@ -67,7 +81,7 @@ public class CourseCatalogueChapterVideoServiceImpl extends ServiceImpl<CourseCa
userToCourseEntity.setUpdateTime(new Date());
userToCourseDao.insert(userToCourseEntity);
}
//加密视频组装playauth
//开始增加视频数据所需的其他信息,加密视频组装playauth
if (video.getType() == 1) {
GetVideoPlayAuthResponse p = SpdbUtil.getPlayAuth(video.getVideo());
String playAuth = p.getBody().getPlayAuth();
@@ -86,7 +100,6 @@ public class CourseCatalogueChapterVideoServiceImpl extends ServiceImpl<CourseCa
}
video.setVideoUrl(s_str + video.getVideo());
}
if(video.getType() == 2){
String s_str = "";
if (video.getVideo().startsWith("article/")) {
@@ -95,10 +108,8 @@ public class CourseCatalogueChapterVideoServiceImpl extends ServiceImpl<CourseCa
s_str = "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/voice/taiHuClass/";
}
video.setVideoUrl(s_str + video.getVideo());
}
return video;
return R.ok().put("video",video);
}
@Override

View File

@@ -248,11 +248,11 @@ public class AliPayServiceImpl implements AliPayService {
userCourseBuyEntity.setCatalogueId(s.getCatalogueId());
userCourseBuyEntity.setDays(s.getDays());
userCourseBuyEntity.setCreateTime(new Date());
userCourseBuyEntity.setStartTime(new Date());
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DAY_OF_MONTH,s.getDays());
userCourseBuyEntity.setEndTime(cal.getTime());
// userCourseBuyEntity.setStartTime(new Date());
// Calendar cal = Calendar.getInstance();
// cal.setTime(new Date());
// cal.add(Calendar.DAY_OF_MONTH,s.getDays());
// userCourseBuyEntity.setEndTime(cal.getTime());
userCourseBuyDao.insert(userCourseBuyEntity);
}
}

View File

@@ -187,11 +187,11 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
userCourseBuyEntity.setCatalogueId(s.getCatalogueId());
userCourseBuyEntity.setDays(s.getDays());
userCourseBuyEntity.setCreateTime(new Date());
userCourseBuyEntity.setStartTime(new Date());
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DAY_OF_MONTH,s.getDays());
userCourseBuyEntity.setEndTime(cal.getTime());
// userCourseBuyEntity.setStartTime(new Date());
// Calendar cal = Calendar.getInstance();
// cal.setTime(new Date());
// cal.add(Calendar.DAY_OF_MONTH,s.getDays());
// userCourseBuyEntity.setEndTime(cal.getTime());
userCourseBuyDao.insert(userCourseBuyEntity);
}
}

View File

@@ -164,8 +164,7 @@ public class CourseController {
*/
@RequestMapping("/checkVideo")
public R checkVideo(@RequestBody CourseCatalogueChapterVideoEntity video) throws Exception {
CourseCatalogueChapterVideoEntity courseCatalogueChapterVideoEntity = courseCatalogueChapterVideoService.checkVideo(video);
return R.ok().put("video",courseCatalogueChapterVideoEntity);
return courseCatalogueChapterVideoService.checkVideo(video);
}
@RequestMapping("/getMyCourse")