|
@@ -391,8 +391,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
public void createForMusicGroup(String musicGroupId, List<CourseSchedule> courseSchedules, List<Integer> studentIds) {
|
|
|
Map<Integer, List<CourseSchedule>> memberCourseMap = courseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getMemberFlag));
|
|
|
- List<Long> operatingCourse = new ArrayList<>();
|
|
|
- Long calenderId = null;
|
|
|
+ Map<Long,List<Long>> courseCalenderMap = new HashMap<>(10);
|
|
|
for (Integer memberFlag : memberCourseMap.keySet()) {
|
|
|
List<CourseSchedule> courseScheduleList = memberCourseMap.get(memberFlag);
|
|
|
if(courseScheduleList != null && courseScheduleList.size() > 0){
|
|
@@ -462,10 +461,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
CourseScheduleStudentPayment cssp = this.init(courseSchedule);
|
|
|
cssp.setUserId(studentId);
|
|
|
//扣除可排课时长
|
|
|
- if(this.calcCourseMinutes(musicGroupPaymentStudentCourseDetails,courseDuration,cssp,musicGroupPaymentCalenders)){
|
|
|
- //课程是否需要标记为云教练赠送
|
|
|
- operatingCourse.add(courseSchedule.getId());
|
|
|
- }
|
|
|
+ //处理经营报表
|
|
|
+ this.calcCourseMinutes(musicGroupPaymentStudentCourseDetails,courseDuration,cssp,musicGroupPaymentCalenders,courseCalenderMap);
|
|
|
typeCourseStudentPayments.add(cssp);
|
|
|
}
|
|
|
courseScheduleStudentPayments.addAll(typeCourseStudentPayments);
|
|
@@ -476,15 +473,19 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(!CollectionUtils.isEmpty(operatingCourse)){
|
|
|
- operatingReportCloudService.updateSet(calenderId,operatingCourse);
|
|
|
+ if(!CollectionUtils.isEmpty(courseCalenderMap)){
|
|
|
+ for (Long calenderId : courseCalenderMap.keySet()) {
|
|
|
+ List<Long> courseIds = courseCalenderMap.get(calenderId);
|
|
|
+ operatingReportCloudService.updateSet(calenderId,courseIds);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private Boolean calcCourseMinutes(List<MusicGroupPaymentStudentCourseDetail> courseDetails,
|
|
|
Integer courseDuration,
|
|
|
CourseScheduleStudentPayment studentPayment,
|
|
|
- List<MusicGroupPaymentCalender> musicGroupPaymentCalenders){
|
|
|
+ List<MusicGroupPaymentCalender> musicGroupPaymentCalenders,
|
|
|
+ Map<Long,List<Long>> courseCalenderMap){
|
|
|
Boolean result = true;
|
|
|
Integer courseMinutes = courseDuration;
|
|
|
Map<Long, List<MusicGroupPaymentCalender>> calenderMap = musicGroupPaymentCalenders.stream().collect(Collectors.groupingBy(MusicGroupPaymentCalender::getId));
|
|
@@ -526,6 +527,17 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
if(MusicGroupPaymentCalender.PayUserType.SCHOOL.equals(calender.getPayUserType())){
|
|
|
studentPayment.setExpectPrice(BigDecimal.ZERO);
|
|
|
}
|
|
|
+ //处理经营报表缴费项目相关数据,线上存在问题,先让用户排课
|
|
|
+ if(result){
|
|
|
+ List<Long> courseIds = courseCalenderMap.get(calender.getId());
|
|
|
+ if(CollectionUtils.isEmpty(courseIds)){
|
|
|
+ courseIds = new ArrayList<>();
|
|
|
+ }
|
|
|
+ courseIds.add(studentPayment.getCourseScheduleId());
|
|
|
+// ArrayList<Long> courseIds = new ArrayList<>();
|
|
|
+// courseIds.add(studentPayment.getCourseScheduleId());
|
|
|
+// operatingReportCloudService.updateSet(calender,courseIds);
|
|
|
+ }
|
|
|
if(courseMinutes == 0){
|
|
|
return result;
|
|
|
}
|