he2802 2 лет назад
Родитель
Сommit
56411d725b

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/domain/ExamApply.java

@@ -63,6 +63,8 @@ private static final long serialVersionUID=1L;
     private Integer applyNature;
     /** 专场学员资料地址 */
     private String natureUrl;
+    /** 关联code(公用祥粤考场) */
+    private String relCode;
 
     private Long tenantId;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamApplyMapper.java

@@ -97,4 +97,7 @@ public interface ExamApplyMapper extends BaseMapper<ExamApply> {
 
     @InterceptorIgnore(tenantLine = "true")
     ExamApply getEntityById(Long applyId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    String getExamRelCodeNotTenant(@Param("applyName") String applyName);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamApplyService.java

@@ -101,4 +101,7 @@ public interface IExamApplyService extends IService<ExamApply> {
     void updateExamUserProfile(MultipartFile file);
 
 	String examUserProfileExport(UserProfileQueryBo bo);
+
+    String getExamRelCodeNotTenant(String applyName);
+
 }

+ 15 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -631,6 +631,16 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         add.setCode(ServletUtils.getEncoded("KSAP"));
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
+        add.setRelCode(ServletUtils.getEncoded("SHEX"));
+        //是否公用祥粤考场
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        SysTenant sysTenant = sysTenantService.getById(Long.valueOf(tenantId));
+        if (ObjectUtils.isNotNull(sysTenant.getExamRoom()) && sysTenant.getExamRoom() == 1){
+            String code = baseMapper.getExamRelCodeNotTenant(add.getApplyName());
+            if (net.polyv.common.v1.util.StringUtils.isNotEmpty(code)){
+                add.setRelCode(code);
+            }
+        }
         this.save(add);
         if (CollectionUtils.isNotEmpty(bo.getApplyUsers())) {
             //专场预约学员
@@ -1219,6 +1229,11 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         return content;
     }
 
+    @Override
+    public String getExamRelCodeNotTenant(String applyName) {
+        return baseMapper.getExamRelCodeNotTenant(applyName);
+    }
+
     //生成承诺书
     private void generateCommitment(String keyValue,String toPath,String idCard,String major)throws IOException {
         int imgIndex=(int)(Math.random() * 10 );

+ 184 - 197
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -266,7 +266,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
 
         //企业ID
         String tenant = ServletUtils.getRequest().getHeader("TenantId");
-//        SysTenant sysTenant = sysTenantService.getById(Long.valueOf(tenant));
+        SysTenant sysTenant = sysTenantService.getById(Long.valueOf(tenant));
         SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
                 .eq(SysOldOrg::getTenantId, tenant)
                 .last("limit 1")).stream().findFirst().orElse(null);
@@ -313,111 +313,111 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 String sevenCode = getSevenCode(goodsId);
                 add.setSevenCode(sevenCode);
             }
-//            else if (("继续教育二级建造师".equals(businessName)) || ("继续教育二级造价师".equals(businessName))){
-//                erJfalg = true;
-//                ezJfalg = "继续教育二级造价师".equals(businessName);
-//                add.setOfficialName(ServletUtils.getEncoded("PIY"));
-//            }
-        }
-        //是否创建官方班级编号
-        if (bo.getClassGradeGoodsAddBos() != null &&
-                (ObjectUtils.isNull(bo.getClassStatus()) || 0 == bo.getClassStatus()) && org.getShareClass() == 1) {
-            Long goodsId = bo.getClassGradeGoodsAddBos()[0];
-            Goods goods = iGoodsService.getById(goodsId);
-            CourseBusiness business = iCourseBusinessService.getById(goods.getBusinessId());
-            CourseBusinessQueryBo businessQueryBo = new CourseBusinessQueryBo();
-            businessQueryBo.setId(goods.getBusinessId());
-            String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
-            if (("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) {
-                List<Goods> goodsList = iGoodsService.list(new LambdaQueryWrapper<Goods>()
-                        .eq(Goods::getEducationTypeId, goods.getEducationTypeId())
-                        .eq(Goods::getBusinessId, goods.getBusinessId())
-                        .eq(Goods::getStatus, 1)
-                        .eq(Goods::getGoodsStatus, 1)
-                        .eq(Goods::getProjectId, goods.getProjectId())
-                        .eq(Goods::getSubjectIds, goods.getSubjectIds()));
-                if (goodsList.size() > 1) {
-                    //该业务层次下有多个商品
-                    List<Long> goodsIds = goodsList.stream().filter(item -> !item.getGoodsId().equals(goodsId)).map(Goods::getGoodsId).collect(Collectors.toList());
-                    List<ClassGradeGoods> goodsGradeList = iClassGradeGoodsService
-                            .list(new LambdaQueryWrapper<ClassGradeGoods>()
-                                    .in(ClassGradeGoods::getGoodsId, goodsIds));
-                    if (CollectionUtils.isNotEmpty(goodsGradeList)) {
-                        Map<Long, List<ClassGradeGoods>> map = goodsGradeList.stream().collect(Collectors.groupingBy(ClassGradeGoods::getGoodsId));
-                        List<ClassGradeSortBo> sortList = new ArrayList<>();
-                        map.forEach((k, v) -> {
-                            ClassGradeSortBo sortBo = new ClassGradeSortBo();
-                            sortBo.setKey(k);
-                            sortBo.setSize(v.size());
-                            sortList.add(sortBo);
-                        });
-                        ClassGradeSortBo sortBo = sortList.stream().sorted(Comparator.comparing(ClassGradeSortBo::getSize).reversed()).findFirst().orElse(null);
-                        List<ClassGradeGoods> classGradesMax = map.get(sortBo.getKey()).stream().sorted(Comparator.comparing(ClassGradeGoods::getCreateTime)).collect(Collectors.toList());
-                        //班级信息
-                        List<ClassGrade> listGrade = listByIds(classGradesMax.stream().map(ClassGradeGoods::getGradeId).collect(Collectors.toList()));
-                        //获取当前机构商品下的班级
-                        List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService.getGradeGoodsList(goods.getGoodsId());
-                        if (gradeGoods.size() < listGrade.size()) {
-                            ClassGrade grade = listGrade.get(gradeGoods.size());
-                            if (checkEjjjPeopleNumLimit(business.getId(), grade.getGradeId())) {
-                                add.setOfficialName(listGrade.get(gradeGoods.size()).getOfficialName());
-                                add.setClassStatus(0);
-                            } else {
-                                add.setOfficialName(ServletUtils.getEncoded("PIY"));
-                                add.setClassStatus(0);
-                            }
-                        }
-                    }
-                }
-
-                if (StringUtils.isBlank(add.getOfficialName())) {
-                    List<CourseSubject> courseSubjectList = iCourseSubjectService.listByIds(Arrays.asList(goods.getSubjectIds().split(",")));
-                    List<String> subNames = courseSubjectList.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
-                    List<Long> subIds = iCourseSubjectService.getIdsByTenant(subNames);
-                    //获取业务层次下所有班级
-                    ClassGradeListBo bgListBo = new ClassGradeListBo();
-                    bgListBo.setAliasName(business.getAliasName());
-                    bgListBo.setSubIds(subIds);
-                    List<ClassGrade> classGrades = baseMapper.getGradeListByTenant(bgListBo);
-                    if (CollectionUtils.isEmpty(classGrades)) {
-                        //生成预报名官方编号
-                        add.setOfficialName(ServletUtils.getEncoded("PIY"));
-                        add.setClassStatus(0);
-                    } else {
-                        //获取班级创建最多的机构
-                        Map<Long, List<ClassGrade>> map = classGrades.stream().collect(Collectors.groupingBy(ClassGrade::getTenantId));
-                        List<ClassGradeSortBo> sortList = new ArrayList<>();
-                        map.forEach((k, v) -> {
-                            ClassGradeSortBo sortBo = new ClassGradeSortBo();
-                            sortBo.setKey(k);
-                            Map<String, List<ClassGrade>> collect = v.stream().collect(Collectors.groupingBy(ClassGrade::getOfficialName));
-                            sortBo.setSize(collect.keySet().size());
-                            sortList.add(sortBo);
-                        });
-                        ClassGradeSortBo sortBo = sortList.stream().sorted(Comparator.comparing(ClassGradeSortBo::getSize).reversed()).findFirst().orElse(null);
-                        List<ClassGrade> classGradesMax = map.get(sortBo.getKey()).stream().sorted(Comparator.comparing(ClassGrade::getCreateTime)).collect(Collectors.toList());
-                        //去重
-                        List<String> codeStrs = new ArrayList<>();
-                        for (ClassGrade gradesMax : classGradesMax) {
-                            if (codeStrs.contains(gradesMax.getOfficialName())) {
-                                continue;
-                            }
-                            codeStrs.add(gradesMax.getOfficialName());
-                        }
-                        //获取当前机构商品下的班级
-                        List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService.getGradeGoodsList(goodsId);
-                        if (gradeGoods.size() < codeStrs.size()) {
-                            add.setOfficialName(codeStrs.get(gradeGoods.size()));
-                            add.setClassStatus(0);
-                        } else {
-                            //生成预报名官方编号
-                            add.setOfficialName(ServletUtils.getEncoded("PIY"));
-                            add.setClassStatus(0);
-                        }
-                    }
-                }
+            else if (("继续教育二级建造师".equals(businessName)) || ("继续教育二级造价师".equals(businessName))){
+                erJfalg = true;
+                ezJfalg = "继续教育二级造价师".equals(businessName);
+                add.setOfficialName(ServletUtils.getEncoded("PIY"));
             }
         }
+        //是否创建官方班级编号
+//        if (bo.getClassGradeGoodsAddBos() != null &&
+//                (ObjectUtils.isNull(bo.getClassStatus()) || 0 == bo.getClassStatus()) && org.getShareClass() == 1) {
+//            Long goodsId = bo.getClassGradeGoodsAddBos()[0];
+//            Goods goods = iGoodsService.getById(goodsId);
+//            CourseBusiness business = iCourseBusinessService.getById(goods.getBusinessId());
+//            CourseBusinessQueryBo businessQueryBo = new CourseBusinessQueryBo();
+//            businessQueryBo.setId(goods.getBusinessId());
+//            String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
+//            if (("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) {
+//                List<Goods> goodsList = iGoodsService.list(new LambdaQueryWrapper<Goods>()
+//                        .eq(Goods::getEducationTypeId, goods.getEducationTypeId())
+//                        .eq(Goods::getBusinessId, goods.getBusinessId())
+//                        .eq(Goods::getStatus, 1)
+//                        .eq(Goods::getGoodsStatus, 1)
+//                        .eq(Goods::getProjectId, goods.getProjectId())
+//                        .eq(Goods::getSubjectIds, goods.getSubjectIds()));
+//                if (goodsList.size() > 1) {
+//                    //该业务层次下有多个商品
+//                    List<Long> goodsIds = goodsList.stream().filter(item -> !item.getGoodsId().equals(goodsId)).map(Goods::getGoodsId).collect(Collectors.toList());
+//                    List<ClassGradeGoods> goodsGradeList = iClassGradeGoodsService
+//                            .list(new LambdaQueryWrapper<ClassGradeGoods>()
+//                                    .in(ClassGradeGoods::getGoodsId, goodsIds));
+//                    if (CollectionUtils.isNotEmpty(goodsGradeList)) {
+//                        Map<Long, List<ClassGradeGoods>> map = goodsGradeList.stream().collect(Collectors.groupingBy(ClassGradeGoods::getGoodsId));
+//                        List<ClassGradeSortBo> sortList = new ArrayList<>();
+//                        map.forEach((k, v) -> {
+//                            ClassGradeSortBo sortBo = new ClassGradeSortBo();
+//                            sortBo.setKey(k);
+//                            sortBo.setSize(v.size());
+//                            sortList.add(sortBo);
+//                        });
+//                        ClassGradeSortBo sortBo = sortList.stream().sorted(Comparator.comparing(ClassGradeSortBo::getSize).reversed()).findFirst().orElse(null);
+//                        List<ClassGradeGoods> classGradesMax = map.get(sortBo.getKey()).stream().sorted(Comparator.comparing(ClassGradeGoods::getCreateTime)).collect(Collectors.toList());
+//                        //班级信息
+//                        List<ClassGrade> listGrade = listByIds(classGradesMax.stream().map(ClassGradeGoods::getGradeId).collect(Collectors.toList()));
+//                        //获取当前机构商品下的班级
+//                        List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService.getGradeGoodsList(goods.getGoodsId());
+//                        if (gradeGoods.size() < listGrade.size()) {
+//                            ClassGrade grade = listGrade.get(gradeGoods.size());
+//                            if (checkEjjjPeopleNumLimit(business.getId(), grade.getGradeId())) {
+//                                add.setOfficialName(listGrade.get(gradeGoods.size()).getOfficialName());
+//                                add.setClassStatus(0);
+//                            } else {
+//                                add.setOfficialName(ServletUtils.getEncoded("PIY"));
+//                                add.setClassStatus(0);
+//                            }
+//                        }
+//                    }
+//                }
+//
+//                if (StringUtils.isBlank(add.getOfficialName())) {
+//                    List<CourseSubject> courseSubjectList = iCourseSubjectService.listByIds(Arrays.asList(goods.getSubjectIds().split(",")));
+//                    List<String> subNames = courseSubjectList.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
+//                    List<Long> subIds = iCourseSubjectService.getIdsByTenant(subNames);
+//                    //获取业务层次下所有班级
+//                    ClassGradeListBo bgListBo = new ClassGradeListBo();
+//                    bgListBo.setAliasName(business.getAliasName());
+//                    bgListBo.setSubIds(subIds);
+//                    List<ClassGrade> classGrades = baseMapper.getGradeListByTenant(bgListBo);
+//                    if (CollectionUtils.isEmpty(classGrades)) {
+//                        //生成预报名官方编号
+//                        add.setOfficialName(ServletUtils.getEncoded("PIY"));
+//                        add.setClassStatus(0);
+//                    } else {
+//                        //获取班级创建最多的机构
+//                        Map<Long, List<ClassGrade>> map = classGrades.stream().collect(Collectors.groupingBy(ClassGrade::getTenantId));
+//                        List<ClassGradeSortBo> sortList = new ArrayList<>();
+//                        map.forEach((k, v) -> {
+//                            ClassGradeSortBo sortBo = new ClassGradeSortBo();
+//                            sortBo.setKey(k);
+//                            Map<String, List<ClassGrade>> collect = v.stream().collect(Collectors.groupingBy(ClassGrade::getOfficialName));
+//                            sortBo.setSize(collect.keySet().size());
+//                            sortList.add(sortBo);
+//                        });
+//                        ClassGradeSortBo sortBo = sortList.stream().sorted(Comparator.comparing(ClassGradeSortBo::getSize).reversed()).findFirst().orElse(null);
+//                        List<ClassGrade> classGradesMax = map.get(sortBo.getKey()).stream().sorted(Comparator.comparing(ClassGrade::getCreateTime)).collect(Collectors.toList());
+//                        //去重
+//                        List<String> codeStrs = new ArrayList<>();
+//                        for (ClassGrade gradesMax : classGradesMax) {
+//                            if (codeStrs.contains(gradesMax.getOfficialName())) {
+//                                continue;
+//                            }
+//                            codeStrs.add(gradesMax.getOfficialName());
+//                        }
+//                        //获取当前机构商品下的班级
+//                        List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService.getGradeGoodsList(goodsId);
+//                        if (gradeGoods.size() < codeStrs.size()) {
+//                            add.setOfficialName(codeStrs.get(gradeGoods.size()));
+//                            add.setClassStatus(0);
+//                        } else {
+//                            //生成预报名官方编号
+//                            add.setOfficialName(ServletUtils.getEncoded("PIY"));
+//                            add.setClassStatus(0);
+//                        }
+//                    }
+//                }
+//            }
+//        }
         boolean save = this.save(add);
 
         //添加班级商品
@@ -445,42 +445,42 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
             classGradeSysService.save(classGradeSys);
         }
 
-//        if (erJfalg && bo.getClassGradeGoodsAddBos() != null){
-//            //二建继教班级创建,所有共享班级机构同步创建
-//            synchronousCreation(add,sysTenant,bo.getClassGradeGoodsAddBos()[0]);
-//            //通知旧系统
-//            CreateSameClassBo classBo = new CreateSameClassBo();
-//            if (ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 1){
-//                classBo.setClassNo(add.getOfficialName());
-//                classBo.setOpenclassState(1);
-//                classBo.setBeginTime(DateUtils.timestampToDateFormat(add.getClassStartTime(),"yyyy-MM-dd HH:mm:ss"));
-//                classBo.setEndTime(DateUtils.timestampToDateFormat(add.getClassEndTime(),"yyyy-MM-dd HH:mm:ss"));
-//            }else {
-//                classBo.setClassNo(add.getOfficialName());
-//                classBo.setOpenclassState(0);
-//            }
-//            classBo.setCategoryName(add.getClassName());
-//            classBo.setPlatformId(ezJfalg?8:5);
-//            Goods goods = iGoodsService.getById(bo.getClassGradeGoodsAddBos()[0]);
-//            Major major = iMajorService.getById(goods.getMajorId());
-//            if (ObjectUtils.isNotNull(major)){
-//                classBo.setMajorName(major.getCategoryName());
-//            }
-//            Long nowTime = DateUtils.getNowTime();
-//            String sign = ToolsUtils.EncoderByMd5(classBo.getClassNo()+nowTime.toString() + "pubilc2022");
-//            classBo.setSign(sign);
-//            classBo.setStamp(nowTime);
-//            JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(classBo));
-//            String respone = "";
-//            try {
-//                respone = HttpUtils.sendPost(CREATE_EXAM_PATH, param);
-//                if (!respone.contains("\"Status\":true")) {
-//                    throw new CustomException("旧系统创建班级错误" + respone);
-//                }
-//            } catch (Exception e) {
-//                throw new CustomException("旧系统创建班级错误" + e.getMessage());
-//            }
-//        }
+        if (erJfalg && bo.getClassGradeGoodsAddBos() != null){
+            //二建继教班级创建,所有共享班级机构同步创建
+            synchronousCreation(add,sysTenant,bo.getClassGradeGoodsAddBos()[0]);
+            //通知旧系统
+            CreateSameClassBo classBo = new CreateSameClassBo();
+            if (ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 1){
+                classBo.setClassNo(add.getOfficialName());
+                classBo.setOpenclassState(1);
+                classBo.setBeginTime(DateUtils.timestampToDateFormat(add.getClassStartTime(),"yyyy-MM-dd HH:mm:ss"));
+                classBo.setEndTime(DateUtils.timestampToDateFormat(add.getClassEndTime(),"yyyy-MM-dd HH:mm:ss"));
+            }else {
+                classBo.setClassNo(add.getOfficialName());
+                classBo.setOpenclassState(0);
+            }
+            classBo.setCategoryName(add.getClassName());
+            classBo.setPlatformId(ezJfalg?8:5);
+            Goods goods = iGoodsService.getById(bo.getClassGradeGoodsAddBos()[0]);
+            Major major = iMajorService.getById(goods.getMajorId());
+            if (ObjectUtils.isNotNull(major)){
+                classBo.setMajorName(major.getCategoryName());
+            }
+            Long nowTime = DateUtils.getNowTime();
+            String sign = ToolsUtils.EncoderByMd5(classBo.getClassNo()+nowTime.toString() + "pubilc2022");
+            classBo.setSign(sign);
+            classBo.setStamp(nowTime);
+            JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(classBo));
+            String respone = "";
+            try {
+                respone = HttpUtils.sendPost(CREATE_EXAM_PATH, param);
+                if (!respone.contains("\"Status\":true")) {
+                    throw new CustomException("旧系统创建班级错误" + respone);
+                }
+            } catch (Exception e) {
+                throw new CustomException("旧系统创建班级错误" + e.getMessage());
+            }
+        }
 
         return save;
     }
@@ -570,16 +570,14 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         String officialName = classGrade.getOfficialName();//预开班班级编号
         //企业ID
         String tenant = ServletUtils.getRequest().getHeader("TenantId");
-        SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
-                .eq(SysOldOrg::getTenantId, tenant)
-                .last("limit 1")).stream().findFirst().orElse(null);
+        SysTenant sysTenant = sysTenantService.getById(Long.valueOf(tenant));
 
         Goods goods = iGoodsService.getById(gradeGoods.getGoodsId());
         CourseBusinessQueryBo businessQueryBo = new CourseBusinessQueryBo();
         businessQueryBo.setId(goods.getBusinessId());
         String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
 
-        if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName)))&& org.getShareClass() == 1) {
+        if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName)))&& sysTenant.getShareClass() == 1) {
             if (update.getClassStatus() != null && update.getClassStatus().equals(1)) {
                 //二造和二建班级开班校验班级人数(300人)
                 if (!checkClassUserNum(goods.getBusinessId(), update.getGradeId())) {
@@ -637,7 +635,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                     throw new RuntimeException("班级还有学员,无法设置为无效");
                 }
             }
-            if (StringUtils.isNotBlank(oldGrade.getOfficialName()) && org.getShareClass() == 1) {
+            if (StringUtils.isNotBlank(oldGrade.getOfficialName()) && sysTenant.getShareClass() == 1) {
                 throw new RuntimeException("二建/二造班级无法设置为无效,请联系技术人员!");
             }
         }
@@ -702,25 +700,13 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         }
 
         ClassGrade grade = getById(update.getGradeId());
-        if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) && org.getShareClass() == 1) {
-            if (ObjectUtils.isNotNull(grade) && ObjectUtils.isNotNull(grade.getClassStatus())
-                    && StringUtils.isNotBlank(grade.getOfficialName()) && grade.getClassStatus() == 1) {
-//                List<ClassGrade> list = list(new LambdaQueryWrapper<ClassGrade>().eq(ClassGrade::getOfficialName, update.getRegisterCode()));
-//                if (CollectionUtils.isNotEmpty(list)){
-//                    update(new LambdaUpdateWrapper<ClassGrade>()
-//                            .set(ClassGrade::getOfficialName,update.getOfficialName())
-//                            .set(ClassGrade::getRegisterCode,update.getRegisterCode())
-//                            .set(ClassGrade::getClassStartTime,update.getClassStartTime())
-//                            .set(ClassGrade::getClassEndTime,update.getClassEndTime())
-//                            .set(ClassGrade::getClassStatus,update.getClassStatus())
-//                            .set(ClassGrade::getLearningStatus,update.getLearningStatus())
-//                            .set(ClassGrade::getInterfacePushId,update.getInterfacePushId())
-//                            .in(ClassGrade::getGradeId,list.stream().map(ClassGrade::getGradeId).collect(Collectors.toList())));
-//                }
+        if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) && sysTenant.getShareClass() == 1) {
+            if (StringUtils.isNotBlank(grade.getOfficialName()) && grade.getClassStatus() == 1) {
 
                 ClassGradeOpenBo openBo = new ClassGradeOpenBo();
                 openBo.setOfficialName(grade.getOfficialName());
-                openBo.setRegisterCode(grade.getRegisterCode());
+//                openBo.setRegisterCode(grade.getRegisterCode());
+                openBo.setRegisterCode(officialName);
                 openBo.setClassName(grade.getClassName());
                 openBo.setClassStartTime(grade.getClassStartTime());
                 openBo.setClassEndTime(grade.getClassEndTime());
@@ -1658,50 +1644,51 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 return;
             }
             //班级是否存在
-            ClassGrade grade = baseMapper.getCodeNoTenant(bo.getRegisterCode(),tenant.getTenantId());
-            if (ObjectUtils.isNotNull(grade)){
-                //已经存在 不创建
-                return;
-            }
-            ClassGrade classGrade = new ClassGrade();
-            classGrade.setCreateTime(DateUtils.getNowTime());
-            if (bo.getClassStatus() == 1){
-                //开班
-                classGrade.setClassStatus(1);
-                classGrade.setOfficialName(bo.getOfficialName());
-                classGrade.setLearningStatus(1);
-                classGrade.setClassStartTime(bo.getClassStartTime());
-                classGrade.setClassEndTime(bo.getClassEndTime());
-                //二建/二造官方信息推送开关打开
-                List<ClassGradeInterface> interfaceList = iClassGradeInterfaceService
-                        .list(new LambdaQueryWrapper<ClassGradeInterface>()
-                                .eq(ClassGradeInterface::getType, 1).last("limit 1"));
-                if (CollectionUtils.isNotEmpty(interfaceList)) {
-                    classGrade.setInterfacePushId(interfaceList.get(0).getId());
+            if (StringUtils.isNotBlank(bo.getRegisterCode())){
+                ClassGrade grade = baseMapper.getCodeNoTenant(bo.getRegisterCode(),tenant.getTenantId());
+                if (ObjectUtils.isNotNull(grade)){
+                    //已经存在 不创建
+                    return;
                 }
-            }else {
-                classGrade.setClassStatus(0);
-                classGrade.setLearningStatus(2);//待定
             }
-            classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
-            classGrade.setUpdateTime(DateUtils.getNowTime());
-            classGrade.setStatus(1);
-            String gradeCode = ServletUtils.getEncoded("BJ");
-            classGrade.setGradeCode(gradeCode);
-            classGrade.setClassName(bo.getClassName());
-            classGrade.setTenantId(tenant.getTenantId());
-            classGrade.setRegisterCode(bo.getRegisterCode());
-            save(classGrade);
-            List<ClassGradeGoods> gradeGoods = relGoods.stream().map(item -> {
+            relGoods.forEach(item -> {
+                ClassGrade classGrade = new ClassGrade();
+                classGrade.setCreateTime(DateUtils.getNowTime());
+                if (bo.getClassStatus() == 1){
+                    //开班
+                    classGrade.setClassStatus(1);
+                    classGrade.setOfficialName(bo.getOfficialName());
+                    classGrade.setLearningStatus(1);
+                    classGrade.setClassStartTime(bo.getClassStartTime());
+                    classGrade.setClassEndTime(bo.getClassEndTime());
+                    //二建/二造官方信息推送开关打开
+                    List<ClassGradeInterface> interfaceList = iClassGradeInterfaceService
+                            .list(new LambdaQueryWrapper<ClassGradeInterface>()
+                                    .eq(ClassGradeInterface::getType, 1).last("limit 1"));
+                    if (CollectionUtils.isNotEmpty(interfaceList)) {
+                        classGrade.setInterfacePushId(interfaceList.get(0).getId());
+                    }
+                }else {
+                    classGrade.setClassStatus(0);
+                    classGrade.setLearningStatus(2);//待定
+                    classGrade.setOfficialName(bo.getRegisterCode());
+                }
+                classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
+                classGrade.setUpdateTime(DateUtils.getNowTime());
+                classGrade.setStatus(1);
+                String gradeCode = ServletUtils.getEncoded("BJ");
+                classGrade.setGradeCode(gradeCode);
+                classGrade.setClassName(bo.getClassName());
+                classGrade.setTenantId(tenant.getTenantId());
+                save(classGrade);
                 ClassGradeGoods classGradeGoods = new ClassGradeGoods();
                 classGradeGoods.setGradeId(classGrade.getGradeId());
                 classGradeGoods.setGoodsId(item.getGoodsId());
                 classGradeGoods.setCreateTime(DateUtils.getNowTime());
                 classGradeGoods.setUpdateTime(DateUtils.getNowTime());
                 classGradeGoods.setTenantId(tenant.getTenantId());
-                return classGradeGoods;
-            }).collect(Collectors.toList());
-            iClassGradeGoodsService.saveBatch(gradeGoods);
+                iClassGradeGoodsService.save(classGradeGoods);
+            });
         });
     }
 

+ 39 - 39
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -2486,8 +2486,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
             if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) && org.getShareClass() == 1) {
                 //生成预开班编号
-                classGrade.setOfficialName(createGradeCode(goodsId, businessVo));
-//                classGrade.setOfficialName(ServletUtils.getEncoded("PIY"));
+//                classGrade.setOfficialName(createGradeCode(goodsId, businessVo));
+                classGrade.setOfficialName(ServletUtils.getEncoded("PIY"));
             }
 
         } else {
@@ -2572,43 +2572,43 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         iClassGradeGoodsService.save(classGradeGoods);
         //锁定班级
         lockGrade(orderGoodsId, classGrade.getGradeId(), userId, goodsId, orderSn,orderGoods.getSevenYear());
-//        if ((("继续教育二级建造师".equals(businessFull)) || ("继续教育二级造价师".equals(businessFull))) && sysTenant.getShareClass() == 1) {
-//            //二建继教班级创建,所有共享班级机构同步创建
-//            synchronousCreation(classGrade,sysTenant,goodsId);
-//            //通知旧系统
-//            CreateSameClassBo classBo = new CreateSameClassBo();
-//            if (ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 1){
-//                classBo.setClassNo(classGrade.getOfficialName());
-//                classBo.setOpenclassState(1);
-//                classBo.setBeginTime(DateUtils.timestampToDateFormat(classGrade.getClassStartTime(),"yyyy-MM-dd HH:mm:ss"));
-//                classBo.setEndTime(DateUtils.timestampToDateFormat(classGrade.getClassEndTime(),"yyyy-MM-dd HH:mm:ss"));
-//            }else {
-//                classBo.setClassNo(classGrade.getOfficialName());
-//                classBo.setOpenclassState(0);
-//            }
-//            classBo.setCategoryName(classGrade.getClassName());
-//            classBo.setPlatformId("继续教育二级造价师".equals(businessFull)?8:5);
-//            Major major = iMajorService.getById(goods.getMajorId());
-//            if (ObjectUtils.isNotNull(major)){
-//                classBo.setMajorName(major.getCategoryName());
-//            }
-//
-//            Long nowTime = DateUtils.getNowTime();
-//            String sign = ToolsUtils.EncoderByMd5(classBo.getClassNo()+nowTime.toString() + "pubilc2022");
-//            classBo.setSign(sign);
-//            classBo.setStamp(nowTime);
-//            JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(classBo));
-//            String respone = "";
-//            try {
-//                respone = HttpUtils.sendPost(CREATE_EXAM_PATH, param);
-//                if (!respone.contains("\"Status\":true")) {
-//                    log.error("旧系统创建班级错误" + respone);
-//                }
-//            } catch (Exception e) {
-//                e.printStackTrace();
-//                log.error("旧系统创建班级错误" + respone);
-//            }
-//        }
+        if ((("继续教育二级建造师".equals(businessFull)) || ("继续教育二级造价师".equals(businessFull))) && sysTenant.getShareClass() == 1) {
+            //二建继教班级创建,所有共享班级机构同步创建
+            synchronousCreation(classGrade,sysTenant,goodsId);
+            //通知旧系统
+            CreateSameClassBo classBo = new CreateSameClassBo();
+            if (ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 1){
+                classBo.setClassNo(classGrade.getOfficialName());
+                classBo.setOpenclassState(1);
+                classBo.setBeginTime(DateUtils.timestampToDateFormat(classGrade.getClassStartTime(),"yyyy-MM-dd HH:mm:ss"));
+                classBo.setEndTime(DateUtils.timestampToDateFormat(classGrade.getClassEndTime(),"yyyy-MM-dd HH:mm:ss"));
+            }else {
+                classBo.setClassNo(classGrade.getOfficialName());
+                classBo.setOpenclassState(0);
+            }
+            classBo.setCategoryName(classGrade.getClassName());
+            classBo.setPlatformId("继续教育二级造价师".equals(businessFull)?8:5);
+            Major major = iMajorService.getById(goods.getMajorId());
+            if (ObjectUtils.isNotNull(major)){
+                classBo.setMajorName(major.getCategoryName());
+            }
+
+            Long nowTime = DateUtils.getNowTime();
+            String sign = ToolsUtils.EncoderByMd5(classBo.getClassNo()+nowTime.toString() + "pubilc2022");
+            classBo.setSign(sign);
+            classBo.setStamp(nowTime);
+            JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(classBo));
+            String respone = "";
+            try {
+                respone = HttpUtils.sendPost(CREATE_EXAM_PATH, param);
+                if (!respone.contains("\"Status\":true")) {
+                    log.error("旧系统创建班级错误" + respone);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("旧系统创建班级错误" + respone);
+            }
+        }
        return true;
     }
 

+ 11 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -98,6 +98,7 @@ import com.zhongzheng.modules.polyv.service.IPolyvLiveService;
 import com.zhongzheng.modules.schedule.service.IScheduleService;
 import com.zhongzheng.modules.system.bo.SysTenantBadBillConfigBo;
 import com.zhongzheng.modules.system.bo.SysTenantQueryBo;
+import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.system.service.ISysUserService;
 import com.zhongzheng.modules.system.vo.SysTenantVo;
@@ -1728,8 +1729,18 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                 examApply.setProjectId(projectId);
                 examApply.setBusinessId(businessId);
                 examApply.setCode(ServletUtils.getEncoded("KSAP"));
+                examApply.setRelCode(ServletUtils.getEncoded("SHEX"));
                 examApply.setReportStatus(0);
                 examApply.setApplyNature(1);//普通场次
+                //是否公用祥粤考场
+                String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+                SysTenant sysTenant = iSysTenantService.getById(Long.valueOf(tenantId));
+                if (ObjectUtils.isNotNull(sysTenant.getExamRoom()) && sysTenant.getExamRoom() == 1){
+                   String code = iExamApplyService.getExamRelCodeNotTenant(examApply.getApplyName());
+                   if (StringUtils.isNotEmpty(code)){
+                       examApply.setRelCode(code);
+                   }
+                }
                 iExamApplyService.save(examApply);
 
                 //考试商品

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/system/domain/SysTenant.java

@@ -111,5 +111,7 @@ private static final long serialVersionUID=1L;
     private Integer sort;
     /** 七大员班级标识:1使用祥粤班级 0正常 */
     private Integer sevenClass;
+    /** 考场共享标识: 1使用祥粤 0正常 */
+    private Integer examRoom;
 
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserSubscribeMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.user.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
 import com.zhongzheng.modules.user.bo.UserSubscribeQueryBo;
 import com.zhongzheng.modules.user.domain.UserSubscribe;
@@ -63,4 +64,8 @@ public interface UserSubscribeMapper extends BaseMapper<UserSubscribe> {
     Long selectMajorId(@Param("majorName")String majorName);
 
     List<Long> getGoodsIds(@Param("userId")Long userId, @Param("applyId")Long applyId,@Param("majorId") Long majorId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    Integer getExamApplyNum(String relCode);
+
 }

+ 69 - 22
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserSubscribeServiceImpl.java

@@ -371,6 +371,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
         if (System.currentTimeMillis()/1000 > time){
             throw new CustomException("当前选择的考试时间已过期,请重新预约,选择未过期考试时间");
         }
+        subscribeNumCheck(60L,bo.getApplyId());
         //要求非必填考点
         if(Validator.isNotEmpty(bo.getApplySiteAddress())){
             ExamApplyQueryBo queryTimeBo = new ExamApplyQueryBo();
@@ -1211,28 +1212,51 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
                 continue;
             }
             //考点已申报人数
-            Long sitePeopleNum = examApplyMapper.sitePeopleNum(queryTimeBo);
-            System.out.println(queryTimeBo);
-            List<String> siteTimeJsonList = examApplyMapper.siteTimeJson(queryTimeBo);
-            String siteTimeJson = siteTimeJsonList.stream().filter(x -> {
-                List<ExamApplySiteTimeTwoVo> timeTwoVos = JSONArray.parseArray(x, ExamApplySiteTimeTwoVo.class);
-                ExamApplySiteTimeTwoVo timeTwoVo = timeTwoVos.get(0);
-                if (timeTwoVo.getStartTime().equals(queryTimeBo.getStartTime())
-                        && timeTwoVo.getEndTime().equals(queryTimeBo.getEndTime())) {
-                    return true;
+//            Long sitePeopleNum = examApplyMapper.sitePeopleNum(queryTimeBo);
+//            System.out.println(queryTimeBo);
+//            List<String> siteTimeJsonList = examApplyMapper.siteTimeJson(queryTimeBo);
+//            String siteTimeJson = siteTimeJsonList.stream().filter(x -> {
+//                List<ExamApplySiteTimeTwoVo> timeTwoVos = JSONArray.parseArray(x, ExamApplySiteTimeTwoVo.class);
+//                ExamApplySiteTimeTwoVo timeTwoVo = timeTwoVos.get(0);
+//                if (timeTwoVo.getStartTime().equals(queryTimeBo.getStartTime())
+//                        && timeTwoVo.getEndTime().equals(queryTimeBo.getEndTime())) {
+//                    return true;
+//                }
+//                return false;
+//            }).findFirst().orElse(null);
+//            if (Validator.isEmpty(siteTimeJson)) {
+//                userSubscribeImport.setCause("考点数据错误");
+//                userSubscribeImports.add(userSubscribeImport);
+//                continue;
+//            }
+//            int num = findPeopleNum(queryTimeBo,siteTimeJson);
+//            if(num==-1||num<=sitePeopleNum){
+//                userSubscribeImport.setCause("考点人数已满");
+//                userSubscribeImports.add(userSubscribeImport);
+//                continue;
+//            }
+
+            String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+            SysTenant sysTenant = iSysTenantService.getById(Long.valueOf(tenantId));
+            if (ObjectUtils.isNotNull(sysTenant.getExamRoom()) && sysTenant.getExamRoom() == 1){
+                //公用祥粤考场
+                ExamApply examApply = iExamApplyService.getById(applyId);
+                if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(examApply.getRelCode())){
+                    //约考人数
+                    Integer number = baseMapper.getExamApplyNum(examApply.getRelCode());
+                    if (number >= 60){
+                        userSubscribeImport.setCause("考点人数已满");
+                        userSubscribeImports.add(userSubscribeImport);
+                    }
+                }
+            }else {
+                int countNum = count(new LambdaQueryWrapper<UserSubscribe>()
+                        .eq(UserSubscribe::getApplyId, applyId)
+                        .eq(UserSubscribe::getSubscribeStatus, 1));
+                if (countNum >= 60){
+                    userSubscribeImport.setCause("考点人数已满");
+                    userSubscribeImports.add(userSubscribeImport);
                 }
-                return false;
-            }).findFirst().orElse(null);
-            if (Validator.isEmpty(siteTimeJson)) {
-                userSubscribeImport.setCause("考点数据错误");
-                userSubscribeImports.add(userSubscribeImport);
-                continue;
-            }
-            int num = findPeopleNum(queryTimeBo,siteTimeJson);
-            if(num==-1||num<=sitePeopleNum){
-                userSubscribeImport.setCause("考点人数已满");
-                userSubscribeImports.add(userSubscribeImport);
-                continue;
             }
 
             //查看是否有无考试记录
@@ -2302,7 +2326,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
         //考场人数
         List<ExamApplySiteTimeTwoAddBo> siteTimeTwoAddBos = JSONArray.parseArray(examApplySiteTime.getSiteTime(), ExamApplySiteTimeTwoAddBo.class);
         Long userNum = siteTimeTwoAddBos.get(0).getNum();
-
+        subscribeNumCheck(userNum,bo.getApplyId());
         //生成座位号
         Integer tNum = getSeatNumber(bo,userNum);
         add.setSeatNumber(tNum.toString());
@@ -2382,6 +2406,29 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
         return add.getSubscribeId();
     }
 
+    private void subscribeNumCheck(Long userNum,Long applyId) {
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        SysTenant sysTenant = iSysTenantService.getById(Long.valueOf(tenantId));
+        if (ObjectUtils.isNotNull(sysTenant.getExamRoom()) && sysTenant.getExamRoom() == 1){
+            //公用祥粤考场
+            ExamApply examApply = iExamApplyService.getById(applyId);
+            if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(examApply.getRelCode())){
+                //约考人数
+                Integer number = baseMapper.getExamApplyNum(examApply.getRelCode());
+                if (number >= userNum){
+                    throw new CustomException("预约考点人数已满,请选择其他场次");
+                }
+            }
+        }else {
+            int count = count(new LambdaQueryWrapper<UserSubscribe>()
+                    .eq(UserSubscribe::getApplyId, applyId)
+                    .eq(UserSubscribe::getSubscribeStatus, 1));
+            if (count >= userNum){
+                throw new CustomException("预约考点人数已满,请选择其他场次");
+            }
+        }
+    }
+
     @Override
     public List<ExamSessionVo> getExamSession(String applyDate) {
         //根据月份筛选

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml

@@ -308,6 +308,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             apply_id = #{applyId}
     </select>
 
+    <select id="getExamRelCodeNotTenant" parameterType="java.lang.String" resultType="java.lang.String">
+        SELECT rel_code FROM `exam_apply` WHERE apply_name = #{applyName} AND rel_code != '' AND rel_code IS NOT NULL LIMIT 1
+    </select>
+
     <select id="getUserProfileList" parameterType="java.lang.String" resultType="com.zhongzheng.modules.base.domain.UserProfile">
         SELECT
             up.*

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -867,6 +867,7 @@
                 LEFT JOIN major m ON g.major_id = m.id
         WHERE
             g.`status` = 1
+            AND g.goods_status = 1
             AND INSTR(#{businessName}, cet.education_name)
             AND INSTR(#{businessName}, cpt.project_name)
             AND INSTR(#{categoryName}, m.category_name)

+ 12 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserSubscribeMapper.xml

@@ -582,4 +582,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             AND og.refund_status != 2
 	        AND og.pay_status IN (2,3,4)
     </select>
+
+    <select id="getExamApplyNum" parameterType="java.lang.String" resultType="java.lang.Integer">
+        SELECT
+            COUNT( DISTINCT us.user_id )
+        FROM
+            exam_apply ea
+                LEFT JOIN user_subscribe us ON ea.apply_id = us.apply_id
+        WHERE
+            ea.rel_code = ''
+          AND ea.`status` = 1
+          AND us.subscribe_status = 1
+    </select>
 </mapper>