Commit d2dd2979 by 涂亚平

插入视频逻辑修改

1 parent dc431b6c
...@@ -45,7 +45,6 @@ public class VodPlayHistoryController { ...@@ -45,7 +45,6 @@ public class VodPlayHistoryController {
@RequestMapping("insertHistoryNew") @RequestMapping("insertHistoryNew")
@ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点") @ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点")
@LoginRequired
@TimeRequired @TimeRequired
public ResponseVO insertHistoryNew(@RequestBody String param){ public ResponseVO insertHistoryNew(@RequestBody String param){
InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class); InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class);
......
...@@ -67,27 +67,32 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -67,27 +67,32 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
.lambda() .lambda()
.eq(ClassDictDO::getId, vodPlayHistoryDO.getClassId())); .eq(ClassDictDO::getId, vodPlayHistoryDO.getClassId()));
if (classDictDO.getLimitHour()==1){ if (classDictDO.getLimitHour() == 1) {
//查看当天这个人看了多少时间 //查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(vodPlayHistoryDO.getMemberId(), classDictDO.getId()); Integer total = vodPlayHistoryMapper.memberDailyStudyLength(vodPlayHistoryDO.getMemberId(), classDictDO.getId());
if (total == 6 * 3600) { if (total >= 6 * 3600) {
throw new HttpException(13001); throw new HttpException(13001);
} }
//是否超过时长 没超过 false 超过 true //是否超过时长
if (total + vodPlayHistoryDO.getPlayLength() > classDictDO.getLimitHour() * 3600) { if (total + vodPlayHistoryDO.getPlayLength() > 6 * 3600) {
int playLength = classDictDO.getLimitHour() * 3600 - total;
//超过时长
int playLength = 6 * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength); vodPlayHistoryDO.setPlayLength(playLength);
vodPlayHistoryDO.setPlayCount(1); vodPlayHistoryDO.setPlayCount(1);
if (playLength > 5) { if (playLength > 5) {
this.baseMapper.insert(vodPlayHistoryDO); this.baseMapper.insert(vodPlayHistoryDO);
} }
throw new HttpException(13001); // throw new HttpException(13001);
}else { } else {
vodPlayHistoryDO.setPlayCount(1); vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO); this.baseMapper.insert(vodPlayHistoryDO);
} }
} else if (classDictDO.getLimitHour() == 0) {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
} }
} }
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
...@@ -122,8 +127,11 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -122,8 +127,11 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
this.baseMapper.insert(vodPlayHistoryDO); this.baseMapper.insert(vodPlayHistoryDO);
} }
throw new HttpException(13001); throw new HttpException(13001);
}else {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
} }
}else { }else if (classDictDO.getLimitHour() == 0) {
vodPlayHistoryDO.setPlayCount(1); vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO); this.baseMapper.insert(vodPlayHistoryDO);
} }
......
# 本地环境配置 # 本地环境配置
spring.server.port=23462 spring.server.port=23457
# 数据源配置 # 数据源配置
spring.datasource.url=jdbc:mysql://116.62.57.92:3306/subsidy_online?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 spring.datasource.url=jdbc:mysql://116.62.57.92:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
#spring.datasource.url=jdbc:mysql://rm-uf6rab73w0qg843opxo.mysql.rds.aliyuncs.com:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 #spring.datasource.url=jdbc:mysql://rm-uf6rab73w0qg843opxo.mysql.rds.aliyuncs.com:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!