Commit 096878dd by 涂亚平

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

1 parent 4f1af516
Showing with 310 additions and 260 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());
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);
} 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);
if (resp.getCaptchaCode()==1){
activityDetectionDO.setVodId(verifyDTO.getVodId());
if (resp.getCaptchaCode() == 1) {
//成功
activityDetectionDO.setStatus(1);
this.baseMapper.insert(activityDetectionDO);
return ConstantUtils.SUCCESS_VERIFY;
}else {
} else {
//失败
activityDetectionDO.setStatus(0);
this.baseMapper.insert(activityDetectionDO);
//
// //失败的话删掉这个人最新的学习数据
// Long latestRecord = vodPlayHistoryMapper.memberLatestRecord(verifyDTO.getMemberId());
// vodPlayHistoryMapper.deleteById(latestRecord);
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) {
......
......@@ -13,14 +13,13 @@ public class ActivityDetectionUtils {
/**
* 活跃度检测工具类
* @param request
* @param randstr
* @return
*
* @throws Exception
*/
public static DescribeCaptchaResultResponse activityDetection(HttpServletRequest request,String ticket, String randstr) throws Exception {
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);
......@@ -44,6 +43,10 @@ public class ActivityDetectionUtils {
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
......
......@@ -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
......@@ -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!