Commit 0ec73509 by 涂亚平

优化后版本,跑数据脚本

1 parent 57bd5af7
...@@ -3,7 +3,7 @@ package com.subsidy.controller; ...@@ -3,7 +3,7 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData; import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO; import com.subsidy.common.ResponseVO;
import com.subsidy.dto.GetCourseQuestionDTO; import com.subsidy.dto.course.GetCourseQuestionDTO;
import com.subsidy.model.AnsweringQuestionDO; import com.subsidy.model.AnsweringQuestionDO;
import com.subsidy.service.AnsweringQuestionService; import com.subsidy.service.AnsweringQuestionService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
......
...@@ -85,11 +85,14 @@ public class MemberController { ...@@ -85,11 +85,14 @@ public class MemberController {
} }
@PostMapping("studyPage") @PostMapping("studyPage")
@ApiOperation("手机端:学习主页 id 学员id") @ApiOperation("[废弃]手机端:学习主页 id 学员id")
public ResponseVO studyPage(@RequestBody MemberDO memberDO){ public ResponseVO studyPage(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.studyPage(memberDO)); return ResponseData.generateCreatedResponse(0,memberService.studyPage(memberDO));
} }
//@PostMapping("MyCourse")
//@ApiOperation("我的课程")
@PostMapping("contentVod") @PostMapping("contentVod")
@ApiOperation("手机端:目录+视频 courseId 课程 memberId 学员id") @ApiOperation("手机端:目录+视频 courseId 课程 memberId 学员id")
public ResponseVO contentVod(@RequestBody ContentMemberDTO contentVodDTO){ public ResponseVO contentVod(@RequestBody ContentMemberDTO contentVodDTO){
......
...@@ -29,9 +29,8 @@ public class OprMemDictController { ...@@ -29,9 +29,8 @@ public class OprMemDictController {
@Autowired @Autowired
private OprMemDictService oprMemDictService; private OprMemDictService oprMemDictService;
@PostMapping("getHistory") @PostMapping("getHistory")
@ApiOperation("###获取学员审计 {pageSize pageNum userName startDate endDate}") @ApiOperation("获取学员审计 {pageSize pageNum userName startDate endDate}")
public ResponseVO getHistory(@RequestBody GetHistoryDTO getHistoryDTO){ public ResponseVO getHistory(@RequestBody GetHistoryDTO getHistoryDTO){
return ResponseData.generateCreatedResponse(0,oprMemDictService.getHistory(getHistoryDTO)); return ResponseData.generateCreatedResponse(0,oprMemDictService.getHistory(getHistoryDTO));
} }
......
...@@ -4,6 +4,8 @@ package com.subsidy.controller; ...@@ -4,6 +4,8 @@ package com.subsidy.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.subsidy.common.ResponseData; import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO; 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.model.VodPlayHistoryDO;
import com.subsidy.service.VodPlayHistoryService; import com.subsidy.service.VodPlayHistoryService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -44,12 +46,17 @@ public class VodPlayHistoryController { ...@@ -44,12 +46,17 @@ public class VodPlayHistoryController {
} }
@PostMapping("dataFix") @PostMapping("dataFix")
public void dadaFix(){ public void dadaFix(@RequestBody SignDatePlaysDTO dataFixDTO){
vodPlayHistoryService.dataFix(); vodPlayHistoryService.dataFix(dataFixDTO);
} }
@PostMapping("fixDataTwo") @PostMapping("fixDataTwo")
public void dataFixTwo(){ public void dataFixTwo(@RequestBody FixDataTwoDTO fixDataTwoDTO){
vodPlayHistoryService.dataFixTwo(); vodPlayHistoryService.dataFixTwo(fixDataTwoDTO);
}
@PostMapping("signDatePlays")
public void signDatePlays(@RequestBody SignDatePlaysDTO signDatePlaysDTO ){
vodPlayHistoryService.signDatePlays(signDatePlaysDTO);
} }
} }
package com.subsidy.dto; package com.subsidy.dto.course;
import lombok.Data; import lombok.Data;
......
package com.subsidy.dto.vod;
import lombok.Data;
@Data
public class DataFixTwoDTO {
private Integer classId;
}
package com.subsidy.dto.vod;
import lombok.Data;
@Data
public class FixDataTwoDTO {
private String classId;
private String step;
}
package com.subsidy.dto.vod;
import lombok.Data;
@Data
public class SignDatePlaysDTO {
private String classId;
}
...@@ -44,4 +44,6 @@ public class OprMemDictDO { ...@@ -44,4 +44,6 @@ public class OprMemDictDO {
* 创建时间 * 创建时间
*/ */
private String createDate; private String createDate;
private String userName;
} }
package com.subsidy.service; package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.subsidy.model.AnsweringQuestionDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.opr.GetHistoryDTO; import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.model.OprMemDictDO; import com.subsidy.model.OprMemDictDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.mongodb.PageVO;
import com.subsidy.vo.opr.GetHistoryVO; import com.subsidy.vo.opr.GetHistoryVO;
/** /**
...@@ -16,6 +17,6 @@ import com.subsidy.vo.opr.GetHistoryVO; ...@@ -16,6 +17,6 @@ import com.subsidy.vo.opr.GetHistoryVO;
*/ */
public interface OprMemDictService extends IService<OprMemDictDO> { public interface OprMemDictService extends IService<OprMemDictDO> {
IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO); PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
} }
package com.subsidy.service; package com.subsidy.service;
import com.subsidy.dto.vod.SignDatePlaysDTO;
import com.subsidy.dto.vod.FixDataTwoDTO;
import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.model.VodPlayHistoryDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
...@@ -17,7 +19,9 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> { ...@@ -17,7 +19,9 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO); String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO);
void dataFix(); void dataFix(SignDatePlaysDTO dataFixDTO);
void dataFixTwo(); void dataFixTwo(FixDataTwoDTO fixDataTwoDTO);
void signDatePlays(SignDatePlaysDTO dataFixDTO);
} }
...@@ -3,13 +3,12 @@ package com.subsidy.service.impl; ...@@ -3,13 +3,12 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.model.AnsweringQuestionDO;
import com.subsidy.mapper.AnsweringQuestionMapper; import com.subsidy.mapper.AnsweringQuestionMapper;
import com.subsidy.service.AnsweringQuestionService; import com.subsidy.service.AnsweringQuestionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
......
...@@ -235,6 +235,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -235,6 +235,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0); oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
mongoTemplate.insert(oprMemDictDO); mongoTemplate.insert(oprMemDictDO);
...@@ -257,6 +258,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -257,6 +258,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0); oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
mongoTemplate.insert(oprMemDictDO); mongoTemplate.insert(oprMemDictDO);
...@@ -267,6 +269,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -267,6 +269,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
OprMemDictDO oprMemDictDO = new OprMemDictDO(); OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setResult(1); oprMemDictDO.setResult(1);
oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
...@@ -300,6 +303,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -300,6 +303,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1); oprMemDictDO.setResult(1);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
mongoTemplate.insert(oprMemDictDO); mongoTemplate.insert(oprMemDictDO);
...@@ -311,6 +315,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -311,6 +315,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0); oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
mongoTemplate.insert(oprMemDictDO); mongoTemplate.insert(oprMemDictDO);
...@@ -322,6 +327,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -322,6 +327,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0); oprMemDictDO.setResult(0);
oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
mongoTemplate.insert(oprMemDictDO); mongoTemplate.insert(oprMemDictDO);
...@@ -372,11 +378,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -372,11 +378,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
i += completeVodOrNot; i += completeVodOrNot;
} }
studyPageVO.setDoneVods(i); studyPageVO.setDoneVods(i);
//该班级课程下有多少人 ////该班级课程下有多少人
Integer count = classMemberMappingMapper.selectCount(new QueryWrapper<ClassMemberMappingDO>() //Integer count = classMemberMappingMapper.selectCount(new QueryWrapper<ClassMemberMappingDO>()
.lambda() // .lambda()
.eq(ClassMemberMappingDO::getClassId, studyPageVO.getClassId())); // .eq(ClassMemberMappingDO::getClassId, studyPageVO.getClassId()));
studyPageVO.setTotalMember(count); //studyPageVO.setTotalMember(count);
return new AsyncResult<>(studyPageVO); return new AsyncResult<>(studyPageVO);
} }
......
...@@ -3,13 +3,29 @@ package com.subsidy.service.impl; ...@@ -3,13 +3,29 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.opr.GetHistoryDTO; 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.model.OprMemDictDO;
import com.subsidy.mapper.OprMemDictMapper; import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.mongodb.PageVO;
import com.subsidy.service.OprMemDictService; import com.subsidy.service.OprMemDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.MongoUtil;
import com.subsidy.vo.opr.GetHistoryVO; 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 org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/** /**
* <p> * <p>
* 审计表 服务实现类 * 审计表 服务实现类
...@@ -21,10 +37,44 @@ import org.springframework.stereotype.Service; ...@@ -21,10 +37,44 @@ import org.springframework.stereotype.Service;
@Service @Service
public class OprMemDictServiceImpl extends ServiceImpl<OprMemDictMapper, OprMemDictDO> implements OprMemDictService { public class OprMemDictServiceImpl extends ServiceImpl<OprMemDictMapper, OprMemDictDO> implements OprMemDictService {
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private MongoUtil mongoUtil;
@Autowired
private MemberMapper memberMapper;
@Autowired
private CompanyDictMapper companyDictMapper;
public PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO) {
PageVO pageVO = new PageVO();
List<GetHistoryVO> 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<OprMemDictDO> 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<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO){ return pageVO;
Page pager = new Page(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize());
return this.baseMapper.getHistory(pager,getHistoryDTO.getUserName(),getHistoryDTO.getStartDate(),getHistoryDTO.getEndDate());
} }
......
package com.subsidy.service.impl; package com.subsidy.service.impl;
import com.amdelamar.jhash.Hash;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.ClassDictDO;
import com.subsidy.model.ClassMemberMappingDO; import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.model.SignInRecordDO; import com.subsidy.model.SignInRecordDO;
import com.subsidy.model.VodDictDO; import com.subsidy.model.VodDictDO;
import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.VodDictService;
import com.subsidy.service.VodPlayHistoryService; import com.subsidy.service.VodPlayHistoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils; 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.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.util.ArrayList;
import java.util.*; import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Random;
/** /**
* <p> * <p>
...@@ -64,10 +68,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -64,10 +68,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
public void dataFix() { public void dataFix(SignDatePlaysDTO dataFixDTO) {
//班级ids //班级ids
List<String> classIds = Arrays.asList(new String[]{"28"}); List<String> classIds = Arrays.asList(new String[]{dataFixDTO.getClassId()});
for (String str : classIds) { for (String str : classIds) {
...@@ -90,7 +94,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -90,7 +94,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
.lambda() .lambda()
.eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId()) .eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId())
.eq(SignInRecordDO::getClassId, str) .eq(SignInRecordDO::getClassId, str)
.orderByDesc(SignInRecordDO::getSignInDate)); .orderByAsc(SignInRecordDO::getSignInDate));
List<LocalDateTime> localDateTimes = new ArrayList<>(); List<LocalDateTime> localDateTimes = new ArrayList<>();
for (SignInRecordDO signInrecord : signInRecordDOS) { for (SignInRecordDO signInrecord : signInRecordDOS) {
if (signInrecord.getSignInDate().getHour() >= 6 && signInrecord.getSignInDate().getHour() < 15) { if (signInrecord.getSignInDate().getHour() >= 6 && signInrecord.getSignInDate().getHour() < 15) {
...@@ -194,7 +198,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -194,7 +198,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
vodPlayHistoryDO.setPlayDate(localDateTime.plusSeconds(totalPlay)); vodPlayHistoryDO.setPlayDate(localDateTime.plusSeconds(totalPlay));
vodPlayHistoryMapper.insert(vodPlayHistoryDO); vodPlayHistoryMapper.insert(vodPlayHistoryDO);
alreadyPlay++; alreadyPlay++;
}else { } else {
//当天看的最后一个视频 //当天看的最后一个视频
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO(); VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1); vodPlayHistoryDO.setPlayCount(1);
...@@ -230,10 +234,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -230,10 +234,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
} }
} }
public void dataFixTwo() { public void dataFixTwo(FixDataTwoDTO fixDataTwoDTO) {
//班级ids //班级ids
List<String> classIds = Arrays.asList(new String[]{"28"}); List<String> classIds = Arrays.asList(new String[]{fixDataTwoDTO.getClassId()});
for (String str : classIds) { for (String str : classIds) {
...@@ -253,17 +257,27 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -253,17 +257,27 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//查询这个人 这节课 签到记录 排序 //查询这个人 这节课 签到记录 排序
List<LocalDateTime> localDateTimes = new ArrayList<>(); List<LocalDateTime> localDateTimes = new ArrayList<>();
List<SignInRecordDO> signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper<SignInRecordDO>() List<SignInRecordDO> signInRecordDOS = new ArrayList<>();
.lambda() if ("2".equals(fixDataTwoDTO.getStep())) {
.eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId()) signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper<SignInRecordDO>()
.eq(SignInRecordDO::getClassId, str) .lambda()
.orderByDesc(SignInRecordDO::getSignInDate)); .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) { for (SignInRecordDO signInrecord : signInRecordDOS) {
if (signInrecord.getSignInDate().getHour() >= 6 && signInrecord.getSignInDate().getHour() < 15) { if (signInrecord.getSignInDate().getHour() >= 6 && signInrecord.getSignInDate().getHour() < 15) {
localDateTimes.add(signInrecord.getSignInDate()); localDateTimes.add(signInrecord.getSignInDate());
} }
} }
if (localDateTimes.size()>0){ if (localDateTimes.size() > 0) {
LocalDateTime date = localDateTimes.get(0); LocalDateTime date = localDateTimes.get(0);
//查看当天这人已经看的视频时长 //查看当天这人已经看的视频时长
...@@ -274,7 +288,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -274,7 +288,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
for (int m = 0; m < vodPlayHistoryDOS.size(); m++) { for (int m = 0; m < vodPlayHistoryDOS.size(); m++) {
playLength += vodPlayHistoryDOS.get(m).getPlayLength(); playLength += vodPlayHistoryDOS.get(m).getPlayLength();
} }
int playCounts = new Random().nextInt(2) + 1; int playCounts = new Random().nextInt(2);
for (int i = 0; i < playCounts; i++) { for (int i = 0; i < playCounts; i++) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO(); VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
...@@ -297,6 +311,70 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -297,6 +311,70 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
} }
} }
public void signDatePlays(SignDatePlaysDTO signDatePlaysDTO) {
//班级ids
List<String> classIds = Arrays.asList(new String[]{signDatePlaysDTO.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 = signInRecordMapper.selectList(new QueryWrapper<SignInRecordDO>()
.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<VodPlayHistoryDO> 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<VodDictDO> vodDictDOS) { public int severalPlays(Long classId, Long memberId, Long vodId, int playLength, LocalDateTime localDateTime, List<VodDictDO> vodDictDOS) {
Random random = new Random(); Random random = new Random();
......
...@@ -17,5 +17,6 @@ public class MemberStudyPageVO { ...@@ -17,5 +17,6 @@ public class MemberStudyPageVO {
private String img; private String img;
private String logo; //private String logo;
} }
...@@ -11,16 +11,12 @@ public class StudyPageVO { ...@@ -11,16 +11,12 @@ public class StudyPageVO {
private String courseName; private String courseName;
private String endDate; private Integer diffDates;
private Integer totalVods; private Integer totalVods;
private Integer doneVods; private Integer doneVods;
private Integer totalMember; //private String className;
private Integer doneMember;
private String className;
} }
...@@ -50,15 +50,25 @@ ...@@ -50,15 +50,25 @@
t3.vod_length, t3.vod_length,
t3.vod_name, t3.vod_name,
t3.vod_url, t3.vod_url,
floor( t2.play_record * 100 / t3.vod_length ) AS percent, sum( t2.play_length ) AS play_length
IF
( t2.play_record >= t3.vod_length * 0.8, 'true', 'false' ) AS STATUS
FROM FROM
vod_play_history t2 vod_play_history t2
LEFT JOIN vod_dict t3 ON t2.vod_id = t3.id LEFT JOIN vod_dict t3 ON t2.vod_id = t3.id
WHERE WHERE
t2.vod_id IN ( SELECT id FROM vod_dict t WHERE t.content_id = #{contentId} ) t2.delete_date IS NULL
AND t2.member_id = #{memberId} 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>
<select id="contentFiles" parameterType="long" resultType="com.subsidy.model.FileDictDO"> <select id="contentFiles" parameterType="long" resultType="com.subsidy.model.FileDictDO">
......
...@@ -27,37 +27,39 @@ ...@@ -27,37 +27,39 @@
</delete> </delete>
<select id="studyHistory" parameterType="long" resultType="com.subsidy.vo.vod.StudyHistoryVO"> <select id="studyHistory" parameterType="long" resultType="com.subsidy.vo.vod.StudyHistoryVO">
SELECT SELECT
t2.id, t2.id,
t2.vod_length, t2.vod_length,
t2.teacher_name, t2.teacher_name,
t2.vod_url, t2.vod_url,
t2.vod_name, t2.vod_name,
t3.play_record, t3.play_record,
if(round( t3.play_record * 100 / t2.vod_length, 0 )>=80,'true','false') as status, t3.create_date,
t.playDate IF
( t.play_length >= t2.vod_length, 'true', 'false' ) AS STATUS
FROM FROM
( (
SELECT SELECT
t.vod_id, t.vod_id,
t.member_id, t.member_id,
max( t.create_date ) AS playDate sum( t.play_length ) AS play_length
FROM FROM
vod_play_history t vod_play_history t
WHERE WHERE
t.delete_date IS NULL t.delete_date IS NULL
AND t.member_id = #{memberId} AND t.member_id = #{member_id}
GROUP BY GROUP BY
t.vod_id, t.vod_id,
t.member_id t.member_id
) t ) t
LEFT JOIN vod_play_history t3 ON t.playDate = t3.create_date LEFT JOIN vod_play_history t3 ON t.vod_id = t3.vod_id
AND t.vod_id = t3.vod_id
AND t.member_id = t3.member_id AND t.member_id = t3.member_id
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE WHERE
t2.delete_date IS NULL t2.delete_date IS NULL
order by t.playDate desc ORDER BY
t3.create_date DESC
</select> </select>
<select id="getMemberStudyInfo" resultType="com.subsidy.vo.vod.GetMemberStudyInfoVO"> <select id="getMemberStudyInfo" resultType="com.subsidy.vo.vod.GetMemberStudyInfoVO">
...@@ -67,7 +69,7 @@ ...@@ -67,7 +69,7 @@
sum( t.play_length ) as playLength, sum( t.play_length ) as playLength,
sum( sum(
IF IF
( t.play_length > t2.vod_length, t2.vod_length, t.play_length )) AS distinctLength ( t.play_length >= t2.vod_length, t2.vod_length, t.play_length )) AS distinctLength
FROM FROM
vod_play_history t vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
...@@ -113,17 +115,19 @@ ...@@ -113,17 +115,19 @@
</select> </select>
<select id="completeVodOrNot" resultType="integer"> <select id="completeVodOrNot" resultType="integer">
SELECT SELECT
IF t.vod_id,
( max( t.play_record ) >= t2.vod_length*0.8, 1, 0 ) AS count t.member_id,
FROM IF
vod_play_history t ( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS count
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id FROM
WHERE vod_play_history t
t.delete_date is null LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
and t2.delete_date is null WHERE
t.member_id = #{memberId} t.delete_date IS NULL
AND t.vod_id = #{vodId} AND t.member_id = #{memberId}
AND t.vod_id = #{vodId}
</select> </select>
<select id="classStudyHistory" parameterType="long" resultType="com.subsidy.vo.sign.ClassSignInfoVO"> <select id="classStudyHistory" parameterType="long" resultType="com.subsidy.vo.sign.ClassSignInfoVO">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!