Commit 096878dd by 涂亚平

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

1 parent 4f1af516
Showing with 310 additions and 260 deletions
...@@ -36,7 +36,7 @@ public class ActivityDetectionController { ...@@ -36,7 +36,7 @@ public class ActivityDetectionController {
private ActivityDetectionService activityDetectionService; private ActivityDetectionService activityDetectionService;
@PostMapping("verify") @PostMapping("verify")
@ApiOperation("验证滑块 ticket randStr memberId classId checkType:检测类型:0:滑块 1:人脸 ") @ApiOperation("验证滑块 ticket randStr vodId memberId classId checkType:检测类型:0:滑块 1:人脸 ")
@TimeRequired @TimeRequired
public ResponseVO verify(@RequestBody VerifyDTO verifyDTO, HttpServletRequest request){ public ResponseVO verify(@RequestBody VerifyDTO verifyDTO, HttpServletRequest request){
return ResponseData.generateCreatedResponse(0,activityDetectionService.verify(verifyDTO,request)); return ResponseData.generateCreatedResponse(0,activityDetectionService.verify(verifyDTO,request));
...@@ -49,7 +49,7 @@ public class ActivityDetectionController { ...@@ -49,7 +49,7 @@ public class ActivityDetectionController {
} }
@PostMapping("verifyError") @PostMapping("verifyError")
@ApiOperation("验证失败记录 classId memberId") @ApiOperation("验证失败记录 vodId classId memberId")
public ResponseVO verifyError(@RequestBody ActivityDetectionDO activityDetectionDO){ public ResponseVO verifyError(@RequestBody ActivityDetectionDO activityDetectionDO){
return ResponseData.generateCreatedResponse(0,activityDetectionService.verifyError(activityDetectionDO)); return ResponseData.generateCreatedResponse(0,activityDetectionService.verifyError(activityDetectionDO));
} }
......
...@@ -181,7 +181,7 @@ public class AdministerController { ...@@ -181,7 +181,7 @@ public class AdministerController {
@PostMapping("classVodDailyInfo") @PostMapping("classVodDailyInfo")
@ApiOperation("学习记录---每日学习时长(视频维度)") @ApiOperation("学习记录---每日学习时长(视频维度)")
@LoginRequired // @LoginRequired
public ResponseVO classVodDailyInfo(@RequestBody ClassVodDailyInfoDTO classVodDailyInfoDTO) { public ResponseVO classVodDailyInfo(@RequestBody ClassVodDailyInfoDTO classVodDailyInfoDTO) {
return ResponseData.generateCreatedResponse(0, administerService.classVodDailyInfo(classVodDailyInfoDTO)); return ResponseData.generateCreatedResponse(0, administerService.classVodDailyInfo(classVodDailyInfoDTO));
} }
......
...@@ -16,6 +16,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -16,6 +16,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
/** /**
...@@ -39,17 +40,17 @@ public class VodPlayHistoryController { ...@@ -39,17 +40,17 @@ public class VodPlayHistoryController {
"memberId 成员id playLength 播放时长 playRecord 位点 suspendLength暂停时长 ") "memberId 成员id playLength 播放时长 playRecord 位点 suspendLength暂停时长 ")
@LoginRequired @LoginRequired
@TimeRequired @TimeRequired
public ResponseVO insertHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){ public ResponseVO insertHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO, HttpServletRequest request){
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistory(vodPlayHistoryDO)); return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistory(vodPlayHistoryDO,request));
} }
@RequestMapping("insertHistoryNew") @RequestMapping("insertHistoryNew")
@ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id " + @ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id " +
"playLength 播放时长 playRecord 位点 suspendLength") "playLength 播放时长 playRecord 位点 suspendLength")
@TimeRequired @TimeRequired
public ResponseVO insertHistoryNew(@RequestBody String param){ public ResponseVO insertHistoryNew(@RequestBody String param,HttpServletRequest request){
InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class); InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class);
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(insertHistoryNewDTO)); return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(insertHistoryNewDTO,request));
} }
@PostMapping("dataFix") @PostMapping("dataFix")
......
...@@ -13,6 +13,10 @@ public class VerifyDTO { ...@@ -13,6 +13,10 @@ public class VerifyDTO {
private Long memberId; private Long memberId;
private Long vodId;
private Long classId; private Long classId;
private Integer clickStatus;
} }
...@@ -64,76 +64,76 @@ public class RenSheJuJob { ...@@ -64,76 +64,76 @@ public class RenSheJuJob {
private String env; 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 * * ?") // @Scheduled(cron = "0 5 1 * * ?")
public void classBaseInfo() throws IOException { // public void classHourBehavior() throws IOException {
if ("prod".equals(env)) { // if ("prod".equals(env)) {
renSheJuService.classBaseInfo(); // renSheJuService.classHourBehavior();
} // }
} // }
//
/** // /**
* POST-3:学时信息采集接口 // * POST-4:考试信息采集接口
*/ // */
@Scheduled(cron = "0 5 1 * * ?") // @Scheduled(cron = "0 10 1 * * ?")
public void classHourBehavior() throws IOException { // public void uploadChapterBehavior() throws IOException {
if ("prod".equals(env)) { // if ("prod".equals(env)) {
renSheJuService.classHourBehavior(); // renSheJuService.uploadChapterBehavior();
} // }
} // }
//
/** // /**
* POST-4:考试信息采集接口 // * POST-5:答疑辅导采集接口
*/ // */
@Scheduled(cron = "0 10 1 * * ?") // @Scheduled(cron = "0 15 1 * * ?")
public void uploadChapterBehavior() throws IOException { // public void uploadClassAnswerQuestionBehavior() throws IOException {
if ("prod".equals(env)) { // if ("prod".equals(env)) {
renSheJuService.uploadChapterBehavior(); // renSheJuService.uploadClassAnswerQuestionBehavior();
} // }
} // }
//
/** // /**
* POST-5:答疑辅导采集接口 // * POST-6 班级活跃度/实名认证照片信息采集接口
*/ // */
@Scheduled(cron = "0 15 1 * * ?") // @Scheduled(cron = "0 20 1 * * ?")
public void uploadClassAnswerQuestionBehavior() throws IOException { // public void uploadImage() throws IOException {
if ("prod".equals(env)) { // if ("prod".equals(env)) {
renSheJuService.uploadClassAnswerQuestionBehavior(); // renSheJuService.uploadImage();
} // }
} // }
//
/** // /**
* POST-6 班级活跃度/实名认证照片信息采集接口 // * POST-7 获取培训待绑定的(班级编号,项目编号)列表
*/ // */
@Scheduled(cron = "0 20 1 * * ?") // @Scheduled(cron = "0 25 1 * * ?")
public void uploadImage() throws IOException { // public void getClassCodeByPrivateKey() throws IOException {
if ("prod".equals(env)) { // if ("prod".equals(env)) {
renSheJuService.uploadImage(); // renSheJuService.getClassCodeByPrivateKey();
} // }
} // }
//
/** // /**
* POST-7 获取培训待绑定的(班级编号,项目编号)列表 // * POST-8 上下游班级数据绑定接口
*/ // */
@Scheduled(cron = "0 25 1 * * ?") // @Scheduled(cron = "0 30 1 * * ?")
public void getClassCodeByPrivateKey() throws IOException { // public void uploadClassCode() throws IOException {
if ("prod".equals(env)) { // if ("prod".equals(env)) {
renSheJuService.getClassCodeByPrivateKey(); // renSheJuService.uploadClassCode();
} // }
} // System.gc();
// }
/**
* POST-8 上下游班级数据绑定接口
*/
@Scheduled(cron = "0 30 1 * * ?")
public void uploadClassCode() throws IOException {
if ("prod".equals(env)) {
renSheJuService.uploadClassCode();
}
System.gc();
}
// /** // /**
// * POST-9 获取推送失败班级列表 // * POST-9 获取推送失败班级列表
......
...@@ -106,7 +106,7 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> { ...@@ -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> { ...@@ -132,4 +132,9 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/ */
List<Long> vodMembers(Long classId); List<Long> vodMembers(Long classId);
/**
* 查看某个学员今天最近的一次学习记录
*/
Date latestDailyStudyRecord(Long memberId);
} }
...@@ -31,6 +31,11 @@ public class ActivityDetectionDO extends BaseModel { ...@@ -31,6 +31,11 @@ public class ActivityDetectionDO extends BaseModel {
private Long classId; private Long classId;
/** /**
* 视频id
*/
private Long vodId;
/**
* 人员id * 人员id
*/ */
private Long memberId; private Long memberId;
......
...@@ -133,4 +133,9 @@ public class ClassDictDO extends BaseModel { ...@@ -133,4 +133,9 @@ public class ClassDictDO extends BaseModel {
*/ */
private String professionRank; private String professionRank;
/**
* 弹窗提醒
*/
private Integer activityFlag;
} }
...@@ -60,8 +60,7 @@ public class VodPlayHistoryDO extends BaseModel { ...@@ -60,8 +60,7 @@ public class VodPlayHistoryDO extends BaseModel {
/** /**
* 聚合 * 聚合
*/ */
private Integer playCount; private String ipAddress;
private LocalDateTime playDate; private LocalDateTime playDate;
} }
...@@ -8,6 +8,7 @@ import com.subsidy.model.VodPlayHistoryDO; ...@@ -8,6 +8,7 @@ import com.subsidy.model.VodPlayHistoryDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.vod.VodPlayStateVO; import com.subsidy.vo.vod.VodPlayStateVO;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
...@@ -22,9 +23,9 @@ import java.util.List; ...@@ -22,9 +23,9 @@ import java.util.List;
*/ */
public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> { 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); void dataFix(SignDatePlaysDTO dataFixDTO);
......
...@@ -30,47 +30,54 @@ import javax.servlet.http.HttpServletRequest; ...@@ -30,47 +30,54 @@ import javax.servlet.http.HttpServletRequest;
@Service @Service
public class ActivityDetectionServiceImpl extends ServiceImpl<ActivityDetectionMapper, ActivityDetectionDO> implements ActivityDetectionService { public class ActivityDetectionServiceImpl extends ServiceImpl<ActivityDetectionMapper, ActivityDetectionDO> implements ActivityDetectionService {
@Autowired public String verify(VerifyDTO verifyDTO, HttpServletRequest request) {
private VodPlayHistoryMapper vodPlayHistoryMapper;
public String verify(VerifyDTO verifyDTO, HttpServletRequest request){ try {
try{ if (verifyDTO.getClickStatus() == 1) {
DescribeCaptchaResultResponse resp = ActivityDetectionUtils.activityDetection(request,verifyDTO.getTicket(),verifyDTO.getRandStr()); 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格式的字符串回包 // 输出json格式的字符串回包
ActivityDetectionDO activityDetectionDO = new ActivityDetectionDO(); ActivityDetectionDO activityDetectionDO = new ActivityDetectionDO();
activityDetectionDO.setClassId(verifyDTO.getClassId()); activityDetectionDO.setClassId(verifyDTO.getClassId());
activityDetectionDO.setMemberId(verifyDTO.getMemberId()); activityDetectionDO.setMemberId(verifyDTO.getMemberId());
activityDetectionDO.setRequestId(resp.getRequestId()); activityDetectionDO.setRequestId(resp.getRequestId());
activityDetectionDO.setCheckType(0); activityDetectionDO.setCheckType(0);
if (resp.getCaptchaCode()==1){ activityDetectionDO.setVodId(verifyDTO.getVodId());
if (resp.getCaptchaCode() == 1) {
//成功 //成功
activityDetectionDO.setStatus(1); activityDetectionDO.setStatus(1);
this.baseMapper.insert(activityDetectionDO); this.baseMapper.insert(activityDetectionDO);
return ConstantUtils.SUCCESS_VERIFY; return ConstantUtils.SUCCESS_VERIFY;
}else { } else {
//失败 //失败
activityDetectionDO.setStatus(0); activityDetectionDO.setStatus(0);
this.baseMapper.insert(activityDetectionDO); this.baseMapper.insert(activityDetectionDO);
//
// //失败的话删掉这个人最新的学习数据
// Long latestRecord = vodPlayHistoryMapper.memberLatestRecord(verifyDTO.getMemberId());
// vodPlayHistoryMapper.deleteById(latestRecord);
throw new HttpException(19001); throw new HttpException(19001);
} }
}
} catch (Exception e) { } catch (Exception e) {
// System.out.println(e.toString()); System.out.println(e.toString());
} }
return ConstantUtils.SUCCESS_VERIFY; return ConstantUtils.SUCCESS_VERIFY;
} }
public IPage<GetCheckHistoryVO> getCheckHistory(GetCheckHistoryDTO getCheckHistoryDTO){ public IPage<GetCheckHistoryVO> getCheckHistory(GetCheckHistoryDTO getCheckHistoryDTO) {
Page pager = new Page(getCheckHistoryDTO.getPageNum(), getCheckHistoryDTO.getPageSize()); 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.setStatus(0);
activityDetectionDO.setCheckType(0); activityDetectionDO.setCheckType(0);
this.baseMapper.insert(activityDetectionDO); this.baseMapper.insert(activityDetectionDO);
......
...@@ -301,12 +301,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -301,12 +301,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId()); CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if ("冻结".equals(memberDO.getStatus())) { 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); throw new HttpException(10013);
} }
...@@ -332,17 +326,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -332,17 +326,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
// oprMemDictMapper.insert(oprMemDictDO); // oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(70010); 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.setCompanyId(companyDictDO.getId());
userRoleVO.setSuperviseName(companyDictDO.getSuperviseName()); userRoleVO.setSuperviseName(companyDictDO.getSuperviseName());
userRoleVO.setCompanyName(companyDictDO.getCompanyName()); userRoleVO.setCompanyName(companyDictDO.getCompanyName());
...@@ -373,7 +356,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -373,7 +356,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
throw new HttpException(10017); throw new HttpException(10017);
} }
/** /**
* 最近5次都输入失败,5分钟后再验证 * 最近5次都输入失败,5分钟后再验证
*/ */
...@@ -790,6 +772,21 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -790,6 +772,21 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
if (1 == classDictDO1.getIsOrder()) { if (1 == classDictDO1.getIsOrder()) {
for (MemberVodVO memberVodVO : memberVodVOS) { 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) { if (i == 0 && contentStatus) {
//第一个视频默认打开 //第一个视频默认打开
memberVodVO.setStatus(true); memberVodVO.setStatus(true);
......
...@@ -166,8 +166,7 @@ public class RenSheJuServiceImpl implements RenSheJuService { ...@@ -166,8 +166,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List<DailyStudyInfoVO> result = new ArrayList<>(); List<DailyStudyInfoVO> result = new ArrayList<>();
// List<Long> vodClassIds = new ArrayList<>(); // List<Long> vodClassIds = new ArrayList<>();
//
// vodClassIds.add(451L);
try { try {
for (Long classId : vodClassIds) { for (Long classId : vodClassIds) {
......
...@@ -13,14 +13,13 @@ public class ActivityDetectionUtils { ...@@ -13,14 +13,13 @@ public class ActivityDetectionUtils {
/** /**
* 活跃度检测工具类 * 活跃度检测工具类
* @param request *
* @param randstr
* @return
* @throws Exception * @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,此处还需注意密钥对的保密 // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
// 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取 // 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
Credential cred = new Credential(ConstantUtils.SECRET_ID, ConstantUtils.SECRET_KEY); Credential cred = new Credential(ConstantUtils.SECRET_ID, ConstantUtils.SECRET_KEY);
...@@ -44,6 +43,10 @@ public class ActivityDetectionUtils { ...@@ -44,6 +43,10 @@ public class ActivityDetectionUtils {
req.setTicket(ticket); req.setTicket(ticket);
// 返回的resp是一个DescribeCaptchaResultResponse的实例,与请求对象对应 // 返回的resp是一个DescribeCaptchaResultResponse的实例,与请求对象对应
return client.DescribeCaptchaResult(req); return client.DescribeCaptchaResult(req);
} catch (Exception e) {
}
return null;
} }
} }
...@@ -67,4 +67,6 @@ public class ClassSettingsVO { ...@@ -67,4 +67,6 @@ public class ClassSettingsVO {
private Integer deviceNoRecord; private Integer deviceNoRecord;
private Integer timeLimit; private Integer timeLimit;
private Integer activityFlag;
} }
...@@ -24,4 +24,5 @@ public class MemberVodVO { ...@@ -24,4 +24,5 @@ public class MemberVodVO {
private String leftLength; 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 @@ ...@@ -2,14 +2,21 @@
spring.server.port=23457 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://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.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.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
#spring.datasource.username=ykadmin_new spring.datasource.username=root
#spring.datasource.password=youkedb608@good spring.datasource.password=ykhladmin302
spring.datasource.username=devloper
spring.datasource.password=dev@1553$
spring.datasource.druid.initialSize=5 spring.datasource.druid.initialSize=5
spring.datasource.druid.minIdle=5 spring.datasource.druid.minIdle=5
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
<select id="getCLassMemberByCompanyId" resultType="com.subsidy.model.ClassMemberMappingDO"> <select id="getCLassMemberByCompanyId" resultType="com.subsidy.model.ClassMemberMappingDO">
SELECT SELECT
t.* distinct t.*
FROM FROM
class_member_mapping t class_member_mapping t
LEFT JOIN class_dict t1 ON t1.id = t.class_id LEFT JOIN class_dict t1 ON t1.id = t.class_id
...@@ -88,7 +88,6 @@ ...@@ -88,7 +88,6 @@
t1.company_id = #{companyId} t1.company_id = #{companyId}
AND t.delete_date IS NULL AND t.delete_date IS NULL
AND t1.delete_date IS NULL AND t1.delete_date IS NULL
GROUP BY t.member_id
</select> </select>
</mapper> </mapper>
...@@ -413,7 +413,7 @@ ...@@ -413,7 +413,7 @@
FROM FROM
member m member m
LEFT JOIN class_member_mapping cm ON cm.member_id = m.id 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 WHERE
cm.class_id = #{classId} cm.class_id = #{classId}
AND r.ts is NULL AND r.ts is NULL
......
...@@ -108,7 +108,6 @@ ...@@ -108,7 +108,6 @@
FROM FROM
( (
SELECT SELECT
id,
user_id, user_id,
opr_type, opr_type,
max( create_date ) AS time1 max( create_date ) AS time1
...@@ -126,7 +125,6 @@ ...@@ -126,7 +125,6 @@
) t1 ) t1
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
id,
user_id, user_id,
opr_type, opr_type,
max( create_date ) AS time2 max( create_date ) AS time2
...@@ -143,8 +141,7 @@ ...@@ -143,8 +141,7 @@
create_date DESC create_date DESC
) t2 ON t1.user_id = t2.user_id ) t2 ON t1.user_id = t2.user_id
WHERE WHERE
t2.id IS NULL t2.time2 &lt; t1.time1
OR t2.time2 &lt; t1.time1
</select> </select>
<select id="insertLastStudyRecord" resultType="com.subsidy.vo.opr.InsertLastStudyRecordVO"> <select id="insertLastStudyRecord" resultType="com.subsidy.vo.opr.InsertLastStudyRecordVO">
......
...@@ -118,15 +118,13 @@ ...@@ -118,15 +118,13 @@
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
t3.user_id, t3.user_id,
login - logout AS loginTime, login - logout AS loginTime
t3.create_date
FROM FROM
( (
SELECT SELECT
user_id, user_id,
sum( sum(
unix_timestamp( t1.create_date )) AS login, unix_timestamp( t1.create_date )) AS login
create_date
FROM FROM
opr_mem_dict t1 opr_mem_dict t1
WHERE WHERE
...@@ -141,8 +139,7 @@ ...@@ -141,8 +139,7 @@
SELECT SELECT
user_id, user_id,
sum( sum(
unix_timestamp( t1.create_date )) AS logout, unix_timestamp( t1.create_date )) AS logout
create_date
FROM FROM
opr_mem_dict t1 opr_mem_dict t1
WHERE WHERE
...@@ -467,7 +464,6 @@ ...@@ -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 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.paper_id IS NULL
AND t1.result = 1 AND t1.result = 1
GROUP BY t1.class_id,t1.member_id
ORDER BY t1.create_date desc ORDER BY t1.create_date desc
</select> </select>
...@@ -490,7 +486,6 @@ ...@@ -490,7 +486,6 @@
and class_id = #{classId} and class_id = #{classId}
AND t1.paper_id IS not NULL AND t1.paper_id IS not NULL
AND t1.result = 1 AND t1.result = 1
GROUP BY t1.class_id,t1.member_id
ORDER BY t1.create_date desc ORDER BY t1.create_date desc
</select> </select>
......
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
t2.content_id = #{conetntId} t2.content_id = #{conetntId}
AND t1.delete_date IS NULL AND t1.delete_date IS NULL
AND t2.delete_date IS NULL AND t2.delete_date IS NULL
GROUP BY order BY
t1.order_no DESC t1.order_no DESC
</select> </select>
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
delete_date, delete_date,
id, class_id, vod_id, member_id, play_length, play_record id, class_id, vod_id, member_id, play_length, play_record
</sql> </sql>
<!-- <delete id="deleteById">--> <!-- <delete id="deleteById">-->
<!-- delete from vod_play_history--> <!-- delete from vod_play_history-->
<!-- </delete>--> <!-- </delete>-->
<select id="studyHistory" parameterType="long" resultType="com.subsidy.vo.vod.StudyHistoryVO"> <select id="studyHistory" parameterType="long" resultType="com.subsidy.vo.vod.StudyHistoryVO">
SELECT SELECT
...@@ -131,107 +131,107 @@ ...@@ -131,107 +131,107 @@
AND t.vod_id = #{vodId} AND t.vod_id = #{vodId}
</select> </select>
<!-- <select id="classStudyHistory" parameterType="long" resultType="com.subsidy.vo.sign.DataViewVO">--> <!-- <select id="classStudyHistory" parameterType="long" resultType="com.subsidy.vo.sign.DataViewVO">-->
<!-- SELECT--> <!-- SELECT-->
<!-- t10.mem_cnt AS memberCount,--> <!-- t10.mem_cnt AS memberCount,-->
<!-- ifnull( floor( t2.ttl / t10.mem_cnt ), 0 ) AS studyVodCounts,--> <!-- ifnull( floor( t2.ttl / t10.mem_cnt ), 0 ) AS studyVodCounts,-->
<!-- ifnull( t3.total_vods, 0 ) AS totalVodCounts,--> <!-- ifnull( t3.total_vods, 0 ) AS totalVodCounts,-->
<!-- ifnull( avg_playlength, 0 ) AS avgVodPlayLength,--> <!-- ifnull( avg_playlength, 0 ) AS avgVodPlayLength,-->
<!-- ifnull( floor( t4.pass_cnt * 100 / t10.mem_cnt ), 0 ) AS passRate,--> <!-- ifnull( floor( t4.pass_cnt * 100 / t10.mem_cnt ), 0 ) AS passRate,-->
<!-- ifnull( t5.ask_cnt, 0 ) AS answerCount--> <!-- ifnull( t5.ask_cnt, 0 ) AS answerCount-->
<!--FROM--> <!--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--> <!-- ( 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 (--> <!-- LEFT JOIN (-->
<!-- SELECT--> <!-- SELECT-->
<!-- t.class_id,--> <!-- t.class_id,-->
<!-- count(--> <!-- count(-->
<!-- DISTINCT ( t.member_id )) AS mem_cnt,--> <!-- DISTINCT ( t.member_id )) AS mem_cnt,-->
<!-- round( sum( t.play_length )/ count( DISTINCT ( t.member_id )), 0 ) AS avg_playlength--> <!-- round( sum( t.play_length )/ count( DISTINCT ( t.member_id )), 0 ) AS avg_playlength-->
<!-- FROM--> <!-- FROM-->
<!-- vod_play_history t--> <!-- vod_play_history t-->
<!-- WHERE--> <!-- WHERE-->
<!-- t.delete_date IS NULL--> <!-- t.delete_date IS NULL-->
<!-- AND t.class_id = #{classId}--> <!-- AND t.class_id = #{classId}-->
<!-- ) t ON t.class_id = t10.class_id--> <!-- ) t ON t.class_id = t10.class_id-->
<!-- LEFT JOIN (--> <!-- LEFT JOIN (-->
<!-- SELECT--> <!-- SELECT-->
<!-- t3.class_id,--> <!-- t3.class_id,-->
<!-- sum( t3.cnt ) AS ttl--> <!-- sum( t3.cnt ) AS ttl-->
<!-- FROM--> <!-- FROM-->
<!-- (--> <!-- (-->
<!-- SELECT--> <!-- SELECT-->
<!-- t.class_id,--> <!-- t.class_id,-->
<!-- t.member_id,--> <!-- t.member_id,-->
<!-- t.vod_id,--> <!-- t.vod_id,-->
<!-- IF--> <!-- IF-->
<!-- ( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS cnt--> <!-- ( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS cnt-->
<!-- FROM--> <!-- FROM-->
<!-- vod_play_history t--> <!-- vod_play_history t-->
<!-- LEFT JOIN vod_dict t2 ON t.vod_id = t2.id--> <!-- LEFT JOIN vod_dict t2 ON t.vod_id = t2.id-->
<!-- WHERE--> <!-- WHERE-->
<!-- t.class_id = #{classId}--> <!-- t.class_id = #{classId}-->
<!-- AND t.delete_date IS NULL--> <!-- AND t.delete_date IS NULL-->
<!-- GROUP BY--> <!-- GROUP BY-->
<!-- t.class_id,--> <!-- t.class_id,-->
<!-- t.member_id,--> <!-- t.member_id,-->
<!-- t.vod_id--> <!-- t.vod_id-->
<!-- ) t3--> <!-- ) t3-->
<!-- ) t2 ON t.class_id = t2.class_id--> <!-- ) t2 ON t.class_id = t2.class_id-->
<!-- LEFT JOIN (--> <!-- LEFT JOIN (-->
<!-- SELECT--> <!-- SELECT-->
<!-- t.id,--> <!-- t.id,-->
<!-- count( 1 ) AS total_vods--> <!-- count( 1 ) AS total_vods-->
<!-- FROM--> <!-- FROM-->
<!-- class_dict t--> <!-- class_dict t-->
<!-- LEFT JOIN course_content t2 ON t.course_id = t2.course_id--> <!-- LEFT JOIN course_content t2 ON t.course_id = t2.course_id-->
<!-- LEFT JOIN vod_dict t3 ON t2.id = t3.content_id--> <!-- LEFT JOIN vod_dict t3 ON t2.id = t3.content_id-->
<!-- WHERE--> <!-- WHERE-->
<!-- t.delete_date IS NULL--> <!-- t.delete_date IS NULL-->
<!-- AND t2.delete_date IS NULL--> <!-- AND t2.delete_date IS NULL-->
<!-- AND t3.delete_date IS NULL--> <!-- AND t3.delete_date IS NULL-->
<!-- AND t.id = #{classId}--> <!-- AND t.id = #{classId}-->
<!-- ) t3 ON t.class_id = t3.id--> <!-- ) t3 ON t.class_id = t3.id-->
<!-- LEFT JOIN (--> <!-- LEFT JOIN (-->
<!-- SELECT--> <!-- SELECT-->
<!-- t2.class_id,--> <!-- t2.class_id,-->
<!-- sum(--> <!-- sum(-->
<!-- IF--> <!-- IF-->
<!-- ( t2.cnt >= t4.paper_cnt, 1, 0 )) AS pass_cnt--> <!-- ( t2.cnt >= t4.paper_cnt, 1, 0 )) AS pass_cnt-->
<!-- FROM--> <!-- FROM-->
<!-- (--> <!-- (-->
<!-- SELECT--> <!-- SELECT-->
<!-- t2.class_id,--> <!-- t2.class_id,-->
<!-- t2.member_id,--> <!-- t2.member_id,-->
<!-- sum( t2.cnt ) AS cnt--> <!-- sum( t2.cnt ) AS cnt-->
<!-- FROM--> <!-- FROM-->
<!-- (--> <!-- (-->
<!-- SELECT--> <!-- SELECT-->
<!-- t.paper_id,--> <!-- t.paper_id,-->
<!-- t.class_id,--> <!-- t.class_id,-->
<!-- t.member_id,--> <!-- t.member_id,-->
<!-- IF--> <!-- IF-->
<!-- ( max( t.score )>= 60, 1, 0 ) AS cnt--> <!-- ( max( t.score )>= 60, 1, 0 ) AS cnt-->
<!-- FROM--> <!-- FROM-->
<!-- exercise_done_result t--> <!-- exercise_done_result t-->
<!-- WHERE--> <!-- WHERE-->
<!-- t.class_id = #{classId}--> <!-- t.class_id = #{classId}-->
<!-- AND t.delete_date IS NULL--> <!-- AND t.delete_date IS NULL-->
<!-- GROUP BY--> <!-- GROUP BY-->
<!-- t.paper_id,--> <!-- t.paper_id,-->
<!-- t.class_id,--> <!-- t.class_id,-->
<!-- t.member_id--> <!-- t.member_id-->
<!-- ) t2--> <!-- ) t2-->
<!-- GROUP BY--> <!-- GROUP BY-->
<!-- t2.class_id,--> <!-- t2.class_id,-->
<!-- t2.member_id--> <!-- t2.member_id-->
<!-- ) t2--> <!-- ) t2-->
<!-- LEFT JOIN class_dict t3 ON t2.class_id = t3.id--> <!-- 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--> <!-- 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--> <!-- ) 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--> <!-- 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 id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO">
SELECT SELECT
...@@ -449,13 +449,13 @@ ...@@ -449,13 +449,13 @@
t.delete_date IS NULL t.delete_date IS NULL
AND t.class_id = #{classId} AND t.class_id = #{classId}
GROUP BY GROUP BY
t.class_id,
t.member_id, t.member_id,
t.vod_id, t.vod_id,
t3.vod_name t6.vodName
</select> </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 SELECT
* *
FROM FROM
...@@ -469,21 +469,21 @@ ...@@ -469,21 +469,21 @@
t.create_date t.create_date
</select> </select>
<!-- <select id="memberLatestRecord" parameterType="long" resultType="long">--> <!-- <select id="memberLatestRecord" parameterType="long" resultType="long">-->
<!-- SELECT--> <!-- SELECT-->
<!-- t.id--> <!-- t.id-->
<!-- FROM--> <!-- FROM-->
<!-- vod_play_history t--> <!-- vod_play_history t-->
<!-- WHERE--> <!-- WHERE-->
<!-- t.member_id = #{memberId}--> <!-- t.member_id = #{memberId}-->
<!-- ORDER BY--> <!-- ORDER BY-->
<!-- t.create_date DESC--> <!-- t.create_date DESC-->
<!-- LIMIT 1--> <!-- LIMIT 1-->
<!-- </select>--> <!-- </select>-->
<insert id="insertPlayRecord"> <insert id="insertPlayRecord">
insert into vod_play_history (class_id,vod_id,member_id,play_length,suspend_length,play_record,play_count,create_date) 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}, #{playCount},#{createDate}) VALUES (#{classId}, #{vodId}, #{memberId}, #{playLength},#{suspendLength},#{playRecord},#{createDate},#{ipAddress})
</insert> </insert>
<update id="updatePlayRecord"> <update id="updatePlayRecord">
...@@ -560,4 +560,15 @@ ...@@ -560,4 +560,15 @@
and t.class_id = #{classId} and t.class_id = #{classId}
</select> </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> </mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!