|
@@ -1,22 +1,73 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.ADD_STUDENT;
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY;
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_RENEW;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.Comparator;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Map.Entry;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Isolation;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.auth.api.entity.SysUserRole;
|
|
|
-import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupBuildLogDao;
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupOrganizationCourseSettingsDao;
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupOrganizationCourseSettingsDetailDao;
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
|
|
|
+import com.ym.mec.biz.dal.dao.OrganizationCourseUnitPriceSettingsDao;
|
|
|
+import com.ym.mec.biz.dal.dao.OrganizationDao;
|
|
|
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
|
|
|
+import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
|
import com.ym.mec.biz.dal.dto.CalenderPushDto;
|
|
|
import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDetailDto;
|
|
|
import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto;
|
|
|
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto;
|
|
|
+import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderDto.MusicGroupPaymentDateRange;
|
|
|
import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
|
|
|
-import com.ym.mec.biz.dal.entity.*;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroup;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupBuildLog;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettings;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettingsDetail;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
|
|
|
+import com.ym.mec.biz.dal.entity.Organization;
|
|
|
+import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
|
|
|
+import com.ym.mec.biz.dal.entity.StudentRegistration;
|
|
|
import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
|
|
|
import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
|
|
|
import com.ym.mec.biz.service.ClassGroupService;
|
|
|
import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
|
|
@@ -32,21 +83,6 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Isolation;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.util.*;
|
|
|
-import java.util.Map.Entry;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
|
|
|
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
|
|
|
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.*;
|
|
|
-
|
|
|
@Service
|
|
|
public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentCalender> implements MusicGroupPaymentCalenderService {
|
|
|
|
|
@@ -102,9 +138,19 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Long create(MusicGroupPaymentCalender musicGroupPaymentCalender) {
|
|
|
+ public String create(MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto) {
|
|
|
|
|
|
- String musicGroupId = musicGroupPaymentCalender.getMusicGroupId();
|
|
|
+ String musicGroupId = musicGroupPaymentCalenderDto.getMusicGroupId();
|
|
|
+
|
|
|
+ PaymentType paymentType = musicGroupPaymentCalenderDto.getPaymentType();
|
|
|
+
|
|
|
+ PayUserType payUserType = musicGroupPaymentCalenderDto.getPayUserType();
|
|
|
+
|
|
|
+ List<MusicGroupPaymentDateRange> musicGroupPaymentDateRangeList = musicGroupPaymentCalenderDto.getMusicGroupPaymentDateRangeList();
|
|
|
+
|
|
|
+ if ((paymentType == PaymentType.ADD_COURSE || payUserType == PayUserType.SCHOOL) && musicGroupPaymentDateRangeList.size() > 1) {
|
|
|
+ throw new BizException("临时加课和学校缴费不支持多周期缴费");
|
|
|
+ }
|
|
|
|
|
|
MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);
|
|
|
|
|
@@ -115,48 +161,44 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if (sysUser == null) {
|
|
|
throw new BizException("请登录");
|
|
|
}
|
|
|
- //不是进行中,只能创建一次缴费
|
|
|
- if(musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS){
|
|
|
+ // 所有缴费项目已完成排课才能创建下一个缴费项目
|
|
|
+ List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao
|
|
|
+ .getUnusedPaymentCalenderWithMusicGroup(musicGroupId);
|
|
|
+ if (musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0) {
|
|
|
+ throw new BizException("当前乐团存在未排课的缴费项目,请先完成排课再操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 不是进行中,只能创建一次缴费
|
|
|
+ if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS) {
|
|
|
List<MusicGroupPaymentCalender> list = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
|
|
|
- if(list.size() > 0){
|
|
|
+ if (list.size() > 0) {
|
|
|
throw new BizException("创建失败,已经存在缴费信息");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ PaymentCalenderStatusEnum status = PaymentCalenderStatusEnum.NO;
|
|
|
+
|
|
|
Date date = new Date();
|
|
|
- List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<>();
|
|
|
- musicGroupPaymentCalender.setOperator(sysUser.getId());
|
|
|
- musicGroupPaymentCalender.setCreateTime(date);
|
|
|
- musicGroupPaymentCalender.setUpdateTime(date);
|
|
|
- musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
|
|
|
+ String batchNo = idGeneratorService.generatorId() + "";
|
|
|
|
|
|
- if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && musicGroupPaymentCalender.getPayUserType() == PayUserType.STUDENT) {
|
|
|
- musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
|
|
|
- }
|
|
|
- if(musicGroupPaymentCalender.getPaymentType() != ADD_STUDENT){
|
|
|
- int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPayUserType(), musicGroupPaymentCalender.getPaymentValidStartDate(),
|
|
|
- musicGroupPaymentCalender.getPaymentValidEndDate(), null);
|
|
|
- if (count > 0) {
|
|
|
- throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
|
|
|
- }
|
|
|
- }
|
|
|
// 获取设置的课程
|
|
|
- List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalender
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalenderDto
|
|
|
.getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
if (musicGroupPaymentCalenderCourseSettingsList == null) {
|
|
|
musicGroupPaymentCalenderCourseSettingsList = new ArrayList<>();
|
|
|
}
|
|
|
- if (musicGroupPaymentCalender.getPayUserType() == SCHOOL) {
|
|
|
- musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
+
|
|
|
+ if (payUserType == SCHOOL) {
|
|
|
+ status = PaymentCalenderStatusEnum.AUDITING;
|
|
|
} else {
|
|
|
- if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY || musicGroupPaymentCalender.getPaymentType() == MUSIC_RENEW) {
|
|
|
+ if (paymentType == MUSIC_APPLY || paymentType == MUSIC_RENEW) {
|
|
|
// 当前缴费的课程费用
|
|
|
Map<CourseScheduleType, BigDecimal> currentCoursePrice = musicGroupPaymentCalenderCourseSettingsList.stream().collect(
|
|
|
Collectors
|
|
|
.toMap(MusicGroupPaymentCalenderCourseSettings::getCourseType, MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice));
|
|
|
|
|
|
// 查询默认课程费用
|
|
|
- Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalender.getMusicGroupOrganizationCourseSettingId();
|
|
|
+ Integer musicGroupOrganizationCourseSettingId = musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId();
|
|
|
Map<CourseScheduleType, BigDecimal> defaultCoursePrice = musicGroupOrganizationCourseSettingsDetailDao
|
|
|
.queryByMusicGroupOrganizationCourseSettingsId(musicGroupOrganizationCourseSettingId)
|
|
|
.stream()
|
|
@@ -167,12 +209,11 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
// 相同类型的课程如果修改了课程费用,需要走审批
|
|
|
for (Entry<CourseScheduleType, BigDecimal> entry : currentCoursePrice.entrySet()) {
|
|
|
if (defaultCoursePrice.get(entry.getKey()).compareTo(entry.getValue()) != 0) {
|
|
|
- musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
+ status = PaymentCalenderStatusEnum.AUDITING;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- } else if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_COURSE || musicGroupPaymentCalender.getPaymentType() == PaymentType
|
|
|
- .ADD_STUDENT) {
|
|
|
+ } else if (paymentType == PaymentType.ADD_COURSE || paymentType == PaymentType.ADD_STUDENT) {
|
|
|
// 如果是临时加课,是否审核是根据单价判断
|
|
|
for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
|
|
@@ -180,48 +221,147 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
if (defaultUnitPrice == null) {
|
|
|
throw new BizException("请先设置分部课程类型单价");
|
|
|
}
|
|
|
- if (courseSettings.getCourseCurrentPrice().divide(new BigDecimal(courseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN)
|
|
|
+ if (courseSettings.getCourseCurrentPrice()
|
|
|
+ .divide(new BigDecimal(courseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN)
|
|
|
.compareTo(defaultUnitPrice.getUnitPrice()) != 0) {
|
|
|
- musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.AUDITING);
|
|
|
+ status = PaymentCalenderStatusEnum.AUDITING;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
|
|
|
- musicGroupPaymentCalender.setPayUserType(STUDENT);
|
|
|
- musicGroupPaymentCalender.setIsGiveMusicNetwork(false);
|
|
|
- if(musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING){
|
|
|
- musicGroupPaymentCalender.setExpectNum(1);
|
|
|
+
|
|
|
+ int times = musicGroupPaymentDateRangeList.size();
|
|
|
+
|
|
|
+ // 排序
|
|
|
+ Collections.sort(musicGroupPaymentDateRangeList, new Comparator<MusicGroupPaymentDateRange>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int compare(MusicGroupPaymentDateRange o1, MusicGroupPaymentDateRange o2) {
|
|
|
+ return o1.getPaymentValidStartDate().compareTo(o2.getPaymentValidStartDate());
|
|
|
}
|
|
|
- }
|
|
|
- if (musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING) {
|
|
|
- if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
|
|
|
- musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OPEN);
|
|
|
- }else if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
|
|
|
- musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OVER);
|
|
|
- }else {
|
|
|
- musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
|
|
|
+ });
|
|
|
+
|
|
|
+ for (int i = 0; i < musicGroupPaymentDateRangeList.size(); i++) {
|
|
|
+
|
|
|
+ MusicGroupPaymentDateRange musicGroupPaymentDateRange = musicGroupPaymentDateRangeList.get(i);
|
|
|
+
|
|
|
+ MusicGroupPaymentCalender musicGroupPaymentCalender = new MusicGroupPaymentCalender();
|
|
|
+ musicGroupPaymentCalender.setAttribute1(musicGroupPaymentCalenderDto.getAttribute1());
|
|
|
+ musicGroupPaymentCalender.setAttribute2(musicGroupPaymentCalenderDto.getAttribute2());
|
|
|
+ musicGroupPaymentCalender.setDeadlinePaymentDate(musicGroupPaymentDateRange.getDeadlinePaymentDate());
|
|
|
+ musicGroupPaymentCalender.setIsGiveMusicNetwork(musicGroupPaymentCalenderDto.getIsGiveMusicNetwork());
|
|
|
+ musicGroupPaymentCalender.setMemo(musicGroupPaymentCalenderDto.getMemo());
|
|
|
+ musicGroupPaymentCalender.setMusicGroupId(musicGroupId);
|
|
|
+ musicGroupPaymentCalender.setMusicGroupOrganizationCourseSettingId(musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId());
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ if (i == 0) {
|
|
|
+ tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().subtract(
|
|
|
+ pccs.getCourseCurrentPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))));
|
|
|
+ tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().subtract(
|
|
|
+ pccs.getCourseOriginalPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(times - 1))));
|
|
|
+ tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() - pccs.getCourseTotalMinuties() / times * (times - 1));
|
|
|
+ } else {
|
|
|
+ tempPccs.setCourseCurrentPrice(pccs.getCourseCurrentPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
+ tempPccs.setCourseOriginalPrice(pccs.getCourseOriginalPrice().divide(new BigDecimal(times)).setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
+ tempPccs.setCourseTotalMinuties(pccs.getCourseTotalMinuties() / times);
|
|
|
+ }
|
|
|
+ newCSList.add(tempPccs);
|
|
|
+ }
|
|
|
+ musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
|
|
|
+
|
|
|
+ musicGroupPaymentCalender.setPaymentPattern(musicGroupPaymentCalenderDto.getPaymentPattern());
|
|
|
+ musicGroupPaymentCalender.setPaymentValidEndDate(musicGroupPaymentDateRange.getPaymentValidEndDate());
|
|
|
+ musicGroupPaymentCalender.setPaymentValidStartDate(musicGroupPaymentDateRange.getPaymentValidStartDate());
|
|
|
+ musicGroupPaymentCalender.setPaymentType(musicGroupPaymentCalenderDto.getPaymentType());
|
|
|
+ musicGroupPaymentCalender.setPayUserType(musicGroupPaymentCalenderDto.getPayUserType());
|
|
|
+ musicGroupPaymentCalender.setStartPaymentDate(musicGroupPaymentDateRange.getStartPaymentDate());
|
|
|
+ musicGroupPaymentCalender.setStudentIds(musicGroupPaymentCalenderDto.getStudentIds());
|
|
|
+ musicGroupPaymentCalender.setOperator(sysUser.getId());
|
|
|
+ musicGroupPaymentCalender.setCreateTime(date);
|
|
|
+ musicGroupPaymentCalender.setUpdateTime(date);
|
|
|
+ musicGroupPaymentCalender.setStatus(status);
|
|
|
+
|
|
|
+ if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && payUserType == PayUserType.STUDENT) {
|
|
|
+ musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
|
|
|
+ }
|
|
|
+ if (paymentType != ADD_STUDENT) {
|
|
|
+ int count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPayUserType(),
|
|
|
+ musicGroupPaymentCalender.getPaymentValidStartDate(), musicGroupPaymentCalender.getPaymentValidEndDate(), null);
|
|
|
+ if (count > 0) {
|
|
|
+ throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (paymentType == PaymentType.ADD_STUDENT) {
|
|
|
+ musicGroupPaymentCalender.setPayUserType(STUDENT);
|
|
|
+ musicGroupPaymentCalender.setIsGiveMusicNetwork(false);
|
|
|
+ if (musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING) {
|
|
|
+ musicGroupPaymentCalender.setExpectNum(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING) {
|
|
|
+ if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
|
|
|
+ musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OPEN);
|
|
|
+ } else if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
|
|
|
+ musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.OVER);
|
|
|
+ } else {
|
|
|
+ musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ status = musicGroupPaymentCalender.getStatus();
|
|
|
+
|
|
|
+ // 设置批次号
|
|
|
+ musicGroupPaymentCalender.setBatchNo(batchNo);
|
|
|
+ musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
|
|
|
+
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> currentMusicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalender
|
|
|
+ .getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
+
|
|
|
+ if (musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING) {
|
|
|
+ // 如果是进行中加学生
|
|
|
+ if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
|
|
|
+ addStudent(musicGroupPaymentCalender, currentMusicGroupPaymentCalenderCourseSettings);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (currentMusicGroupPaymentCalenderCourseSettings.size() > 0) {
|
|
|
+ MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsDao.get(musicGroupPaymentCalender
|
|
|
+ .getMusicGroupOrganizationCourseSettingId());
|
|
|
+ for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : currentMusicGroupPaymentCalenderCourseSettings) {
|
|
|
+ musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
|
|
|
+ if (courseSettings != null) {
|
|
|
+ musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ musicGroupPaymentCalenderCourseSettingsDao.batchInsert(currentMusicGroupPaymentCalenderCourseSettings);
|
|
|
}
|
|
|
- }else {
|
|
|
- Set<Integer> roleIds = new HashSet<>(1);
|
|
|
- roleIds.add(SysUserRole.ADMINISTRATOR);
|
|
|
- Organization organization = organizationDao.get(musicGroup.getOrganId());
|
|
|
- sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId()), MessageTypeEnum.BACKSTAGE_PAYMENT_CALENDER_AUDIT, "", organization.getName(),musicGroup.getName());
|
|
|
}
|
|
|
|
|
|
// 如果是报名,需要修改乐团状态
|
|
|
- if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY) {
|
|
|
- int countAuditReject = musicGroupPaymentCalenderDao.countAuditReject(musicGroupPaymentCalender.getMusicGroupId(),null);
|
|
|
- if(countAuditReject == 0){
|
|
|
+ if (paymentType == MUSIC_APPLY) {
|
|
|
+ int countAuditReject = musicGroupPaymentCalenderDao.countAuditReject(musicGroupId, null);
|
|
|
+ if (countAuditReject == 0) {
|
|
|
if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT) {
|
|
|
throw new BizException("创建失败:缴费项目类型不匹配");
|
|
|
}
|
|
|
- if(musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING){
|
|
|
+ if (status != PaymentCalenderStatusEnum.AUDITING) {
|
|
|
musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
|
|
|
// 记录操作日志
|
|
|
musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 基础信息审核中)", sysUser.getId(), ""));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
musicGroup.setStatus(MusicGroupStatusEnum.FEE_AUDIT);
|
|
|
// 记录操作日志
|
|
|
musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(草稿 -> 费用审核中)", sysUser.getId(), ""));
|
|
@@ -230,33 +370,17 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
musicGroupDao.update(musicGroup);
|
|
|
}
|
|
|
}
|
|
|
- // 设置批次号
|
|
|
- musicGroupPaymentCalender.setBatchNo(idGeneratorService.generatorId() + "");
|
|
|
- musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
|
|
|
-
|
|
|
- if (musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.AUDITING) {
|
|
|
- // 如果是进行中加学生
|
|
|
- if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
|
|
|
- addStudent(musicGroupPaymentCalender, musicGroupPaymentCalenderCourseSettingsList);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- if (musicGroupPaymentCalenderCourseSettingsList.size() > 0) {
|
|
|
- MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsDao.get(musicGroupPaymentCalender
|
|
|
- .getMusicGroupOrganizationCourseSettingId());
|
|
|
- for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
- musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
|
|
|
- if (courseSettings != null) {
|
|
|
- musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
|
|
|
- }
|
|
|
- }
|
|
|
- musicGroupPaymentCalenderCourseSettingsDao.batchInsert(musicGroupPaymentCalenderCourseSettingsList);
|
|
|
+ if (status == PaymentCalenderStatusEnum.AUDITING) {
|
|
|
+ // 如果是审核中
|
|
|
+ Set<Integer> roleIds = new HashSet<>(1);
|
|
|
+ roleIds.add(SysUserRole.ADMINISTRATOR);
|
|
|
+ Organization organization = organizationDao.get(musicGroup.getOrganId());
|
|
|
+ sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId()),
|
|
|
+ MessageTypeEnum.BACKSTAGE_PAYMENT_CALENDER_AUDIT, "", organization.getName(), musicGroup.getName());
|
|
|
}
|
|
|
|
|
|
- if (musicGroupPaymentCalenderDetailList.size() > 0) {
|
|
|
- musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
|
|
|
- }
|
|
|
- return musicGroupPaymentCalender.getId();
|
|
|
+ return batchNo;
|
|
|
}
|
|
|
|
|
|
@Override
|