|
@@ -1232,6 +1232,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
//祥粤云
|
|
|
Long tenantId = 867735392558919680L;
|
|
|
bgListBo.setTenantId(tenantId);
|
|
|
+ bgListBo.setEducationName("继续教育");
|
|
|
List<Long> goodsIds = baseMapper.getGoodsIdByBoTenant(bgListBo);
|
|
|
if (CollectionUtils.isEmpty(goodsIds)) {
|
|
|
throw new CustomException("改业务层次下不存在商品,请检查!");
|
|
@@ -1240,7 +1241,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
String encoded = ServletUtils.getEncoded("PIY");
|
|
|
if (CollectionUtils.isEmpty(classGrades)) {
|
|
|
//创建新预报名班级
|
|
|
- creatClass(goodsIds.get(0), tenantId, encoded);
|
|
|
+ creatClass(goodsIds, tenantId, encoded);
|
|
|
} else {
|
|
|
//获取班级创建最多的机构
|
|
|
Map<Long, List<ClassGrade>> map = classGrades.stream().collect(Collectors.groupingBy(ClassGrade::getTenantId));
|
|
@@ -1265,7 +1266,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
return classUserNumBo;
|
|
|
} else {
|
|
|
//创建新预报名班级
|
|
|
- creatClass(goodsIds.get(0), tenantId, encoded);
|
|
|
+ creatClass(goodsIds, tenantId, encoded);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1395,66 +1396,68 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
}
|
|
|
|
|
|
//创建预开班班级
|
|
|
- private void creatClass(Long goodsId, Long tenantId, String code) {
|
|
|
- //创建新班级
|
|
|
- Goods goods = iGoodsService.getGoodsByIdTenant(goodsId, tenantId);
|
|
|
- CourseBusiness businessVo = iCourseBusinessService.getBusinessByIdTenant(goods.getBusinessId(), tenantId);
|
|
|
- boolean isConfigTp = false; //商品是否有配置选班模板
|
|
|
- if (Validator.isNotEmpty(businessVo) && Validator.isNotEmpty(businessVo.getTemplateName()) && businessVo.getTemplateName().equals("班级")) {
|
|
|
- isConfigTp = true;
|
|
|
- }
|
|
|
- ClassGrade classGrade = new ClassGrade();
|
|
|
- classGrade.setCreateTime(DateUtils.getNowTime());
|
|
|
- if (isConfigTp) {
|
|
|
- classGrade.setClassStatus(0);
|
|
|
- classGrade.setLearningStatus(2);//待定
|
|
|
- classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
|
|
|
- //生成官方班级编号
|
|
|
- classGrade.setOfficialName(code);
|
|
|
- }
|
|
|
- classGrade.setUpdateTime(DateUtils.getNowTime());
|
|
|
- classGrade.setStatus(1);
|
|
|
- String gradeCode = ServletUtils.getEncoded("BJ");
|
|
|
- classGrade.setGradeCode(gradeCode);
|
|
|
+ private void creatClass(List<Long> goodsIds, Long tenantId, String code) {
|
|
|
+ goodsIds.forEach(goodsId -> {
|
|
|
+ //创建新班级
|
|
|
+ Goods goods = iGoodsService.getGoodsByIdTenant(goodsId, tenantId);
|
|
|
+ CourseBusiness businessVo = iCourseBusinessService.getBusinessByIdTenant(goods.getBusinessId(), tenantId);
|
|
|
+ boolean isConfigTp = false; //商品是否有配置选班模板
|
|
|
+ if (Validator.isNotEmpty(businessVo) && Validator.isNotEmpty(businessVo.getTemplateName()) && businessVo.getTemplateName().equals("班级")) {
|
|
|
+ isConfigTp = true;
|
|
|
+ }
|
|
|
+ ClassGrade classGrade = new ClassGrade();
|
|
|
+ classGrade.setCreateTime(DateUtils.getNowTime());
|
|
|
+ if (isConfigTp) {
|
|
|
+ classGrade.setClassStatus(0);
|
|
|
+ classGrade.setLearningStatus(2);//待定
|
|
|
+ classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
|
|
|
+ //生成官方班级编号
|
|
|
+ classGrade.setOfficialName(code);
|
|
|
+ }
|
|
|
+ classGrade.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ classGrade.setStatus(1);
|
|
|
+ String gradeCode = ServletUtils.getEncoded("BJ");
|
|
|
+ classGrade.setGradeCode(gradeCode);
|
|
|
// classGrade.setClassName(goodsName + gradeCode);
|
|
|
- //班级名称 年份+期数+业务层次(俗名)+教育类型+科目(存在多个科目时,显示多个科目,用“+”分割)
|
|
|
- String businessName = businessVo.getAliasName();
|
|
|
- CourseEducationType educationType = courseEducationTypeService.getEducationByIdtenant(goods.getEducationTypeId(), tenantId);
|
|
|
- String educationName = educationType.getEducationName();
|
|
|
- String className = businessName + educationName;
|
|
|
- if (net.polyv.common.v1.util.StringUtils.isNotBlank(goods.getSubjectIds())) {
|
|
|
- ClassGradeListBo bgListBo = new ClassGradeListBo();
|
|
|
- bgListBo.setSubIds(Arrays.stream(goods.getSubjectIds().split(",")).map(x -> Long.valueOf(x)).collect(Collectors.toList()));
|
|
|
- bgListBo.setTenantId(tenantId);
|
|
|
- List<CourseSubject> subjects = iCourseSubjectService.listByIdsTenant(bgListBo);
|
|
|
- List<String> names = subjects.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
|
|
|
- className = String.format("%s(%s)", className, org.apache.commons.lang3.StringUtils.join(names, '+'));
|
|
|
- }
|
|
|
- Integer nameSort = 1;
|
|
|
- //获取排序值
|
|
|
- List<ClassGrade> list = baseMapper.queryListByNameTenantId(className, tenantId);
|
|
|
- if (CollectionUtils.isNotEmpty(list)) {
|
|
|
- List<Integer> collect = list.stream().filter(x -> x.getClassName().contains("第") && x.getClassName().contains("期")).map(item -> {
|
|
|
- String name = item.getClassName();
|
|
|
- String substring = name.substring(name.indexOf("第") + 1, name.indexOf("期"));
|
|
|
- return Integer.parseInt(substring);
|
|
|
- }).collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(collect)) {
|
|
|
- Integer integer = collect.stream().sorted(Comparator.reverseOrder()).findFirst().get();
|
|
|
- nameSort = integer + 1;
|
|
|
+ //班级名称 年份+期数+业务层次(俗名)+教育类型+科目(存在多个科目时,显示多个科目,用“+”分割)
|
|
|
+ String businessName = businessVo.getAliasName();
|
|
|
+ CourseEducationType educationType = courseEducationTypeService.getEducationByIdtenant(goods.getEducationTypeId(), tenantId);
|
|
|
+ String educationName = educationType.getEducationName();
|
|
|
+ String className = businessName + educationName;
|
|
|
+ if (net.polyv.common.v1.util.StringUtils.isNotBlank(goods.getSubjectIds())) {
|
|
|
+ ClassGradeListBo bgListBo = new ClassGradeListBo();
|
|
|
+ bgListBo.setSubIds(Arrays.stream(goods.getSubjectIds().split(",")).map(x -> Long.valueOf(x)).collect(Collectors.toList()));
|
|
|
+ bgListBo.setTenantId(tenantId);
|
|
|
+ List<CourseSubject> subjects = iCourseSubjectService.listByIdsTenant(bgListBo);
|
|
|
+ List<String> names = subjects.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
|
|
|
+ className = String.format("%s(%s)", className, org.apache.commons.lang3.StringUtils.join(names, '+'));
|
|
|
}
|
|
|
- }
|
|
|
- classGrade.setClassName(String.format("%s年第%s期%s", goods.getYear(), nameSort, className));
|
|
|
- classGrade.setTenantId(tenantId);
|
|
|
- save(classGrade);
|
|
|
- //绑定班级商品
|
|
|
- ClassGradeGoods classGradeGoods = new ClassGradeGoods();
|
|
|
- classGradeGoods.setGradeId(classGrade.getGradeId());
|
|
|
- classGradeGoods.setGoodsId(goodsId);
|
|
|
- classGradeGoods.setCreateTime(DateUtils.getNowTime());
|
|
|
- classGradeGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
- classGradeGoods.setTenantId(tenantId);
|
|
|
- iClassGradeGoodsService.save(classGradeGoods);
|
|
|
+ Integer nameSort = 1;
|
|
|
+ //获取排序值
|
|
|
+ List<ClassGrade> list = baseMapper.queryListByNameTenantId(className, tenantId);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ List<Integer> collect = list.stream().filter(x -> x.getClassName().contains("第") && x.getClassName().contains("期")).map(item -> {
|
|
|
+ String name = item.getClassName();
|
|
|
+ String substring = name.substring(name.indexOf("第") + 1, name.indexOf("期"));
|
|
|
+ return Integer.parseInt(substring);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(collect)) {
|
|
|
+ Integer integer = collect.stream().sorted(Comparator.reverseOrder()).findFirst().get();
|
|
|
+ nameSort = integer + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ classGrade.setClassName(String.format("%s年第%s期%s", goods.getYear(), nameSort, className));
|
|
|
+ classGrade.setTenantId(tenantId);
|
|
|
+ save(classGrade);
|
|
|
+ //绑定班级商品
|
|
|
+ ClassGradeGoods classGradeGoods = new ClassGradeGoods();
|
|
|
+ classGradeGoods.setGradeId(classGrade.getGradeId());
|
|
|
+ classGradeGoods.setGoodsId(goodsId);
|
|
|
+ classGradeGoods.setCreateTime(DateUtils.getNowTime());
|
|
|
+ classGradeGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ classGradeGoods.setTenantId(tenantId);
|
|
|
+ iClassGradeGoodsService.save(classGradeGoods);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|