|
@@ -24,6 +24,7 @@ import java.util.Objects;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -82,6 +83,7 @@ import com.ym.mec.biz.dal.entity.ClassGroupRelation;
|
|
|
import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
|
|
|
import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
|
|
|
import com.ym.mec.biz.dal.entity.CourseSchedule;
|
|
|
+import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
|
|
|
import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
|
|
|
import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
|
|
|
import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
|
|
@@ -89,6 +91,7 @@ import com.ym.mec.biz.dal.entity.CoursesGroup;
|
|
|
import com.ym.mec.biz.dal.entity.Group;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroup;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupBuildLog;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
|
|
|
import com.ym.mec.biz.dal.entity.PracticeGroup;
|
|
|
import com.ym.mec.biz.dal.entity.StudentRegistration;
|
|
|
import com.ym.mec.biz.dal.entity.Subject;
|
|
@@ -114,16 +117,6 @@ import com.ym.mec.biz.dal.page.StudentPayLogQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.TeacherMusicClassQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.VipClassQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.queryMusicGroupCourseScheduleQueryInfo;
|
|
|
-import com.ym.mec.biz.service.ClassGroupRelationService;
|
|
|
-import com.ym.mec.biz.service.ClassGroupService;
|
|
|
-import com.ym.mec.biz.service.ClassGroupTeacherMapperService;
|
|
|
-import com.ym.mec.biz.service.CourseScheduleService;
|
|
|
-import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
|
|
|
-import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
|
|
|
-import com.ym.mec.biz.service.StudentRegistrationService;
|
|
|
-import com.ym.mec.biz.service.SubjectService;
|
|
|
-import com.ym.mec.biz.service.SysConfigService;
|
|
|
-import com.ym.mec.biz.service.TeacherDefaultMusicGroupSalaryService;
|
|
|
import com.ym.mec.common.constant.CommonConstants;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.entity.ImGroupMember;
|
|
@@ -220,6 +213,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
private SysConfigService sysConfigService;
|
|
|
@Autowired
|
|
|
private StudentDao studentDao;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupPaymentCalenderCourseSettingsService musicGroupPaymentCalenderCourseSettingsService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, ClassGroup> getDAO() {
|
|
@@ -1132,89 +1127,99 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean addStudentToClassGroupAndCourseArranging(Integer studentId, String classGroupIdListStr) {
|
|
|
-
|
|
|
- List<ClassGroup> classGroupList = classGroupDao.findClassGroupByIds(classGroupIdListStr);
|
|
|
- if(classGroupList == null || classGroupList.size() == 0){
|
|
|
- throw new BizException("班级查询失败");
|
|
|
- }
|
|
|
-
|
|
|
- Date date = new Date();
|
|
|
- List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<CourseScheduleStudentPayment>();
|
|
|
-
|
|
|
- for(ClassGroup classGroup : classGroupList){
|
|
|
- //1、增加班级人数
|
|
|
- classGroupDao.addStudentNum(classGroup);
|
|
|
-
|
|
|
- //2、插入关联关系
|
|
|
- ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
- classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
- classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
- classGroupStudentMapper.setUserId(studentId);
|
|
|
- classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
- classGroupStudentMapper.setGroupType(classGroup.getGroupType());
|
|
|
- classGroupStudentMapper.setCreateTime(date);
|
|
|
- classGroupStudentMapperDao.insert(classGroupStudentMapper);
|
|
|
-
|
|
|
- //3、学生加入级未开始课程
|
|
|
- List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroup.getId());
|
|
|
- for (CourseSchedule courseSchedule : courseScheduleList) {
|
|
|
- CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
|
- courseScheduleStudentPayment.setGroupType(classGroup.getGroupType());
|
|
|
- courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
- courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
- courseScheduleStudentPayment.setUserId(studentId);
|
|
|
- courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
|
|
|
- courseScheduleStudentPayment.setCreateTime(date);
|
|
|
- courseScheduleStudentPayment.setUpdateTime(date);
|
|
|
- courseScheduleStudentPayments.add(courseScheduleStudentPayment);
|
|
|
- }
|
|
|
-
|
|
|
- List<Long> courseScheduleIds = courseScheduleList.stream().map(CourseSchedule::getId).collect(Collectors.toList());
|
|
|
- //4、调整线上基础技能班未上课课酬
|
|
|
- List<ClassGroupTeacherMapper> classGroupTeachers = classGroupTeacherMapperService.getClassGroupTeachers(classGroup.getId());
|
|
|
- int hasTeacherSalaryCount = 0;
|
|
|
- if (courseScheduleIds.size() > 0) {
|
|
|
- hasTeacherSalaryCount = courseScheduleTeacherSalaryDao.getHasTeacherSalaryCount(courseScheduleIds);
|
|
|
- }
|
|
|
- if (classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) && hasTeacherSalaryCount > 0) {
|
|
|
- Integer studentNum = classGroup.getStudentNum() + 1;
|
|
|
- List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
|
|
|
- courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
|
|
|
- for (CourseSchedule courseSchedule : courseScheduleList) {
|
|
|
- for (ClassGroupTeacherMapper classGroupTeacher : classGroupTeachers) {
|
|
|
- List<TeacherDefaultMusicGroupSalary> teacherSalaryList = teacherDefaultMusicGroupSalaryService.getTeacherSalaryByUserIdAndType(classGroupTeacher.getUserId(), ClassGroupTypeEnum.HIGH_ONLINE.getCode(), null);
|
|
|
- Map<CourseSchedule.CourseScheduleType, TeacherDefaultMusicGroupSalary> collect = teacherSalaryList.stream().collect(Collectors.toMap(TeacherDefaultMusicGroupSalary::getCourseScheduleType, teacherDefaultMusicGroupSalary -> teacherDefaultMusicGroupSalary));
|
|
|
- TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = collect.get(courseSchedule.getType());
|
|
|
- BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
|
|
|
-
|
|
|
- CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
|
|
|
- courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
|
|
|
- courseScheduleTeacherSalary.setGroupType(courseSchedule.getGroupType());
|
|
|
- courseScheduleTeacherSalary.setMusicGroupId(courseSchedule.getMusicGroupId());
|
|
|
- courseScheduleTeacherSalary.setTeacherRole(classGroupTeacher.getTeacherRole());
|
|
|
- courseScheduleTeacherSalary.setUserId(classGroupTeacher.getUserId());
|
|
|
- courseScheduleTeacherSalary.setExpectSalary(salary);
|
|
|
- courseScheduleTeacherSalary.setClassGroupId(classGroup.getId());
|
|
|
- courseScheduleTeacherSalary.setCreateTime(date);
|
|
|
- courseScheduleTeacherSalary.setUpdateTime(date);
|
|
|
- courseScheduleTeacherSalaryList.add(courseScheduleTeacherSalary);
|
|
|
- }
|
|
|
- }
|
|
|
- courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList);
|
|
|
- }
|
|
|
-
|
|
|
- //5、加入班级群组
|
|
|
- ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(studentId.toString())};
|
|
|
- imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (courseScheduleStudentPayments.size() != 0) {
|
|
|
- courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
+ public boolean addStudentToClassGroupAndCourseArranging(Integer studentId, String classGroupIdListStr,
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
+
|
|
|
+ List<ClassGroup> classGroupList = classGroupDao.findClassGroupByIds(classGroupIdListStr);
|
|
|
+ if (classGroupList == null || classGroupList.size() == 0) {
|
|
|
+ throw new BizException("班级查询失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ Date date = new Date();
|
|
|
+ List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<CourseScheduleStudentPayment>();
|
|
|
+
|
|
|
+ // 计算单价
|
|
|
+ Map<CourseScheduleType, BigDecimal> unitPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
|
|
|
+ Map<CourseScheduleType, BigDecimal> OriginTotalPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
|
|
|
+ for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
+ unitPriceMap.put(
|
|
|
+ musicGroupPaymentCalenderCourseSettings.getCourseType(),
|
|
|
+ musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice().divide(
|
|
|
+ new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties())));
|
|
|
+
|
|
|
+ OriginTotalPriceMap.put(musicGroupPaymentCalenderCourseSettings.getCourseType(), musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice());
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<CourseScheduleType, BigDecimal> totalPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
|
|
|
+
|
|
|
+ BigDecimal unitPrice = new BigDecimal(0);
|
|
|
+ CourseScheduleType courseType = null;
|
|
|
+ for (ClassGroup classGroup : classGroupList) {
|
|
|
+ // 1、增加班级人数
|
|
|
+ classGroupDao.addStudentNum(classGroup);
|
|
|
+
|
|
|
+ // 2、插入关联关系
|
|
|
+ ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
+ classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
+ classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupStudentMapper.setUserId(studentId);
|
|
|
+ classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ classGroupStudentMapper.setGroupType(classGroup.getGroupType());
|
|
|
+ classGroupStudentMapper.setCreateTime(date);
|
|
|
+ classGroupStudentMapperDao.insert(classGroupStudentMapper);
|
|
|
+
|
|
|
+ // 3、学生加入级未开始课程
|
|
|
+ List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroup.getId());
|
|
|
+ for (CourseSchedule courseSchedule : courseScheduleList) {
|
|
|
+ CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
|
+ courseScheduleStudentPayment.setCourseSchedule(courseSchedule);
|
|
|
+ courseScheduleStudentPayment.setGroupType(classGroup.getGroupType());
|
|
|
+ courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
+ courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
+ courseScheduleStudentPayment.setUserId(studentId);
|
|
|
+
|
|
|
+ unitPrice = unitPriceMap.get(courseSchedule.getType());
|
|
|
+ if (unitPrice != null) {
|
|
|
+ courseType = courseSchedule.getType();
|
|
|
+ BigDecimal duration = new BigDecimal(DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime()));
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(unitPrice.multiply(duration).setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
+
|
|
|
+ if (totalPriceMap.containsKey(courseType)) {
|
|
|
+ totalPriceMap.put(courseType, totalPriceMap.get(courseType).add(courseScheduleStudentPayment.getExpectPrice()));
|
|
|
+ } else {
|
|
|
+ totalPriceMap.put(courseType, courseScheduleStudentPayment.getExpectPrice());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
|
|
|
+ courseScheduleStudentPayment.setCreateTime(date);
|
|
|
+ courseScheduleStudentPayment.setUpdateTime(date);
|
|
|
+ courseScheduleStudentPayments.add(courseScheduleStudentPayment);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 5、加入班级群组
|
|
|
+ ImGroupMember[] imGroupMembers = new ImGroupMember[] { new ImGroupMember(studentId.toString()) };
|
|
|
+ imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (courseScheduleStudentPayments.size() > 0) {
|
|
|
+ // 排序
|
|
|
+ Collections.sort(courseScheduleStudentPayments);
|
|
|
+ List<CourseScheduleType> list = new ArrayList<CourseSchedule.CourseScheduleType>();
|
|
|
+ for (CourseScheduleStudentPayment courseScheduleStudentPayment : courseScheduleStudentPayments) {
|
|
|
+ courseType = courseScheduleStudentPayment.getCourseSchedule().getType();
|
|
|
+ if (!list.contains(courseType)) {
|
|
|
+ list.add(courseType);
|
|
|
+
|
|
|
+ // 修改第一节课的金额
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(courseScheduleStudentPayment.getExpectPrice().add(
|
|
|
+ OriginTotalPriceMap.get(courseType).subtract(totalPriceMap.get(courseType))));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1717,11 +1722,24 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
//5、插入班级排课信息
|
|
|
LocalDateTime now = LocalDate.parse(classGroup4MixDtos.get(0).getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
|
|
|
|
|
+ Map<String, Integer> courseTypeMinutesMap = musicGroupPaymentCalenderCourseSettingsService.getMusicCourseSettingsWithStudents(musicGroupId, studentIdList);
|
|
|
+
|
|
|
//计算每节课的课酬
|
|
|
List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
|
|
|
List<CourseSchedule> courseScheduleList = new ArrayList<>();
|
|
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
|
|
|
+ if(!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())){
|
|
|
+ throw new BizException("{}课程类型暂无剩余课程时长", classGroup4MixDto.getCourseType().getMsg());
|
|
|
+ }
|
|
|
+ Integer totalMinutes = courseTypeMinutesMap.get(classGroup4MixDto.getCourseType().getCode());
|
|
|
+ long courseDuration = Duration.between(LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getCourseTimeDtoList().get(0).getStartClassTime() + ":00", formatter),
|
|
|
+ LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getCourseTimeDtoList().get(0).getEndClassTime() + ":00", formatter))
|
|
|
+ .toMinutes();
|
|
|
+ classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
|
|
|
+
|
|
|
int times = 0;
|
|
|
|
|
|
Set<String> holidayDays = new HashSet<>();
|
|
@@ -1732,7 +1750,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
|
|
|
}
|
|
|
}
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
WhileNode:
|
|
|
while (true) {
|
|
@@ -2008,18 +2025,32 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
classGroupTeacherMapperService.classGroupTeachersInsert(newClassGroupTeacherMapperList);
|
|
|
}
|
|
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
//2、获取班级学生
|
|
|
List<StudentRegistration> studentList = classGroupStudentMapperDao.findClassStudentList(classGroup.getId(), ClassGroupStudentStatusEnum.NORMAL);
|
|
|
|
|
|
+ List<Integer> studentIds = studentList.stream().map(StudentRegistration::getUserId).collect(Collectors.toList());
|
|
|
+
|
|
|
//3、插入班级排课信息
|
|
|
LocalDateTime now = LocalDate.parse(classGroup4MixDtos.get(0).getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
|
|
|
|
|
+ Map<String, Integer> courseTypeMinutesMap = musicGroupPaymentCalenderCourseSettingsService.getMusicCourseSettingsWithStudents(musicGroupId, studentIds);
|
|
|
+
|
|
|
//计算每节课的课酬
|
|
|
List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
|
|
|
List<CourseSchedule> courseScheduleList = new ArrayList<>();
|
|
|
|
|
|
for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
|
|
|
+ if(!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())){
|
|
|
+ throw new BizException("{}课程类型暂无剩余课程时长", classGroup4MixDto.getCourseType().getMsg());
|
|
|
+ }
|
|
|
+ Integer totalMinutes = courseTypeMinutesMap.get(classGroup4MixDto.getCourseType().getCode());
|
|
|
+ long courseDuration = Duration.between(LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getCourseTimeDtoList().get(0).getStartClassTime() + ":00", formatter),
|
|
|
+ LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getCourseTimeDtoList().get(0).getEndClassTime() + ":00", formatter))
|
|
|
+ .toMinutes();
|
|
|
+ classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
|
|
|
+
|
|
|
int times = 0;
|
|
|
Set<String> holidayDays = new HashSet<>();
|
|
|
if (classGroup4MixDto.getHoliday()) {
|
|
@@ -2028,7 +2059,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
|
|
|
}
|
|
|
}
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
WhileNode:
|
|
|
while (true) {
|
|
@@ -2191,7 +2221,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(studentList)) {
|
|
|
- List<Integer> studentIds = studentList.stream().map(StudentRegistration::getUserId).collect(Collectors.toList());
|
|
|
studentDao.updateStudentServiceTag(null, studentIds, YesOrNoEnum.YES.getCode());
|
|
|
|
|
|
//学生结算表
|
|
@@ -2291,11 +2320,23 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
//5、插入班级排课信息
|
|
|
LocalDateTime now = LocalDate.parse(classGroup4MixDtos.get(0).getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
|
|
|
|
|
+ Map<String, Integer> courseTypeMinutesMap = musicGroupPaymentCalenderCourseSettingsService.getMusicCourseSettingsWithStudents(musicGroupId, studentIdList);
|
|
|
+
|
|
|
//计算每节课的课酬
|
|
|
List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
|
|
|
List<CourseSchedule> courseScheduleList = new ArrayList<>();
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
|
|
|
+ if(!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())){
|
|
|
+ throw new BizException("{}课程类型暂无剩余课程时长", classGroup4MixDto.getCourseType().getMsg());
|
|
|
+ }
|
|
|
+ Integer totalMinutes = courseTypeMinutesMap.get(classGroup4MixDto.getCourseType().getCode());
|
|
|
+ long courseDuration = Duration.between(LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getCourseTimeDtoList().get(0).getStartClassTime() + ":00", formatter),
|
|
|
+ LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getCourseTimeDtoList().get(0).getEndClassTime() + ":00", formatter))
|
|
|
+ .toMinutes();
|
|
|
+ classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
|
|
|
+
|
|
|
int times = 0;
|
|
|
Set<String> holidayDays = new HashSet<>();
|
|
|
if (classGroup4MixDto.getHoliday()) {
|
|
@@ -2304,7 +2345,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
|
|
|
}
|
|
|
}
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
WhileNode:
|
|
|
while (true) {
|