Commit eefbce7c by 涂亚平

签到数据删除了历史数据

1 parent b17282a8
......@@ -133,11 +133,11 @@
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>com.amdelamar</groupId>
<artifactId>jhash</artifactId>
<version>${jhash.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.amdelamar</groupId>-->
<!-- <artifactId>jhash</artifactId>-->
<!-- <version>${jhash.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.poi</groupId>
......
......@@ -56,9 +56,6 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//private RedisUtil redisUtil;
@Autowired
private SignInRecordMapper signInRecordMapper;
@Autowired
private ClassDictMapper classDictMapper;
@Autowired
......@@ -89,10 +86,10 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//}
//redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyy-MM-dd") + ":" + System.currentTimeMillis(), null);
signInRecordMapper.delete(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId,signInRecordDO.getMemberId())
.eq(SignInRecordDO::getClassId,classDictDO.getId()));
this.baseMapper.delete(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
.gt(SignInRecordDO::getSignInDate, LocalDate.now()));
// 存储到缓存到同时保存到数据库
SignInRecordDO sign = this.baseMapper.selectOne(new QueryWrapper<SignInRecordDO>()
......@@ -138,7 +135,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
//签到
Integer signCount = signInRecordMapper.selectCount(new QueryWrapper<SignInRecordDO>()
Integer signCount = this.baseMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId())
.eq(SignInRecordDO::getClassId, dataViewVO.getClassId()));
......
......@@ -366,12 +366,16 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
.eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId())
.eq(SignInRecordDO::getClassId, classId));
//确定每日最大学习时长
int maxLength = memberStudyLengthDO.getTotalLength()/signInRecordDOS.size()+650;
for (int k = signInRecordDOS.size() - 1; k >= 0; k--) {
//查看当天这人已经看的视频时长
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.exPlayInfo(classMemberMappingDO.getMemberId(), String.valueOf(classId), signInRecordDOS.get(k).getSignInDate());
//查看学生看视频时长
//查看学生看视频时长
int totalLength = 0;
System.out.println("111111111111111");
List<VodPlayHistoryDO> vodPlayHistoryDOS1 = vodPlayHistoryMapper.selectList(new QueryWrapper<VodPlayHistoryDO>()
......@@ -398,39 +402,42 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
playLength += vodPlayHistoryDOS.get(m).getPlayLength();
}
System.out.println("33333333333333333333");
if (leftLength > 0) {
//随机看几个视频
int playCounts = new Random().nextInt(4) + 2;
System.out.println("4444444444444444");
for (int i = 0; i < playCounts; i++) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
Random random1 = new Random();
System.out.println("55555555555555555555");
int j = random1.nextInt(vodDictDOS.size());
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(classId);
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
int h = new Random().nextInt(vodDictDOS.get(j).getVodLength() - 10) + 1;
System.out.println("666666666666666666");
vodPlayHistoryDO.setPlayRecord(new Random().nextInt(h));
if (leftLength - h > 0) {
vodPlayHistoryDO.setPlayLength(h);
playLength += h;
vodPlayHistoryDO.setVodId(vodDictDOS.get(j).getId());
vodPlayHistoryDO.setPlayDate(signInRecordDOS.get(k).getSignInDate().plusSeconds(playLength));
leftLength = leftLength - h;
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
} else {
vodPlayHistoryDO.setPlayLength(leftLength);
playLength += leftLength;
vodPlayHistoryDO.setVodId(vodDictDOS.get(j).getId());
vodPlayHistoryDO.setPlayDate(signInRecordDOS.get(k).getSignInDate().plusSeconds(playLength));
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
break;
if (maxLength>playLength){
if (leftLength > 0) {
//随机看几个视频
int playCounts = new Random().nextInt(4) + 2;
System.out.println("4444444444444444");
for (int i = 0; i < playCounts; i++) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
Random random1 = new Random();
System.out.println("55555555555555555555");
int j = random1.nextInt(vodDictDOS.size());
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(classId);
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
int h = new Random().nextInt(vodDictDOS.get(j).getVodLength() - 10) + 1;
System.out.println("666666666666666666");
vodPlayHistoryDO.setPlayRecord(new Random().nextInt(h));
if (leftLength - h > 0) {
vodPlayHistoryDO.setPlayLength(h);
playLength += h;
vodPlayHistoryDO.setVodId(vodDictDOS.get(j).getId());
vodPlayHistoryDO.setPlayDate(signInRecordDOS.get(k).getSignInDate().plusSeconds(playLength));
leftLength = leftLength - h;
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
} else {
vodPlayHistoryDO.setPlayLength(leftLength);
playLength += leftLength;
vodPlayHistoryDO.setVodId(vodDictDOS.get(j).getId());
vodPlayHistoryDO.setPlayDate(signInRecordDOS.get(k).getSignInDate().plusSeconds(playLength));
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
break;
}
}
}
}
System.out.println("33333333333333333333");
}
}
}
......
# 环境配置
spring.profiles.active=dev
spring.profiles.active=prod
# 端口号
spring.server.port=23457
spring.server.port=23459
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount=600
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!