Commit 096878dd by 涂亚平

解决时间交叉,活跃度检测的问题

1 parent 4f1af516
Showing with 447 additions and 378 deletions
......@@ -36,7 +36,7 @@ public class ActivityDetectionController {
private ActivityDetectionService activityDetectionService;
@PostMapping("verify")
@ApiOperation("验证滑块 ticket randStr memberId classId checkType:检测类型:0:滑块 1:人脸 ")
@ApiOperation("验证滑块 ticket randStr vodId memberId classId checkType:检测类型:0:滑块 1:人脸 ")
@TimeRequired
public ResponseVO verify(@RequestBody VerifyDTO verifyDTO, HttpServletRequest request){
return ResponseData.generateCreatedResponse(0,activityDetectionService.verify(verifyDTO,request));
......@@ -49,7 +49,7 @@ public class ActivityDetectionController {
}
@PostMapping("verifyError")
@ApiOperation("验证失败记录 classId memberId")
@ApiOperation("验证失败记录 vodId classId memberId")
public ResponseVO verifyError(@RequestBody ActivityDetectionDO activityDetectionDO){
return ResponseData.generateCreatedResponse(0,activityDetectionService.verifyError(activityDetectionDO));
}
......
......@@ -181,7 +181,7 @@ public class AdministerController {
@PostMapping("classVodDailyInfo")
@ApiOperation("学习记录---每日学习时长(视频维度)")
@LoginRequired
// @LoginRequired
public ResponseVO classVodDailyInfo(@RequestBody ClassVodDailyInfoDTO classVodDailyInfoDTO) {
return ResponseData.generateCreatedResponse(0, administerService.classVodDailyInfo(classVodDailyInfoDTO));
}
......
......@@ -16,6 +16,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
......@@ -39,17 +40,17 @@ public class VodPlayHistoryController {
"memberId 成员id playLength 播放时长 playRecord 位点 suspendLength暂停时长 ")
@LoginRequired
@TimeRequired
public ResponseVO insertHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistory(vodPlayHistoryDO));
public ResponseVO insertHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO, HttpServletRequest request){
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistory(vodPlayHistoryDO,request));
}
@RequestMapping("insertHistoryNew")
@ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id " +
"playLength 播放时长 playRecord 位点 suspendLength")
@TimeRequired
public ResponseVO insertHistoryNew(@RequestBody String param){
public ResponseVO insertHistoryNew(@RequestBody String param,HttpServletRequest request){
InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class);
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(insertHistoryNewDTO));
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(insertHistoryNewDTO,request));
}
@PostMapping("dataFix")
......
......@@ -13,6 +13,10 @@ public class VerifyDTO {
private Long memberId;
private Long vodId;
private Long classId;
private Integer clickStatus;
}
......@@ -64,76 +64,76 @@ public class RenSheJuJob {
private String env;
/**
// * POST-2:班级基本信息信息采集接口
// /**
//// * POST-2:班级基本信息信息采集接口
//// */
// @Scheduled(cron = "0 0 1 * * ?")
// public void classBaseInfo() throws IOException {
// if ("prod".equals(env)) {
// renSheJuService.classBaseInfo();
// }
// }
//
// /**
// * POST-3:学时信息采集接口
// */
@Scheduled(cron = "0 0 1 * * ?")
public void classBaseInfo() throws IOException {
if ("prod".equals(env)) {
renSheJuService.classBaseInfo();
}
}
/**
* POST-3:学时信息采集接口
*/
@Scheduled(cron = "0 5 1 * * ?")
public void classHourBehavior() throws IOException {
if ("prod".equals(env)) {
renSheJuService.classHourBehavior();
}
}
/**
* POST-4:考试信息采集接口
*/
@Scheduled(cron = "0 10 1 * * ?")
public void uploadChapterBehavior() throws IOException {
if ("prod".equals(env)) {
renSheJuService.uploadChapterBehavior();
}
}
/**
* POST-5:答疑辅导采集接口
*/
@Scheduled(cron = "0 15 1 * * ?")
public void uploadClassAnswerQuestionBehavior() throws IOException {
if ("prod".equals(env)) {
renSheJuService.uploadClassAnswerQuestionBehavior();
}
}
/**
* POST-6 班级活跃度/实名认证照片信息采集接口
*/
@Scheduled(cron = "0 20 1 * * ?")
public void uploadImage() throws IOException {
if ("prod".equals(env)) {
renSheJuService.uploadImage();
}
}
/**
* POST-7 获取培训待绑定的(班级编号,项目编号)列表
*/
@Scheduled(cron = "0 25 1 * * ?")
public void getClassCodeByPrivateKey() throws IOException {
if ("prod".equals(env)) {
renSheJuService.getClassCodeByPrivateKey();
}
}
/**
* POST-8 上下游班级数据绑定接口
*/
@Scheduled(cron = "0 30 1 * * ?")
public void uploadClassCode() throws IOException {
if ("prod".equals(env)) {
renSheJuService.uploadClassCode();
}
System.gc();
}
// @Scheduled(cron = "0 5 1 * * ?")
// public void classHourBehavior() throws IOException {
// if ("prod".equals(env)) {
// renSheJuService.classHourBehavior();
// }
// }
//
// /**
// * POST-4:考试信息采集接口
// */
// @Scheduled(cron = "0 10 1 * * ?")
// public void uploadChapterBehavior() throws IOException {
// if ("prod".equals(env)) {
// renSheJuService.uploadChapterBehavior();
// }
// }
//
// /**
// * POST-5:答疑辅导采集接口
// */
// @Scheduled(cron = "0 15 1 * * ?")
// public void uploadClassAnswerQuestionBehavior() throws IOException {
// if ("prod".equals(env)) {
// renSheJuService.uploadClassAnswerQuestionBehavior();
// }
// }
//
// /**
// * POST-6 班级活跃度/实名认证照片信息采集接口
// */
// @Scheduled(cron = "0 20 1 * * ?")
// public void uploadImage() throws IOException {
// if ("prod".equals(env)) {
// renSheJuService.uploadImage();
// }
// }
//
// /**
// * POST-7 获取培训待绑定的(班级编号,项目编号)列表
// */
// @Scheduled(cron = "0 25 1 * * ?")
// public void getClassCodeByPrivateKey() throws IOException {
// if ("prod".equals(env)) {
// renSheJuService.getClassCodeByPrivateKey();
// }
// }
//
// /**
// * POST-8 上下游班级数据绑定接口
// */
// @Scheduled(cron = "0 30 1 * * ?")
// public void uploadClassCode() throws IOException {
// if ("prod".equals(env)) {
// renSheJuService.uploadClassCode();
// }
// System.gc();
// }
// /**
// * POST-9 获取推送失败班级列表
......
......@@ -106,7 +106,7 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
/**
* 插入一条学习数据
*/
void insertPlayRecord(Long classId,Long vodId,Long memberId,Integer playLength,Integer suspendLength,Integer playRecord,Integer playCount,Date createDate);
void insertPlayRecord(Long classId,Long vodId,Long memberId,Integer playLength,Integer suspendLength,Integer playRecord,Date createDate,String ipAddress);
/**
* 修改一条记录
......@@ -132,4 +132,9 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
List<Long> vodMembers(Long classId);
/**
* 查看某个学员今天最近的一次学习记录
*/
Date latestDailyStudyRecord(Long memberId);
}
......@@ -31,6 +31,11 @@ public class ActivityDetectionDO extends BaseModel {
private Long classId;
/**
* 视频id
*/
private Long vodId;
/**
* 人员id
*/
private Long memberId;
......
......@@ -133,4 +133,9 @@ public class ClassDictDO extends BaseModel {
*/
private String professionRank;
/**
* 弹窗提醒
*/
private Integer activityFlag;
}
......@@ -60,8 +60,7 @@ public class VodPlayHistoryDO extends BaseModel {
/**
* 聚合
*/
private Integer playCount;
private String ipAddress;
private LocalDateTime playDate;
}
......@@ -8,6 +8,7 @@ import com.subsidy.model.VodPlayHistoryDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.vod.VodPlayStateVO;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
......@@ -22,9 +23,9 @@ import java.util.List;
*/
public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
String insertHistory(VodPlayHistoryDO vodPlayHistoryDO);
String insertHistory(VodPlayHistoryDO vodPlayHistoryDO,HttpServletRequest request);
String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO);
String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDT,HttpServletRequest request);
void dataFix(SignDatePlaysDTO dataFixDTO);
......
......@@ -30,47 +30,54 @@ import javax.servlet.http.HttpServletRequest;
@Service
public class ActivityDetectionServiceImpl extends ServiceImpl<ActivityDetectionMapper, ActivityDetectionDO> implements ActivityDetectionService {
@Autowired
private VodPlayHistoryMapper vodPlayHistoryMapper;
public String verify(VerifyDTO verifyDTO, HttpServletRequest request) {
public String verify(VerifyDTO verifyDTO, HttpServletRequest request){
try {
try{
DescribeCaptchaResultResponse resp = ActivityDetectionUtils.activityDetection(request,verifyDTO.getTicket(),verifyDTO.getRandStr());
// 输出json格式的字符串回包
ActivityDetectionDO activityDetectionDO = new ActivityDetectionDO();
activityDetectionDO.setClassId(verifyDTO.getClassId());
activityDetectionDO.setMemberId(verifyDTO.getMemberId());
activityDetectionDO.setRequestId(resp.getRequestId());
activityDetectionDO.setCheckType(0);
if (resp.getCaptchaCode()==1){
if (verifyDTO.getClickStatus() == 1) {
ActivityDetectionDO activityDetectionDO = new ActivityDetectionDO();
activityDetectionDO.setClassId(verifyDTO.getClassId());
activityDetectionDO.setMemberId(verifyDTO.getMemberId());
activityDetectionDO.setCheckType(0);
activityDetectionDO.setVodId(verifyDTO.getVodId());
//成功
activityDetectionDO.setStatus(1);
this.baseMapper.insert(activityDetectionDO);
return ConstantUtils.SUCCESS_VERIFY;
}else {
//失败
activityDetectionDO.setStatus(0);
this.baseMapper.insert(activityDetectionDO);
//
// //失败的话删掉这个人最新的学习数据
// Long latestRecord = vodPlayHistoryMapper.memberLatestRecord(verifyDTO.getMemberId());
// vodPlayHistoryMapper.deleteById(latestRecord);
} else {
DescribeCaptchaResultResponse resp = ActivityDetectionUtils.activityDetection(request, verifyDTO.getTicket(), verifyDTO.getRandStr());
// 输出json格式的字符串回包
ActivityDetectionDO activityDetectionDO = new ActivityDetectionDO();
activityDetectionDO.setClassId(verifyDTO.getClassId());
activityDetectionDO.setMemberId(verifyDTO.getMemberId());
activityDetectionDO.setRequestId(resp.getRequestId());
activityDetectionDO.setCheckType(0);
activityDetectionDO.setVodId(verifyDTO.getVodId());
if (resp.getCaptchaCode() == 1) {
//成功
activityDetectionDO.setStatus(1);
this.baseMapper.insert(activityDetectionDO);
return ConstantUtils.SUCCESS_VERIFY;
} else {
//失败
activityDetectionDO.setStatus(0);
this.baseMapper.insert(activityDetectionDO);
throw new HttpException(19001);
throw new HttpException(19001);
}
}
} catch (Exception e) {
// System.out.println(e.toString());
System.out.println(e.toString());
}
return ConstantUtils.SUCCESS_VERIFY;
}
public IPage<GetCheckHistoryVO> getCheckHistory(GetCheckHistoryDTO getCheckHistoryDTO){
public IPage<GetCheckHistoryVO> getCheckHistory(GetCheckHistoryDTO getCheckHistoryDTO) {
Page pager = new Page(getCheckHistoryDTO.getPageNum(), getCheckHistoryDTO.getPageSize());
return this.baseMapper.getCheckHistory(pager,getCheckHistoryDTO.getClassId(),getCheckHistoryDTO.getMemberId());
return this.baseMapper.getCheckHistory(pager, getCheckHistoryDTO.getClassId(), getCheckHistoryDTO.getMemberId());
}
public String verifyError(ActivityDetectionDO activityDetectionDO){
public String verifyError(ActivityDetectionDO activityDetectionDO) {
activityDetectionDO.setStatus(0);
activityDetectionDO.setCheckType(0);
this.baseMapper.insert(activityDetectionDO);
......
......@@ -301,12 +301,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if ("冻结".equals(memberDO.getStatus())) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10013);
}
......@@ -332,17 +326,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(70010);
}
//审计日志
// OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
// if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
// oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(1);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
// }
//mongoTemplate.insert(oprMemDictDO);
userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setSuperviseName(companyDictDO.getSuperviseName());
userRoleVO.setCompanyName(companyDictDO.getCompanyName());
......@@ -373,7 +356,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
throw new HttpException(10017);
}
/**
* 最近5次都输入失败,5分钟后再验证
*/
......@@ -790,6 +772,21 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
if (1 == classDictDO1.getIsOrder()) {
for (MemberVodVO memberVodVO : memberVodVOS) {
//当前视频有没有做过活跃度检测
Integer count = activityDetectionMapper.selectCount(new QueryWrapper<ActivityDetectionDO>()
.lambda()
.eq(ActivityDetectionDO::getVodId, memberVodVO.getId())
.eq(ActivityDetectionDO::getMemberId, contentVodDTO.getMemberId())
.eq(ActivityDetectionDO::getClassId, contentVodDTO.getClassId())
.eq(ActivityDetectionDO::getStatus, 1));
if (count > 0) {
memberVodVO.setActivityStatus(true);
} else {
memberVodVO.setActivityStatus(false);
}
if (i == 0 && contentStatus) {
//第一个视频默认打开
memberVodVO.setStatus(true);
......
......@@ -166,8 +166,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List<DailyStudyInfoVO> result = new ArrayList<>();
// List<Long> vodClassIds = new ArrayList<>();
//
// vodClassIds.add(451L);
try {
for (Long classId : vodClassIds) {
......
......@@ -10,13 +10,17 @@ import com.subsidy.mapper.*;
import com.subsidy.model.*;
import com.subsidy.service.VodPlayHistoryService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.IpAddressUtil;
import com.subsidy.util.SMSUtils;
import com.subsidy.vo.vod.FixLengthVO;
import com.subsidy.vo.vod.VodPlayStateVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sun.util.calendar.CalendarDate;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.*;
......@@ -55,21 +59,15 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Autowired
private SMSUtils smsUtils;
@Autowired
private ExerciseDoneResultMapper exerciseDoneResultMapper;
@Transactional(rollbackFor = Exception.class)
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO, HttpServletRequest request) {
// Integer count = exerciseDoneResultMapper.selectCount(new QueryWrapper<ExerciseDoneResultDO>()
// .lambda()
// .eq(ExerciseDoneResultDO::getClassId, vodPlayHistoryDO.getClassId())
// .eq(ExerciseDoneResultDO::getMemberId, vodPlayHistoryDO.getMemberId())
// .eq(ExerciseDoneResultDO::getResult, "合格"));
// if (count == 0){
Date date = new Date();
if (vodPlayHistoryDO.getPlayLength() > 8 && vodPlayHistoryDO.getSuspendLength() <= 3000) {
Date latestDailyDate = this.baseMapper.latestDailyStudyRecord(vodPlayHistoryDO.getMemberId());
//查看系统设定的时长
ClassDictDO classDictDO = classDictMapper.selectOne(new QueryWrapper<ClassDictDO>()
.lambda()
......@@ -85,40 +83,35 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//超过时长
int playLength = 6 * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
vodPlayHistoryDO.setPlayCount(1);
if (playLength > 5) {
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
// this.baseMapper.insert(vodPlayHistoryDO);
if (playLength > 8) {
FixLengthVO fixLengthVO = fixPlayLength(date, latestDailyDate, vodPlayHistoryDO.getPlayLength(), vodPlayHistoryDO.getSuspendLength());
if (null != fixLengthVO.getSuspendLength() && null != fixLengthVO.getPlayLength()) {
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), fixLengthVO.getPlayLength()
, fixLengthVO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), date, IpAddressUtil.getIpAddress(request));
}
}
} else {
vodPlayHistoryDO.setPlayCount(1);
// this.baseMapper.insert(vodPlayHistoryDO);
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
FixLengthVO fixLengthVO = fixPlayLength(date, latestDailyDate, vodPlayHistoryDO.getPlayLength(), vodPlayHistoryDO.getSuspendLength());
if (null != fixLengthVO.getSuspendLength() && null != fixLengthVO.getPlayLength()) {
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), fixLengthVO.getPlayLength()
, fixLengthVO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), date, IpAddressUtil.getIpAddress(request));
}
}
} else if (classDictDO.getLimitHour() == 0) {
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
// this.baseMapper.insert(vodPlayHistoryDO);
FixLengthVO fixLengthVO = fixPlayLength(date, latestDailyDate, vodPlayHistoryDO.getPlayLength(), vodPlayHistoryDO.getSuspendLength());
if (null != fixLengthVO.getSuspendLength() && null != fixLengthVO.getPlayLength()) {
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), fixLengthVO.getPlayLength()
, fixLengthVO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), date, IpAddressUtil.getIpAddress(request));
}
}
}
// }
return ConstantUtils.ADD_SUCCESS;
}
@Transactional(rollbackFor = Exception.class)
public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO) {
public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO, HttpServletRequest request) {
// Integer count = exerciseDoneResultMapper.selectCount(new QueryWrapper<ExerciseDoneResultDO>()
// .lambda()
// .eq(ExerciseDoneResultDO::getClassId, insertHistoryNewDTO.getClassId())
// .eq(ExerciseDoneResultDO::getMemberId, insertHistoryNewDTO.getMemberId())
// .eq(ExerciseDoneResultDO::getResult, "合格"));
//
// if (count == 0){
Date date = new Date();
if (insertHistoryNewDTO.getPlayLength() > 8 && insertHistoryNewDTO.getSuspendLength() <= 3000) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
......@@ -127,6 +120,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
ClassDictDO classDictDO = classDictMapper.selectOne(new QueryWrapper<ClassDictDO>()
.lambda()
.eq(ClassDictDO::getId, insertHistoryNewDTO.getClassId()));
Date latestDailyDate = this.baseMapper.latestDailyStudyRecord(vodPlayHistoryDO.getMemberId());
if (classDictDO.getLimitHour() == 1) {
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(insertHistoryNewDTO.getMemberId(), insertHistoryNewDTO.getClassId());
......@@ -137,29 +131,62 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
if (total + vodPlayHistoryDO.getPlayLength() > 6 * 3600) {
int playLength = 6 * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
vodPlayHistoryDO.setPlayCount(1);
if (playLength > 5) {
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
// this.baseMapper.insert(vodPlayHistoryDO);
if (playLength > 8) {
FixLengthVO fixLengthVO = fixPlayLength(date, latestDailyDate, vodPlayHistoryDO.getPlayLength(), vodPlayHistoryDO.getSuspendLength());
if (null != fixLengthVO.getSuspendLength() && null != fixLengthVO.getPlayLength()) {
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), fixLengthVO.getPlayLength()
, fixLengthVO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), date, IpAddressUtil.getIpAddress(request));
}
}
} else {
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
// this.baseMapper.insert(vodPlayHistoryDO);
FixLengthVO fixLengthVO = fixPlayLength(date, latestDailyDate, vodPlayHistoryDO.getPlayLength(), vodPlayHistoryDO.getSuspendLength());
if (null != fixLengthVO.getSuspendLength() && null != fixLengthVO.getPlayLength()) {
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), fixLengthVO.getPlayLength()
, fixLengthVO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), date, IpAddressUtil.getIpAddress(request));
}
}
} else if (classDictDO.getLimitHour() == 0) {
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
// this.baseMapper.insert(vodPlayHistoryDO);
FixLengthVO fixLengthVO = fixPlayLength(date, latestDailyDate, vodPlayHistoryDO.getPlayLength(), vodPlayHistoryDO.getSuspendLength());
if (null != fixLengthVO.getSuspendLength() && null != fixLengthVO.getPlayLength()) {
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), fixLengthVO.getPlayLength()
, fixLengthVO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), date, IpAddressUtil.getIpAddress(request));
}
}
}
// }
return ConstantUtils.ADD_SUCCESS;
}
/**
* 修正插入观看时长,使不在有交叉
*
* @param currentDate 当前插入时间
* @param latestDate 最近一次学习时间
* @param playLength 当前观看时长
* @param suspendLength 暂停时长
* @return
*/
public FixLengthVO fixPlayLength(Date currentDate, Date latestDate, Integer playLength, Integer suspendLength) {
FixLengthVO fixLengthVO = new FixLengthVO();
if (null != latestDate) {
int diff = (int) (currentDate.getTime() - latestDate.getTime()) / 1000;
if (diff < playLength + suspendLength) {
if (diff > 8) {
fixLengthVO.setSuspendLength(0);
fixLengthVO.setPlayLength(diff);
}
} else {
fixLengthVO.setPlayLength(playLength);
fixLengthVO.setSuspendLength(suspendLength);
}
} else {
fixLengthVO.setPlayLength(playLength);
fixLengthVO.setSuspendLength(suspendLength);
}
return fixLengthVO;
}
public void dataFix(SignDatePlaysDTO dataFixDTO) {
//班级ids
......@@ -254,7 +281,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
if (leftLength > 0) {
totalPlay += leftLength;
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(Long.valueOf(str));
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
vodPlayHistoryDO.setPlayRecord(vodDictDO.getVodLength());
......@@ -282,7 +308,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//最后一天最后一个视频
if (key_index == integers.size()) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(Long.valueOf(str));
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
vodPlayHistoryDO.setPlayRecord(vodDictDO.getVodLength());
......@@ -294,7 +319,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
} else {
//当天看的最后一个视频
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(Long.valueOf(str));
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
int rdm = random.nextInt(vodDictDO.getVodLength());
......@@ -309,7 +333,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
} else {
totalPlay += vodDictDO.getVodLength();
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(Long.valueOf(str));
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
vodPlayHistoryDO.setPlayRecord(vodDictDO.getVodLength());
......@@ -374,7 +397,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
Random random1 = new Random();
int j = random1.nextInt(vodDictDOS.size());
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(Long.valueOf(str));
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
int h = new Random().nextInt(vodDictDOS.get(j).getVodLength() - 10) + 1;
......@@ -468,7 +490,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
Random random1 = new Random();
System.out.println("55555555555555555555");
int j = random1.nextInt(vodDictDOS.size());
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(classId);
vodPlayHistoryDO.setMemberId(remainSecondsDTO.getMemberId());
int h = new Random().nextInt(vodDictDOS.get(j).getVodLength() - 10) + 1;
......@@ -604,7 +625,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
if (leftLength > 0) {
totalPlay += leftLength;
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(classDictDO.getId());
vodPlayHistoryDO.setMemberId(remainSecondsDTO.getMemberId());
vodPlayHistoryDO.setPlayRecord(vodDictDO.getVodLength());
......@@ -628,7 +648,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
if (count == 0) {
if (totalPlayLength > totalPlay) { //说明今天还可以学
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(classDictDO.getId());
vodPlayHistoryDO.setMemberId(remainSecondsDTO.getMemberId());
vodPlayHistoryDO.setPlayRecord(vodDictDO.getVodLength());
......@@ -724,21 +743,21 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
VodDictDO vodDictDO = vodDictMapper.selectById(vodPlayHistoryDO.getVodId());
for (Long memberId : vodMembers){
List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.selectList(new QueryWrapper<VodPlayHistoryDO>()
.lambda()
.eq(VodPlayHistoryDO::getClassId,vodPlayHistoryDO.getClassId())
.eq(VodPlayHistoryDO::getMemberId,memberId)
.eq(VodPlayHistoryDO::getVodId,vodPlayHistoryDO.getVodId())
.orderByAsc(VodPlayHistoryDO::getCreateDate));
int i = 0 ;
for (VodPlayHistoryDO vodPlayHistoryDO1 : vodPlayHistoryDOS){
i+=vodPlayHistoryDO1.getPlayLength();
if ( i >= vodDictDO.getVodLength()){
result.add(vodPlayHistoryDO1.getId());
break;
}
for (Long memberId : vodMembers) {
List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.selectList(new QueryWrapper<VodPlayHistoryDO>()
.lambda()
.eq(VodPlayHistoryDO::getClassId, vodPlayHistoryDO.getClassId())
.eq(VodPlayHistoryDO::getMemberId, memberId)
.eq(VodPlayHistoryDO::getVodId, vodPlayHistoryDO.getVodId())
.orderByAsc(VodPlayHistoryDO::getCreateDate));
int i = 0;
for (VodPlayHistoryDO vodPlayHistoryDO1 : vodPlayHistoryDOS) {
i += vodPlayHistoryDO1.getPlayLength();
if (i >= vodDictDO.getVodLength()) {
result.add(vodPlayHistoryDO1.getId());
break;
}
}
}
return result;
......
......@@ -13,37 +13,40 @@ public class ActivityDetectionUtils {
/**
* 活跃度检测工具类
* @param request
* @param randstr
* @return
*
* @throws Exception
*/
public static DescribeCaptchaResultResponse activityDetection(HttpServletRequest request,String ticket, String randstr) throws Exception {
// 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
// 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
Credential cred = new Credential(ConstantUtils.SECRET_ID, ConstantUtils.SECRET_KEY);
// 实例化一个http选项,可选的,没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("captcha.tencentcloudapi.com");
// 实例化一个client选项,可选的,没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
CaptchaClient client = new CaptchaClient(cred, "", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
DescribeCaptchaResultRequest req = new DescribeCaptchaResultRequest();
req.setCaptchaType(9L);
String ip = IpAddressUtil.getIpAddress(request);
req.setUserIp(ip);
req.setRandstr(randstr);
req.setCaptchaAppId(ConstantUtils.CAPTCHAAPP_ID);
req.setAppSecretKey(ConstantUtils.APP_SECRET_KEY);
req.setBusinessId(ConstantUtils.BUSINESS_ID);
req.setTicket(ticket);
// 返回的resp是一个DescribeCaptchaResultResponse的实例,与请求对象对应
return client.DescribeCaptchaResult(req);
public static DescribeCaptchaResultResponse activityDetection(HttpServletRequest request, String ticket, String randstr) {
try {
// 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
// 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
Credential cred = new Credential(ConstantUtils.SECRET_ID, ConstantUtils.SECRET_KEY);
// 实例化一个http选项,可选的,没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("captcha.tencentcloudapi.com");
// 实例化一个client选项,可选的,没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
CaptchaClient client = new CaptchaClient(cred, "", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
DescribeCaptchaResultRequest req = new DescribeCaptchaResultRequest();
req.setCaptchaType(9L);
String ip = IpAddressUtil.getIpAddress(request);
req.setUserIp(ip);
req.setRandstr(randstr);
req.setCaptchaAppId(ConstantUtils.CAPTCHAAPP_ID);
req.setAppSecretKey(ConstantUtils.APP_SECRET_KEY);
req.setBusinessId(ConstantUtils.BUSINESS_ID);
req.setTicket(ticket);
// 返回的resp是一个DescribeCaptchaResultResponse的实例,与请求对象对应
return client.DescribeCaptchaResult(req);
} catch (Exception e) {
}
return null;
}
}
......@@ -67,4 +67,6 @@ public class ClassSettingsVO {
private Integer deviceNoRecord;
private Integer timeLimit;
private Integer activityFlag;
}
......@@ -24,4 +24,5 @@ public class MemberVodVO {
private String leftLength;
private Boolean activityStatus;
}
package com.subsidy.vo.vod;
import lombok.Data;
@Data
public class FixLengthVO {
private Integer suspendLength;
private Integer playLength;
}
......@@ -2,14 +2,21 @@
spring.server.port=23457
# 数据源配置
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://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.type=com.alibaba.druid.pool.DruidDataSource
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
##spring.datasource.username=ykadmin_new
##spring.datasource.password=youkedb608@good
#spring.datasource.username=devloper
#spring.datasource.password=dev@1553$
# 数据源配置 8.0数据库
spring.datasource.url=jdbc:mysql://139.224.253.21:3306/subsidy?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.username=ykadmin_new
#spring.datasource.password=youkedb608@good
spring.datasource.username=devloper
spring.datasource.password=dev@1553$
spring.datasource.username=root
spring.datasource.password=ykhladmin302
spring.datasource.druid.initialSize=5
spring.datasource.druid.minIdle=5
......
......@@ -203,7 +203,7 @@
AND t2.class_id = #{classId}
GROUP BY
t2.member_id,
t2.class_id
t2.class_id
) t2 ON t1.id = t2.member_id
order by t1.account_name ASC
</select>
......
......@@ -80,7 +80,7 @@
<select id="getCLassMemberByCompanyId" resultType="com.subsidy.model.ClassMemberMappingDO">
SELECT
t.*
distinct t.*
FROM
class_member_mapping t
LEFT JOIN class_dict t1 ON t1.id = t.class_id
......@@ -88,7 +88,6 @@
t1.company_id = #{companyId}
AND t.delete_date IS NULL
AND t1.delete_date IS NULL
GROUP BY t.member_id
</select>
</mapper>
......@@ -413,7 +413,7 @@
FROM
member m
LEFT JOIN class_member_mapping cm ON cm.member_id = m.id
LEFT JOIN ( SELECT member_id, count( 1 ) AS ts, class_id FROM exercise_done_result WHERE score >= 60 GROUP BY class_id ) AS r ON r.member_id = m.id AND r.class_id = cm.class_id
LEFT JOIN ( SELECT member_id, count( 1 ) AS ts, class_id FROM exercise_done_result WHERE score >= 60 GROUP BY class_id,member_id ) AS r ON r.member_id = m.id AND r.class_id = cm.class_id
WHERE
cm.class_id = #{classId}
AND r.ts is NULL
......
......@@ -108,7 +108,6 @@
FROM
(
SELECT
id,
user_id,
opr_type,
max( create_date ) AS time1
......@@ -126,7 +125,6 @@
) t1
LEFT JOIN (
SELECT
id,
user_id,
opr_type,
max( create_date ) AS time2
......@@ -143,8 +141,7 @@
create_date DESC
) t2 ON t1.user_id = t2.user_id
WHERE
t2.id IS NULL
OR t2.time2 &lt; t1.time1
t2.time2 &lt; t1.time1
</select>
<select id="insertLastStudyRecord" resultType="com.subsidy.vo.opr.InsertLastStudyRecordVO">
......
......@@ -118,15 +118,13 @@
LEFT JOIN (
SELECT
t3.user_id,
login - logout AS loginTime,
t3.create_date
login - logout AS loginTime
FROM
(
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS login,
create_date
unix_timestamp( t1.create_date )) AS login
FROM
opr_mem_dict t1
WHERE
......@@ -141,8 +139,7 @@
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS logout,
create_date
unix_timestamp( t1.create_date )) AS logout
FROM
opr_mem_dict t1
WHERE
......@@ -467,7 +464,6 @@
AND DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.paper_id IS NULL
AND t1.result = 1
GROUP BY t1.class_id,t1.member_id
ORDER BY t1.create_date desc
</select>
......@@ -490,7 +486,6 @@
and class_id = #{classId}
AND t1.paper_id IS not NULL
AND t1.result = 1
GROUP BY t1.class_id,t1.member_id
ORDER BY t1.create_date desc
</select>
......
......@@ -126,7 +126,7 @@
t2.content_id = #{conetntId}
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
GROUP BY
order BY
t1.order_no DESC
</select>
......
......@@ -22,9 +22,9 @@
delete_date,
id, class_id, vod_id, member_id, play_length, play_record
</sql>
<!-- <delete id="deleteById">-->
<!-- delete from vod_play_history-->
<!-- </delete>-->
<!-- <delete id="deleteById">-->
<!-- delete from vod_play_history-->
<!-- </delete>-->
<select id="studyHistory" parameterType="long" resultType="com.subsidy.vo.vod.StudyHistoryVO">
SELECT
......@@ -66,28 +66,28 @@
<select id="getMemberStudyInfo" resultType="com.subsidy.vo.vod.GetMemberStudyInfoVO">
SELECT
t.member_id,
DATE_FORMAT( t.create_date, '%Y-%m-%d' ) as studyDate,
sum( t.play_length ) as playLength,
sum(
IF
( t.play_length >= t2.vod_length, t2.vod_length, t.play_length )) AS distinctLength
t.member_id,
DATE_FORMAT( t.create_date, '%Y-%m-%d' ) as studyDate,
sum( t.play_length ) as playLength,
sum(
IF
( t.play_length >= t2.vod_length, t2.vod_length, t.play_length )) AS distinctLength
FROM
vod_play_history t
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t.delete_date IS NULL
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.class_id = #{classId}
AND t.member_id IN
<foreach collection="memberIds" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) BETWEEN DATE_FORMAT( #{startDate}, '%Y-%m-%d' )
AND DATE_FORMAT( #{endDate}, '%Y-%m-%d' )
GROUP BY
t.member_id,
DATE_FORMAT( t.create_date, '%Y-%m-%d' )
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) BETWEEN DATE_FORMAT( #{startDate}, '%Y-%m-%d' )
AND DATE_FORMAT( #{endDate}, '%Y-%m-%d' )
GROUP BY
t.member_id,
DATE_FORMAT( t.create_date, '%Y-%m-%d' )
</select>
<select id="getVodPlayHistory" resultType="com.subsidy.model.VodPlayHistoryDO">
......@@ -131,107 +131,107 @@
AND t.vod_id = #{vodId}
</select>
<!-- <select id="classStudyHistory" parameterType="long" resultType="com.subsidy.vo.sign.DataViewVO">-->
<!-- <select id="classStudyHistory" parameterType="long" resultType="com.subsidy.vo.sign.DataViewVO">-->
<!-- SELECT-->
<!-- t10.mem_cnt AS memberCount,-->
<!-- ifnull( floor( t2.ttl / t10.mem_cnt ), 0 ) AS studyVodCounts,-->
<!-- ifnull( t3.total_vods, 0 ) AS totalVodCounts,-->
<!-- ifnull( avg_playlength, 0 ) AS avgVodPlayLength,-->
<!-- ifnull( floor( t4.pass_cnt * 100 / t10.mem_cnt ), 0 ) AS passRate,-->
<!-- ifnull( t5.ask_cnt, 0 ) AS answerCount-->
<!--FROM-->
<!-- ( SELECT t.class_id, count( 1 ) AS mem_cnt FROM class_member_mapping t WHERE t.delete_date IS NULL AND t.class_id = #{classId} ) t10-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t.class_id,-->
<!-- count(-->
<!-- DISTINCT ( t.member_id )) AS mem_cnt,-->
<!-- round( sum( t.play_length )/ count( DISTINCT ( t.member_id )), 0 ) AS avg_playlength-->
<!-- FROM-->
<!-- vod_play_history t-->
<!-- WHERE-->
<!-- t.delete_date IS NULL-->
<!-- AND t.class_id = #{classId}-->
<!-- ) t ON t.class_id = t10.class_id-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t3.class_id,-->
<!-- sum( t3.cnt ) AS ttl-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t.class_id,-->
<!-- t.member_id,-->
<!-- t.vod_id,-->
<!-- IF-->
<!-- ( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS cnt-->
<!-- FROM-->
<!-- vod_play_history t-->
<!-- LEFT JOIN vod_dict t2 ON t.vod_id = t2.id-->
<!-- WHERE-->
<!-- t.class_id = #{classId}-->
<!-- AND t.delete_date IS NULL-->
<!-- GROUP BY-->
<!-- t.class_id,-->
<!-- t.member_id,-->
<!-- t.vod_id-->
<!-- ) t3-->
<!-- ) t2 ON t.class_id = t2.class_id-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t.id,-->
<!-- count( 1 ) AS total_vods-->
<!-- FROM-->
<!-- class_dict t-->
<!-- LEFT JOIN course_content t2 ON t.course_id = t2.course_id-->
<!-- LEFT JOIN vod_dict t3 ON t2.id = t3.content_id-->
<!-- WHERE-->
<!-- t.delete_date IS NULL-->
<!-- AND t2.delete_date IS NULL-->
<!-- AND t3.delete_date IS NULL-->
<!-- AND t.id = #{classId}-->
<!-- ) t3 ON t.class_id = t3.id-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t2.class_id,-->
<!-- sum(-->
<!-- IF-->
<!-- ( t2.cnt >= t4.paper_cnt, 1, 0 )) AS pass_cnt-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t2.class_id,-->
<!-- t2.member_id,-->
<!-- sum( t2.cnt ) AS cnt-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t.paper_id,-->
<!-- t.class_id,-->
<!-- t.member_id,-->
<!-- IF-->
<!-- ( max( t.score )>= 60, 1, 0 ) AS cnt-->
<!-- FROM-->
<!-- exercise_done_result t-->
<!-- WHERE-->
<!-- t.class_id = #{classId}-->
<!-- AND t.delete_date IS NULL-->
<!-- GROUP BY-->
<!-- t.paper_id,-->
<!-- t.class_id,-->
<!-- t.member_id-->
<!-- ) t2-->
<!-- GROUP BY-->
<!-- t2.class_id,-->
<!-- t2.member_id-->
<!-- ) t2-->
<!-- LEFT JOIN class_dict t3 ON t2.class_id = t3.id-->
<!-- LEFT JOIN ( SELECT t.course_id, count( 1 ) AS paper_cnt FROM paper_dict t WHERE t.delete_date IS NULL GROUP BY t.course_id ) t4 ON t3.course_id = t4.course_id-->
<!-- ) t4 ON t.class_id = t4.class_id-->
<!-- LEFT JOIN ( SELECT t.class_id, sum( 1 ) AS ask_cnt FROM answering_question t WHERE t.class_id = #{classId} AND t.delete_date IS NULL ) t5 ON t.class_id = t5.class_id-->
<!-- SELECT-->
<!-- t10.mem_cnt AS memberCount,-->
<!-- ifnull( floor( t2.ttl / t10.mem_cnt ), 0 ) AS studyVodCounts,-->
<!-- ifnull( t3.total_vods, 0 ) AS totalVodCounts,-->
<!-- ifnull( avg_playlength, 0 ) AS avgVodPlayLength,-->
<!-- ifnull( floor( t4.pass_cnt * 100 / t10.mem_cnt ), 0 ) AS passRate,-->
<!-- ifnull( t5.ask_cnt, 0 ) AS answerCount-->
<!--FROM-->
<!-- ( SELECT t.class_id, count( 1 ) AS mem_cnt FROM class_member_mapping t WHERE t.delete_date IS NULL AND t.class_id = #{classId} ) t10-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t.class_id,-->
<!-- count(-->
<!-- DISTINCT ( t.member_id )) AS mem_cnt,-->
<!-- round( sum( t.play_length )/ count( DISTINCT ( t.member_id )), 0 ) AS avg_playlength-->
<!-- FROM-->
<!-- vod_play_history t-->
<!-- WHERE-->
<!-- t.delete_date IS NULL-->
<!-- AND t.class_id = #{classId}-->
<!-- ) t ON t.class_id = t10.class_id-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t3.class_id,-->
<!-- sum( t3.cnt ) AS ttl-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t.class_id,-->
<!-- t.member_id,-->
<!-- t.vod_id,-->
<!-- IF-->
<!-- ( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS cnt-->
<!-- FROM-->
<!-- vod_play_history t-->
<!-- LEFT JOIN vod_dict t2 ON t.vod_id = t2.id-->
<!-- WHERE-->
<!-- t.class_id = #{classId}-->
<!-- AND t.delete_date IS NULL-->
<!-- GROUP BY-->
<!-- t.class_id,-->
<!-- t.member_id,-->
<!-- t.vod_id-->
<!-- ) t3-->
<!-- ) t2 ON t.class_id = t2.class_id-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t.id,-->
<!-- count( 1 ) AS total_vods-->
<!-- FROM-->
<!-- class_dict t-->
<!-- LEFT JOIN course_content t2 ON t.course_id = t2.course_id-->
<!-- LEFT JOIN vod_dict t3 ON t2.id = t3.content_id-->
<!-- WHERE-->
<!-- t.delete_date IS NULL-->
<!-- AND t2.delete_date IS NULL-->
<!-- AND t3.delete_date IS NULL-->
<!-- AND t.id = #{classId}-->
<!-- ) t3 ON t.class_id = t3.id-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t2.class_id,-->
<!-- sum(-->
<!-- IF-->
<!-- ( t2.cnt >= t4.paper_cnt, 1, 0 )) AS pass_cnt-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t2.class_id,-->
<!-- t2.member_id,-->
<!-- sum( t2.cnt ) AS cnt-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t.paper_id,-->
<!-- t.class_id,-->
<!-- t.member_id,-->
<!-- IF-->
<!-- ( max( t.score )>= 60, 1, 0 ) AS cnt-->
<!-- FROM-->
<!-- exercise_done_result t-->
<!-- WHERE-->
<!-- t.class_id = #{classId}-->
<!-- AND t.delete_date IS NULL-->
<!-- GROUP BY-->
<!-- t.paper_id,-->
<!-- t.class_id,-->
<!-- t.member_id-->
<!-- ) t2-->
<!-- GROUP BY-->
<!-- t2.class_id,-->
<!-- t2.member_id-->
<!-- ) t2-->
<!-- LEFT JOIN class_dict t3 ON t2.class_id = t3.id-->
<!-- LEFT JOIN ( SELECT t.course_id, count( 1 ) AS paper_cnt FROM paper_dict t WHERE t.delete_date IS NULL GROUP BY t.course_id ) t4 ON t3.course_id = t4.course_id-->
<!-- ) t4 ON t.class_id = t4.class_id-->
<!-- LEFT JOIN ( SELECT t.class_id, sum( 1 ) AS ask_cnt FROM answering_question t WHERE t.class_id = #{classId} AND t.delete_date IS NULL ) t5 ON t.class_id = t5.class_id-->
<!-- </select>-->
<!-- </select>-->
<select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO">
SELECT
......@@ -449,13 +449,13 @@
t.delete_date IS NULL
AND t.class_id = #{classId}
GROUP BY
t.class_id,
t.member_id,
t.vod_id,
t3.vod_name
t6.vodName
</select>
<select id="getVodPlayDay" parameterType="com.subsidy.model.VodPlayHistoryDO" resultType="com.subsidy.model.VodPlayHistoryDO">
<select id="getVodPlayDay" parameterType="com.subsidy.model.VodPlayHistoryDO"
resultType="com.subsidy.model.VodPlayHistoryDO">
SELECT
*
FROM
......@@ -469,21 +469,21 @@
t.create_date
</select>
<!-- <select id="memberLatestRecord" parameterType="long" resultType="long">-->
<!-- SELECT-->
<!-- t.id-->
<!-- FROM-->
<!-- vod_play_history t-->
<!-- WHERE-->
<!-- t.member_id = #{memberId}-->
<!-- ORDER BY-->
<!-- t.create_date DESC-->
<!-- LIMIT 1-->
<!-- </select>-->
<!-- <select id="memberLatestRecord" parameterType="long" resultType="long">-->
<!-- SELECT-->
<!-- t.id-->
<!-- FROM-->
<!-- vod_play_history t-->
<!-- WHERE-->
<!-- t.member_id = #{memberId}-->
<!-- ORDER BY-->
<!-- t.create_date DESC-->
<!-- LIMIT 1-->
<!-- </select>-->
<insert id="insertPlayRecord">
insert into vod_play_history (class_id,vod_id,member_id,play_length,suspend_length,play_record,play_count,create_date)
VALUES (#{classId}, #{vodId}, #{memberId}, #{playLength},#{suspendLength},#{playRecord}, #{playCount},#{createDate})
insert into vod_play_history (class_id,vod_id,member_id,play_length,suspend_length,play_record,create_date,ip_address)
VALUES (#{classId}, #{vodId}, #{memberId}, #{playLength},#{suspendLength},#{playRecord},#{createDate},#{ipAddress})
</insert>
<update id="updatePlayRecord">
......@@ -560,4 +560,15 @@
and t.class_id = #{classId}
</select>
<select id="latestDailyStudyRecord" parameterType="long" resultType="date">
SELECT
max( t.create_date )
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
and DATE_FORMAT(t.create_date,'%y-%m-%d') = CURRENT_DATE
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!