|
@@ -123,6 +123,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
private StudentRegistrationDao studentRegistrationDao;
|
|
|
@Autowired
|
|
|
private GroupEventSource groupEventSource;
|
|
|
+ @Autowired
|
|
|
+ private MemberFeeSettingDao memberFeeSettingDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
|
|
@@ -200,73 +202,101 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
// 获取设置的课程
|
|
|
List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalenderDto
|
|
|
.getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
- if (musicGroupPaymentCalenderCourseSettingsList == null) {
|
|
|
- musicGroupPaymentCalenderCourseSettingsList = new ArrayList<>();
|
|
|
- }
|
|
|
-
|
|
|
- // 必须课程缴费金额为0时,报名、续费不能建多期
|
|
|
- if(paymentType == MUSIC_APPLY || paymentType == MUSIC_RENEW){
|
|
|
- BigDecimal noOptionalCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream()
|
|
|
- .filter(e -> !e.getIsStudentOptional()).map(MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice)
|
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- if(noOptionalCoursePrice.compareTo(BigDecimal.ZERO) <= 0 && musicGroupPaymentDateRangeList.size() > 1){
|
|
|
- throw new BizException("必选课程缴费金额为0时不支持多周期缴费");
|
|
|
+// if (musicGroupPaymentCalenderCourseSettingsList == null) {
|
|
|
+// musicGroupPaymentCalenderCourseSettingsList = new ArrayList<>();
|
|
|
+// }
|
|
|
+
|
|
|
+ if(musicGroupPaymentCalenderCourseSettingsList != null){
|
|
|
+ // 必须课程缴费金额为0时,报名、续费不能建多期
|
|
|
+ if(paymentType == MUSIC_APPLY || paymentType == MUSIC_RENEW){
|
|
|
+ BigDecimal noOptionalCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream()
|
|
|
+ .filter(e -> !e.getIsStudentOptional()).map(MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if(noOptionalCoursePrice.compareTo(BigDecimal.ZERO) <= 0 && musicGroupPaymentDateRangeList.size() > 1){
|
|
|
+ throw new BizException("必选课程缴费金额为0时不支持多周期缴费");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (payUserType == SCHOOL) {
|
|
|
status = AUDITING;
|
|
|
} else {
|
|
|
- if (paymentType == MUSIC_APPLY || paymentType == MUSIC_RENEW) {
|
|
|
- // 当前缴费的课程费用
|
|
|
- Map<CourseScheduleType, BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(
|
|
|
- Collectors
|
|
|
- .toMap(MusicGroupPaymentCalenderCourseSettings::getCourseType, MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice));
|
|
|
-
|
|
|
- // 查询默认课程费用
|
|
|
- Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId();
|
|
|
- Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao
|
|
|
- .queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId)
|
|
|
- .stream()
|
|
|
- .collect(
|
|
|
- Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail::getCourseType,
|
|
|
- MusicGroupOrganizationCourseSettingsDetail::getCourseCurrentPrice));
|
|
|
-
|
|
|
- // 相同类型的课程如果修改了课程费用,需要走审批
|
|
|
- for (Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()) {
|
|
|
- if (defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0) {
|
|
|
- status = AUDITING;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (paymentType == PaymentType.ADD_COURSE || paymentType == PaymentType.ADD_STUDENT) {
|
|
|
- PaymentCalenderStatusEnum dtoStatus = musicGroupPaymentCalenderDto.getStatus();
|
|
|
- if(dtoStatus != null && dtoStatus == AUDITING){
|
|
|
- status = AUDITING;
|
|
|
- }else {
|
|
|
- // 如果是临时加课,判断是否审核
|
|
|
- for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
- OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
|
|
|
- musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
|
|
|
- if (defaultUnitPrice == null) {
|
|
|
- throw new BizException("请先设置分部课程类型单价");
|
|
|
+ if(musicGroupPaymentCalenderCourseSettingsList != null){
|
|
|
+ if (paymentType == MUSIC_APPLY || paymentType == MUSIC_RENEW) {
|
|
|
+ // 当前缴费的课程费用
|
|
|
+ Map<CourseScheduleType, BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(
|
|
|
+ Collectors
|
|
|
+ .toMap(MusicGroupPaymentCalenderCourseSettings::getCourseType, MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice));
|
|
|
+
|
|
|
+ // 查询默认课程费用
|
|
|
+ Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId();
|
|
|
+ Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao
|
|
|
+ .queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId)
|
|
|
+ .stream()
|
|
|
+ .collect(
|
|
|
+ Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail::getCourseType,
|
|
|
+ MusicGroupOrganizationCourseSettingsDetail::getCourseCurrentPrice));
|
|
|
+
|
|
|
+ // 相同类型的课程如果修改了课程费用,需要走审批
|
|
|
+ for (Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()) {
|
|
|
+ if (defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0) {
|
|
|
+ status = AUDITING;
|
|
|
+ break;
|
|
|
}
|
|
|
- if (courseSettings.getCourseTotalMinuties() != 0) {
|
|
|
-
|
|
|
- if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties())).setScale(0, BigDecimal.ROUND_HALF_UP)
|
|
|
- .compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
|
|
|
+ }
|
|
|
+ } else if (paymentType == PaymentType.ADD_COURSE || paymentType == PaymentType.ADD_STUDENT) {
|
|
|
+ PaymentCalenderStatusEnum dtoStatus = musicGroupPaymentCalenderDto.getStatus();
|
|
|
+ if(dtoStatus != null && dtoStatus == AUDITING){
|
|
|
+ status = AUDITING;
|
|
|
+ }else {
|
|
|
+ // 如果是临时加课,判断是否审核
|
|
|
+ for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
+ OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
|
|
|
+ musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
|
|
|
+ if (defaultUnitPrice == null) {
|
|
|
+ throw new BizException("请先设置分部课程类型单价");
|
|
|
+ }
|
|
|
+ if (courseSettings.getCourseTotalMinuties() != 0) {
|
|
|
+
|
|
|
+ if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties())).setScale(0, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
|
|
|
|
|
|
+ status = AUDITING;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
status = AUDITING;
|
|
|
break;
|
|
|
}
|
|
|
- } else {
|
|
|
- status = AUDITING;
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
+ }else if(paymentType == SPAN_GROUP_CLASS_ADJUST){
|
|
|
+ status = musicGroupPaymentCalenderDto.getStatus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(status != AUDITING && musicGroupPaymentCalenderDto.getMemberRankSettingId() != null){
|
|
|
+ //会员价格是否变动
|
|
|
+ MemberFeeSetting memberFee = memberFeeSettingDao.findByRankIdAndOrganId(musicGroup.getOrganId(), musicGroupPaymentCalenderDto.getMemberRankSettingId());
|
|
|
+ if(memberFee == null){
|
|
|
+ throw new BizException("操作失败:请配置当前分部会员收费标准");
|
|
|
+ }
|
|
|
+ BigDecimal memberPaymentAmount;
|
|
|
+ switch (musicGroupPaymentCalenderDto.getMemberValidDate()){
|
|
|
+ case 1 :
|
|
|
+ memberPaymentAmount = memberFee.getCurrentMonthFee();
|
|
|
+ break;
|
|
|
+ case 6 :
|
|
|
+ memberPaymentAmount = memberFee.getCurrentHalfYearFee();
|
|
|
+ break;
|
|
|
+ case 12 :
|
|
|
+ memberPaymentAmount = memberFee.getCurrentYearFee();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("请选择正确的会员有效期");
|
|
|
+ }
|
|
|
+ if(memberPaymentAmount.compareTo(musicGroupPaymentCalenderDto.getMemberPaymentAmount()) != 0){
|
|
|
+ status = AUDITING;
|
|
|
}
|
|
|
- }else if(paymentType == SPAN_GROUP_CLASS_ADJUST){
|
|
|
- status = musicGroupPaymentCalenderDto.getStatus();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -294,48 +324,47 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
musicGroupPaymentCalender.setMusicGroupId(musicGroupId);
|
|
|
musicGroupPaymentCalender.setMusicGroupOrganizationCourseSettingId(musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId());
|
|
|
|
|
|
- List<MusicGroupPaymentCalenderCourseSettings> newCSList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>(
|
|
|
- musicGroupPaymentCalenderCourseSettingsList.size());
|
|
|
-
|
|
|
BigDecimal totalPaymentAmount = musicGroupPaymentCalenderDto.getMasterTotalPrice();
|
|
|
- for (MusicGroupPaymentCalenderCourseSettings pccs : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
-
|
|
|
- MusicGroupPaymentCalenderCourseSettings tempPccs = new MusicGroupPaymentCalenderCourseSettings();
|
|
|
- try {
|
|
|
- BeanUtils.copyProperties(tempPccs, pccs);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new BizException("克隆对象出错", e);
|
|
|
- }
|
|
|
- if (i == 0) {
|
|
|
- if (pccs.getIsStudentOptional()) {
|
|
|
- tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice());
|
|
|
- tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice());
|
|
|
- tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties());
|
|
|
- } else {
|
|
|
- tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
|
|
|
- pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
- .setScale(0, BigDecimal.ROUND_DOWN)));
|
|
|
- tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
|
|
|
- pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
- .setScale(0, BigDecimal.ROUND_DOWN)));
|
|
|
- tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
|
|
|
+ if(musicGroupPaymentCalenderCourseSettingsList != null){
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> newCSList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>(
|
|
|
+ musicGroupPaymentCalenderCourseSettingsList.size());
|
|
|
+ for (MusicGroupPaymentCalenderCourseSettings pccs : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
+
|
|
|
+ MusicGroupPaymentCalenderCourseSettings tempPccs = new MusicGroupPaymentCalenderCourseSettings();
|
|
|
+ try {
|
|
|
+ BeanUtils.copyProperties(tempPccs, pccs);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BizException("克隆对象出错", e);
|
|
|
}
|
|
|
- } else {
|
|
|
- if (!pccs.getIsStudentOptional()) {
|
|
|
- tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
|
|
|
- tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
|
|
|
- tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
|
|
|
+ if (i == 0) {
|
|
|
+ if (pccs.getIsStudentOptional()) {
|
|
|
+ tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice());
|
|
|
+ tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice());
|
|
|
+ tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties());
|
|
|
+ } else {
|
|
|
+ tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
|
|
|
+ pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
+ .setScale(0, BigDecimal.ROUND_DOWN)));
|
|
|
+ tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
|
|
|
+ pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
+ .setScale(0, BigDecimal.ROUND_DOWN)));
|
|
|
+ tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
|
|
|
+ }
|
|
|
} else {
|
|
|
- continue;
|
|
|
+ if (!pccs.getIsStudentOptional()) {
|
|
|
+ tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
|
|
|
+ tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
|
|
|
+ tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
+ totalPaymentAmount = totalPaymentAmount.add(tempPccs.getCourseCurrentPrice());
|
|
|
+ newCSList.add(tempPccs);
|
|
|
}
|
|
|
- totalPaymentAmount = totalPaymentAmount.add(tempPccs.getCourseCurrentPrice());
|
|
|
- newCSList.add(tempPccs);
|
|
|
+ musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
|
|
|
}
|
|
|
-
|
|
|
- musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
|
|
|
musicGroupPaymentCalender.setPaymentAmount(totalPaymentAmount);
|
|
|
-
|
|
|
musicGroupPaymentCalender.setPaymentPattern(musicGroupPaymentCalenderDto.getPaymentPattern());
|
|
|
musicGroupPaymentCalender.setPaymentValidEndDate(musicGroupPaymentDateRange.getPaymentValidEndDate());
|
|
|
musicGroupPaymentCalender.setPaymentValidStartDate(musicGroupPaymentDateRange.getPaymentValidStartDate());
|
|
@@ -387,6 +416,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
|
|
|
// 设置批次号
|
|
|
musicGroupPaymentCalender.setBatchNo(batchNo);
|
|
|
+ musicGroupPaymentCalender.setMemberPaymentAmount(musicGroupPaymentCalenderDto.getMemberPaymentAmount());
|
|
|
+ musicGroupPaymentCalender.setMemberRankSettingId(musicGroupPaymentCalenderDto.getMemberRankSettingId());
|
|
|
+ musicGroupPaymentCalender.setMemberValidDate(musicGroupPaymentCalenderDto.getMemberValidDate());
|
|
|
musicGroupPaymentCalenderDto.setBatchNo(batchNo);
|
|
|
musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
|
|
|
|
|
@@ -394,7 +426,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
List<MusicGroupPaymentCalenderCourseSettings> currentMusicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalender
|
|
|
.getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
|
|
|
- if (currentMusicGroupPaymentCalenderCourseSettings.size() > 0) {
|
|
|
+ if (currentMusicGroupPaymentCalenderCourseSettings != null && currentMusicGroupPaymentCalenderCourseSettings.size() > 0) {
|
|
|
MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsDao.get(musicGroupPaymentCalender
|
|
|
.getMusicGroupOrganizationCourseSettingId());
|
|
|
for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : currentMusicGroupPaymentCalenderCourseSettings) {
|
|
@@ -417,7 +449,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if (musicGroupPaymentCalender.getStatus() != AUDITING) {
|
|
|
// 如果是进行中加学生
|
|
|
if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
|
|
|
- addStudent(musicGroupPaymentCalender, currentMusicGroupPaymentCalenderCourseSettings);
|
|
|
+ addStudent(musicGroupPaymentCalender, currentMusicGroupPaymentCalenderCourseSettings,musicGroup);
|
|
|
}else if(musicGroupPaymentCalender.getPaymentType() == SPAN_GROUP_CLASS_ADJUST){
|
|
|
//如果是跨团班级合并,添加学员
|
|
|
musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender,musicGroupPaymentCalenderStudentDetails);
|
|
@@ -425,7 +457,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
//缴费项目添加学员
|
|
|
int[] ints = Arrays.stream(musicGroupPaymentCalenderDto.getStudentIds().split(",")).mapToInt(Integer::parseInt).toArray();
|
|
|
Set<Integer> list2 = Arrays.stream(ints).boxed().collect(Collectors.toSet());
|
|
|
- musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender.getId(),list2);
|
|
|
+ musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender.getId(),list2,musicGroup);
|
|
|
}
|
|
|
//将0元未缴费学员缴费状态更新为已缴费
|
|
|
int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
|
|
@@ -454,7 +486,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
String classGroupIdStr = musicGroupPaymentCalenderDto.getAttribute1();
|
|
|
if (StringUtils.isNotBlank(classGroupIdStr)) {
|
|
|
classGroupService.addStudentToClassGroupAndCourseArranging(Integer.parseInt(musicGroupPaymentCalenderDto.getStudentIds()), classGroupIdStr,
|
|
|
- batchNo, musicGroupPaymentCalenderCourseSettingsList);
|
|
|
+ batchNo, musicGroupPaymentCalenderCourseSettingsList,musicGroup);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -541,87 +573,113 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
// 获取设置的课程
|
|
|
List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalenderDto
|
|
|
.getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
- if (musicGroupPaymentCalenderCourseSettingsList == null) {
|
|
|
- musicGroupPaymentCalenderCourseSettingsList = new ArrayList<>();
|
|
|
- }
|
|
|
+// if (musicGroupPaymentCalenderCourseSettingsList == null) {
|
|
|
+// musicGroupPaymentCalenderCourseSettingsList = new ArrayList<>();
|
|
|
+// }
|
|
|
|
|
|
if (payUserType == SCHOOL) {
|
|
|
status = AUDITING;
|
|
|
} else {
|
|
|
- if (paymentType == MUSIC_APPLY || paymentType == MUSIC_RENEW) {
|
|
|
- // 当前缴费的课程费用
|
|
|
- Map<CourseScheduleType, BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(
|
|
|
- Collectors
|
|
|
- .toMap(MusicGroupPaymentCalenderCourseSettings::getCourseType, MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice));
|
|
|
-
|
|
|
- // 查询默认课程费用
|
|
|
- Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId();
|
|
|
- Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao
|
|
|
- .queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId)
|
|
|
- .stream()
|
|
|
- .collect(
|
|
|
- Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail::getCourseType,
|
|
|
- MusicGroupOrganizationCourseSettingsDetail::getCourseCurrentPrice));
|
|
|
-
|
|
|
- // 相同类型的课程如果修改了课程费用,需要走审批
|
|
|
- for (Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()) {
|
|
|
- if (defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0) {
|
|
|
- status = AUDITING;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (paymentType == PaymentType.ADD_COURSE || paymentType == PaymentType.ADD_STUDENT) {
|
|
|
- // 如果是临时加课,判断是否审核
|
|
|
- for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
- OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
|
|
|
- musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
|
|
|
- if (defaultUnitPrice == null) {
|
|
|
- throw new BizException("请先设置分部课程类型单价");
|
|
|
+ if(musicGroupPaymentCalenderCourseSettingsList != null){
|
|
|
+ if (paymentType == MUSIC_APPLY || paymentType == MUSIC_RENEW) {
|
|
|
+ // 当前缴费的课程费用
|
|
|
+ Map<CourseScheduleType, BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(
|
|
|
+ Collectors
|
|
|
+ .toMap(MusicGroupPaymentCalenderCourseSettings::getCourseType, MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice));
|
|
|
+
|
|
|
+ // 查询默认课程费用
|
|
|
+ Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId();
|
|
|
+ Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao
|
|
|
+ .queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId)
|
|
|
+ .stream()
|
|
|
+ .collect(
|
|
|
+ Collectors.toMap(MusicGroupOrganizationCourseSettingsDetail::getCourseType,
|
|
|
+ MusicGroupOrganizationCourseSettingsDetail::getCourseCurrentPrice));
|
|
|
+
|
|
|
+ // 相同类型的课程如果修改了课程费用,需要走审批
|
|
|
+ for (Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()) {
|
|
|
+ if (defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0) {
|
|
|
+ status = AUDITING;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- if (courseSettings.getCourseTotalMinuties() != 0) {
|
|
|
- if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties())).setScale(0, BigDecimal.ROUND_HALF_UP)
|
|
|
- .compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
|
|
|
+ } else if (paymentType == PaymentType.ADD_COURSE || paymentType == PaymentType.ADD_STUDENT) {
|
|
|
+ // 如果是临时加课,判断是否审核
|
|
|
+ for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
+ OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
|
|
|
+ musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
|
|
|
+ if (defaultUnitPrice == null) {
|
|
|
+ throw new BizException("请先设置分部课程类型单价");
|
|
|
+ }
|
|
|
+ if (courseSettings.getCourseTotalMinuties() != 0) {
|
|
|
+ if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties())).setScale(0, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
|
|
|
|
|
|
+ status = AUDITING;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
status = AUDITING;
|
|
|
break;
|
|
|
}
|
|
|
- } else {
|
|
|
- status = AUDITING;
|
|
|
- break;
|
|
|
}
|
|
|
- }
|
|
|
- }else if(paymentType == SPAN_GROUP_CLASS_ADJUST){
|
|
|
- MusicGroupStudentClassAdjust adjust = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
|
|
|
- //获取默认的学员缴费详情
|
|
|
- List<Integer> studentIdList = JSON.parseArray(adjust.getStudentIds(), Integer.class);
|
|
|
- //获取欠费学员列表
|
|
|
- List<Integer> noPaymentUserIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentUserIds(musicGroup.getId(), studentIdList);
|
|
|
- if(noPaymentUserIds.size() > 0){
|
|
|
- throw new BizException("操作失败:有欠费的学员不允许创建缴费");
|
|
|
- }
|
|
|
- //获取缴费状态在审核中或者已拒绝的缴费项目的学员
|
|
|
- String studentIds = musicGroupPaymentCalenderDao.queryCalenderStudentIds(musicGroupId,batchNo);
|
|
|
- if(StringUtils.isNotEmpty(studentIds)){
|
|
|
- for (Integer integer : studentIdList) {
|
|
|
- if(studentIds.contains(integer.toString())){
|
|
|
- throw new BizException("操作失败:所选学员有待审核或已拒绝的缴费项目");
|
|
|
+ }else if(paymentType == SPAN_GROUP_CLASS_ADJUST){
|
|
|
+ MusicGroupStudentClassAdjust adjust = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
|
|
|
+ //获取默认的学员缴费详情
|
|
|
+ List<Integer> studentIdList = JSON.parseArray(adjust.getStudentIds(), Integer.class);
|
|
|
+ //获取欠费学员列表
|
|
|
+ List<Integer> noPaymentUserIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentUserIds(musicGroup.getId(), studentIdList);
|
|
|
+ if(noPaymentUserIds.size() > 0){
|
|
|
+ throw new BizException("操作失败:有欠费的学员不允许创建缴费");
|
|
|
+ }
|
|
|
+ //获取缴费状态在审核中或者已拒绝的缴费项目的学员
|
|
|
+ String studentIds = musicGroupPaymentCalenderDao.queryCalenderStudentIds(musicGroupId,batchNo);
|
|
|
+ if(StringUtils.isNotEmpty(studentIds)){
|
|
|
+ for (Integer integer : studentIdList) {
|
|
|
+ if(studentIds.contains(integer.toString())){
|
|
|
+ throw new BizException("操作失败:所选学员有待审核或已拒绝的缴费项目");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails = classGroupService.queryStudentPaymentCalenders(adjust.getMasterClassGroupId(),
|
|
|
- adjust.getClassGroupStudents(),studentIdList);
|
|
|
- List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails();
|
|
|
+ List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails = classGroupService.queryStudentPaymentCalenders(adjust.getMasterClassGroupId(),
|
|
|
+ adjust.getClassGroupStudents(),studentIdList);
|
|
|
+ List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails();
|
|
|
|
|
|
- boolean containsAll = musicGroupPaymentCalenderStudentDetails.containsAll(calenderStudentDetails);
|
|
|
- if(!containsAll){
|
|
|
+ boolean containsAll = musicGroupPaymentCalenderStudentDetails.containsAll(calenderStudentDetails);
|
|
|
+ if(!containsAll){
|
|
|
+ status = AUDITING;
|
|
|
+ //保存新的学员详情
|
|
|
+ }
|
|
|
+ //删除之前的记录
|
|
|
+ musicGroupPaymentCalenderStudentDetailDao.delByBatchNo(batchNo);
|
|
|
+ //保存现有记录
|
|
|
+ musicGroupPaymentCalenderStudentDetailDao.batchInsert(calenderStudentDetails,batchNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(status != AUDITING && musicGroupPaymentCalenderDto.getMemberRankSettingId() != null){
|
|
|
+ //会员价格是否变动
|
|
|
+ MemberFeeSetting memberFee = memberFeeSettingDao.findByRankIdAndOrganId(musicGroup.getOrganId(), musicGroupPaymentCalenderDto.getMemberRankSettingId());
|
|
|
+ if(memberFee == null){
|
|
|
+ throw new BizException("操作失败:请配置当前分部会员收费标准");
|
|
|
+ }
|
|
|
+ BigDecimal memberPaymentAmount;
|
|
|
+ switch (musicGroupPaymentCalenderDto.getMemberValidDate()){
|
|
|
+ case 1 :
|
|
|
+ memberPaymentAmount = memberFee.getCurrentMonthFee();
|
|
|
+ break;
|
|
|
+ case 6 :
|
|
|
+ memberPaymentAmount = memberFee.getCurrentHalfYearFee();
|
|
|
+ break;
|
|
|
+ case 12 :
|
|
|
+ memberPaymentAmount = memberFee.getCurrentYearFee();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("请选择正确的会员有效期");
|
|
|
+ }
|
|
|
+ if(memberPaymentAmount.compareTo(musicGroupPaymentCalenderDto.getMemberPaymentAmount()) != 0){
|
|
|
status = AUDITING;
|
|
|
- //保存新的学员详情
|
|
|
}
|
|
|
- //删除之前的记录
|
|
|
- musicGroupPaymentCalenderStudentDetailDao.delByBatchNo(batchNo);
|
|
|
- //保存现有记录
|
|
|
- musicGroupPaymentCalenderStudentDetailDao.batchInsert(calenderStudentDetails,batchNo);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -648,47 +706,49 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
musicGroupPaymentCalender.setMemo(musicGroupPaymentCalenderDto.getMemo());
|
|
|
musicGroupPaymentCalender.setMusicGroupId(musicGroupId);
|
|
|
musicGroupPaymentCalender.setMusicGroupOrganizationCourseSettingId(musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId());
|
|
|
+ BigDecimal totalPaymentAmount = musicGroupPaymentCalender.getMemberPaymentAmount();
|
|
|
+ if(musicGroupPaymentCalenderCourseSettingsList != null){
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> newCSList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>(
|
|
|
+ musicGroupPaymentCalenderCourseSettingsList.size());
|
|
|
|
|
|
- List<MusicGroupPaymentCalenderCourseSettings> newCSList = new ArrayList<MusicGroupPaymentCalenderCourseSettings>(
|
|
|
- musicGroupPaymentCalenderCourseSettingsList.size());
|
|
|
-
|
|
|
- BigDecimal totalPaymentAmount = new BigDecimal(0);
|
|
|
- if(musicGroupPaymentCalenderDto.getPaymentType() == SPAN_GROUP_CLASS_ADJUST){
|
|
|
- totalPaymentAmount = musicGroupPaymentDateRange.getPaymentAmount();
|
|
|
- }
|
|
|
- for (MusicGroupPaymentCalenderCourseSettings pccs : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
-
|
|
|
- MusicGroupPaymentCalenderCourseSettings tempPccs = new MusicGroupPaymentCalenderCourseSettings();
|
|
|
- try {
|
|
|
- BeanUtils.copyProperties(tempPccs, pccs);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new BizException("克隆对象出错", e);
|
|
|
+ if(musicGroupPaymentCalenderDto.getPaymentType() == SPAN_GROUP_CLASS_ADJUST){
|
|
|
+ totalPaymentAmount = musicGroupPaymentDateRange.getPaymentAmount();
|
|
|
}
|
|
|
- if (i == 0) {
|
|
|
- if (pccs.getIsStudentOptional()) {
|
|
|
- tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice());
|
|
|
- tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice());
|
|
|
- tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties());
|
|
|
- } else {
|
|
|
- tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
|
|
|
- pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
- .setScale(0, BigDecimal.ROUND_DOWN)));
|
|
|
- tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
|
|
|
- pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
- .setScale(0, BigDecimal.ROUND_DOWN)));
|
|
|
- tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
|
|
|
+ for (MusicGroupPaymentCalenderCourseSettings pccs : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
+
|
|
|
+ MusicGroupPaymentCalenderCourseSettings tempPccs = new MusicGroupPaymentCalenderCourseSettings();
|
|
|
+ try {
|
|
|
+ BeanUtils.copyProperties(tempPccs, pccs);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BizException("克隆对象出错", e);
|
|
|
}
|
|
|
- } else {
|
|
|
- if (!pccs.getIsStudentOptional()) {
|
|
|
- tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
|
|
|
- tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
|
|
|
- tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
|
|
|
+ if (i == 0) {
|
|
|
+ if (pccs.getIsStudentOptional()) {
|
|
|
+ tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice());
|
|
|
+ tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice());
|
|
|
+ tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties());
|
|
|
+ } else {
|
|
|
+ tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
|
|
|
+ pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
+ .setScale(0, BigDecimal.ROUND_DOWN)));
|
|
|
+ tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
|
|
|
+ pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))
|
|
|
+ .setScale(0, BigDecimal.ROUND_DOWN)));
|
|
|
+ tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!pccs.getIsStudentOptional()) {
|
|
|
+ tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
|
|
|
+ tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times), 0, BigDecimal.ROUND_DOWN));
|
|
|
+ tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
|
|
|
+ }
|
|
|
}
|
|
|
+ totalPaymentAmount = totalPaymentAmount.add(tempPccs.getCourseCurrentPrice());
|
|
|
+ newCSList.add(tempPccs);
|
|
|
}
|
|
|
- totalPaymentAmount = totalPaymentAmount.add(tempPccs.getCourseCurrentPrice());
|
|
|
- newCSList.add(tempPccs);
|
|
|
+ musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
|
|
|
}
|
|
|
- musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
|
|
|
+
|
|
|
musicGroupPaymentCalender.setPaymentAmount(totalPaymentAmount);
|
|
|
|
|
|
musicGroupPaymentCalender.setPaymentPattern(musicGroupPaymentCalenderDto.getPaymentPattern());
|
|
@@ -751,7 +811,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if (musicGroupPaymentCalender.getStatus() != AUDITING) {
|
|
|
// 如果是进行中加学生
|
|
|
if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
|
|
|
- addStudent(musicGroupPaymentCalender, currentMusicGroupPaymentCalenderCourseSettings);
|
|
|
+ addStudent(musicGroupPaymentCalender, currentMusicGroupPaymentCalenderCourseSettings,musicGroup);
|
|
|
}else if(musicGroupPaymentCalender.getPaymentType() == SPAN_GROUP_CLASS_ADJUST){
|
|
|
//如果是跨团班级合并,添加学员
|
|
|
musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender,musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails());
|
|
@@ -794,7 +854,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
String classGroupIdStr = musicGroupPaymentCalenderDto.getAttribute1();
|
|
|
if (StringUtils.isNotBlank(classGroupIdStr)) {
|
|
|
classGroupService.addStudentToClassGroupAndCourseArranging(Integer.parseInt(musicGroupPaymentCalenderDto.getStudentIds()), classGroupIdStr,
|
|
|
- batchNo, musicGroupPaymentCalenderCourseSettingsList);
|
|
|
+ batchNo, musicGroupPaymentCalenderCourseSettingsList,musicGroup);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -854,15 +914,19 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public void addStudent(MusicGroupPaymentCalender musicGroupPaymentCalender,List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList){
|
|
|
+ public void addStudent(MusicGroupPaymentCalender musicGroupPaymentCalender,
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList,
|
|
|
+ MusicGroup musicGroup){
|
|
|
//如果是进行中加学生
|
|
|
Date date = new Date();
|
|
|
String studentIdStr = musicGroupPaymentCalender.getStudentIds();
|
|
|
if (StringUtils.isNoneBlank(studentIdStr)) {
|
|
|
//计算总费用
|
|
|
- BigDecimal totalPrice = new BigDecimal(0);
|
|
|
- for(MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList){
|
|
|
- totalPrice = totalPrice.add(musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice());
|
|
|
+ BigDecimal totalPrice = musicGroupPaymentCalender.getMemberPaymentAmount();
|
|
|
+ if(musicGroupPaymentCalenderCourseSettingsList != null && musicGroupPaymentCalenderCourseSettingsList.size() > 0){
|
|
|
+ for(MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList){
|
|
|
+ totalPrice = totalPrice.add(musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = new ArrayList<MusicGroupPaymentStudentCourseDetail>();
|
|
@@ -901,26 +965,38 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
groupEventSource.musicGroupStudentChangeEvent(musicGroupPaymentCalender.getMusicGroupId(), StudentMusicGroupStatusEnum.NORMAL, new ArrayList<>(Arrays.asList(Integer.parseInt(studentId))));
|
|
|
}
|
|
|
|
|
|
- // 学生加课程明细
|
|
|
- for(MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList){
|
|
|
- if (courseSettings.getIsStudentOptional() == true) {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
|
|
|
musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail();
|
|
|
- musicGroupPaymentStudentCourseDetail.setCourseType(courseSettings.getCourseType());
|
|
|
+// musicGroupPaymentStudentCourseDetail.setCourseType(courseSettings.getCourseType());
|
|
|
musicGroupPaymentStudentCourseDetail.setCreateTime(date);
|
|
|
musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
|
|
|
musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetail.getId());
|
|
|
- musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(courseSettings.getCourseTotalMinuties());
|
|
|
+ musicGroupPaymentStudentCourseDetail.setMemberCourseMinutes(6*4*4*45);
|
|
|
musicGroupPaymentStudentCourseDetail.setUpdateTime(date);
|
|
|
- musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(courseSettings.getCourseTotalMinuties());
|
|
|
+// musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(6*4*4*45);
|
|
|
musicGroupPaymentStudentCourseDetail.setUserId(Integer.parseInt(studentId));
|
|
|
+ }else {
|
|
|
+ // 学生加课程明细
|
|
|
+ for(MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList){
|
|
|
+ if (courseSettings.getIsStudentOptional() == true) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail();
|
|
|
+ musicGroupPaymentStudentCourseDetail.setCourseType(courseSettings.getCourseType());
|
|
|
+ musicGroupPaymentStudentCourseDetail.setCreateTime(date);
|
|
|
+ musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
|
|
|
+ musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetail.getId());
|
|
|
+ musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(courseSettings.getCourseTotalMinuties());
|
|
|
+ musicGroupPaymentStudentCourseDetail.setUpdateTime(date);
|
|
|
+ musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(courseSettings.getCourseTotalMinuties());
|
|
|
+ musicGroupPaymentStudentCourseDetail.setUserId(Integer.parseInt(studentId));
|
|
|
+
|
|
|
+ musicGroupPaymentStudentCourseDetailList.add(musicGroupPaymentStudentCourseDetail);
|
|
|
+ }
|
|
|
|
|
|
- musicGroupPaymentStudentCourseDetailList.add(musicGroupPaymentStudentCourseDetail);
|
|
|
- }
|
|
|
-
|
|
|
- if(musicGroupPaymentStudentCourseDetailList.size() > 0){
|
|
|
- musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetailList);
|
|
|
+ if(musicGroupPaymentStudentCourseDetailList.size() > 0){
|
|
|
+ musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetailList);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1055,12 +1131,13 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
}
|
|
|
}
|
|
|
List<ClassGroup4MixDto> classGroup4MixDtos = JSON.parseArray(musicGroupStudentClassAdjust.getNewClassGroupJson(), ClassGroup4MixDto.class);
|
|
|
-
|
|
|
+ String musicGroupId = musicGroupPaymentCalenders.get(0).getMusicGroupId();
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
for (MusicGroupPaymentCalender calender : musicGroupPaymentCalenders) {
|
|
|
//缴费项目添加学员
|
|
|
int[] ints = Arrays.stream(calender.getStudentIds().split(",")).mapToInt(Integer::parseInt).toArray();
|
|
|
Set<Integer> list2 = Arrays.stream(ints).boxed().collect(Collectors.toSet());
|
|
|
- musicGroupPaymentCalenderDetailService.batchAdd(calender.getId(),list2);
|
|
|
+ musicGroupPaymentCalenderDetailService.batchAdd(calender.getId(),list2,musicGroup);
|
|
|
}
|
|
|
//每种课程类型单独排课
|
|
|
ClassGroup classGroup = null;
|
|
@@ -1106,7 +1183,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(delCourseIds);
|
|
|
}
|
|
|
classGroupService.batchUpdateTeacherSalary(classGroupIds);
|
|
|
- imUserFriendService.refreshGroupImUserFriend(musicGroupPaymentCalenders.get(0).getMusicGroupId(),GroupType.MUSIC);
|
|
|
+ imUserFriendService.refreshGroupImUserFriend(musicGroupId,GroupType.MUSIC);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1119,6 +1196,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if(musicGroupPaymentCalenders == null || musicGroupPaymentCalenders.size() == 0){
|
|
|
throw new BizException("缴费项目不存在");
|
|
|
}
|
|
|
+ MusicGroupPaymentCalender calender = musicGroupPaymentCalenders.get(0);
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(calender.getMusicGroupId());
|
|
|
for (MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenders) {
|
|
|
//如果是报名项目,将乐团改为审核中,缴费项目修改状态,审核状态改为审核通过
|
|
|
if(musicGroupPaymentCalender.getPayUserType() == SCHOOL){
|
|
@@ -1136,11 +1215,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
|
|
|
musicGroupPaymentCalender.setExpectNum(1);
|
|
|
List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(musicGroupPaymentCalender.getId());
|
|
|
- addStudent(musicGroupPaymentCalender,musicGroupPaymentCalenderCourseSettings);
|
|
|
+ addStudent(musicGroupPaymentCalender,musicGroupPaymentCalenderCourseSettings,musicGroup);
|
|
|
}
|
|
|
}
|
|
|
- MusicGroupPaymentCalender calender = musicGroupPaymentCalenders.get(0);
|
|
|
- MusicGroup musicGroup = musicGroupDao.get(calender.getMusicGroupId());
|
|
|
if(calender.getPaymentType() == ADD_STUDENT || calender.getPaymentType() == SPAN_GROUP_CLASS_ADJUST){
|
|
|
// 所有缴费项目已完成排课才能创建下一个缴费项目
|
|
|
List<String> batchNoList = new ArrayList<>();
|
|
@@ -1185,7 +1262,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
String classGroupIdStr = calender.getAttribute1();
|
|
|
if (StringUtils.isNotBlank(classGroupIdStr)) {
|
|
|
classGroupService.addStudentToClassGroupAndCourseArranging(Integer.parseInt(calender.getStudentIds()), classGroupIdStr, batchNo,
|
|
|
- musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettingsByBatchNo(batchNo));
|
|
|
+ musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettingsByBatchNo(batchNo),musicGroup);
|
|
|
}
|
|
|
MusicGroupStudentClassAdjust musicGroupStudentClassAdjust = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
|
|
|
if(musicGroupStudentClassAdjust != null){
|