|
@@ -17,6 +17,7 @@ import java.util.stream.Collectors;
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -59,21 +60,6 @@ import com.ym.mec.biz.dal.entity.Subject;
|
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccount;
|
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
|
|
|
import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
|
|
|
-import com.ym.mec.biz.service.ClassGroupRelationService;
|
|
|
-import com.ym.mec.biz.service.ClassGroupService;
|
|
|
-import com.ym.mec.biz.service.ClassGroupStudentMapperService;
|
|
|
-import com.ym.mec.biz.service.ContractService;
|
|
|
-import com.ym.mec.biz.service.CourseScheduleService;
|
|
|
-import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
|
|
|
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
|
|
|
-import com.ym.mec.biz.service.StudentPaymentOrderService;
|
|
|
-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.SysMessageService;
|
|
|
-import com.ym.mec.biz.service.SysUserCashAccountDetailService;
|
|
|
-import com.ym.mec.biz.service.SysUserCashAccountService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.entity.ImGroupMember;
|
|
|
import com.ym.mec.common.entity.ImGroupModel;
|
|
@@ -129,6 +115,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
@Autowired
|
|
|
private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
|
|
|
@Autowired
|
|
|
+ private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
|
|
|
+ @Autowired
|
|
|
private SubjectService subjectService;
|
|
|
@Autowired
|
|
|
private SysConfigDao sysConfigDao;
|
|
@@ -592,19 +580,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//添加班级关联
|
|
|
addStudents(classGroup, userId);
|
|
|
Date date = new Date();
|
|
|
- //获取当前月
|
|
|
- Integer month = Integer.parseInt(DateUtil.getMonth(date));
|
|
|
- //获取下次缴费月份
|
|
|
- List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
|
|
|
- List<Integer> months = musicGroupPaymentCalenders.stream().map(e -> e.getPaymentMonth()).collect(Collectors.toList());
|
|
|
- for (int i = 0; i < months.size(); i++) {
|
|
|
- if (months.get(i).equals(month)) {
|
|
|
- month = i == months.size() - 1 ? months.get(0) : months.get(i + 1);
|
|
|
- }
|
|
|
- }
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.add(Calendar.MONTH, month);
|
|
|
- DateUtil.getFirstDayOfMonth(calendar.getTime());
|
|
|
//保存乐团学生费用表
|
|
|
if (studentAddDto.getCourseFee() == null) {
|
|
|
MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, studentRegistration.getActualSubjectId());
|
|
@@ -612,7 +587,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
musicGroupStudentFeeDao.insert(new MusicGroupStudentFee(musicGroupId,
|
|
|
userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
|
|
|
- DateUtil.getFirstDayOfMonth(calendar.getTime()), studentAddDto.getTemporaryCourseFee()));
|
|
|
+ musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId), studentAddDto.getTemporaryCourseFee()));
|
|
|
//生成订单
|
|
|
StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
|
studentPaymentOrder.setUserId(userId);
|
|
@@ -798,19 +773,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//添加学生
|
|
|
//classGroupStudentMapperService.addStudents(waitPayOrder.getClassGroupId(), studentRegistration.getUserId().toString(), GroupType.MUSIC);
|
|
|
} else {
|
|
|
- //获取当前月
|
|
|
- Integer month = Integer.parseInt(DateUtil.getMonth(nowDate));
|
|
|
- //获取下次缴费月份
|
|
|
- List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(studentRegistration.getMusicGroupId());
|
|
|
- List<Integer> months = musicGroupPaymentCalenders.stream().map(e -> e.getPaymentMonth()).collect(Collectors.toList());
|
|
|
- for (int i = 0; i < months.size(); i++) {
|
|
|
- if (months.get(i).equals(month)) {
|
|
|
- month = i == months.size() - 1 ? months.get(0) : months.get(i + 1);
|
|
|
- }
|
|
|
- }
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.add(Calendar.MONTH, month);
|
|
|
-
|
|
|
//加入缴费周期
|
|
|
MusicGroupStudentFee musicGroupStudentFee = new MusicGroupStudentFee();
|
|
|
musicGroupStudentFee.setMusicGroupId(studentRegistration.getMusicGroupId());
|
|
@@ -818,7 +780,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
musicGroupStudentFee.setCourseFee(musicOneSubjectClassPlan.getFee());
|
|
|
musicGroupStudentFee.setCreateTime(nowDate);
|
|
|
musicGroupStudentFee.setUpdateTime(nowDate);
|
|
|
- musicGroupStudentFee.setNextPaymentDate(DateUtil.getFirstDayOfMonth(calendar.getTime()));
|
|
|
+ musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(studentRegistration.getMusicGroupId()));
|
|
|
musicGroupStudentFee.setLatestPaidTime(nowDate);
|
|
|
musicGroupStudentFee.setSubjectId(studentRegistration.getActualSubjectId());
|
|
|
musicGroupStudentFee.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
|