|
@@ -19,6 +19,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
import com.ym.mec.im.ImFeignService;
|
|
import com.ym.mec.im.ImFeignService;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
|
|
|
|
|
+import com.ym.mec.util.date.DateUtil;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -26,6 +27,8 @@ import org.springframework.transaction.annotation.Propagation;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.text.ParseException;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -110,7 +113,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
List<SubjectRegisterDto> subjectRegisters = subFeeSettingDto.getSubjectRegisters();
|
|
List<SubjectRegisterDto> subjectRegisters = subFeeSettingDto.getSubjectRegisters();
|
|
String musicGroupId = idGeneratorService.generatorId() + "";
|
|
String musicGroupId = idGeneratorService.generatorId() + "";
|
|
musicGroup.setId(musicGroupId);
|
|
musicGroup.setId(musicGroupId);
|
|
- musicGroup.setStatus(MusicGroupStatusEnum.PREPARE);
|
|
|
|
|
|
+ musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
|
|
// 保存乐团基本信息
|
|
// 保存乐团基本信息
|
|
musicGroupDao.insert(musicGroup);
|
|
musicGroupDao.insert(musicGroup);
|
|
// 保存乐团付费主体列表
|
|
// 保存乐团付费主体列表
|
|
@@ -124,29 +127,28 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
musicGroupPaymentCalenderDao.batchAdd(months,musicGroupId);
|
|
musicGroupPaymentCalenderDao.batchAdd(months,musicGroupId);
|
|
}
|
|
}
|
|
// 保存乐团声部规划
|
|
// 保存乐团声部规划
|
|
- if (musicGroupSubjectPlans == null) {
|
|
|
|
- musicGroupSubjectPlans = new ArrayList<>();
|
|
|
|
|
|
+ if (musicGroupSubjectPlans != null) {
|
|
|
|
+ musicGroupSubjectPlanDao.batchAdd(musicGroupSubjectPlans,musicGroupId);
|
|
}
|
|
}
|
|
- musicGroupSubjectPlans.forEach(e -> {
|
|
|
|
- e.setMusicGroupId(musicGroupId);
|
|
|
|
- musicGroupSubjectPlanDao.insert(e);
|
|
|
|
- });
|
|
|
|
|
|
+// musicGroupSubjectPlans.forEach(e -> {
|
|
|
|
+// e.setMusicGroupId(musicGroupId);
|
|
|
|
+// musicGroupSubjectPlanDao.insert(e);
|
|
|
|
+// });
|
|
//乐团科目学生
|
|
//乐团科目学生
|
|
if (subjectRegisters != null) {
|
|
if (subjectRegisters != null) {
|
|
List<StudentRegistration> studentRegistrationList = new ArrayList<>();
|
|
List<StudentRegistration> studentRegistrationList = new ArrayList<>();
|
|
subjectRegisters.forEach(e -> {
|
|
subjectRegisters.forEach(e -> {
|
|
- //原来乐团的注册学生
|
|
|
|
- List<StudentRegistration> musicGroupStudentRegistrationList = studentRegistrationService.findStudentListByIdList(e.getRegisterIdList());
|
|
|
|
- for (StudentRegistration studentRegistration : musicGroupStudentRegistrationList) {
|
|
|
|
- studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
|
- studentRegistration.setPaymentStatus(PaymentStatusEnum.NO);
|
|
|
|
- studentRegistration.setMusicGroupId(musicGroupId);
|
|
|
|
- studentRegistration.setSubjectId(e.getSubjectId());
|
|
|
|
- studentRegistration.setActualSubjectId(e.getSubjectId());
|
|
|
|
- }
|
|
|
|
- studentRegistrationList.addAll(musicGroupStudentRegistrationList);
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
|
|
+ //原来乐团的注册学生
|
|
|
|
+ List<StudentRegistration> musicGroupStudentRegistrationList = studentRegistrationService.findStudentListByIdList(e.getRegisterIdList());
|
|
|
|
+ for (StudentRegistration studentRegistration : musicGroupStudentRegistrationList) {
|
|
|
|
+ studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
|
+ studentRegistration.setPaymentStatus(PaymentStatusEnum.NO);
|
|
|
|
+ studentRegistration.setMusicGroupId(musicGroupId);
|
|
|
|
+ studentRegistration.setSubjectId(e.getSubjectId());
|
|
|
|
+ studentRegistration.setActualSubjectId(e.getSubjectId());
|
|
|
|
+ }
|
|
|
|
+ studentRegistrationList.addAll(musicGroupStudentRegistrationList);
|
|
|
|
+ });
|
|
studentRegistrationService.batchInsert(studentRegistrationList);
|
|
studentRegistrationService.batchInsert(studentRegistrationList);
|
|
}
|
|
}
|
|
// 保存乐团声部商品规划
|
|
// 保存乐团声部商品规划
|
|
@@ -568,11 +570,46 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
- public void updateBaseInfo(SubFeeSettingDto subFeeSettingDto) {
|
|
|
|
|
|
+ public void updateBaseInfo(SubFeeSettingDto subFeeSettingDto) throws Exception {
|
|
MusicGroup musicGroup = subFeeSettingDto.getMusicGroup();
|
|
MusicGroup musicGroup = subFeeSettingDto.getMusicGroup();
|
|
String musicGroupId = musicGroup.getId();
|
|
String musicGroupId = musicGroup.getId();
|
|
MusicGroup group = musicGroupDao.get(musicGroupId);
|
|
MusicGroup group = musicGroupDao.get(musicGroupId);
|
|
if(group != null){
|
|
if(group != null){
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ List<Integer> months = subFeeSettingDto.getMonths();
|
|
|
|
+ //删除乐团相关付费周期
|
|
|
|
+ musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
|
|
|
|
+ if(months != null && months.size() > 0){
|
|
|
|
+ Integer num = musicGroupStudentFeeDao.countStudentNoPayNum(musicGroupId);
|
|
|
|
+ if(num > 0){
|
|
|
|
+ throw new Exception("缴费周期更新失败,当前乐团有未缴费的学员");
|
|
|
|
+ }
|
|
|
|
+ //修改学员下次缴费日期
|
|
|
|
+ //获取当前月份
|
|
|
|
+ int currentMonth = Integer.parseInt(DateUtil.getMonth(date));
|
|
|
|
+ int nextMonth = currentMonth;
|
|
|
|
+ for (int i = 0;i < months.size();i++){
|
|
|
|
+ if(i == months.size()-1 && months.get(i) <= currentMonth){
|
|
|
|
+ nextMonth = months.get(0);
|
|
|
|
+ break;
|
|
|
|
+ }else if(months.get(i) > currentMonth){
|
|
|
|
+ nextMonth = months.get(i);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 修改学员付费周期
|
|
|
|
+ Date nextPaymentDate = null;
|
|
|
|
+ if(nextMonth > currentMonth){
|
|
|
|
+ nextPaymentDate = DateUtil.addMonths(date, nextMonth - currentMonth);
|
|
|
|
+ }else if(nextMonth < currentMonth) {
|
|
|
|
+ nextPaymentDate = DateUtil.addMonths(date, 12 - currentMonth + nextMonth);
|
|
|
|
+ }else {
|
|
|
|
+ nextPaymentDate = DateUtil.addMonths(date, 12);
|
|
|
|
+ }
|
|
|
|
+ musicGroupStudentFeeDao.updateNextPaymentDate(musicGroupId,nextPaymentDate);
|
|
|
|
+ //批量插入
|
|
|
|
+ musicGroupPaymentCalenderDao.batchAdd(months,musicGroupId);
|
|
|
|
+ }
|
|
musicGroupDao.update(musicGroup);
|
|
musicGroupDao.update(musicGroup);
|
|
//修改课程里面的教学点
|
|
//修改课程里面的教学点
|
|
if(!group.getSchoolId().equals(musicGroup.getSchoolId())){
|
|
if(!group.getSchoolId().equals(musicGroup.getSchoolId())){
|
|
@@ -581,14 +618,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
// 删除乐团付费主体列表
|
|
// 删除乐团付费主体列表
|
|
musicGroupPaymentEntitiesDao.delByGroupId(musicGroupId);
|
|
musicGroupPaymentEntitiesDao.delByGroupId(musicGroupId);
|
|
//批量新增
|
|
//批量新增
|
|
- musicGroupPaymentEntitiesDao.batchAdd(subFeeSettingDto.getMusicGroupPaymentEntities(),musicGroupId);
|
|
|
|
-
|
|
|
|
- // 修改学员付费周期
|
|
|
|
- List<Integer> calender = subFeeSettingDto.getMonths();
|
|
|
|
- //删除乐团相关付费周期
|
|
|
|
- musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
|
|
|
|
- //批量插入
|
|
|
|
- musicGroupPaymentCalenderDao.batchAdd(calender,musicGroupId);
|
|
|
|
|
|
+ if(subFeeSettingDto.getMusicGroupPaymentEntities() != null){
|
|
|
|
+ musicGroupPaymentEntitiesDao.batchAdd(subFeeSettingDto.getMusicGroupPaymentEntities(),musicGroupId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|