|
@@ -169,6 +169,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
|
|
|
lqw.eq(bo.getModuleId() != null, UserStudyRecord::getModuleId, bo.getModuleId());
|
|
|
lqw.eq(bo.getChapterId() != null, UserStudyRecord::getChapterId, bo.getChapterId());
|
|
|
lqw.eq(bo.getGradeId() != null, UserStudyRecord::getGradeId, bo.getGradeId());
|
|
|
+ lqw.eq(bo.getOrderGoodsId() != null, UserStudyRecord::getOrderGoodsId, bo.getOrderGoodsId());
|
|
|
lqw.eq( UserStudyRecord::getCurrentStatus, 1);
|
|
|
lqw.orderByDesc(UserStudyRecord::getRecordId);
|
|
|
UserStudyRecord last = this.getOne(lqw.last("limit 1"));
|
|
@@ -178,6 +179,23 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
|
|
|
return BeanUtil.toBean(last, UserStudyRecordVo.class);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public UserStudyRecordVo queryLiveLast(UserStudyRecordQueryBo bo) {
|
|
|
+ LambdaQueryWrapper<UserStudyRecord> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(bo.getUserId() != null, UserStudyRecord::getUserId, bo.getUserId());
|
|
|
+ lqw.eq(bo.getCourseId() != null, UserStudyRecord::getCourseId, bo.getCourseId());
|
|
|
+ lqw.eq(bo.getSectionId() != null, UserStudyRecord::getSectionId, bo.getSectionId());
|
|
|
+ lqw.eq(bo.getGoodsId() != null, UserStudyRecord::getGoodsId, bo.getGoodsId());
|
|
|
+ lqw.eq(bo.getModuleId() != null, UserStudyRecord::getModuleId, bo.getModuleId());
|
|
|
+ lqw.eq(bo.getChapterId() != null, UserStudyRecord::getChapterId, bo.getChapterId());
|
|
|
+ lqw.eq(bo.getGradeId() != null, UserStudyRecord::getGradeId, bo.getGradeId());
|
|
|
+ lqw.eq(bo.getOrderGoodsId() != null, UserStudyRecord::getOrderGoodsId, bo.getOrderGoodsId());
|
|
|
+ lqw.eq( UserStudyRecord::getCurrentStatus, 1);
|
|
|
+ lqw.orderByDesc(UserStudyRecord::getRecordId);
|
|
|
+ UserStudyRecord last = this.getOne(lqw.last("limit 1"));
|
|
|
+ return BeanUtil.toBean(last, UserStudyRecordVo.class);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Boolean delUserCourseHistory(Long userId, Long goodsId, Long gradeId,Long orderGoodsId) {
|
|
|
//删除看视频历史历史
|
|
@@ -822,6 +840,52 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<GoodsStudyRecordVo> queryLiveGoods(UserQueryBo bo) {
|
|
|
+ //查询学员拥有商品
|
|
|
+ List<GoodsStudyRecordVo> list = baseMapper.queryLiveGoods(bo);
|
|
|
+
|
|
|
+ for (GoodsStudyRecordVo goodsStudyRecordVo : list) {
|
|
|
+ Long secLong = 0L;
|
|
|
+ Long studyLong = 0L;
|
|
|
+ //查询学习记录
|
|
|
+ SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
|
|
|
+ subjectStudyRecordQueryBo.setGoodsId(goodsStudyRecordVo.getGoodsId());
|
|
|
+ subjectStudyRecordQueryBo.setUserId(goodsStudyRecordVo.getUserId());
|
|
|
+ subjectStudyRecordQueryBo.setOrderGoodsId(goodsStudyRecordVo.getOrderGoodsId());
|
|
|
+ List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
|
|
|
+
|
|
|
+ for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
|
|
|
+ String sectionType = "";
|
|
|
+ secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
|
|
|
+ studyLong = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordNum().toString())).longValue();
|
|
|
+ //节里面有什么类型
|
|
|
+ if (CollectionUtils.isNotEmpty(baseMapper.sectionType(subjectStudyRecordVo.getCourseId(), 1L))) {
|
|
|
+ sectionType = sectionType.concat("1,");
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(baseMapper.sectionType(subjectStudyRecordVo.getCourseId(), 2L))) {
|
|
|
+ sectionType = sectionType.concat("2,");
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(baseMapper.sectionType(subjectStudyRecordVo.getCourseId(), 3L))) {
|
|
|
+ sectionType = sectionType.concat("3,");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(sectionType)) {
|
|
|
+ subjectStudyRecordVo.setSectionType(sectionType.substring(0, sectionType.length() - 1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BigDecimal divide = new BigDecimal("0");
|
|
|
+ if (secLong != 0) {
|
|
|
+ divide = new BigDecimal(studyLong.toString()).divide(new BigDecimal(secLong.toString()), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ goodsStudyRecordVo.setStudyNum(divide.multiply(new BigDecimal("100")).longValue());
|
|
|
+ goodsStudyRecordVo.setSubjectStudyRecordVos(subjectStudyRecordVos);
|
|
|
+ goodsStudyRecordVo.setSecAllNum(secLong);
|
|
|
+ goodsStudyRecordVo.setStuAllNum(studyLong);
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<SubjectStudyRecordVo> listSubject(SubjectStudyRecordQueryBo bo) {
|
|
|
List<SubjectStudyRecordVo> subjectStudyRecordVos = baseMapper.listSubject(bo);
|