he2802 1 년 전
부모
커밋
77bb4cf16f

+ 19 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java

@@ -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());

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseChapterVo.java

@@ -7,6 +7,8 @@ import com.zhongzheng.modules.course.domain.CourseStreamingBusiness;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -85,4 +87,5 @@ public class CourseChapterVo {
 	private Integer commonSign;
 	@ApiModelProperty("节总时间")
 	private Long totalTime;
+
 }