|
@@ -193,21 +193,31 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
.eq(ObjectUtils.isNotNull(bo.getOrderGoodsId()),ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId())
|
|
|
.eq(ClassGradeUser::getGradeId,bo.getGradeId()).last("limit 1"));
|
|
|
UserVo userVo = iUserService.queryById(bo.getUserId());
|
|
|
+ if(Validator.isEmpty(userVo.getRealname())){
|
|
|
+ throw new CustomException("生成证书姓名缺失");
|
|
|
+ }
|
|
|
if(Validator.isNotEmpty(goodsVo.getMoreCertificateStatus())&&goodsVo.getMoreCertificateStatus()==1){
|
|
|
//获取章列表
|
|
|
List<CourseChapterVo> chapterList = iClassGradeUserService.findChapterList(bo);
|
|
|
BigDecimal totalTime = new BigDecimal(0);
|
|
|
+ BigDecimal totalClassHour = new BigDecimal(0);
|
|
|
BigDecimal publicTotalTime = new BigDecimal(0);
|
|
|
+ BigDecimal publicClassHour = new BigDecimal(0);
|
|
|
for(CourseChapterVo chapterVo : chapterList){
|
|
|
+ BigDecimal cTime = new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId()));
|
|
|
if(Validator.isEmpty(chapterVo.getCommonSign())||chapterVo.getCommonSign()==0){
|
|
|
- totalTime=totalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
|
|
|
+ totalTime=totalTime.add(cTime);
|
|
|
+ totalClassHour = totalClassHour.add(cTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP).setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
}else if(chapterVo.getCommonSign()==1){
|
|
|
- publicTotalTime=publicTotalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
|
|
|
+ publicTotalTime=publicTotalTime.add(cTime);
|
|
|
+ publicClassHour = publicClassHour.add(cTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP).setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- goodsVo.setClassHours(totalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
|
|
|
- goodsVo.setPublicClassHours(publicTotalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
|
|
|
+ goodsVo.setClassHours(totalClassHour);
|
|
|
+ goodsVo.setPublicClassHours(publicClassHour);
|
|
|
+ /* goodsVo.setClassHours(totalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
|
|
|
+ goodsVo.setPublicClassHours(publicTotalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));*/
|
|
|
if(Validator.isNotEmpty(goodsVo.getCertificateTpId())){
|
|
|
// String[] s = goodsVo.getCertificateIds().split(",");
|
|
|
List<Long> tpIds = new ArrayList<>();
|
|
@@ -241,10 +251,13 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
//获取章列表
|
|
|
List<CourseChapterVo> chapterList = iClassGradeUserService.findChapterList(bo);
|
|
|
BigDecimal totalTime = new BigDecimal(0);
|
|
|
+ BigDecimal totalClassHour = new BigDecimal(0);
|
|
|
for(CourseChapterVo chapterVo : chapterList){
|
|
|
- totalTime=totalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
|
|
|
+ BigDecimal cTime = new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId()));
|
|
|
+ totalTime=totalTime.add(cTime);
|
|
|
+ totalClassHour = totalClassHour.add(cTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP).setScale( 0, BigDecimal.ROUND_HALF_UP ));
|
|
|
}
|
|
|
- goodsVo.setClassHours(totalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
|
|
|
+ goodsVo.setClassHours(totalClassHour);
|
|
|
List<Long> tpIds = new ArrayList<>();
|
|
|
if(Validator.isNotEmpty(moduleVo.getCertificateTpId())){
|
|
|
tpIds.add(moduleVo.getCertificateTpId());
|