|
@@ -27,6 +27,7 @@ import com.zhongzheng.modules.course.bo.CourseProjectTypeQueryBo;
|
|
|
import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
|
import com.zhongzheng.modules.course.domain.CourseEducationType;
|
|
|
import com.zhongzheng.modules.course.domain.CourseSubject;
|
|
|
+import com.zhongzheng.modules.course.domain.Major;
|
|
|
import com.zhongzheng.modules.course.service.*;
|
|
|
import com.zhongzheng.modules.course.vo.*;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
@@ -178,6 +179,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
@Value("${oldStudySys.classOpenPath}")
|
|
|
private String CLASS_OPEN_PATH;
|
|
|
|
|
|
+ @Value("${oldStudySys.createExamPath}")
|
|
|
+ private String CREATE_EXAM_PATH;
|
|
|
+
|
|
|
@Override
|
|
|
public ClassGradeVo queryById(Long gradeId) {
|
|
|
ClassGradeQueryBo classGradeQueryBo = new ClassGradeQueryBo();
|
|
@@ -259,30 +263,11 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
add.setGradeCode(ServletUtils.getEncoded("BJ"));
|
|
|
- /*LambdaQueryWrapper<ClassGrade> lqw = Wrappers.lambdaQuery();
|
|
|
- lqw.eq(ClassGrade::getClassName, add.getClassName());
|
|
|
- lqw.eq(ClassGrade::getStatus, 1);
|
|
|
- List<ClassGrade> list = this.list(lqw);
|
|
|
- if (CollectionUtils.isNotEmpty(list)) {
|
|
|
- throw new RuntimeException("班级名称不能重复");
|
|
|
- }*/
|
|
|
+
|
|
|
//企业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);
|
|
|
-// //校验是否二建/二造商品创建班级
|
|
|
-// if (bo.getClassGradeGoodsAddBos() != null &&
|
|
|
-// (ObjectUtils.isNull(bo.getClassStatus()) || 1 == bo.getClassStatus()) && org.getShareClass() == 1) {
|
|
|
-// Long goodsId = bo.getClassGradeGoodsAddBos()[0];
|
|
|
-// Goods goods = iGoodsService.getById(goodsId);
|
|
|
-// CourseBusinessQueryBo businessQueryBo = new CourseBusinessQueryBo();
|
|
|
-// businessQueryBo.setId(goods.getBusinessId());
|
|
|
-// String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
|
|
|
-// if (("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) {
|
|
|
-// throw new CustomException("二建/二造不允许直接创建开班班级!");
|
|
|
-// }
|
|
|
-// }
|
|
|
+ SysTenant sysTenant = sysTenantService.getById(Long.valueOf(tenant));
|
|
|
+
|
|
|
//班级绑定学员资料推送和学时推送
|
|
|
List<ClassGradeInterface> list = iClassGradeInterfaceService.list(new LambdaQueryWrapper<ClassGradeInterface>()
|
|
|
.eq(ClassGradeInterface::getStatus, 1)
|
|
@@ -296,6 +281,8 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ Boolean erJfalg = false;
|
|
|
+ Boolean ezJfalg = false;
|
|
|
//七大员继教班级默认学时推送和报名推送
|
|
|
if (bo.getClassGradeGoodsAddBos() != null ) {
|
|
|
Long goodsId = bo.getClassGradeGoodsAddBos()[0];
|
|
@@ -323,108 +310,144 @@ 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.setRegisterCode(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 (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);
|
|
|
+ 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.getRegisterCode());
|
|
|
+ classBo.setOpenclassState(0);
|
|
|
+ }
|
|
|
+ classBo.setCategoryName(add.getClassName());
|
|
|
+ classBo.setPlatformId(ezJfalg?8:5);
|
|
|
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
+ 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());
|
|
|
}
|
|
|
}
|
|
|
- boolean save = this.save(add);
|
|
|
//添加班级商品
|
|
|
if (bo.getClassGradeGoodsAddBos() != null) {
|
|
|
for (Long classGradeGoodsAddBo : bo.getClassGradeGoodsAddBos()) {
|
|
@@ -453,6 +476,50 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
return save;
|
|
|
}
|
|
|
|
|
|
+ public void createSameClass(){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void synchronousCreation(ClassGrade classGrade, SysTenant sysTenant,Long goodsId) {
|
|
|
+ List<SysTenant> tenantList = sysTenantService.getListNoTenant(sysTenant.getTenantId());
|
|
|
+ if (CollectionUtils.isEmpty(tenantList)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Goods goods = iGoodsService.getById(goodsId);
|
|
|
+ String businessName = iGoodsService.getGoodsBusinessName(goodsId);
|
|
|
+ Major major = iMajorService.getById(goods.getMajorId());
|
|
|
+ tenantList.forEach(tenant -> {
|
|
|
+ //是否存在对应课程商品
|
|
|
+ List<Goods> relGoods = iGoodsService.getRelGoodsNoTenant(businessName,major.getCategoryName(),tenant.getTenantId());
|
|
|
+ if (CollectionUtils.isEmpty(relGoods)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //班级是否存在
|
|
|
+ ClassGrade grade = baseMapper.getCodeNoTenant(classGrade.getRegisterCode(),tenant.getTenantId());
|
|
|
+ if (ObjectUtils.isNotNull(grade)){
|
|
|
+ //已经存在 不创建
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //同步班级
|
|
|
+ classGrade.setGradeId(null);
|
|
|
+ classGrade.setTenantId(tenant.getTenantId());
|
|
|
+ save(classGrade);
|
|
|
+
|
|
|
+ List<ClassGradeGoods> gradeGoods = relGoods.stream().map(item -> {
|
|
|
+ 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);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
private String getSevenCode(Long goodsId) {
|
|
|
Goods g = iGoodsService.getById(goodsId);
|
|
|
List<Goods> list = iGoodsService.list(new LambdaQueryWrapper<Goods>()
|
|
@@ -507,10 +574,6 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
if (!checkClassUserNum(goods.getBusinessId(), update.getGradeId())) {
|
|
|
throw new RuntimeException("班级人数超过上限,不能开班,请检查!");
|
|
|
}
|
|
|
- ClassGrade gradeGrade = getById(update.getGradeId());
|
|
|
- if (StringUtils.isNotBlank(gradeGrade.getOfficialName())) {
|
|
|
- update.setRegisterCode(gradeGrade.getOfficialName());
|
|
|
- }
|
|
|
//二建/二造官方信息推送开关打开
|
|
|
List<ClassGradeInterface> interfaceList = iClassGradeInterfaceService
|
|
|
.list(new LambdaQueryWrapper<ClassGradeInterface>()
|
|
@@ -625,21 +688,7 @@ 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 (ObjectUtils.isNotNull(grade) && ObjectUtils.isNotNull(grade.getClassStatus()) && grade.getClassStatus() == 1) {
|
|
|
ClassGradeOpenBo openBo = new ClassGradeOpenBo();
|
|
|
openBo.setOfficialName(grade.getOfficialName());
|
|
|
openBo.setRegisterCode(grade.getRegisterCode());
|
|
@@ -1440,8 +1489,8 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
return;
|
|
|
}
|
|
|
List<Long> ids = list.stream().map(ClassGrade::getGradeId).collect(Collectors.toList());
|
|
|
- //保留预报名编号
|
|
|
- baseMapper.UpGradeCodeByIdTenant(ids);
|
|
|
+// //保留预报名编号
|
|
|
+// baseMapper.UpGradeCodeByIdTenant(ids);
|
|
|
|
|
|
ClassGradeOpenUpBo openUpBo = new ClassGradeOpenUpBo();
|
|
|
openUpBo.setGradeIds(ids);
|
|
@@ -1562,6 +1611,71 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
return baseMapper.listByIdsNoTenant(ids);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ClassGrade getCodeNoTenant(String registerCode, Long tenantId) {
|
|
|
+ return baseMapper.getCodeNoTenant(registerCode,tenantId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void openOfficialSaveGrade(ClassGradeOpenBo bo) {
|
|
|
+ List<SysTenant> tenantList = sysTenantService.getListNoTenant(0L);
|
|
|
+ if (CollectionUtils.isEmpty(tenantList)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ tenantList.forEach(tenant -> {
|
|
|
+ //是否存在对应课程商品
|
|
|
+ List<Goods> relGoods = iGoodsService.getRelGoodsNoTenant(bo.getBusinessName(),bo.getMajorName(),tenant.getTenantId());
|
|
|
+ if (CollectionUtils.isEmpty(relGoods)){
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+ }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 -> {
|
|
|
+ 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);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
//创建预开班班级
|
|
|
private void creatClass(List<Long> goodsIds, Long tenantId, String code) {
|
|
|
goodsIds.forEach(goodsId -> {
|