From b998e5ed60e7c0ccd3bdb6eafa8902ab1a9dc33c Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 20 Jan 2022 15:58:20 +0800 Subject: [PATCH] 优化后版本,跑数据脚本 --- src/main/java/com/subsidy/controller/MemberController.java | 8 ++++++-- src/main/java/com/subsidy/controller/VodPlayHistoryController.java | 5 ----- src/main/java/com/subsidy/dto/member/MyCoursesDTO.java | 16 ++++++++++++++++ src/main/java/com/subsidy/service/MemberService.java | 4 ++++ src/main/java/com/subsidy/service/VodPlayHistoryService.java | 2 -- src/main/java/com/subsidy/service/impl/MemberServiceImpl.java | 8 ++++++++ src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java | 77 ----------------------------------------------------------------------------- src/main/java/com/subsidy/vo/member/MyCoursesVO.java | 10 ++++++++++ src/main/resources/application.properties | 2 +- 9 files changed, 45 insertions(+), 87 deletions(-) create mode 100644 src/main/java/com/subsidy/dto/member/MyCoursesDTO.java create mode 100644 src/main/java/com/subsidy/vo/member/MyCoursesVO.java diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java index 2a5559a..2616a63 100644 --- a/src/main/java/com/subsidy/controller/MemberController.java +++ b/src/main/java/com/subsidy/controller/MemberController.java @@ -8,6 +8,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO; import com.subsidy.dto.member.AddMemberDTO; import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.GetAllDTO; +import com.subsidy.dto.member.MyCoursesDTO; import com.subsidy.dto.member.PasswordLoginDTO; import com.subsidy.dto.member.StudyHistoryDTO; import com.subsidy.model.ExerciseDoneResultDO; @@ -90,8 +91,11 @@ public class MemberController { return ResponseData.generateCreatedResponse(0,memberService.studyPage(memberDO)); } - //@PostMapping("MyCourse") - //@ApiOperation("我的课程") + @PostMapping("myCourses") + @ApiOperation("手机端:我的学习--课程 id 学员id status 状态 0:全部 1:进行中 2:待开始 3:已完成 ") + public ResponseVO myCourses(@RequestBody MyCoursesDTO myCoursesDTO){ + return ResponseData.generateCreatedResponse(0,memberService.myCourses(myCoursesDTO)); + } @PostMapping("contentVod") @ApiOperation("手机端:目录+视频 courseId 课程 memberId 学员id") diff --git a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java index 0906af8..85eb0ff 100644 --- a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java +++ b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java @@ -50,11 +50,6 @@ public class VodPlayHistoryController { vodPlayHistoryService.dataFix(dataFixDTO); } - @PostMapping("fixDataTwo") - public void dataFixTwo(@RequestBody FixDataTwoDTO fixDataTwoDTO){ - vodPlayHistoryService.dataFixTwo(fixDataTwoDTO); - } - @PostMapping("signDatePlays") public void signDatePlays(@RequestBody SignDatePlaysDTO signDatePlaysDTO ){ vodPlayHistoryService.signDatePlays(signDatePlaysDTO); diff --git a/src/main/java/com/subsidy/dto/member/MyCoursesDTO.java b/src/main/java/com/subsidy/dto/member/MyCoursesDTO.java new file mode 100644 index 0000000..dfd07b4 --- /dev/null +++ b/src/main/java/com/subsidy/dto/member/MyCoursesDTO.java @@ -0,0 +1,16 @@ +package com.subsidy.dto.member; + +import lombok.Data; + +@Data +public class MyCoursesDTO { + + private Long memberId; + + private Integer status; + + private Integer pageSize; + + private Integer pageNum; + +} diff --git a/src/main/java/com/subsidy/service/MemberService.java b/src/main/java/com/subsidy/service/MemberService.java index e4e3928..73586d4 100644 --- a/src/main/java/com/subsidy/service/MemberService.java +++ b/src/main/java/com/subsidy/service/MemberService.java @@ -6,6 +6,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO; import com.subsidy.dto.member.AddMemberDTO; import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.GetAllDTO; +import com.subsidy.dto.member.MyCoursesDTO; import com.subsidy.dto.member.PasswordLoginDTO; import com.subsidy.dto.member.StudyHistoryDTO; import com.subsidy.model.ExerciseDoneResultDO; @@ -18,6 +19,7 @@ import com.subsidy.vo.member.GetAllVO; import com.subsidy.vo.member.GetStudyInfoVO; import com.subsidy.vo.member.MemberStudyPageVO; import com.subsidy.vo.member.MemberVO; +import com.subsidy.vo.member.MyCoursesVO; import com.subsidy.vo.paper.QueryPapersVO; import java.util.List; @@ -48,6 +50,8 @@ public interface MemberService extends IService { MemberStudyPageVO studyPage(MemberDO memberDO); + IPage myCourses(MyCoursesDTO myCoursesDTO); + ContentVodNewVO contentVod(ContentMemberDTO contentVodDTO); List contentFiles(ContentMemberDTO contentMemberDTO); diff --git a/src/main/java/com/subsidy/service/VodPlayHistoryService.java b/src/main/java/com/subsidy/service/VodPlayHistoryService.java index 7254d54..04830dd 100644 --- a/src/main/java/com/subsidy/service/VodPlayHistoryService.java +++ b/src/main/java/com/subsidy/service/VodPlayHistoryService.java @@ -21,7 +21,5 @@ public interface VodPlayHistoryService extends IService { void dataFix(SignDatePlaysDTO dataFixDTO); - void dataFixTwo(FixDataTwoDTO fixDataTwoDTO); - void signDatePlays(SignDatePlaysDTO dataFixDTO); } diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java index 2b9a6d1..15f6d3f 100644 --- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java @@ -10,6 +10,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO; import com.subsidy.dto.member.AddMemberDTO; import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.GetAllDTO; +import com.subsidy.dto.member.MyCoursesDTO; import com.subsidy.dto.member.PasswordLoginDTO; import com.subsidy.dto.member.StudyHistoryDTO; import com.subsidy.mapper.ClassDictMapper; @@ -47,6 +48,7 @@ import com.subsidy.vo.member.GetAllVO; import com.subsidy.vo.member.GetStudyInfoVO; import com.subsidy.vo.member.MemberStudyPageVO; import com.subsidy.vo.member.MemberVO; +import com.subsidy.vo.member.MyCoursesVO; import com.subsidy.vo.member.StudyPageVO; import com.subsidy.vo.paper.QueryPapersVO; import org.springframework.beans.BeanUtils; @@ -387,6 +389,12 @@ public class MemberServiceImpl extends ServiceImpl imple return new AsyncResult<>(studyPageVO); } + public IPage myCourses(MyCoursesDTO myCoursesDTO){ + + + return null; + } + public ContentVodNewVO contentVod(ContentMemberDTO contentVodDTO) { ContentVodNewVO contentVodNewVO = new ContentVodNewVO(); diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java index a6b67dd..2415615 100644 --- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java @@ -234,83 +234,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl classIds = Arrays.asList(new String[]{fixDataTwoDTO.getClassId()}); - - for (String str : classIds) { - - ClassDictDO classDictDO = classDictMapper.selectById(str); - - //找到班级里的学生 - List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper() - .lambda() - .eq(ClassMemberMappingDO::getClassId, Long.valueOf(str))); - - - //查找课程里的所有视频 - List vodDictDOS = courseContentMapper.getCourseVods(classDictDO.getCourseId()); - - //遍历班级学生 - for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { - - //查询这个人 这节课 签到记录 排序 - List localDateTimes = new ArrayList<>(); - List signInRecordDOS = new ArrayList<>(); - if ("2".equals(fixDataTwoDTO.getStep())) { - signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper() - .lambda() - .eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId()) - .eq(SignInRecordDO::getClassId, str) - .orderByDesc(SignInRecordDO::getSignInDate)); - } else { - signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper() - .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 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) { //班级ids diff --git a/src/main/java/com/subsidy/vo/member/MyCoursesVO.java b/src/main/java/com/subsidy/vo/member/MyCoursesVO.java new file mode 100644 index 0000000..22ca5a9 --- /dev/null +++ b/src/main/java/com/subsidy/vo/member/MyCoursesVO.java @@ -0,0 +1,10 @@ +package com.subsidy.vo.member; + +import lombok.Data; + +@Data +public class MyCoursesVO { + + + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 33a6e52..6a755f2 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ # 环境配置 spring.profiles.active=dev # 端口号 -spring.server.port=23457 +spring.server.port=23460 #嵌入tomcat配置 #和CPU数 spring.server.acceptorThreadCount=600 -- libgit2 0.25.0