he2802 2 years ago
parent
commit
2aeb3f30e0

+ 283 - 242
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java

@@ -28,6 +28,9 @@ 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.course.vo.CourseVo;
+import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
+import com.zhongzheng.modules.goods.service.IGoodsCourseService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
@@ -85,6 +88,9 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
     @Autowired
     private CourseMenuMapper courseMenuMapper;
 
+    @Autowired
+    private IGoodsCourseService iGoodsCourseService;
+
 
     @Value("${certificate.host}")
     private String CERTIFICATE_HOST;
@@ -161,7 +167,6 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
             throw new CustomException("数据错误");
         }
         GoodsVo goodsVo = iGoodsService.selectDetail(bo.getGoodsId());
-
         //获取培训开始时间
         UserStudyRecordQueryBo studyRecordQueryBo = new UserStudyRecordQueryBo();
         studyRecordQueryBo.setUserId(bo.getUserId());
@@ -173,259 +178,293 @@ 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);
+                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("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);
-                }
-                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 = "女";
-                    }
-                    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(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){
+                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())));
                 }
-                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);
-                    iUserCertificateService.insertByAddBo(addBo);
+                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());
                 }
             }
+
         }
+
         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 courseId){
+        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,courseId);
+            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,courseId);
+            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,courseId);
+            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,courseId);
+            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,courseId);
+            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,courseId);
+            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,courseId);
+            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,courseId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+    }
+
+    private UserCertificateAddBo mergeData(ClassGradeUserQueryBo bo, GoodsVo goodsVo,CertificatePhotoVo vo,Long certificateTpId,String certificatePath,Long courseId){
         UserCertificateAddBo addBo = new UserCertificateAddBo();
         addBo.setUserId(bo.getUserId());
         addBo.setGoodsId(bo.getGoodsId());
@@ -444,6 +483,8 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
         addBo.setTrainStartTime(vo.getTrainStartTime());
         addBo.setTrainEndTime(vo.getTrainEndTime());
         addBo.setChapterStr(ArrayUtils.toString(vo.getChapterList(), ","));
+        addBo.setMoreCertificateStatus(goodsVo.getMoreCertificateStatus());
+        addBo.setCourseId(courseId);
         return addBo;
     }
     private String getCertificateCode(){

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserCertificateAddBo.java

@@ -79,4 +79,10 @@ public class UserCertificateAddBo {
     /** 章名,拼接 */
     @ApiModelProperty("章名,拼接")
     private String chapterStr;
+    /** 课程id */
+    @ApiModelProperty("课程id")
+    private Long courseId;
+    /** 1单证书 2多证书 */
+    @ApiModelProperty("1单证书 2多证书")
+    private Integer moreCertificateStatus;
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserCertificateEditBo.java

@@ -88,4 +88,10 @@ public class UserCertificateEditBo {
     /** 章名,拼接 */
     @ApiModelProperty("章名,拼接")
     private String chapterStr;
+    /** 课程id */
+    @ApiModelProperty("课程id")
+    private Long courseId;
+    /** 1单证书 2多证书 */
+    @ApiModelProperty("1单证书 2多证书")
+    private Integer moreCertificateStatus;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserCertificate.java

@@ -66,4 +66,8 @@ private static final long serialVersionUID=1L;
     private String pushDate;
     /** 章名,拼接 */
     private String chapterStr;
+    /** 课程id */
+    private Long courseId;
+    /** 1单证书 2多证书 */
+    private Integer moreCertificateStatus;
 }