Commit d2b413ec by 涂亚平

人脸识别上线版本

1 parent f4da1322
......@@ -48,14 +48,12 @@ public class ClassHourDictController {
return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(getSettingVO));
}
@PostMapping("pollingGet")
@ApiOperation("轮询查询当前这个人当天有没有超过最长时长 memberId playLength")
@LoginRequired
@TimeRequired
public ResponseVO pollingGet(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
return ResponseData.generateCreatedResponse(0,classHourDictService.pollingGet(vodPlayHistoryDO));
}
// @PostMapping("pollingGet")
// @ApiOperation("轮询查询当前这个人当天有没有超过最长时长 memberId playLength")
// @LoginRequired
// @TimeRequired
// public ResponseVO pollingGet(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
// return ResponseData.generateCreatedResponse(0,classHourDictService.pollingGet(vodPlayHistoryDO));
// }
//
}
......@@ -44,7 +44,7 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
/**
* 查看某人当天看了多少时间
*/
int memberDailyStudyLength(Long memberId);
int memberDailyStudyLength(Long memberId,Long classId);
/**
* 查看学生是否完成了某个视频
......
......@@ -127,7 +127,7 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
}
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId(),null);
//是否超过时长 没超过 false 超过 true
if (classHourDictDO == null) {
......
......@@ -56,85 +56,78 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Autowired
private MemberStudyLengthMapper memberStudyLengthMapper;
@Autowired
private ClassHourDictMapper classHourDictMapper;
@Autowired
private MemberMapper memberMapper;
// @Autowired
// private RedisUtil redisUtil;
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
if (vodPlayHistoryDO.getPlayLength() > 3) {
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
if (vodPlayHistoryDO.getPlayLength() > 5) {
//查看系统设定的时长
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>()
ClassDictDO classDictDO = classDictMapper.selectOne(new QueryWrapper<ClassDictDO>()
.lambda()
.eq(ClassHourDictDO::getCompanyId, memberDO.getCompanyId()));
.eq(ClassDictDO::getId, vodPlayHistoryDO.getClassId()));
if (classHourDictDO.getStatus() == 1) {
if (classDictDO.getLimitHour()==1){
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(vodPlayHistoryDO.getMemberId(), classDictDO.getId());
if (total == classHourDictDO.getClassHour() * 3600) {
if (total == 6 * 3600) {
throw new HttpException(13001);
}
//是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() > classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour() * 3600 - total;
if (total + vodPlayHistoryDO.getPlayLength() > classDictDO.getLimitHour() * 3600) {
int playLength = classDictDO.getLimitHour() * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
vodPlayHistoryDO.setPlayCount(1);
if (playLength > 3) {
if (playLength > 5) {
this.baseMapper.insert(vodPlayHistoryDO);
}
throw new HttpException(13001);
}
}
}else {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
}
}
return ConstantUtils.ADD_SUCCESS;
}
public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO) {
if (insertHistoryNewDTO.getPlayLength() > 3) {
if (insertHistoryNewDTO.getPlayLength() > 5) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
BeanUtils.copyProperties(insertHistoryNewDTO, vodPlayHistoryDO);
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
//查看系统设定的时长
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>()
ClassDictDO classDictDO = classDictMapper.selectOne(new QueryWrapper<ClassDictDO>()
.lambda()
.eq(ClassHourDictDO::getCompanyId, memberDO.getCompanyId()));
.eq(ClassDictDO::getId, insertHistoryNewDTO.getClassId()));
if (classHourDictDO.getStatus() == 1) {
if (classDictDO.getLimitHour()==1){
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(insertHistoryNewDTO.getMemberId(),insertHistoryNewDTO.getClassId());
if (total == classHourDictDO.getClassHour() * 3600) {
if (total == 6 * 3600) {
throw new HttpException(13001);
}
//是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() > classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour() * 3600 - total;
if (total + vodPlayHistoryDO.getPlayLength() > classDictDO.getLimitHour() * 3600) {
int playLength = classDictDO.getLimitHour() * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
vodPlayHistoryDO.setPlayCount(1);
if (playLength > 3) {
if (playLength > 5) {
this.baseMapper.insert(vodPlayHistoryDO);
}
throw new HttpException(13001);
}
}
}else {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
}
}
return ConstantUtils.ADD_SUCCESS;
}
......@@ -630,7 +623,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public HashSet<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO) {
String classIds = "344";
String classIds = "286,292,350,355,302,366,379,367,368,371,374,373";
String[] classIdArr = classIds.split(",");
......@@ -647,19 +640,19 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
if (vodPlayStateVO1.getEndDate().getTime() - 3000 > vodPlayStateVO.getStartDate().getTime() && vodPlayStateVO.getPlayLength() >= 3) {
//这一条数据有问题
System.out.println("111111111111111111111" + vodPlayStateVO);
//查看这个人 这个课程 当天的全部数据 按照createDate升序排序
List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate());
//从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) {
VodPlayHistoryDO vph1 = vodPlayHistoryDOS.get(l); //第一条
if (l==0){
vph1.setPlayDate(vph1.getCreateDate());
}
VodPlayHistoryDO vph2 = vodPlayHistoryDOS.get(l + 1); //第二条
LocalDateTime dateTmp = vph1.getPlayDate().plusSeconds(vph2.getPlayLength()+getRandom1_2());
vph2.setPlayDate(dateTmp);
this.baseMapper.updateById(vph2);
}
// //查看这个人 这个课程 当天的全部数据 按照createDate升序排序
// List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate());
// //从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
// for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) {
// VodPlayHistoryDO vph1 = vodPlayHistoryDOS.get(l); //第一条
// if (l==0){
// vph1.setPlayDate(vph1.getCreateDate());
// }
// VodPlayHistoryDO vph2 = vodPlayHistoryDOS.get(l + 1); //第二条
// LocalDateTime dateTmp = vph1.getPlayDate().plusSeconds(vph2.getPlayLength()+getRandom1_2());
// vph2.setPlayDate(dateTmp);
// this.baseMapper.updateById(vph2);
// }
result.add(vodPlayStateVO.getId());
// break;
}
......
# 环境配置
spring.profiles.active=prod
spring.profiles.active=dev
#和CPU数
spring.server.acceptorThreadCount=600
spring.server.minSpareThreads=100
......
......@@ -105,7 +105,7 @@
AND a.vod_id = b.vod_id
</select>
<select id="memberDailyStudyLength" parameterType="long" resultType="integer">
<select id="memberDailyStudyLength" resultType="integer">
SELECT
ifnull( sum( t.play_length ), 0 )
FROM
......@@ -114,6 +114,7 @@
t.delete_date IS NULL
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
AND t.member_id = #{memberId}
and t.class_id = #{classId}
</select>
<select id="completeVodOrNot" resultType="integer">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!