Commit eefbce7c by 涂亚平

签到数据删除了历史数据

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