|
@@ -1012,12 +1012,11 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
if (CollectionUtils.isEmpty(goodsIds)){
|
|
|
throw new CustomException("改业务层次下不存在商品,请检查!");
|
|
|
}
|
|
|
- ServletUtils.getRequestAttributes().getRequest().setAttribute("TenantId",String.valueOf(tenantId));
|
|
|
//生成预报名官方编号
|
|
|
String encoded = ServletUtils.getEncoded("PIY");
|
|
|
if (CollectionUtils.isEmpty(classGrades)){
|
|
|
//创建新预报名班级
|
|
|
- creatClass(goodsIds.get(0),encoded);
|
|
|
+ creatClass(goodsIds.get(0),tenantId,encoded);
|
|
|
}else {
|
|
|
//获取班级创建最多的机构
|
|
|
Map<Long, List<ClassGrade>> map = classGrades.stream().collect(Collectors.groupingBy(ClassGrade::getTenantId));
|
|
@@ -1035,17 +1034,17 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
return classGrade.getRegisterCode();
|
|
|
}else {
|
|
|
//创建新预报名班级
|
|
|
- creatClass(goodsIds.get(0),encoded);
|
|
|
+ creatClass(goodsIds.get(0),tenantId,encoded);
|
|
|
}
|
|
|
}
|
|
|
return encoded;
|
|
|
}
|
|
|
|
|
|
//创建预开班班级
|
|
|
- private void creatClass(Long goodsId,String code){
|
|
|
+ private void creatClass(Long goodsId,Long tenantId,String code){
|
|
|
//创建新班级
|
|
|
- Goods goods = iGoodsService.getById(goodsId);
|
|
|
- CourseBusinessVo businessVo = iCourseBusinessService.queryById(goods.getBusinessId());
|
|
|
+ Goods goods = iGoodsService.getGoodsByIdTenant(goodsId,tenantId);
|
|
|
+ CourseBusiness businessVo = iCourseBusinessService.getBusinessByIdTenant(goods.getBusinessId(),tenantId);
|
|
|
boolean isConfigTp = false; //商品是否有配置选班模板
|
|
|
if (Validator.isNotEmpty(businessVo) && Validator.isNotEmpty(businessVo.getTemplateStatus()) && businessVo.getTemplateStatus() == 1) {
|
|
|
isConfigTp = true;
|
|
@@ -1066,18 +1065,20 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
// classGrade.setClassName(goodsName + gradeCode);
|
|
|
//班级名称 年份+期数+业务层次(俗名)+教育类型+科目(存在多个科目时,显示多个科目,用“+”分割)
|
|
|
String businessName = businessVo.getAliasName();
|
|
|
- CourseEducationType educationType = courseEducationTypeService.getById(goods.getEducationTypeId());
|
|
|
+ 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())){
|
|
|
- List<CourseSubject> subjects = iCourseSubjectService.listByIds(Arrays.stream(goods.getSubjectIds().split(",")).collect(Collectors.toList()));
|
|
|
+ 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 = list(new LambdaQueryWrapper<ClassGrade>()
|
|
|
- .like(ClassGrade::getClassName, className));
|
|
|
+ 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();
|
|
@@ -1090,7 +1091,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
}
|
|
|
}
|
|
|
classGrade.setClassName(String.format("%s年第%s期%s",goods.getYear(),nameSort,className));
|
|
|
-
|
|
|
+ classGrade.setTenantId(tenantId);
|
|
|
save(classGrade);
|
|
|
//绑定班级商品
|
|
|
ClassGradeGoods classGradeGoods = new ClassGradeGoods();
|
|
@@ -1098,6 +1099,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
classGradeGoods.setGoodsId(goodsId);
|
|
|
classGradeGoods.setCreateTime(DateUtils.getNowTime());
|
|
|
classGradeGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ classGradeGoods.setTenantId(tenantId);
|
|
|
iClassGradeGoodsService.save(classGradeGoods);
|
|
|
}
|
|
|
|