yangdamao 2 tahun lalu
induk
melakukan
0feb30ce1d

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeService.java

@@ -85,6 +85,8 @@ public interface IClassGradeService extends IService<ClassGrade> {
 
 	boolean checkEjjjPeopleNumLimit(Long businessId,Long gradeId);
 
+	boolean checkClassUserNum(Long businessId,Long gradeId);
+
 	List<ClassGradeVo> queryGradeList(ClassGradeQueryBo bo);
 
 	boolean gradeChangeEjjjPeople(Long businessId,Long gradeId);

+ 55 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -271,8 +271,14 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                             //获取当前机构商品下的班级
                             List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService.getGradeGoodsList(goods.getGoodsId());
                             if (gradeGoods.size() < listGrade.size()) {
-                                add.setOfficialName(list.get(gradeGoods.size()).getOfficialName());
-                                add.setClassStatus(0);
+                                ClassGrade grade = list.get(gradeGoods.size());
+                                if (checkEjjjPeopleNumLimit(business.getId(),grade.getGradeId())){
+                                    add.setOfficialName(list.get(gradeGoods.size()).getOfficialName());
+                                    add.setClassStatus(0);
+                                }else {
+                                    add.setOfficialName(ServletUtils.getEncoded("PIY"));
+                                    add.setClassStatus(0);
+                                }
                             }
                         }
                     }
@@ -371,7 +377,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 throw new RuntimeException("班级商品信息查询失败");
             }
             Goods goods = iGoodsService.getById(gradeGoods.getGoodsId());
-            if (!checkEjjjPeopleNumLimit(goods.getBusinessId(),update.getGradeId())){
+            if (!checkClassUserNum(goods.getBusinessId(),update.getGradeId())){
                 throw new RuntimeException("班级人数超过上限,不能开班,请检查!");
             }
 
@@ -963,7 +969,52 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                     log.info("查询业务系统班级人数失败参数" + params, "");
                     throw new CustomException("同步查询班级人数请求错误" + e.getMessage());
                 }
-                if ((peopleNum + oldGradeNum) >= 5) { //全系统平台二建班级人数不能超300
+                if ((peopleNum + oldGradeNum) >= 7) { //全系统平台二建班级人数不能超300
+                    return false;
+                }
+            }
+
+        }
+        return true;
+    }
+
+
+    @Override
+    public boolean checkClassUserNum(Long businessId, Long gradeId) {
+        CourseBusinessQueryBo businessQueryBo = new CourseBusinessQueryBo();
+        businessQueryBo.setId(businessId);
+        String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
+        if (("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) {
+            //继教二建或者继教二造班级
+            ClassGradeVo gradeVo = queryById(gradeId);
+            if (Validator.isNotEmpty(gradeVo) && Validator.isNotEmpty(gradeVo.getOfficialName())) {
+                ClassGradeQueryBo queryBo = new ClassGradeQueryBo();
+                queryBo.setOfficialName(gradeVo.getOfficialName());
+                Integer peopleNum = queryOfficialGradeCount(queryBo);
+                //查询旧系统
+                Map<String, String> params = new HashMap<>();
+                Long nowTime = DateUtils.getNowTime();
+                String sign = ToolsUtils.EncoderByMd5(nowTime.toString() + "pubilc2022");
+                params.put("stamp", nowTime.toString());
+                params.put("sign", sign);
+                params.put("jsonstr", gradeVo.getOfficialName());
+                String respone = "";
+                Integer oldGradeNum = 0;
+                try {
+                    respone = HttpUtils.postFormBody(GRADE_COUNT_PATH, params);
+                    log.info("查询业务系统班级人数结果" + respone, "");
+                    if (!respone.contains("\"Status\":true")) {
+                        throw new CustomException("同步请求错误" + respone);
+                    }
+                    JSONObject jsonObject = (JSONObject) JSONObject.parse(respone);
+                    JSONArray dataArray = jsonObject.getJSONArray("Data");
+                    JSONObject fObject = dataArray.getJSONObject(0);
+                    oldGradeNum = (Integer) fObject.get("num");
+                } catch (IOException e) {
+                    log.info("查询业务系统班级人数失败参数" + params, "");
+                    throw new CustomException("同步查询班级人数请求错误" + e.getMessage());
+                }
+                if ((peopleNum + oldGradeNum) > 7) { //全系统平台二建班级人数不能超300
                     return false;
                 }
             }

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

@@ -1825,7 +1825,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                     //获取当前机构商品下的班级
                     List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService.getGradeGoodsList(goods.getGoodsId());
                     if (gradeGoods.size() < list.size()) {
-                        return list.get(gradeGoods.size()).getOfficialName();
+                        ClassGrade grade = list.get(gradeGoods.size());
+                        if (iClassGradeService.checkEjjjPeopleNumLimit(business.getId(),grade.getGradeId())){
+                            return grade.getOfficialName();
+                        }
+                        return ServletUtils.getEncoded("PIY");
                     }
                 }
             }