he2802 2 년 전
부모
커밋
1034637b3e
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java

@@ -26,6 +26,7 @@ import com.zhongzheng.modules.base.mapper.CertificateTpMapper;
 import com.zhongzheng.modules.base.service.ICertificateTpService;
 import com.zhongzheng.modules.base.vo.CertificatePhotoVo;
 import com.zhongzheng.modules.base.vo.CertificateTpVo;
+import com.zhongzheng.modules.course.mapper.CourseMenuMapper;
 import com.zhongzheng.modules.course.vo.CourseChapterVo;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
@@ -81,6 +82,8 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
     @Autowired
     private RedisCache redisCache;
 
+    @Autowired
+    private CourseMenuMapper courseMenuMapper;
 
     @Value("${certificate.host}")
     private String CERTIFICATE_HOST;
@@ -170,6 +173,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
                 .eq(ClassGradeUser::getGradeId,bo.getGradeId()).last("limit 1"));
         //获取章列表
         List<CourseChapterVo> chapterList =  iClassGradeUserService.findChapterList(bo);
+        BigDecimal totalTime = new BigDecimal(0);
+        for(CourseChapterVo chapterVo : chapterList){
+            totalTime=totalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
+        }
+        goodsVo.setClassHours(totalTime.divide(new BigDecimal(45*60)));
         UserVo userVo = iUserService.queryById(bo.getUserId());
         if(Validator.isNotEmpty(goodsVo.getCertificateTpId())){
     //        String[] s = goodsVo.getCertificateIds().split(",");