Pārlūkot izejas kodu

feat:活动排课

Joburgess 4 gadi atpakaļ
vecāks
revīzija
fb3858323d

+ 28 - 28
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -653,20 +653,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		className.append(StringUtils.join(studentNames, ","));
 		vipGroupApplyBaseInfoDto.setName(className.toString());
 
-
-		if(!ActivityCourseType.FREE_VIP.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
-			//计算课程相关费用信息
-			Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
-					vipGroupApplyBaseInfoDto.getUserId(), null);
-			vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(costInfo.get("onlineTeacherSalary"));
-			vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(costInfo.get("offlineTeacherSalary"));
-			vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
-		}else{
-			vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(BigDecimal.ZERO);
-			vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(BigDecimal.ZERO);
-			vipGroupApplyBaseInfoDto.setTotalPrice(BigDecimal.ZERO);
-		}
-
 		vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
 		vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.PROGRESS);
 
@@ -710,6 +696,34 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		classGroup.setUpdateTime(now);
 		classGroupDao.insert(classGroup);
 
+		//班级学员关联记录
+		List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
+		for (Integer studentId : studentIdList) {
+			ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
+			classGroupStudentMapper.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
+			classGroupStudentMapper.setClassGroupId(classGroup.getId());
+			classGroupStudentMapper.setUserId(studentId);
+			classGroupStudentMapper.setCreateTime(now);
+			classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+			classGroupStudentMapper.setGroupType(GroupType.VIP);
+			classGroupStudentMapperList.add(classGroupStudentMapper);
+		}
+		classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
+
+		if(!ActivityCourseType.FREE_VIP.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
+			//计算课程相关费用信息
+			Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
+					vipGroupApplyBaseInfoDto.getUserId(), null);
+			vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(costInfo.get("onlineTeacherSalary"));
+			vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(costInfo.get("offlineTeacherSalary"));
+			vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
+		}else{
+			vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(BigDecimal.ZERO);
+			vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(BigDecimal.ZERO);
+			vipGroupApplyBaseInfoDto.setTotalPrice(BigDecimal.ZERO);
+		}
+		vipGroupDao.update(vipGroupApplyBaseInfoDto);
+
 		//创建班级老师关联记录
 		ClassGroupTeacherMapper classGroupTeacherMapper=new ClassGroupTeacherMapper();
 		classGroupTeacherMapper.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
@@ -734,20 +748,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		classGroupTeacherSalary.setUpdateTime(now);
 		classGroupTeacherSalaryDao.insert(classGroupTeacherSalary);
 
-		//班级学员关联记录
-		List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
-		for (Integer studentId : studentIdList) {
-			ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
-			classGroupStudentMapper.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
-			classGroupStudentMapper.setClassGroupId(classGroup.getId());
-			classGroupStudentMapper.setUserId(studentId);
-			classGroupStudentMapper.setCreateTime(now);
-			classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-			classGroupStudentMapper.setGroupType(GroupType.VIP);
-			classGroupStudentMapperList.add(classGroupStudentMapper);
-		}
-		classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
-
 		//课程信息调整
 		vipGroup.getCourseSchedules().forEach(courseSchedule -> {
 			courseSchedule.setGroupType(GroupType.VIP);