diff --git a/src/main/java/com/subsidy/controller/AnsweringQuestionController.java b/src/main/java/com/subsidy/controller/AnsweringQuestionController.java index 3f4dad2..06ce356 100644 --- a/src/main/java/com/subsidy/controller/AnsweringQuestionController.java +++ b/src/main/java/com/subsidy/controller/AnsweringQuestionController.java @@ -3,7 +3,7 @@ package com.subsidy.controller; import com.subsidy.common.ResponseData; import com.subsidy.common.ResponseVO; -import com.subsidy.dto.GetCourseQuestionDTO; +import com.subsidy.dto.course.GetCourseQuestionDTO; import com.subsidy.model.AnsweringQuestionDO; import com.subsidy.service.AnsweringQuestionService; import io.swagger.annotations.Api; diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java index d18538f..2a5559a 100644 --- a/src/main/java/com/subsidy/controller/MemberController.java +++ b/src/main/java/com/subsidy/controller/MemberController.java @@ -85,11 +85,14 @@ public class MemberController { } @PostMapping("studyPage") - @ApiOperation("手机端:学习主页 id 学员id") + @ApiOperation("[废弃]手机端:学习主页 id 学员id") public ResponseVO studyPage(@RequestBody MemberDO memberDO){ return ResponseData.generateCreatedResponse(0,memberService.studyPage(memberDO)); } + //@PostMapping("MyCourse") + //@ApiOperation("我的课程") + @PostMapping("contentVod") @ApiOperation("手机端:目录+视频 courseId 课程 memberId 学员id") public ResponseVO contentVod(@RequestBody ContentMemberDTO contentVodDTO){ diff --git a/src/main/java/com/subsidy/controller/OprMemDictController.java b/src/main/java/com/subsidy/controller/OprMemDictController.java index 45aa443..e942f74 100644 --- a/src/main/java/com/subsidy/controller/OprMemDictController.java +++ b/src/main/java/com/subsidy/controller/OprMemDictController.java @@ -29,9 +29,8 @@ public class OprMemDictController { @Autowired private OprMemDictService oprMemDictService; - @PostMapping("getHistory") - @ApiOperation("###获取学员审计 {pageSize pageNum userName startDate endDate}") + @ApiOperation("获取学员审计 {pageSize pageNum userName startDate endDate}") public ResponseVO getHistory(@RequestBody GetHistoryDTO getHistoryDTO){ return ResponseData.generateCreatedResponse(0,oprMemDictService.getHistory(getHistoryDTO)); } diff --git a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java index f3f62a8..0906af8 100644 --- a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java +++ b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java @@ -4,6 +4,8 @@ package com.subsidy.controller; import com.alibaba.fastjson.JSON; import com.subsidy.common.ResponseData; import com.subsidy.common.ResponseVO; +import com.subsidy.dto.vod.SignDatePlaysDTO; +import com.subsidy.dto.vod.FixDataTwoDTO; import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.service.VodPlayHistoryService; import io.swagger.annotations.Api; @@ -44,12 +46,17 @@ public class VodPlayHistoryController { } @PostMapping("dataFix") - public void dadaFix(){ - vodPlayHistoryService.dataFix(); + public void dadaFix(@RequestBody SignDatePlaysDTO dataFixDTO){ + vodPlayHistoryService.dataFix(dataFixDTO); } @PostMapping("fixDataTwo") - public void dataFixTwo(){ - vodPlayHistoryService.dataFixTwo(); + 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/GetCourseQuestionDTO.java b/src/main/java/com/subsidy/dto/course/GetCourseQuestionDTO.java similarity index 88% rename from src/main/java/com/subsidy/dto/GetCourseQuestionDTO.java rename to src/main/java/com/subsidy/dto/course/GetCourseQuestionDTO.java index e544f88..0e4a22a 100644 --- a/src/main/java/com/subsidy/dto/GetCourseQuestionDTO.java +++ b/src/main/java/com/subsidy/dto/course/GetCourseQuestionDTO.java @@ -1,4 +1,4 @@ -package com.subsidy.dto; +package com.subsidy.dto.course; import lombok.Data; diff --git a/src/main/java/com/subsidy/dto/vod/DataFixTwoDTO.java b/src/main/java/com/subsidy/dto/vod/DataFixTwoDTO.java new file mode 100644 index 0000000..5732f9e --- /dev/null +++ b/src/main/java/com/subsidy/dto/vod/DataFixTwoDTO.java @@ -0,0 +1,10 @@ +package com.subsidy.dto.vod; + +import lombok.Data; + +@Data +public class DataFixTwoDTO { + + private Integer classId; + +} diff --git a/src/main/java/com/subsidy/dto/vod/FixDataTwoDTO.java b/src/main/java/com/subsidy/dto/vod/FixDataTwoDTO.java new file mode 100644 index 0000000..c1cbafd --- /dev/null +++ b/src/main/java/com/subsidy/dto/vod/FixDataTwoDTO.java @@ -0,0 +1,12 @@ +package com.subsidy.dto.vod; + +import lombok.Data; + +@Data +public class FixDataTwoDTO { + + private String classId; + + private String step; + +} diff --git a/src/main/java/com/subsidy/dto/vod/SignDatePlaysDTO.java b/src/main/java/com/subsidy/dto/vod/SignDatePlaysDTO.java new file mode 100644 index 0000000..1e26c85 --- /dev/null +++ b/src/main/java/com/subsidy/dto/vod/SignDatePlaysDTO.java @@ -0,0 +1,10 @@ +package com.subsidy.dto.vod; + +import lombok.Data; + +@Data +public class SignDatePlaysDTO { + + private String classId; + +} diff --git a/src/main/java/com/subsidy/model/OprMemDictDO.java b/src/main/java/com/subsidy/model/OprMemDictDO.java index 5622567..3bbc3a7 100644 --- a/src/main/java/com/subsidy/model/OprMemDictDO.java +++ b/src/main/java/com/subsidy/model/OprMemDictDO.java @@ -44,4 +44,6 @@ public class OprMemDictDO { * 创建时间 */ private String createDate; + + private String userName; } diff --git a/src/main/java/com/subsidy/service/AnsweringQuestionService.java b/src/main/java/com/subsidy/service/AnsweringQuestionService.java index d4c3eb2..5bd489f 100644 --- a/src/main/java/com/subsidy/service/AnsweringQuestionService.java +++ b/src/main/java/com/subsidy/service/AnsweringQuestionService.java @@ -1,7 +1,7 @@ package com.subsidy.service; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.subsidy.dto.GetCourseQuestionDTO; +import com.subsidy.dto.course.GetCourseQuestionDTO; import com.subsidy.model.AnsweringQuestionDO; import com.baomidou.mybatisplus.extension.service.IService; diff --git a/src/main/java/com/subsidy/service/OprMemDictService.java b/src/main/java/com/subsidy/service/OprMemDictService.java index 294ac35..bd433b9 100644 --- a/src/main/java/com/subsidy/service/OprMemDictService.java +++ b/src/main/java/com/subsidy/service/OprMemDictService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.subsidy.dto.opr.GetHistoryDTO; import com.subsidy.model.OprMemDictDO; import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.mongodb.PageVO; import com.subsidy.vo.opr.GetHistoryVO; /** @@ -16,6 +17,6 @@ import com.subsidy.vo.opr.GetHistoryVO; */ public interface OprMemDictService extends IService { - IPage getHistory(GetHistoryDTO getHistoryDTO); + PageVO getHistory(GetHistoryDTO getHistoryDTO); } diff --git a/src/main/java/com/subsidy/service/VodPlayHistoryService.java b/src/main/java/com/subsidy/service/VodPlayHistoryService.java index 8afbe47..7254d54 100644 --- a/src/main/java/com/subsidy/service/VodPlayHistoryService.java +++ b/src/main/java/com/subsidy/service/VodPlayHistoryService.java @@ -1,5 +1,7 @@ package com.subsidy.service; +import com.subsidy.dto.vod.SignDatePlaysDTO; +import com.subsidy.dto.vod.FixDataTwoDTO; import com.subsidy.model.VodPlayHistoryDO; import com.baomidou.mybatisplus.extension.service.IService; @@ -17,7 +19,9 @@ public interface VodPlayHistoryService extends IService { String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO); - void dataFix(); + void dataFix(SignDatePlaysDTO dataFixDTO); - void dataFixTwo(); + void dataFixTwo(FixDataTwoDTO fixDataTwoDTO); + + void signDatePlays(SignDatePlaysDTO dataFixDTO); } diff --git a/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java b/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java index 3eaba90..ed62496 100644 --- a/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java @@ -3,13 +3,12 @@ package com.subsidy.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.subsidy.dto.GetCourseQuestionDTO; +import com.subsidy.dto.course.GetCourseQuestionDTO; import com.subsidy.model.AnsweringQuestionDO; import com.subsidy.mapper.AnsweringQuestionMapper; import com.subsidy.service.AnsweringQuestionService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.subsidy.util.ConstantUtils; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; /** diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java index 3e13508..2b9a6d1 100644 --- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java @@ -235,6 +235,7 @@ public class MemberServiceImpl extends ServiceImpl imple oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); oprMemDictDO.setResult(0); + oprMemDictDO.setUserName(memberDO.getUserName()); oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); mongoTemplate.insert(oprMemDictDO); @@ -257,6 +258,7 @@ public class MemberServiceImpl extends ServiceImpl imple oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); oprMemDictDO.setResult(0); + oprMemDictDO.setUserName(memberDO.getUserName()); oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); mongoTemplate.insert(oprMemDictDO); @@ -267,6 +269,7 @@ public class MemberServiceImpl extends ServiceImpl imple OprMemDictDO oprMemDictDO = new OprMemDictDO(); oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); + oprMemDictDO.setUserName(memberDO.getUserName()); oprMemDictDO.setResult(1); oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); @@ -300,6 +303,7 @@ public class MemberServiceImpl extends ServiceImpl imple oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); oprMemDictDO.setResult(1); + oprMemDictDO.setUserName(memberDO.getUserName()); oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); mongoTemplate.insert(oprMemDictDO); @@ -311,6 +315,7 @@ public class MemberServiceImpl extends ServiceImpl imple oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); oprMemDictDO.setResult(0); + oprMemDictDO.setUserName(memberDO.getUserName()); oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); mongoTemplate.insert(oprMemDictDO); @@ -322,6 +327,7 @@ public class MemberServiceImpl extends ServiceImpl imple oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); oprMemDictDO.setResult(0); + oprMemDictDO.setUserName(memberDO.getUserName()); oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); mongoTemplate.insert(oprMemDictDO); @@ -372,11 +378,11 @@ public class MemberServiceImpl extends ServiceImpl imple i += completeVodOrNot; } studyPageVO.setDoneVods(i); - //该班级课程下有多少人 - Integer count = classMemberMappingMapper.selectCount(new QueryWrapper() - .lambda() - .eq(ClassMemberMappingDO::getClassId, studyPageVO.getClassId())); - studyPageVO.setTotalMember(count); + ////该班级课程下有多少人 + //Integer count = classMemberMappingMapper.selectCount(new QueryWrapper() + // .lambda() + // .eq(ClassMemberMappingDO::getClassId, studyPageVO.getClassId())); + //studyPageVO.setTotalMember(count); return new AsyncResult<>(studyPageVO); } diff --git a/src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java index b41bfcb..081f701 100644 --- a/src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java @@ -3,13 +3,29 @@ package com.subsidy.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.subsidy.dto.opr.GetHistoryDTO; +import com.subsidy.mapper.CompanyDictMapper; +import com.subsidy.mapper.MemberMapper; +import com.subsidy.model.AdministerDO; +import com.subsidy.model.CompanyDictDO; +import com.subsidy.model.MemberDO; import com.subsidy.model.OprMemDictDO; import com.subsidy.mapper.OprMemDictMapper; +import com.subsidy.mongodb.OprAdmDictDO; +import com.subsidy.mongodb.PageVO; import com.subsidy.service.OprMemDictService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.MongoUtil; import com.subsidy.vo.opr.GetHistoryVO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; + /** *

* 审计表 服务实现类 @@ -21,10 +37,44 @@ import org.springframework.stereotype.Service; @Service public class OprMemDictServiceImpl extends ServiceImpl implements OprMemDictService { + @Autowired + private MongoTemplate mongoTemplate; + + @Autowired + private MongoUtil mongoUtil; + + @Autowired + private MemberMapper memberMapper; + + @Autowired + private CompanyDictMapper companyDictMapper; + + public PageVO getHistory(GetHistoryDTO getHistoryDTO) { + + PageVO pageVO = new PageVO(); + + List getHistoryVOS = new ArrayList<>(); + + //可累加条件 + Query query = new Query(Criteria.where("userName").regex(getHistoryDTO.getUserName()) + .andOperator(Criteria.where("loginDateFormat").gte(getHistoryDTO.getStartDate()), + Criteria.where("loginDateFormat").lte(getHistoryDTO.getEndDate()))); + Long count = mongoTemplate.count(query, OprMemDictDO.class); + mongoUtil.start(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize(), query); + List oprMemDictDOS = mongoTemplate.find(query, OprMemDictDO.class); + for (OprMemDictDO oprMemDictDO : oprMemDictDOS) { + MemberDO memberDO = memberMapper.selectById(oprMemDictDO.getUserId()); + CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId()); + GetHistoryVO getHistoryVO = new GetHistoryVO(); + BeanUtils.copyProperties(oprMemDictDO, getHistoryVO); + getHistoryVO.setCompanyName(companyDictDO.getCompanyName()); + getHistoryVO.setUserName(memberDO.getUserName()); + getHistoryVOS.add(getHistoryVO); + } + pageVO.setRecords(getHistoryVOS); + pageVO.setTotal(count); - public IPage getHistory(GetHistoryDTO getHistoryDTO){ - Page pager = new Page(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize()); - return this.baseMapper.getHistory(pager,getHistoryDTO.getUserName(),getHistoryDTO.getStartDate(),getHistoryDTO.getEndDate()); + return pageVO; } diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java index f83d3d6..a6b67dd 100644 --- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java @@ -1,27 +1,31 @@ package com.subsidy.service.impl; -import com.amdelamar.jhash.Hash; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.subsidy.mapper.*; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.dto.vod.FixDataTwoDTO; +import com.subsidy.dto.vod.SignDatePlaysDTO; +import com.subsidy.mapper.ClassDictMapper; +import com.subsidy.mapper.ClassMemberMappingMapper; +import com.subsidy.mapper.CourseContentMapper; +import com.subsidy.mapper.SignInRecordMapper; +import com.subsidy.mapper.VodDictMapper; +import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassMemberMappingDO; import com.subsidy.model.SignInRecordDO; import com.subsidy.model.VodDictDO; import com.subsidy.model.VodPlayHistoryDO; -import com.subsidy.service.VodDictService; import com.subsidy.service.VodPlayHistoryService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.subsidy.util.ConstantUtils; -import com.subsidy.util.DateFormatUtil; -import com.subsidy.util.MathUtil; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import java.time.LocalDate; import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Random; /** *

@@ -64,10 +68,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl classIds = Arrays.asList(new String[]{"28"}); + List classIds = Arrays.asList(new String[]{dataFixDTO.getClassId()}); for (String str : classIds) { @@ -90,7 +94,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl localDateTimes = new ArrayList<>(); for (SignInRecordDO signInrecord : signInRecordDOS) { if (signInrecord.getSignInDate().getHour() >= 6 && signInrecord.getSignInDate().getHour() < 15) { @@ -194,7 +198,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl classIds = Arrays.asList(new String[]{"28"}); + List classIds = Arrays.asList(new String[]{fixDataTwoDTO.getClassId()}); for (String str : classIds) { @@ -253,17 +257,27 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl localDateTimes = new ArrayList<>(); - List signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper() - .lambda() - .eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId()) - .eq(SignInRecordDO::getClassId, str) - .orderByDesc(SignInRecordDO::getSignInDate)); + 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){ + if (localDateTimes.size() > 0) { LocalDateTime date = localDateTimes.get(0); //查看当天这人已经看的视频时长 @@ -274,7 +288,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl classIds = Arrays.asList(new String[]{signDatePlaysDTO.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 = signInRecordMapper.selectList(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId()) + .eq(SignInRecordDO::getClassId, str)); + + for (SignInRecordDO signInrecord : signInRecordDOS) { + localDateTimes.add(signInrecord.getSignInDate()); + } + if (localDateTimes.size() > 0) { + for (LocalDateTime localDateTime : localDateTimes) { + + //查看当天这人已经看的视频时长 + List vodPlayHistoryDOS = vodPlayHistoryMapper.exPlayInfo(classMemberMappingDO.getMemberId(), str, localDateTime); + + 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(localDateTime.plusSeconds(playLength)); + vodPlayHistoryMapper.insert(vodPlayHistoryDO); + } + } + } + } + } + } + public int severalPlays(Long classId, Long memberId, Long vodId, int playLength, LocalDateTime localDateTime, List vodDictDOS) { Random random = new Random(); diff --git a/src/main/java/com/subsidy/vo/member/MemberStudyPageVO.java b/src/main/java/com/subsidy/vo/member/MemberStudyPageVO.java index f9730e3..ea7e975 100644 --- a/src/main/java/com/subsidy/vo/member/MemberStudyPageVO.java +++ b/src/main/java/com/subsidy/vo/member/MemberStudyPageVO.java @@ -17,5 +17,6 @@ public class MemberStudyPageVO { private String img; - private String logo; + //private String logo; + } diff --git a/src/main/java/com/subsidy/vo/member/StudyPageVO.java b/src/main/java/com/subsidy/vo/member/StudyPageVO.java index 6c06e4b..154c85a 100644 --- a/src/main/java/com/subsidy/vo/member/StudyPageVO.java +++ b/src/main/java/com/subsidy/vo/member/StudyPageVO.java @@ -11,16 +11,12 @@ public class StudyPageVO { private String courseName; - private String endDate; + private Integer diffDates; private Integer totalVods; private Integer doneVods; - private Integer totalMember; - - private Integer doneMember; - - private String className; + //private String className; } diff --git a/src/main/resources/mapper/CourseContentMapper.xml b/src/main/resources/mapper/CourseContentMapper.xml index 1b62f54..03921b6 100644 --- a/src/main/resources/mapper/CourseContentMapper.xml +++ b/src/main/resources/mapper/CourseContentMapper.xml @@ -50,15 +50,25 @@ t3.vod_length, t3.vod_name, t3.vod_url, - floor( t2.play_record * 100 / t3.vod_length ) AS percent, - IF - ( t2.play_record >= t3.vod_length * 0.8, 'true', 'false' ) AS STATUS + sum( t2.play_length ) AS play_length FROM vod_play_history t2 LEFT JOIN vod_dict t3 ON t2.vod_id = t3.id WHERE - t2.vod_id IN ( SELECT id FROM vod_dict t WHERE t.content_id = #{contentId} ) - AND t2.member_id = #{memberId} + t2.delete_date IS NULL + AND t3.delete_date IS NULL + AND t2.vod_id IN ( + SELECT + id + FROM + vod_dict t + WHERE + t.content_id = #{contentId} ) + AND t2.member_id = #{memberId} + GROUP BY + t3.id, + t3.vod_name, + t2.member_id - SELECT + SELECT t2.id, t2.vod_length, t2.teacher_name, t2.vod_url, t2.vod_name, t3.play_record, - if(round( t3.play_record * 100 / t2.vod_length, 0 )>=80,'true','false') as status, - t.playDate + t3.create_date, + IF + ( t.play_length >= t2.vod_length, 'true', 'false' ) AS STATUS FROM ( SELECT t.vod_id, t.member_id, - max( t.create_date ) AS playDate + sum( t.play_length ) AS play_length FROM vod_play_history t WHERE t.delete_date IS NULL - AND t.member_id = #{memberId} + AND t.member_id = #{member_id} + GROUP BY t.vod_id, t.member_id ) t - LEFT JOIN vod_play_history t3 ON t.playDate = t3.create_date - AND t.vod_id = t3.vod_id + LEFT JOIN vod_play_history t3 ON t.vod_id = t3.vod_id AND t.member_id = t3.member_id LEFT JOIN vod_dict t2 ON t.vod_id = t2.id WHERE t2.delete_date IS NULL - order by t.playDate desc + ORDER BY + t3.create_date DESC