Commit ccfd90c4 by 涂亚平

30秒以内的视频数据不插入

1 parent 3a53359c
......@@ -38,7 +38,7 @@ public class VodPlayHistoryController {
@PostMapping("insertHistory")
@ApiOperation("记录学生看视频位置 ajax请求 classId班级id vodId 视频id " +
"memberId 成员id playLength 播放时长 playRecord 位点 suspendLength暂停时长 ")
@LoginRequired
// @LoginRequired
@TimeRequired
public ResponseVO insertHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO, HttpServletRequest request)throws Exception{
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistory(vodPlayHistoryDO,request));
......
......@@ -61,4 +61,17 @@ public class PushJob {
}
}
/**
* 定时发短信
*/
@Scheduled(cron = "0 0 9 * * ?")
public void sendWarning(){
pushDataService.sendWarning();
}
}
......@@ -138,4 +138,9 @@ public class ClassDictDO extends BaseModel {
*/
private Integer activityFlag;
/**
* 考试次数限制
*/
private Integer checkFlag;
}
......@@ -24,5 +24,7 @@ public interface PushDataService extends IService<PushAnsweringDataDO> {
void post7();
void sendWarning();
HashMap<String, List<Long>> check();
}
......@@ -131,6 +131,7 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
BeanUtils.copyProperties(addClassDTO, classDictDO);
//每天最大学习时长默认值
classDictDO.setLimitHour(1);
classDictDO.setCheckFlag(1);
this.baseMapper.insert(classDictDO);
//班级里添加成员
......
......@@ -189,7 +189,7 @@ public class DudaoServiceImpl implements DudaoService {
for (DailyStudyInfoVO dailyStudyInfoVO : result) {
ClassHourBasic classHourBasic = new ClassHourBasic();
BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic);
classHourBasic.setClassCode(dailyStudyInfoVO.getDownCode());
classHourBasic.setClassCode(dailyStudyInfoVO.getClassCode());
//上线时间列表
//找到当天每次上线下线时间
......
......@@ -87,54 +87,63 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
List<MemberExerciseVO> memberExerciseVOS = submitDTO.getMemberExerciseVOS();
SimpleDateFormat startDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date startDate = startDateFormat1.parse(submitDTO.getStartDate());
if (new Date().getTime() - startDate.getTime() < 180 * 1000L) {
throw new HttpException(20003);
}
} catch (ParseException e) {
//判断数据库里是否有一样开始时间的记录,有的话就不插入
Integer count = exerciseDoneResultMapper.selectCount(new QueryWrapper<ExerciseDoneResultDO>()
.lambda()
.eq(ExerciseDoneResultDO::getMemberId,submitDTO.getMemberId())
.eq(ExerciseDoneResultDO::getClassId,submitDTO.getClassId())
.eq(ExerciseDoneResultDO::getPaperId,submitDTO.getPaperId())
.eq(ExerciseDoneResultDO::getStartDate,submitDTO.getStartDate()));
}
if (count == 0){
try {
Date startDate = startDateFormat1.parse(submitDTO.getStartDate());
int rightCounts = 0;
if (new Date().getTime() - startDate.getTime() < 180 * 1000L) {
throw new HttpException(20003);
}
} catch (ParseException e) {
for (MemberExerciseVO exerciseVO : memberExerciseVOS) {
ExerciseDictDO exerciseDictDO = this.baseMapper.selectById(exerciseVO.getId());
if (exerciseDictDO.getRightAnswer().equals(exerciseVO.getSelectAnswer())) {
exerciseVO.setResult(1);
rightCounts++;
} else {
exerciseVO.setResult(0);
}
}
int rightCounts = 0;
exerciseDoneResultDO.setClassId(submitDTO.getClassId());
exerciseDoneResultDO.setRightCounts(rightCounts);
exerciseDoneResultDO.setTotalCounts(memberExerciseVOS.size());
exerciseDoneResultDO.setCourseId(submitDTO.getCourseId());
exerciseDoneResultDO.setMemberId(submitDTO.getMemberId());
exerciseDoneResultDO.setPaperId(submitDTO.getPaperId());
exerciseDoneResultDO.setLength(submitDTO.getLength());
exerciseDoneResultDO.setStartDate(submitDTO.getStartDate());
int score = MathUtil.intDivFloorPercent(rightCounts, memberExerciseVOS.size());
exerciseDoneResultDO.setScore(score);
exerciseDoneResultDO.setResult(score >= 60 ? "合格" : "不合格");
exerciseDoneResultMapper.insert(exerciseDoneResultDO);
for (MemberExerciseVO memberExerciseVO : memberExerciseVOS) {
ExerciseDoneHistoryDO exerciseDoneHistoryDO = new ExerciseDoneHistoryDO();
exerciseDoneHistoryDO.setPaperId(submitDTO.getPaperId());
exerciseDoneHistoryDO.setDoneId(exerciseDoneResultDO.getId());
exerciseDoneHistoryDO.setMemberId(submitDTO.getMemberId());
exerciseDoneHistoryDO.setClassId(submitDTO.getClassId());
exerciseDoneHistoryDO.setExerciseId(memberExerciseVO.getId());
exerciseDoneHistoryDO.setAnswer(memberExerciseVO.getSelectAnswer());
exerciseDoneHistoryDO.setResult(memberExerciseVO.getResult());
exerciseDoneHistoryMapper.insert(exerciseDoneHistoryDO);
for (MemberExerciseVO exerciseVO : memberExerciseVOS) {
ExerciseDictDO exerciseDictDO = this.baseMapper.selectById(exerciseVO.getId());
if (exerciseDictDO.getRightAnswer().equals(exerciseVO.getSelectAnswer())) {
exerciseVO.setResult(1);
rightCounts++;
} else {
exerciseVO.setResult(0);
}
}
exerciseDoneResultDO.setClassId(submitDTO.getClassId());
exerciseDoneResultDO.setRightCounts(rightCounts);
exerciseDoneResultDO.setTotalCounts(memberExerciseVOS.size());
exerciseDoneResultDO.setCourseId(submitDTO.getCourseId());
exerciseDoneResultDO.setMemberId(submitDTO.getMemberId());
exerciseDoneResultDO.setPaperId(submitDTO.getPaperId());
exerciseDoneResultDO.setLength(submitDTO.getLength());
exerciseDoneResultDO.setStartDate(submitDTO.getStartDate());
int score = MathUtil.intDivFloorPercent(rightCounts, memberExerciseVOS.size());
exerciseDoneResultDO.setScore(score);
exerciseDoneResultDO.setResult(score >= 60 ? "合格" : "不合格");
exerciseDoneResultMapper.insert(exerciseDoneResultDO);
for (MemberExerciseVO memberExerciseVO : memberExerciseVOS) {
ExerciseDoneHistoryDO exerciseDoneHistoryDO = new ExerciseDoneHistoryDO();
exerciseDoneHistoryDO.setPaperId(submitDTO.getPaperId());
exerciseDoneHistoryDO.setDoneId(exerciseDoneResultDO.getId());
exerciseDoneHistoryDO.setMemberId(submitDTO.getMemberId());
exerciseDoneHistoryDO.setClassId(submitDTO.getClassId());
exerciseDoneHistoryDO.setExerciseId(memberExerciseVO.getId());
exerciseDoneHistoryDO.setAnswer(memberExerciseVO.getSelectAnswer());
exerciseDoneHistoryDO.setResult(memberExerciseVO.getResult());
exerciseDoneHistoryMapper.insert(exerciseDoneHistoryDO);
}
}
return exerciseDoneResultDO.getId();
......
......@@ -953,15 +953,19 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
public String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO) {
//查看这个人这个卷子做了几次
Integer count = exerciseDoneResultMapper.selectCount(new QueryWrapper<ExerciseDoneResultDO>()
.lambda()
.eq(ExerciseDoneResultDO::getMemberId, exerciseDoneResultDO.getMemberId())
.eq(ExerciseDoneResultDO::getPaperId, exerciseDoneResultDO.getPaperId())
.eq(ExerciseDoneResultDO::getClassId, exerciseDoneResultDO.getClassId()));
ClassDictDO classDictDO = classDictMapper.selectById(exerciseDoneResultDO.getClassId());
if (count > 3) {
throw new HttpException(60001);
if (1 == classDictDO.getCheckFlag()) {
//查看这个人这个卷子做了几次
Integer count = exerciseDoneResultMapper.selectCount(new QueryWrapper<ExerciseDoneResultDO>()
.lambda()
.eq(ExerciseDoneResultDO::getMemberId, exerciseDoneResultDO.getMemberId())
.eq(ExerciseDoneResultDO::getPaperId, exerciseDoneResultDO.getPaperId())
.eq(ExerciseDoneResultDO::getClassId, exerciseDoneResultDO.getClassId()));
if (count >= 3) {
throw new HttpException(60001);
}
}
return ConstantUtils.CHECK_STATUS;
......
......@@ -10,16 +10,14 @@ import com.subsidy.service.PushDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.service.RenshejuHistoryService;
import com.subsidy.util.RenSheJuConstant;
import com.subsidy.util.SMSUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.configurationprocessor.json.JSONObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.*;
/**
* <p>
......@@ -59,6 +57,9 @@ public class PushDataServiceImpl extends ServiceImpl<PushAnsweringDataMapper, Pu
@Autowired
private PushAnsweringDataMapper pushAnsweringDataMapper;
@Autowired
private SMSUtils smsUtils;
@Transactional(rollbackFor = Exception.class)
public void post4() {
......@@ -176,7 +177,7 @@ public class PushDataServiceImpl extends ServiceImpl<PushAnsweringDataMapper, Pu
// List<RenshejuHistoryDO> renshejuHistoryDOS = renshejuHistoryMapper.selectList(new QueryWrapper<RenshejuHistoryDO>()
// .lambda()
// .in(RenshejuHistoryDO::getId,longs));
for (RenshejuHistoryDO renshejuHistoryDO : renshejuHistoryDOS){
for (RenshejuHistoryDO renshejuHistoryDO : renshejuHistoryDOS) {
String input = renshejuHistoryDO.getInputParam();
Gson gson = new Gson();
UploadImageDTO uploadImageDTO = gson.fromJson(input, UploadImageDTO.class);
......@@ -197,29 +198,60 @@ public class PushDataServiceImpl extends ServiceImpl<PushAnsweringDataMapper, Pu
}
}
public HashMap<String, List<Long>> check(){
public void sendWarning() {
HashMap<String, List<Long>> hashMap = new HashMap();
//视频
List<Long> vodList = pushVodDataMapper.vodIds();
//答疑
List<Long> answerList = pushAnsweringDataMapper.answerList();
//考试
List<Long> examList = pushExerciseDataMapper.examList();
//活跃度
List<Long> activityList = pushDetectionDataMapper.activityList();
//人脸
List<Long> imageList = pushImageDataMapper.imageList();
if (vodList.size()+answerList.size()+examList.size()+activityList.size()+imageList.size()>0){
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
for (String telephone : telephones) {
smsUtils.sendWarning("SMS_460945631", telephone, null);
}
}
}
public HashMap<String, List<Long>> check() {
HashMap<String, List<Long>> hashMap = new HashMap();
//视频
List<Long> vodList = pushVodDataMapper.vodIds();
hashMap.put("视频",vodList);
hashMap.put("视频", vodList);
//答疑
List<Long> answerList = pushAnsweringDataMapper.answerList();
hashMap.put("答疑",answerList);
hashMap.put("答疑", answerList);
//考试
List<Long> examList = pushExerciseDataMapper.examList();
hashMap.put("考试",examList);
hashMap.put("考试", examList);
//活跃度
List<Long> activityList = pushDetectionDataMapper.activityList();
hashMap.put("活跃度",activityList);
hashMap.put("活跃度", activityList);
//人脸
List<Long> imageList = pushImageDataMapper.imageList();
hashMap.put("人脸",imageList);
hashMap.put("人脸", imageList);
return hashMap;
}
......
......@@ -176,7 +176,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
for (DailyStudyInfoVO dailyStudyInfoVO : result) {
ClassHourBasic classHourBasic = new ClassHourBasic();
BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic);
classHourBasic.setClassCode(dailyStudyInfoVO.getDownCode());
classHourBasic.setClassCode(dailyStudyInfoVO.getClassCode());
//找到当天每次上线下线时间
//上线时间
......
......@@ -89,7 +89,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
if (count == 0 && flag) {
if (vodPlayHistoryDO.getPlayLength() > 8 && vodPlayHistoryDO.getSuspendLength() <= 3000) {
if (vodPlayHistoryDO.getPlayLength() > 30 && vodPlayHistoryDO.getSuspendLength() <= 3000) {
Date latestDailyDate = this.baseMapper.latestDailyStudyRecord(vodPlayHistoryDO.getMemberId());
......@@ -108,7 +108,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//超过时长
int playLength = 6 * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
if (playLength > 8) {
if (playLength > 30) {
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()
......@@ -159,7 +159,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
}
if (count == 0 && flag) {
if (insertHistoryNewDTO.getPlayLength() > 8 && insertHistoryNewDTO.getSuspendLength() <= 3000) {
if (insertHistoryNewDTO.getPlayLength() > 30 && insertHistoryNewDTO.getSuspendLength() <= 3000) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
BeanUtils.copyProperties(insertHistoryNewDTO, vodPlayHistoryDO);
//查看系统设定的时长
......@@ -177,7 +177,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
if (total + vodPlayHistoryDO.getPlayLength() > 6 * 3600) {
int playLength = 6 * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
if (playLength > 8) {
if (playLength > 30) {
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()
......
......@@ -12,7 +12,7 @@ public class DailyStudyInfoVO {
/**
* 临时班级(临时项目)编号
*/
private String downCode;
private String classCode;
/**
* 学员身份证号,会对身份证号长度、格式进行校验、X用大写
*/
......
......@@ -216,7 +216,7 @@
class_dict t1
LEFT JOIN company_dict t3 ON t1.company_id = t3.id
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
DATE_FORMAT( DATE_ADD( t1.start_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
and t1.class_code is not NULL
<if test="classType != null and classType != ''">
......
......@@ -12,13 +12,16 @@
t2.id AS 答疑id
FROM
answering_question t2
left join class_dict t3 on t2.class_id = t3.id
LEFT JOIN push_answering_data t1 ON t1.class_id = t2.class_id
AND t1.ask_id = t2.ask_id
AND t1.create_date = t2.create_date
AND t1.update_date = t2.update_date
WHERE
t2.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t2.update_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND DATE_FORMAT( DATE_ADD( t2.update_date, interval 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.create_date IS NULL
and t3.class_type = 0
</select>
</mapper>
......@@ -12,12 +12,15 @@
t2.id 活跃度id
FROM
activity_detection t2
left join class_dict t3 on t2.class_id = t3.id
LEFT JOIN push_detection_data t1 ON t1.class_id = t2.class_id
AND t1.member_id = t2.member_id
AND t1.create_date = t2.create_date
WHERE
t2.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t2.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND DATE_FORMAT( DATE_ADD( t2.create_date, interval 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.create_date IS NULL
and t3.class_type = 0
</select>
</mapper>
......@@ -12,14 +12,16 @@
t2.id as 考试id
FROM
exercise_done_result t2
left join class_dict t3 on t2.class_id = t3.id
LEFT JOIN push_exercise_data t1 ON t1.class_id = t2.class_id
AND t1.member_id = t2.member_id
AND t1.start_date = t2.start_date
AND t1.create_date = t2.create_date
WHERE
t2.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t2.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND DATE_FORMAT( DATE_ADD( t2.create_date, interval 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.create_date IS NULL
and t3.class_type = 0
</select>
</mapper>
......@@ -12,6 +12,7 @@
t2.id 人脸id
FROM
image_check_record t2
left join class_dict t3 on t2.class_id = t3.id
LEFT JOIN push_image_data t1 ON t1.class_id = t2.class_id
AND t1.member_id = t2.member_id
AND t1.occurred_time = t2.create_date
......@@ -20,5 +21,6 @@
AND DATE_FORMAT( DATE_ADD( t2.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.id IS NULL
AND t2.result = 1
and t3.class_type = 0
</select>
</mapper>
......@@ -12,6 +12,7 @@
t2.id as 视频id
FROM
vod_play_history t2
left join class_dict t3 on t2.class_id = t3.id
LEFT JOIN push_vod_data t1 ON t1.class_id = t2.class_id
AND t1.vod_id = t2.vod_id
AND t1.member_id = t2.member_id
......@@ -20,8 +21,9 @@
AND t1.create_date = t2.create_date
WHERE
t2.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t2.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND DATE_FORMAT( DATE_ADD( t2.create_date, interval 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.create_date IS NULL
and t3.class_type = 0
</select>
</mapper>
......@@ -83,7 +83,7 @@
<select id="dailyStudyInfo" resultType="com.subsidy.vo.renshe.DailyStudyInfoVO">
SELECT
t.class_id,
t5.class_code AS downCode,
t5.class_code,
t3.id AS member_id,
t3.user_name AS studentName,
t3.telephone AS phone,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!