he2802 2 年之前
父节点
当前提交
d093dca368

+ 289 - 240
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java

@@ -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.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.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
@@ -171,259 +176,303 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
                 .eq(ClassGradeUser::getUserId, bo.getUserId())
                 .eq(ObjectUtils.isNotNull(bo.getOrderGoodsId()),ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId())
                 .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),BigDecimal.ROUND_HALF_UP));
         UserVo userVo = iUserService.queryById(bo.getUserId());
-        if(Validator.isNotEmpty(goodsVo.getCertificateTpId())){
-    //        String[] s = goodsVo.getCertificateIds().split(",");
-            List<Long> tpIds = new ArrayList<>();
+        if(Validator.isNotEmpty(goodsVo.getMoreCertificateStatus())&&goodsVo.getMoreCertificateStatus()==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),BigDecimal.ROUND_HALF_UP));
+            if(Validator.isNotEmpty(goodsVo.getCertificateTpId())){
+                //        String[] s = goodsVo.getCertificateIds().split(",");
+                List<Long> tpIds = new ArrayList<>();
            /* for(String each : s) {
                 tpIds.add(Long.valueOf(each));
             }*/
-            tpIds.add(goodsVo.getCertificateTpId());
-            CertificateTpQueryBo queryBo = new CertificateTpQueryBo();
-            queryBo.setTpIds(tpIds);
-            queryBo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
-            List<CertificateTpVo> list = selectListByBo(queryBo);
-            String nowDate = DateUtils.getDate();
-            for(CertificateTpVo tpVo : list){
-                if("certificate01".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYZC"+nowDate.substring(2, 4)+"01"+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("专业");
-                    vo.setMajor("网络班");
-                    vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath = drawPic(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-
-                }
-                else if("certificate02".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYZC"+nowDate.substring(2, 4)+"03"+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath = drawPic(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-
-                }
-                else if("certificate03".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX01YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
-                    }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中必修");
-                    vo.setRemark2("课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-                }
-                else if("certificate04".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
-                    }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中建");
-                    vo.setRemark2("筑工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
+                tpIds.add(goodsVo.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,null);
                 }
-                else if("certificate05".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
-                    }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中机");
-                    vo.setRemark2("电工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-                }
-                else if("certificate06".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
-                    }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中市");
-                    vo.setRemark2("政公用工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-                }
-                else if("certificate07".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
+            }
+        }
+        else if(Validator.isNotEmpty(goodsVo.getMoreCertificateStatus())&&goodsVo.getMoreCertificateStatus()==2){
+            GoodsCourseQueryBo courseQueryBo = new GoodsCourseQueryBo();
+            courseQueryBo.setGoodsId(goodsVo.getGoodsId());
+            List<CourseVo> courseVoList = iGoodsCourseService.selectList(courseQueryBo);
+            for(CourseVo courseVo : courseVoList){
+                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());
+                    bo.setMoreCertificateStatus(goodsVo.getMoreCertificateStatus());
+                    CourseModuleVo moduleVo = iCourseModuleService.queryById(bo.getModuleId());
+                    //获取章列表
+                    List<CourseChapterVo> chapterList =  iClassGradeUserService.findChapterList(bo);
+                    BigDecimal totalTime = new BigDecimal(0);
+                    for(CourseChapterVo chapterVo : chapterList){
+                        totalTime=totalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
                     }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中公");
-                    vo.setRemark2("路工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-                }
-                else if("certificate08".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
+                    goodsVo.setClassHours(totalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
+                    List<Long> tpIds = new ArrayList<>();
+                    if(Validator.isNotEmpty(moduleVo.getCertificateTpId())){
+                        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,bo.getModuleId());
+                        }
                     }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中水");
-                    vo.setRemark2("利水电课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
                 }
             }
+
         }
+
         return null;
     }
 
-    private UserCertificateAddBo mergeData(ClassGradeUserQueryBo bo, GoodsVo goodsVo,CertificatePhotoVo vo,Long certificateTpId,String certificatePath){
+    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();
+            String code = "XYZC"+nowDate.substring(2, 4)+"01"+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("专业");
+            vo.setMajor("网络班");
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath = drawPic(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+
+        }
+        else if("certificate02".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYZC"+nowDate.substring(2, 4)+"03"+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath = drawPic(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+
+        }
+        else if("certificate03".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX01YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中必修");
+            vo.setRemark2("课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate04".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中建");
+            vo.setRemark2("筑工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate05".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中机");
+            vo.setRemark2("电工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate06".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中市");
+            vo.setRemark2("政公用工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate07".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中公");
+            vo.setRemark2("路工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate08".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中水");
+            vo.setRemark2("利水电课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            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 moduleId){
         UserCertificateAddBo addBo = new UserCertificateAddBo();
         addBo.setUserId(bo.getUserId());
         addBo.setGoodsId(bo.getGoodsId());