Commit a079f1ef by 涂亚平

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

重新开始推送数据
1 parent 096878dd
......@@ -123,7 +123,7 @@ public class AdministerController {
@PostMapping("exportExerciseTest")
@ApiOperation("班级管理--测评成绩 id 班级id userName paperId")
// @LoginRequired
@LoginRequired
public void exportExerciseTest(@RequestBody ClassDetailDTO classDetailDTO) throws Exception {
classDetailDTO.setFlag(true);
administerService.exportExerciseTest(classDetailDTO);
......
......@@ -105,7 +105,4 @@ public class VodPlayHistoryController {
return vodPlayHistoryService.criticalData(vodPlayHistoryDO);
}
}
......@@ -64,76 +64,76 @@ public class RenSheJuJob {
private String env;
// /**
//// * POST-2:班级基本信息信息采集接口
//// */
// @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 上下游班级数据绑定接口
/**
// * POST-2:班级基本信息信息采集接口
// */
// @Scheduled(cron = "0 30 1 * * ?")
// public void uploadClassCode() throws IOException {
// if ("prod".equals(env)) {
// renSheJuService.uploadClassCode();
// }
// System.gc();
// }
@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();
}
// /**
// * POST-9 获取推送失败班级列表
......@@ -297,7 +297,6 @@ public class RenSheJuJob {
activityDetectionMapper.deleteById(activityDetectionDO.getId());
}
});
}
......
......@@ -142,10 +142,10 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
for (String telephone : telephones) {
smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_2);
}
// List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
// for (String telephone : telephones) {
// smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_2);
// }
}
return null;
}
......@@ -165,7 +165,6 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List<Long> vodClassIds = renSheJuMapper.vodClassIds("0");
List<DailyStudyInfoVO> result = new ArrayList<>();
// List<Long> vodClassIds = new ArrayList<>();
try {
......@@ -251,6 +250,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
// return null;
} else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3);
......@@ -406,10 +406,11 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
for (String telephone : telephones) {
smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_4);
}
// List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
// for (String telephone : telephones) {
// smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_4);
// }
}
return null;
}
......@@ -427,6 +428,9 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List<DailyAnswerVO> dailyAnswerVOS = renSheJuMapper.dailyAnswer("0");
// List<DailyAnswerVO> dailyAnswerVOS = new ArrayList<>();
try {
if (dailyAnswerVOS.size() > 0) {
HashMap<String, List<AnswerAndQuestionList>> hashMap = new HashMap<>();
......@@ -498,10 +502,10 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
for (String telephone : telephones) {
smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_5);
}
// List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
// for (String telephone : telephones) {
// smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_5);
// }
}
return null;
}
......@@ -517,10 +521,6 @@ public class RenSheJuServiceImpl implements RenSheJuService {
//找到昨天做过人脸识别的班级
List<Long> classIds = renSheJuMapper.checkClassIds("0");
// List<Long> classIds = new ArrayList<>();
//
// classIds.add(451L);
for (Long classId : classIds) {
UploadImageDTO uploadImage = new UploadImageDTO();
......
......@@ -59,50 +59,60 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Autowired
private SMSUtils smsUtils;
@Autowired
private ExerciseDoneResultMapper exerciseDoneResultMapper;
@Transactional(rollbackFor = Exception.class)
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()));
if (count == 0) {
Date date = new Date();
if (vodPlayHistoryDO.getPlayLength() > 8 && vodPlayHistoryDO.getSuspendLength() <= 3000) {
Date date = new Date();
if (vodPlayHistoryDO.getPlayLength() > 8 && vodPlayHistoryDO.getSuspendLength() <= 3000) {
Date latestDailyDate = this.baseMapper.latestDailyStudyRecord(vodPlayHistoryDO.getMemberId());
Date latestDailyDate = this.baseMapper.latestDailyStudyRecord(vodPlayHistoryDO.getMemberId());
//查看系统设定的时长
ClassDictDO classDictDO = classDictMapper.selectOne(new QueryWrapper<ClassDictDO>()
.lambda()
.eq(ClassDictDO::getId, vodPlayHistoryDO.getClassId()));
if (classDictDO.getLimitHour() == 1) {
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(vodPlayHistoryDO.getMemberId(), classDictDO.getId());
if (total >= 6 * 3600) {
throw new HttpException(13001);
}
//是否超过时长
if (total + vodPlayHistoryDO.getPlayLength() > 6 * 3600) {
//超过时长
int playLength = 6 * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
if (playLength > 8) {
//查看系统设定的时长
ClassDictDO classDictDO = classDictMapper.selectOne(new QueryWrapper<ClassDictDO>()
.lambda()
.eq(ClassDictDO::getId, vodPlayHistoryDO.getClassId()));
if (classDictDO.getLimitHour() == 1) {
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(vodPlayHistoryDO.getMemberId(), classDictDO.getId());
if (total >= 6 * 3600) {
throw new HttpException(13001);
}
//是否超过时长
if (total + vodPlayHistoryDO.getPlayLength() > 6 * 3600) {
//超过时长
int playLength = 6 * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
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 {
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 {
} else if (classDictDO.getLimitHour() == 0) {
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) {
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));
}
}
}
......@@ -112,45 +122,52 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Transactional(rollbackFor = Exception.class)
public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO, HttpServletRequest request) {
Date date = new Date();
if (insertHistoryNewDTO.getPlayLength() > 8 && insertHistoryNewDTO.getSuspendLength() <= 3000) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
BeanUtils.copyProperties(insertHistoryNewDTO, vodPlayHistoryDO);
//查看系统设定的时长
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());
if (total == 6 * 3600) {
throw new HttpException(13001);
}
//是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() > 6 * 3600) {
int playLength = 6 * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
if (playLength > 8) {
Integer count = exerciseDoneResultMapper.selectCount(new QueryWrapper<ExerciseDoneResultDO>()
.lambda()
.eq(ExerciseDoneResultDO::getClassId, insertHistoryNewDTO.getClassId())
.eq(ExerciseDoneResultDO::getMemberId, insertHistoryNewDTO.getMemberId()));
if (count == 0) {
Date date = new Date();
if (insertHistoryNewDTO.getPlayLength() > 8 && insertHistoryNewDTO.getSuspendLength() <= 3000) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
BeanUtils.copyProperties(insertHistoryNewDTO, vodPlayHistoryDO);
//查看系统设定的时长
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());
if (total == 6 * 3600) {
throw new HttpException(13001);
}
//是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() > 6 * 3600) {
int playLength = 6 * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
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 {
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 {
} else if (classDictDO.getLimitHour() == 0) {
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) {
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;
......
......@@ -2,30 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.RenSheJuMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.CertCompanyMappingDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="company_id" property="companyId" />
<result column="cert_id" property="certId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, company_id, cert_id
</sql>
<select id="classBaseInfo" parameterType="long" resultType="com.subsidy.vo.renshe.ClassBaseInfoVO">
SELECT
t2.id AS downCode,
t2.class_code,
t2.class_name AS shortName,
ROUND( sum( t7.vod_length )/ 60 ) AS learnHour,
FLOOR( sum( t7.vod_length )/ 60 ) AS learnHour,
FLOOR( sum( t7.vod_length )/ 2700 ) AS courseHour,
REPLACE ( unix_timestamp( t2.start_date ), '.', '' )/ 1000 AS startDate,
REPLACE ( unix_timestamp( t2.end_date ), '.', '' )/ 1000 AS endDate,
......@@ -67,7 +49,7 @@
SELECT
t7.id AS chapterCode,
IFNULL( t6.vod_alias_name, t7.vod_name ) as chapterName,
ROUND( t7.vod_length / 60 ) as chapterTime,
FLOOR( t7.vod_length / 60 ) as chapterTime,
0 as isExam,
120 as examTime
FROM
......@@ -90,17 +72,17 @@
</select>
<select id="newClasses" parameterType="string" resultType="long">
SELECT DISTINCT
t1.id
FROM
class_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_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 != ''">
and t1.class_type = #{classType}
</if>
SELECT DISTINCT
t1.id
FROM
class_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_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 != ''">
and t1.class_type = #{classType}
</if>
</select>
<select id="dailyStudyInfo" resultType="com.subsidy.vo.renshe.DailyStudyInfoVO">
......@@ -389,21 +371,21 @@
</select>
<select id="checkClassIds" parameterType="string" resultType="long">
SELECT
distinct class_id
SELECT
distinct class_id
FROM
image_check_record t
image_check_record t
left join class_dict t2 on t.class_id = t2.id
WHERE
t.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
and class_id is not null
<if test="classType != null and classType != ''">
and t2.class_type = #{classType}
</if>
t.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
and class_id is not null
<if test="classType != null and classType != ''">
and t2.class_type = #{classType}
</if>
</select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!