|
|
@@ -26,8 +26,13 @@ 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.bo.CourseMenuQueryBo;
|
|
|
import com.zhongzheng.modules.course.mapper.CourseMenuMapper;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseMenuService;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseModuleService;
|
|
|
import com.zhongzheng.modules.course.vo.CourseChapterVo;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseMenuVo;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseModuleVo;
|
|
|
import com.zhongzheng.modules.course.vo.CourseVo;
|
|
|
import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsCourseService;
|
|
|
@@ -91,6 +96,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
@Autowired
|
|
|
private IGoodsCourseService iGoodsCourseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICourseMenuService iCourseMenuService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICourseModuleService iCourseModuleService;
|
|
|
|
|
|
@Value("${certificate.host}")
|
|
|
private String CERTIFICATE_HOST;
|
|
|
@@ -209,23 +219,30 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
courseQueryBo.setGoodsId(goodsVo.getGoodsId());
|
|
|
List<CourseVo> courseVoList = iGoodsCourseService.selectList(courseQueryBo);
|
|
|
for(CourseVo courseVo : courseVoList){
|
|
|
- bo.setCourseId(courseVo.getCourseId());
|
|
|
- //获取章列表
|
|
|
- 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),BigDecimal.ROUND_HALF_UP));
|
|
|
- List<Long> tpIds = new ArrayList<>();
|
|
|
- tpIds.add(courseVo.getCertificateTpId());
|
|
|
- CertificateTpQueryBo queryBo = new CertificateTpQueryBo();
|
|
|
- queryBo.setTpIds(tpIds);
|
|
|
- queryBo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
|
|
|
- List<CertificateTpVo> list = selectListByBo(queryBo);
|
|
|
-
|
|
|
- for(CertificateTpVo tpVo : list){
|
|
|
- drawCertificate(tpVo,goodsVo,bo,userVo,studyRecordVo,classGradeUser,chapterList,courseVo.getCourseId());
|
|
|
+ CourseMenuQueryBo menuQueryBo = new CourseMenuQueryBo();
|
|
|
+ menuQueryBo.setCourseId(courseVo.getCourseId());
|
|
|
+ menuQueryBo.setType(1);
|
|
|
+ List<CourseMenuVo> menuVoList = iCourseMenuService.queryList(menuQueryBo);
|
|
|
+ for(CourseMenuVo menuVo : menuVoList){
|
|
|
+ bo.setModuleId(menuVo.getMenuId());
|
|
|
+ CourseModuleVo moduleVo = iCourseModuleService.queryById(menuVo.getMenuId());
|
|
|
+ //获取章列表
|
|
|
+ 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),BigDecimal.ROUND_HALF_UP));
|
|
|
+ List<Long> tpIds = new ArrayList<>();
|
|
|
+ tpIds.add(moduleVo.getCertificateTpId());
|
|
|
+ CertificateTpQueryBo queryBo = new CertificateTpQueryBo();
|
|
|
+ queryBo.setTpIds(tpIds);
|
|
|
+ queryBo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
|
|
|
+ List<CertificateTpVo> list = selectListByBo(queryBo);
|
|
|
+
|
|
|
+ for(CertificateTpVo tpVo : list){
|
|
|
+ drawCertificate(tpVo,goodsVo,bo,userVo,studyRecordVo,classGradeUser,chapterList,courseVo.getCourseId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -234,7 +251,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- private void drawCertificate(CertificateTpVo tpVo,GoodsVo goodsVo,ClassGradeUserQueryBo bo,UserVo userVo,UserStudyRecordVo studyRecordVo,ClassGradeUser classGradeUser,List<CourseChapterVo> chapterList,Long courseId){
|
|
|
+ private void drawCertificate(CertificateTpVo tpVo,GoodsVo goodsVo,ClassGradeUserQueryBo bo,UserVo userVo,UserStudyRecordVo studyRecordVo,ClassGradeUser classGradeUser,List<CourseChapterVo> chapterList,Long moduleId){
|
|
|
String nowDate = DateUtils.getDate();
|
|
|
if("certificate01".equals(tpVo.getKeyValue())){
|
|
|
CertificatePhotoVo vo = new CertificatePhotoVo();
|
|
|
@@ -255,7 +272,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
List<String> chapterListTxt = changeChapterList(chapterList);
|
|
|
vo.setChapterList(chapterListTxt);
|
|
|
String ossPath = drawPic(vo);
|
|
|
- UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,courseId);
|
|
|
+ UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
|
|
|
iUserCertificateService.insertByAddBo(addBo);
|
|
|
|
|
|
}
|
|
|
@@ -278,7 +295,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
List<String> chapterListTxt = changeChapterList(chapterList);
|
|
|
vo.setChapterList(chapterListTxt);
|
|
|
String ossPath = drawPic(vo);
|
|
|
- UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,courseId);
|
|
|
+ UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
|
|
|
iUserCertificateService.insertByAddBo(addBo);
|
|
|
|
|
|
}
|
|
|
@@ -309,7 +326,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
List<String> chapterListTxt = changeChapterList(chapterList);
|
|
|
vo.setChapterList(chapterListTxt);
|
|
|
String ossPath =drawPicOneBuild(vo);
|
|
|
- UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,courseId);
|
|
|
+ UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
|
|
|
iUserCertificateService.insertByAddBo(addBo);
|
|
|
}
|
|
|
else if("certificate04".equals(tpVo.getKeyValue())){
|
|
|
@@ -339,7 +356,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
List<String> chapterListTxt = changeChapterList(chapterList);
|
|
|
vo.setChapterList(chapterListTxt);
|
|
|
String ossPath =drawPicOneBuild(vo);
|
|
|
- UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,courseId);
|
|
|
+ UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
|
|
|
iUserCertificateService.insertByAddBo(addBo);
|
|
|
}
|
|
|
else if("certificate05".equals(tpVo.getKeyValue())){
|
|
|
@@ -369,7 +386,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
List<String> chapterListTxt = changeChapterList(chapterList);
|
|
|
vo.setChapterList(chapterListTxt);
|
|
|
String ossPath =drawPicOneBuild(vo);
|
|
|
- UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,courseId);
|
|
|
+ UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
|
|
|
iUserCertificateService.insertByAddBo(addBo);
|
|
|
}
|
|
|
else if("certificate06".equals(tpVo.getKeyValue())){
|
|
|
@@ -399,7 +416,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
List<String> chapterListTxt = changeChapterList(chapterList);
|
|
|
vo.setChapterList(chapterListTxt);
|
|
|
String ossPath =drawPicOneBuild(vo);
|
|
|
- UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,courseId);
|
|
|
+ UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
|
|
|
iUserCertificateService.insertByAddBo(addBo);
|
|
|
}
|
|
|
else if("certificate07".equals(tpVo.getKeyValue())){
|
|
|
@@ -429,7 +446,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
List<String> chapterListTxt = changeChapterList(chapterList);
|
|
|
vo.setChapterList(chapterListTxt);
|
|
|
String ossPath =drawPicOneBuild(vo);
|
|
|
- UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,courseId);
|
|
|
+ UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
|
|
|
iUserCertificateService.insertByAddBo(addBo);
|
|
|
}
|
|
|
else if("certificate08".equals(tpVo.getKeyValue())){
|
|
|
@@ -459,12 +476,12 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
List<String> chapterListTxt = changeChapterList(chapterList);
|
|
|
vo.setChapterList(chapterListTxt);
|
|
|
String ossPath =drawPicOneBuild(vo);
|
|
|
- UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,courseId);
|
|
|
+ UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
|
|
|
iUserCertificateService.insertByAddBo(addBo);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private UserCertificateAddBo mergeData(ClassGradeUserQueryBo bo, GoodsVo goodsVo,CertificatePhotoVo vo,Long certificateTpId,String certificatePath,Long courseId){
|
|
|
+ private UserCertificateAddBo mergeData(ClassGradeUserQueryBo bo, GoodsVo goodsVo,CertificatePhotoVo vo,Long certificateTpId,String certificatePath,Long moduleId){
|
|
|
UserCertificateAddBo addBo = new UserCertificateAddBo();
|
|
|
addBo.setUserId(bo.getUserId());
|
|
|
addBo.setGoodsId(bo.getGoodsId());
|
|
|
@@ -484,7 +501,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
addBo.setTrainEndTime(vo.getTrainEndTime());
|
|
|
addBo.setChapterStr(ArrayUtils.toString(vo.getChapterList(), ","));
|
|
|
addBo.setMoreCertificateStatus(goodsVo.getMoreCertificateStatus());
|
|
|
- addBo.setCourseId(courseId);
|
|
|
+ addBo.setModuleId(moduleId);
|
|
|
return addBo;
|
|
|
}
|
|
|
private String getCertificateCode(){
|