|
@@ -539,6 +539,381 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String create1(MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto) {
|
|
|
+
|
|
|
+ String musicGroupId = musicGroupPaymentCalenderDto.getMusicGroupId();
|
|
|
+
|
|
|
+ PaymentType paymentType = musicGroupPaymentCalenderDto.getPaymentType();
|
|
|
+
|
|
|
+ PayUserType payUserType = musicGroupPaymentCalenderDto.getPayUserType();
|
|
|
+
|
|
|
+ List<MusicGroupPaymentDateRange> musicGroupPaymentDateRangeList = musicGroupPaymentCalenderDto.getMusicGroupPaymentDateRangeList();
|
|
|
+ if(musicGroupPaymentDateRangeList.size() > 1){
|
|
|
+ throw new BizException("暂不支持多周期缴费");
|
|
|
+ }
|
|
|
+ MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);
|
|
|
+ if (musicGroup == null) {
|
|
|
+ throw new BizException("乐团查询失败,请检查参数");
|
|
|
+ }
|
|
|
+ if (paymentType == PaymentType.ADD_STUDENT) {
|
|
|
+ //获取缴费状态在审核中或者已拒绝的缴费项目的学员
|
|
|
+ Integer userId = Integer.parseInt(musicGroupPaymentCalenderDto.getStudentIds());
|
|
|
+ if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
|
|
|
+ //该学员是否在其他的会员团
|
|
|
+ boolean hasMemberGroup = studentRegistrationDao.checkHasMemberGroup(musicGroupId,userId);
|
|
|
+ if(hasMemberGroup){
|
|
|
+ throw new BizException("操作失败:学员已在其他系统收费乐团中,不可报名该乐团请联系教务老师");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String studentIds = musicGroupPaymentCalenderDao.queryCalenderStudentIds(musicGroupId,null);
|
|
|
+ if(StringUtils.isNotEmpty(studentIds)){
|
|
|
+ if(studentIds.contains(userId.toString())){
|
|
|
+ throw new BizException("创建缴费失败:所选学员有待审核或已拒绝的缴费项目");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryNotPaymentStudentByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
+ if(musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0){
|
|
|
+ throw new BizException("创建缴费失败:已存在缴费项目");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS && musicGroup.getStatus() != MusicGroupStatusEnum.PRE_BUILD_FEE) {
|
|
|
+ throw new BizException("创建缴费失败:已存在缴费项目");
|
|
|
+ }
|
|
|
+
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("请登录");
|
|
|
+ }
|
|
|
+ if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE && musicGroupPaymentDateRangeList.size() > 1) {
|
|
|
+ throw new BizException("创建缴费失败:会员收费乐团不支持多周期缴费");
|
|
|
+ }
|
|
|
+ //是否自动创建
|
|
|
+ if(!musicGroupPaymentCalenderDto.getAutoCreate()){
|
|
|
+ // 所有缴费项目已完成排课才能创建下一个缴费项目
|
|
|
+ String orignBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null,musicGroupPaymentCalenderDto.getIgnoreBatchNoList());
|
|
|
+ if (StringUtils.isNoneBlank(orignBatchNo)) {
|
|
|
+ if(StringUtils.isEmpty(musicGroupPaymentCalenderDto.getBatchNo()) || !musicGroupPaymentCalenderDto.getBatchNo().equals(orignBatchNo)){
|
|
|
+ throw new BizException("当前乐团存在未排课的缴费项目,请先完成排课再操作");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 不是进行中,只能创建一次缴费
|
|
|
+ if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS) {
|
|
|
+ List<MusicGroupPaymentCalender> list = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ throw new BizException("创建失败,已经存在缴费信息");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ PaymentCalenderStatusEnum status = PaymentCalenderStatusEnum.NO;
|
|
|
+
|
|
|
+ Date date = new Date();
|
|
|
+ String batchNo = idGeneratorService.generatorId() + "";
|
|
|
+
|
|
|
+ // 获取设置的课程收费标准
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalenderDto
|
|
|
+ .getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
+
|
|
|
+ //会员原价
|
|
|
+ BigDecimal memberPaymentAmount = BigDecimal.ZERO;
|
|
|
+ BigDecimal originalMemberPaymentAmount = BigDecimal.ZERO;
|
|
|
+ if (payUserType == SCHOOL) {
|
|
|
+ status = AUDITING;
|
|
|
+ } else {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } 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 if(paymentType == SPAN_GROUP_CLASS_ADJUST){
|
|
|
+ status = musicGroupPaymentCalenderDto.getStatus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(musicGroupPaymentCalenderDto.getMemberRankSettingId() != null){
|
|
|
+ //会员价格是否变动
|
|
|
+ MemberFeeSetting memberFee = memberFeeSettingDao.findByRankIdAndOrganId(musicGroup.getOrganId(), musicGroupPaymentCalenderDto.getMemberRankSettingId());
|
|
|
+ if(memberFee == null){
|
|
|
+ throw new BizException("操作失败:请配置当前分部会员收费标准");
|
|
|
+ }
|
|
|
+ switch (musicGroupPaymentCalenderDto.getMemberValidDate()){
|
|
|
+ case 1 :
|
|
|
+ memberPaymentAmount = memberFee.getGroupPurchaseMonthFee().setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ originalMemberPaymentAmount = memberFee.getOriginalMonthFee().setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ break;
|
|
|
+ case 6 :
|
|
|
+ memberPaymentAmount = memberFee.getGroupPurchaseHalfYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ originalMemberPaymentAmount = memberFee.getOriginalHalfYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ break;
|
|
|
+ case 12 :
|
|
|
+ memberPaymentAmount = memberFee.getGroupPurchaseYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ originalMemberPaymentAmount = memberFee.getOriginalYearFee().setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("请选择正确的会员有效期");
|
|
|
+ }
|
|
|
+ if(memberPaymentAmount.compareTo(musicGroupPaymentCalenderDto.getMemberPaymentAmount()) != 0){
|
|
|
+ status = AUDITING;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int times = musicGroupPaymentDateRangeList.size();
|
|
|
+
|
|
|
+ // 排序
|
|
|
+ Collections.sort(musicGroupPaymentDateRangeList, new Comparator<MusicGroupPaymentDateRange>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int compare(MusicGroupPaymentDateRange o1, MusicGroupPaymentDateRange o2) {
|
|
|
+ return o1.getPaymentValidStartDate().compareTo(o2.getPaymentValidStartDate());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ for (int i = 0; i < musicGroupPaymentDateRangeList.size(); i++) {
|
|
|
+
|
|
|
+ MusicGroupPaymentDateRange musicGroupPaymentDateRange = musicGroupPaymentDateRangeList.get(i);
|
|
|
+
|
|
|
+ MusicGroupPaymentCalender musicGroupPaymentCalender = new MusicGroupPaymentCalender();
|
|
|
+ musicGroupPaymentCalender.setAttribute1(musicGroupPaymentCalenderDto.getAttribute1());
|
|
|
+ musicGroupPaymentCalender.setOriginalMemberPaymentAmount(originalMemberPaymentAmount);
|
|
|
+ musicGroupPaymentCalender.setAttribute2(musicGroupPaymentCalenderDto.getAttribute2());
|
|
|
+ musicGroupPaymentCalender.setDeadlinePaymentDate(musicGroupPaymentDateRange.getDeadlinePaymentDate());
|
|
|
+ musicGroupPaymentCalender.setIsGiveMusicNetwork(musicGroupPaymentCalenderDto.getIsGiveMusicNetwork());
|
|
|
+ musicGroupPaymentCalender.setMemo(musicGroupPaymentCalenderDto.getMemo());
|
|
|
+ musicGroupPaymentCalender.setMusicGroupId(musicGroupId);
|
|
|
+ musicGroupPaymentCalender.setMusicGroupOrganizationCourseSettingId(musicGroupPaymentCalenderDto.getMusicGroupOrganizationCourseSettingId());
|
|
|
+
|
|
|
+ BigDecimal totalPaymentAmount = musicGroupPaymentCalenderDto.getMasterTotalPrice();
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ totalPaymentAmount = totalPaymentAmount.add(tempPccs.getCourseCurrentPrice());
|
|
|
+ newCSList.add(tempPccs);
|
|
|
+ }
|
|
|
+ musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(newCSList);
|
|
|
+ }
|
|
|
+ musicGroupPaymentCalender.setPaymentAmount(totalPaymentAmount);
|
|
|
+ musicGroupPaymentCalender.setPaymentPattern(musicGroupPaymentCalenderDto.getPaymentPattern());
|
|
|
+ musicGroupPaymentCalender.setPaymentValidEndDate(musicGroupPaymentDateRange.getPaymentValidEndDate());
|
|
|
+ musicGroupPaymentCalender.setPaymentValidStartDate(musicGroupPaymentDateRange.getPaymentValidStartDate());
|
|
|
+
|
|
|
+ if (paymentType == PaymentType.MUSIC_APPLY) {
|
|
|
+ if (i == 0) {
|
|
|
+ musicGroupPaymentCalender.setPaymentType(paymentType);
|
|
|
+ } else {
|
|
|
+ musicGroupPaymentCalender.setPaymentType(PaymentType.MUSIC_RENEW);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ musicGroupPaymentCalender.setPaymentType(paymentType);
|
|
|
+ }
|
|
|
+ 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 && paymentType != ADD_COURSE && paymentType != SPAN_GROUP_CLASS_ADJUST) {
|
|
|
+ if(musicGroupPaymentCalender.getPaymentValidStartDate() != null){
|
|
|
+ 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() != AUDITING) {
|
|
|
+ musicGroupPaymentCalender.setExpectNum(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (musicGroupPaymentCalender.getStatus() != 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置批次号
|
|
|
+ musicGroupPaymentCalender.setBatchNo(batchNo);
|
|
|
+ //设置会员缴费金额、级别以及有效期
|
|
|
+ musicGroupPaymentCalender.setMemberPaymentAmount(musicGroupPaymentCalenderDto.getMemberPaymentAmount());
|
|
|
+ musicGroupPaymentCalender.setMemberRankSettingId(musicGroupPaymentCalenderDto.getMemberRankSettingId());
|
|
|
+ musicGroupPaymentCalender.setMemberValidDate(musicGroupPaymentCalenderDto.getMemberValidDate());
|
|
|
+ musicGroupPaymentCalenderDto.setBatchNo(batchNo);
|
|
|
+ musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
|
|
|
+
|
|
|
+ //课程费用列表
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> currentMusicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalender
|
|
|
+ .getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
+
|
|
|
+ if (currentMusicGroupPaymentCalenderCourseSettings != null && 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果是跨团班级合并,保存用户缴费详情
|
|
|
+ List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails = null;
|
|
|
+ if (musicGroupPaymentCalender.getPaymentType() == SPAN_GROUP_CLASS_ADJUST){
|
|
|
+ musicGroupPaymentCalenderStudentDetails = musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails();
|
|
|
+ //记录学员缴费详情
|
|
|
+ musicGroupPaymentCalenderStudentDetailDao.batchInsert(musicGroupPaymentCalenderStudentDetails,musicGroupPaymentCalender.getBatchNo());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (musicGroupPaymentCalender.getStatus() != AUDITING) {
|
|
|
+ // 如果是进行中加学生
|
|
|
+ if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
|
|
|
+ addStudent(musicGroupPaymentCalender, currentMusicGroupPaymentCalenderCourseSettings,musicGroup);
|
|
|
+ }else if(musicGroupPaymentCalender.getPaymentType() == SPAN_GROUP_CLASS_ADJUST){
|
|
|
+ //如果是跨团班级合并,添加学员
|
|
|
+ musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender,musicGroupPaymentCalenderStudentDetails);
|
|
|
+ }else if(musicGroupPaymentCalenderDto.getMergeClassFlag()){
|
|
|
+ //缴费项目添加学员
|
|
|
+ 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,musicGroup,false);
|
|
|
+ }
|
|
|
+ //将0元未缴费学员缴费状态更新为已缴费
|
|
|
+ int j = musicGroupPaymentCalenderDetailDao.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender.getId());
|
|
|
+ musicGroupPaymentCalender.setActualNum((musicGroupPaymentCalender.getActualNum()==null?0:musicGroupPaymentCalender.getActualNum()) + j);
|
|
|
+ musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果是报名,需要修改乐团状态
|
|
|
+ if (paymentType == MUSIC_APPLY) {
|
|
|
+ if (status != AUDITING) {
|
|
|
+ musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
|
|
|
+ // 记录操作日志
|
|
|
+ musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(创建缴费 -> 报名中)", sysUser.getId(), ""));
|
|
|
+ } else {
|
|
|
+ musicGroup.setStatus(MusicGroupStatusEnum.FEE_AUDIT);
|
|
|
+ // 记录操作日志
|
|
|
+ musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "报名缴费项目创建成功(创建缴费 -> 费用审核中)", sysUser.getId(), ""));
|
|
|
+ }
|
|
|
+ musicGroup.setUpdateTime(date);
|
|
|
+ musicGroupDao.update(musicGroup);
|
|
|
+ } else if (paymentType == ADD_STUDENT) {
|
|
|
+ if (status != AUDITING) {
|
|
|
+ // 学生加到班级
|
|
|
+ String classGroupIdStr = musicGroupPaymentCalenderDto.getAttribute1();
|
|
|
+ classGroupService.addStudentToClassGroupAndCourseArranging(Integer.parseInt(musicGroupPaymentCalenderDto.getStudentIds()), classGroupIdStr,
|
|
|
+ batchNo, musicGroupPaymentCalenderCourseSettingsList,musicGroup);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (status == AUDITING) {
|
|
|
+ // 如果是审核中
|
|
|
+ Set<Integer> roleIds = new HashSet<>(1);
|
|
|
+ roleIds.add(SysUserRole.SECTION_MANAGER);
|
|
|
+ Organization organization = organizationDao.get(musicGroup.getOrganId());
|
|
|
+ sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId()),
|
|
|
+ MessageTypeEnum.BACKSTAGE_PAYMENT_CALENDER_AUDIT, "", organization.getName(), musicGroup.getName());
|
|
|
+ }else {
|
|
|
+ imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.MUSIC);
|
|
|
+ }
|
|
|
+
|
|
|
+ return batchNo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public Object getDetail(Long id) {
|
|
|
MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(id);
|
|
|
Map<Long, Long> expectNumMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.countExpectNum(id));
|