Commit b998e5ed by 涂亚平

优化后版本,跑数据脚本

1 parent 0ec73509
...@@ -8,6 +8,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO; ...@@ -8,6 +8,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.member.AddMemberDTO; import com.subsidy.dto.member.AddMemberDTO;
import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.ContentMemberDTO;
import com.subsidy.dto.member.GetAllDTO; import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.dto.member.MyCoursesDTO;
import com.subsidy.dto.member.PasswordLoginDTO; import com.subsidy.dto.member.PasswordLoginDTO;
import com.subsidy.dto.member.StudyHistoryDTO; import com.subsidy.dto.member.StudyHistoryDTO;
import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.model.ExerciseDoneResultDO;
...@@ -90,8 +91,11 @@ public class MemberController { ...@@ -90,8 +91,11 @@ public class MemberController {
return ResponseData.generateCreatedResponse(0,memberService.studyPage(memberDO)); return ResponseData.generateCreatedResponse(0,memberService.studyPage(memberDO));
} }
//@PostMapping("MyCourse") @PostMapping("myCourses")
//@ApiOperation("我的课程") @ApiOperation("手机端:我的学习--课程 id 学员id status 状态 0:全部 1:进行中 2:待开始 3:已完成 ")
public ResponseVO myCourses(@RequestBody MyCoursesDTO myCoursesDTO){
return ResponseData.generateCreatedResponse(0,memberService.myCourses(myCoursesDTO));
}
@PostMapping("contentVod") @PostMapping("contentVod")
@ApiOperation("手机端:目录+视频 courseId 课程 memberId 学员id") @ApiOperation("手机端:目录+视频 courseId 课程 memberId 学员id")
......
...@@ -50,11 +50,6 @@ public class VodPlayHistoryController { ...@@ -50,11 +50,6 @@ public class VodPlayHistoryController {
vodPlayHistoryService.dataFix(dataFixDTO); vodPlayHistoryService.dataFix(dataFixDTO);
} }
@PostMapping("fixDataTwo")
public void dataFixTwo(@RequestBody FixDataTwoDTO fixDataTwoDTO){
vodPlayHistoryService.dataFixTwo(fixDataTwoDTO);
}
@PostMapping("signDatePlays") @PostMapping("signDatePlays")
public void signDatePlays(@RequestBody SignDatePlaysDTO signDatePlaysDTO ){ public void signDatePlays(@RequestBody SignDatePlaysDTO signDatePlaysDTO ){
vodPlayHistoryService.signDatePlays(signDatePlaysDTO); vodPlayHistoryService.signDatePlays(signDatePlaysDTO);
......
package com.subsidy.dto.member;
import lombok.Data;
@Data
public class MyCoursesDTO {
private Long memberId;
private Integer status;
private Integer pageSize;
private Integer pageNum;
}
...@@ -6,6 +6,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO; ...@@ -6,6 +6,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.member.AddMemberDTO; import com.subsidy.dto.member.AddMemberDTO;
import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.ContentMemberDTO;
import com.subsidy.dto.member.GetAllDTO; import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.dto.member.MyCoursesDTO;
import com.subsidy.dto.member.PasswordLoginDTO; import com.subsidy.dto.member.PasswordLoginDTO;
import com.subsidy.dto.member.StudyHistoryDTO; import com.subsidy.dto.member.StudyHistoryDTO;
import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.model.ExerciseDoneResultDO;
...@@ -18,6 +19,7 @@ import com.subsidy.vo.member.GetAllVO; ...@@ -18,6 +19,7 @@ import com.subsidy.vo.member.GetAllVO;
import com.subsidy.vo.member.GetStudyInfoVO; import com.subsidy.vo.member.GetStudyInfoVO;
import com.subsidy.vo.member.MemberStudyPageVO; import com.subsidy.vo.member.MemberStudyPageVO;
import com.subsidy.vo.member.MemberVO; import com.subsidy.vo.member.MemberVO;
import com.subsidy.vo.member.MyCoursesVO;
import com.subsidy.vo.paper.QueryPapersVO; import com.subsidy.vo.paper.QueryPapersVO;
import java.util.List; import java.util.List;
...@@ -48,6 +50,8 @@ public interface MemberService extends IService<MemberDO> { ...@@ -48,6 +50,8 @@ public interface MemberService extends IService<MemberDO> {
MemberStudyPageVO studyPage(MemberDO memberDO); MemberStudyPageVO studyPage(MemberDO memberDO);
IPage<MyCoursesVO> myCourses(MyCoursesDTO myCoursesDTO);
ContentVodNewVO contentVod(ContentMemberDTO contentVodDTO); ContentVodNewVO contentVod(ContentMemberDTO contentVodDTO);
List<ContentFilesVO> contentFiles(ContentMemberDTO contentMemberDTO); List<ContentFilesVO> contentFiles(ContentMemberDTO contentMemberDTO);
......
...@@ -21,7 +21,5 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> { ...@@ -21,7 +21,5 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
void dataFix(SignDatePlaysDTO dataFixDTO); void dataFix(SignDatePlaysDTO dataFixDTO);
void dataFixTwo(FixDataTwoDTO fixDataTwoDTO);
void signDatePlays(SignDatePlaysDTO dataFixDTO); void signDatePlays(SignDatePlaysDTO dataFixDTO);
} }
...@@ -10,6 +10,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO; ...@@ -10,6 +10,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.member.AddMemberDTO; import com.subsidy.dto.member.AddMemberDTO;
import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.ContentMemberDTO;
import com.subsidy.dto.member.GetAllDTO; import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.dto.member.MyCoursesDTO;
import com.subsidy.dto.member.PasswordLoginDTO; import com.subsidy.dto.member.PasswordLoginDTO;
import com.subsidy.dto.member.StudyHistoryDTO; import com.subsidy.dto.member.StudyHistoryDTO;
import com.subsidy.mapper.ClassDictMapper; import com.subsidy.mapper.ClassDictMapper;
...@@ -47,6 +48,7 @@ import com.subsidy.vo.member.GetAllVO; ...@@ -47,6 +48,7 @@ import com.subsidy.vo.member.GetAllVO;
import com.subsidy.vo.member.GetStudyInfoVO; import com.subsidy.vo.member.GetStudyInfoVO;
import com.subsidy.vo.member.MemberStudyPageVO; import com.subsidy.vo.member.MemberStudyPageVO;
import com.subsidy.vo.member.MemberVO; import com.subsidy.vo.member.MemberVO;
import com.subsidy.vo.member.MyCoursesVO;
import com.subsidy.vo.member.StudyPageVO; import com.subsidy.vo.member.StudyPageVO;
import com.subsidy.vo.paper.QueryPapersVO; import com.subsidy.vo.paper.QueryPapersVO;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -387,6 +389,12 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -387,6 +389,12 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return new AsyncResult<>(studyPageVO); return new AsyncResult<>(studyPageVO);
} }
public IPage<MyCoursesVO> myCourses(MyCoursesDTO myCoursesDTO){
return null;
}
public ContentVodNewVO contentVod(ContentMemberDTO contentVodDTO) { public ContentVodNewVO contentVod(ContentMemberDTO contentVodDTO) {
ContentVodNewVO contentVodNewVO = new ContentVodNewVO(); ContentVodNewVO contentVodNewVO = new ContentVodNewVO();
......
...@@ -234,83 +234,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -234,83 +234,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
} }
} }
public void dataFixTwo(FixDataTwoDTO fixDataTwoDTO) {
//班级ids
List<String> classIds = Arrays.asList(new String[]{fixDataTwoDTO.getClassId()});
for (String str : classIds) {
ClassDictDO classDictDO = classDictMapper.selectById(str);
//找到班级里的学生
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
.eq(ClassMemberMappingDO::getClassId, Long.valueOf(str)));
//查找课程里的所有视频
List<VodDictDO> vodDictDOS = courseContentMapper.getCourseVods(classDictDO.getCourseId());
//遍历班级学生
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
//查询这个人 这节课 签到记录 排序
List<LocalDateTime> localDateTimes = new ArrayList<>();
List<SignInRecordDO> signInRecordDOS = new ArrayList<>();
if ("2".equals(fixDataTwoDTO.getStep())) {
signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId())
.eq(SignInRecordDO::getClassId, str)
.orderByDesc(SignInRecordDO::getSignInDate));
} else {
signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId())
.eq(SignInRecordDO::getClassId, str)
.orderByAsc(SignInRecordDO::getSignInDate));
}
for (SignInRecordDO signInrecord : signInRecordDOS) {
if (signInrecord.getSignInDate().getHour() >= 6 && signInrecord.getSignInDate().getHour() < 15) {
localDateTimes.add(signInrecord.getSignInDate());
}
}
if (localDateTimes.size() > 0) {
LocalDateTime date = localDateTimes.get(0);
//查看当天这人已经看的视频时长
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.exPlayInfo(classMemberMappingDO.getMemberId(), str, date);
int playLength = 0;
for (int m = 0; m < vodPlayHistoryDOS.size(); m++) {
playLength += vodPlayHistoryDOS.get(m).getPlayLength();
}
int playCounts = new Random().nextInt(2);
for (int i = 0; i < playCounts; i++) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
Random random1 = new Random();
int j = random1.nextInt(vodDictDOS.size());
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(Long.valueOf(str));
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
int h = new Random().nextInt(vodDictDOS.get(j).getVodLength() - 10) + 1;
vodPlayHistoryDO.setPlayRecord(h);
vodPlayHistoryDO.setPlayLength(new Random().nextInt(vodPlayHistoryDO.getPlayRecord()));
playLength += vodPlayHistoryDO.getPlayLength();
vodPlayHistoryDO.setVodId(vodDictDOS.get(j).getId());
vodPlayHistoryDO.setPlayDate(date.plusSeconds(playLength));
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
}
}
}
}
}
public void signDatePlays(SignDatePlaysDTO signDatePlaysDTO) { public void signDatePlays(SignDatePlaysDTO signDatePlaysDTO) {
//班级ids //班级ids
......
package com.subsidy.vo.member;
import lombok.Data;
@Data
public class MyCoursesVO {
}
# 环境配置 # 环境配置
spring.profiles.active=dev spring.profiles.active=dev
# 端口号 # 端口号
spring.server.port=23457 spring.server.port=23460
#嵌入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!