Browse Source

Merge branch 'saas' of http://git.dayaedu.com/yonge/mec into saas

yanite 3 years ago
parent
commit
996b604e39

+ 75 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CalenderMemberDto.java

@@ -0,0 +1,75 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.enums.PeriodEnum;
+
+import java.math.BigDecimal;
+
+import static com.ym.mec.biz.dal.enums.PeriodEnum.MONTH;
+
+public class CalenderMemberDto {
+    //会员周期
+    private PeriodEnum periodEnum = MONTH;
+
+    //会员数量
+    private Integer memberNum = 1 ;
+
+    //会员现价
+    private BigDecimal actualAmount = BigDecimal.ZERO;
+
+    //会员原价
+    private BigDecimal originalAmount = BigDecimal.ZERO;
+
+    //会员等级编号
+    private Integer memberRankSettingId = 1;
+
+    //是否可选
+    private Boolean optionalFlag = false;
+
+    public PeriodEnum getPeriodEnum() {
+        return periodEnum;
+    }
+
+    public void setPeriodEnum(PeriodEnum periodEnum) {
+        this.periodEnum = periodEnum;
+    }
+
+    public Integer getMemberNum() {
+        return memberNum;
+    }
+
+    public void setMemberNum(Integer memberNum) {
+        this.memberNum = memberNum;
+    }
+
+    public BigDecimal getActualAmount() {
+        return actualAmount;
+    }
+
+    public void setActualAmount(BigDecimal actualAmount) {
+        this.actualAmount = actualAmount;
+    }
+
+    public BigDecimal getOriginalAmount() {
+        return originalAmount;
+    }
+
+    public void setOriginalAmount(BigDecimal originalAmount) {
+        this.originalAmount = originalAmount;
+    }
+
+    public Integer getMemberRankSettingId() {
+        return memberRankSettingId;
+    }
+
+    public void setMemberRankSettingId(Integer memberRankSettingId) {
+        this.memberRankSettingId = memberRankSettingId;
+    }
+
+    public Boolean getOptionalFlag() {
+        return optionalFlag;
+    }
+
+    public void setOptionalFlag(Boolean optionalFlag) {
+        this.optionalFlag = optionalFlag;
+    }
+}

+ 0 - 26
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MemberFeeDto.java

@@ -1,26 +0,0 @@
-package com.ym.mec.biz.dal.dto;
-
-import java.math.BigDecimal;
-
-public class MemberFeeDto {
-
-    private BigDecimal currentAmount;
-
-    private BigDecimal originalAmount;
-
-    public BigDecimal getCurrentAmount() {
-        return currentAmount;
-    }
-
-    public void setCurrentAmount(BigDecimal currentAmount) {
-        this.currentAmount = currentAmount;
-    }
-
-    public BigDecimal getOriginalAmount() {
-        return originalAmount;
-    }
-
-    public void setOriginalAmount(BigDecimal originalAmount) {
-        this.originalAmount = originalAmount;
-    }
-}

+ 21 - 10
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentCalenderDto.java

@@ -43,6 +43,17 @@ public class MusicGroupPaymentCalenderDto {
 
 	private BigDecimal masterTotalPrice = BigDecimal.ZERO;
 
+	//会员缴费相关信息
+	private CalenderMemberDto calenderMember;
+
+	public CalenderMemberDto getCalenderMember() {
+		return calenderMember;
+	}
+
+	public void setCalenderMember(CalenderMemberDto calenderMember) {
+		this.calenderMember = calenderMember;
+	}
+
 	//会员有效期(月)
 	private Integer memberValidDate;
 
@@ -52,16 +63,6 @@ public class MusicGroupPaymentCalenderDto {
 	//会员等级编号
 	private Integer memberRankSettingId;
 
-	private Boolean autoCreate = false;
-
-	public Boolean getAutoCreate() {
-		return autoCreate;
-	}
-
-	public void setAutoCreate(Boolean autoCreate) {
-		this.autoCreate = autoCreate;
-	}
-
 	public Integer getMemberValidDate() {
 		return memberValidDate;
 	}
@@ -86,6 +87,16 @@ public class MusicGroupPaymentCalenderDto {
 		this.memberRankSettingId = memberRankSettingId;
 	}
 
+	private Boolean autoCreate = false;
+
+	public Boolean getAutoCreate() {
+		return autoCreate;
+	}
+
+	public void setAutoCreate(Boolean autoCreate) {
+		this.autoCreate = autoCreate;
+	}
+
 	@ApiModelProperty(value = "跨团合并时缴费项目中学员的缴费明细")
 	private List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails;
 

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CalenderMemberService.java

@@ -0,0 +1,4 @@
+package com.ym.mec.biz.service;
+
+public interface CalenderMemberService {
+}

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java

@@ -19,6 +19,13 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	 * @return
 	 */
 	String create(MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto);
+
+	/**
+	 * 创建缴费信息
+	 * @param musicGroupPaymentCalenderDto
+	 * @return
+	 */
+	String create1(MusicGroupPaymentCalenderDto musicGroupPaymentCalenderDto);
 	
 	/**
 	 * 获取明细

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java

@@ -153,9 +153,9 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     //陪练课可预约声部列表
     String PRACTICE_SUBJECT_ID_LIST = "practice_subject_id_list";
     //陪练课预约开始时间
-    String PRACTICE_APPLY_START_TIME = "practice_apply_start_time";
+//    String PRACTICE_APPLY_START_TIME = "practice_apply_start_time";
     //陪练课预约结束时间
-    String PRACTICE_APPLY_END_TIME = "practice_apply_end_time";
+//    String PRACTICE_APPLY_END_TIME = "practice_apply_end_time";
 
     //特殊规则默认值--》商品规则设置
     //内部库存预警值

+ 375 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -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));

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationServiceImpl.java

@@ -138,7 +138,7 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 		String joinTeacherId = organization.getJoinTeacherId();
 		String organManagerUserIds = concatOrganManager(organManager, repairId, educationId, joinTeacherId);
 		Map<String,List<Mapper>> resultMap = new HashMap<>(4);
-		if(organManagerUserIds.length() > 0){
+		if(StringUtils.isNotEmpty(organManagerUserIds) && organManagerUserIds.length() > 0){
 			Map<Integer, String> educationalTeacherNameMap = MapUtil.convertMybatisMap(teacherDao.queryNameByIds(organManagerUserIds));
 			resultMap.put("organManager",getOrganManagerName(educationalTeacherNameMap,organManager));
 			resultMap.put("repairId",getOrganManagerName(educationalTeacherNameMap,repairId));

+ 20 - 20
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -786,8 +786,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if(StringUtils.isEmpty(practiceSubjectIdListConfig)){
             throw new BizException("请配置陪练课可预约声部");
         }
-        String practiceApplyStartTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
-        String practiceApplyEndTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
+//        String practiceApplyStartTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+//        String practiceApplyEndTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
         SysConfig practiceFreeApplyExpireDateConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_FREE_APPLY_EXPIRE_DATE);
@@ -802,8 +802,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
 
         result.put("subjects", subjects);
-        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
-        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig);
+//        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
+//        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig);
         result.put("userDefaultSubjectIds", StringUtils.join(userDefaultSubjectIds.toArray(), ","));
         result.put("practiceApplyIntervalMinutes", practiceApplyIntervalTimeConfig.getParanValue(Integer.class));
         result.put("practiceCourseMinutes", practiceCourseMinutesConfig.getParanValue(Integer.class));
@@ -1661,15 +1661,15 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         calendar.add(Calendar.DATE, -1);
         calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
-        String enableStartTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
-        String enableEndTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
+//        String enableStartTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+//        String enableEndTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         while (!calendar.getTime().after(endDay)) {
             calendar.add(Calendar.DATE, 1);
-            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableStartTimeStr.split(":")[0]));
-            calendar.set(Calendar.MINUTE, Integer.valueOf(enableStartTimeStr.split(":")[1]));
+//            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableStartTimeStr.split(":")[0]));
+//            calendar.set(Calendar.MINUTE, Integer.valueOf(enableStartTimeStr.split(":")[1]));
             Date enableApplyDayStartTime = calendar.getTime();
-            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableEndTimeStr.split(":")[0]));
-            calendar.set(Calendar.MINUTE, Integer.valueOf(enableEndTimeStr.split(":")[1]));
+//            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableEndTimeStr.split(":")[0]));
+//            calendar.set(Calendar.MINUTE, Integer.valueOf(enableEndTimeStr.split(":")[1]));
             Calendar applyStartCalendar = Calendar.getInstance();
             applyStartCalendar.setTime(enableApplyDayStartTime);
             for (String applyDayTime : applyDayTimes) {
@@ -1689,8 +1689,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         calendar.add(Calendar.DATE, -1);
         calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
-        String enableStartTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
-        String enableEndTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
+//        String enableStartTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+//        String enableEndTimeStr = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         Integer practiceApplyIntervalMinutes = practiceApplyIntervalTimeConfig.getParanValue(Integer.class);
         LocalTime dayStartTime = LocalTime.parse("00:00:00", DateUtil.timeFormatter);
@@ -1706,11 +1706,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
         while (!calendar.getTime().after(endDay)) {
             calendar.add(Calendar.DATE, 1);
-            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableStartTimeStr.split(":")[0]));
-            calendar.set(Calendar.MINUTE, Integer.valueOf(enableStartTimeStr.split(":")[1]));
+//            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableStartTimeStr.split(":")[0]));
+//            calendar.set(Calendar.MINUTE, Integer.valueOf(enableStartTimeStr.split(":")[1]));
             Date enableApplyDayStartTime = calendar.getTime();
-            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableEndTimeStr.split(":")[0]));
-            calendar.set(Calendar.MINUTE, Integer.valueOf(enableEndTimeStr.split(":")[1]));
+//            calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(enableEndTimeStr.split(":")[0]));
+//            calendar.set(Calendar.MINUTE, Integer.valueOf(enableEndTimeStr.split(":")[1]));
             Calendar applyStartCalendar = Calendar.getInstance();
             applyStartCalendar.setTime(enableApplyDayStartTime);
             for (String applyDayTime : dayApplyTimes) {
@@ -2318,8 +2318,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if(StringUtils.isEmpty(practiceSubjectIdListConfig)){
             throw new BizException("请配置陪练课可预约声部");
         }
-        String practiceApplyStartTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
-        String practiceApplyEndTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
+//        String practiceApplyStartTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_START_TIME,tenantId);
+//        String practiceApplyEndTimeConfig = sysTenantConfigService.getTenantConfigValue(SysConfigService.PRACTICE_APPLY_END_TIME,tenantId);
         SysConfig practiceApplyIntervalTimeConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_APPLY_INTERVAL_TIME);
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
         SysConfig practicePayMaxMonthConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_PAY_MAX_MONTH);
@@ -2339,8 +2339,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         Collections.swap(subjects, 6, 7);
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(organId);
         result.put("subjects", subjects);
-        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
-        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig);
+//        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
+//        result.put("practiceApplyEndTime", practiceApplyEndTimeConfig);
         result.put("userDefaultSubjectIds", StringUtils.join(userDefaultSubjectIds.toArray(), ","));
         result.put("practiceApplyIntervalMinutes", practiceApplyIntervalTimeConfig.getParanValue(Integer.class));
         result.put("practiceCourseMinutes", practiceCourseMinutesConfig.getParanValue(Integer.class));

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java

@@ -39,7 +39,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
                         "/eduSubject/findSubSubjects", "/eduFinancialExpenditure/batchAdd", "/eduSendNotice/*",
                         "/oaContracts/*", "/eduStudent/organStudentOverView", "/activity/countCloudTeacherActive",
                         "/activity/organDoubleEleven2021Statis", "/activity/doubleEleven2021Statis", "/questionnaireTopic/getDetail", "/questionnaireUserResult/add",
-                        "/tenantInfo/info"
+                        "/tenantInfo/info/*"
                 )
                 .permitAll().anyRequest().authenticated().and().httpBasic();
     }