|
@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
+import com.zhongzheng.modules.course.mapper.CourseMenuMapper;
|
|
|
import com.zhongzheng.modules.course.vo.CourseChapterVo;
|
|
|
import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
@@ -22,6 +23,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
@@ -39,6 +41,9 @@ public class UserCertificateServiceImpl extends ServiceImpl<UserCertificateMappe
|
|
|
@Autowired
|
|
|
private IClassGradeUserService iClassGradeUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CourseMenuMapper courseMenuMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public UserCertificateVo queryById(Long id){
|
|
|
UserCertificate db = this.baseMapper.selectById(id);
|
|
@@ -80,6 +85,13 @@ public class UserCertificateServiceImpl extends ServiceImpl<UserCertificateMappe
|
|
|
queryBo.setGoodsId(userCertificateVo.getGoodsId());
|
|
|
queryBo.setGradeId(userCertificateVo.getGradeId());
|
|
|
List<CourseChapterVo> chapterList = iClassGradeUserService.findChapterList(queryBo);
|
|
|
+ BigDecimal totalTime = new BigDecimal(0);
|
|
|
+ for(CourseChapterVo chapterVo : chapterList){
|
|
|
+ Long secTotalTime = courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId());
|
|
|
+ chapterVo.setTotalTime(secTotalTime);
|
|
|
+ totalTime=totalTime.add(new BigDecimal(secTotalTime));
|
|
|
+ }
|
|
|
+ userCertificateVo.setClassHours(totalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
|
|
|
userCertificateVo.setChapterList(chapterList);
|
|
|
return userCertificateVo;
|
|
|
}
|