|  | @@ -1,198 +1,22 @@
 | 
	
		
			
				|  |  |  package com.ym.mec.biz.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import static com.ym.mec.biz.dal.entity.ApprovalStatus.PROCESSING;
 | 
	
		
			
				|  |  | -import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
 | 
	
		
			
				|  |  | -import static com.ym.mec.biz.dal.enums.DealStatusEnum.ING;
 | 
	
		
			
				|  |  | -import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
 | 
	
		
			
				|  |  | -import static com.ym.mec.biz.dal.enums.OrderDetailTypeEnum.ACCESSORIES;
 | 
	
		
			
				|  |  | -import static com.ym.mec.biz.dal.enums.OrderDetailTypeEnum.MAINTENANCE;
 | 
	
		
			
				|  |  | -import static com.ym.mec.biz.dal.enums.OrderDetailTypeEnum.MUSICAL;
 | 
	
		
			
				|  |  | -import static com.ym.mec.biz.dal.enums.OrderDetailTypeEnum.TEACHING;
 | 
	
		
			
				|  |  | -import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
 | 
	
		
			
				|  |  | -import static com.ym.mec.biz.dal.enums.SysUserRoleEnum.ORGAN_MANAGER;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import java.io.IOException;
 | 
	
		
			
				|  |  | -import java.math.BigDecimal;
 | 
	
		
			
				|  |  | -import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | -import java.util.ArrayList;
 | 
	
		
			
				|  |  | -import java.util.Arrays;
 | 
	
		
			
				|  |  | -import java.util.Collections;
 | 
	
		
			
				|  |  | -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.Objects;
 | 
	
		
			
				|  |  | -import java.util.Set;
 | 
	
		
			
				|  |  | -import java.util.stream.Collectors;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import org.apache.commons.collections.CollectionUtils;
 | 
	
		
			
				|  |  | -import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | -import org.slf4j.Logger;
 | 
	
		
			
				|  |  | -import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | -import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | -import org.springframework.context.annotation.Lazy;
 | 
	
		
			
				|  |  | -import org.springframework.http.HttpStatus;
 | 
	
		
			
				|  |  | -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 | 
	
		
			
				|  |  | -import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | -import org.springframework.transaction.annotation.Propagation;
 | 
	
		
			
				|  |  | -import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.TypeReference;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.ChargeTypeDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.ClassGroupDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.ClassGroupTeacherMapperDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.CooperationOrganDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.GoodsDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupBuildLogDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupDao;
 | 
	
		
			
				|  |  | -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.MusicGroupPaymentCalenderStudentDetailDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupPaymentEntitiesDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupPurchaseListDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupQuitDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupSchoolTermCourseDetailDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupSchoolTermStudentCourseDetailDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupSubjectGoodsGroupDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.OrganizationDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.SchoolDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.SporadicChargeInfoDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.StudentDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.StudentPreRegistrationDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.StudentVisitDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.SubjectChangeDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.SubjectDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.SysConfigDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.SysUserCashAccountLogDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.TeacherAttendanceDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dao.TeacherDao;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.BasicUserDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.CloseMusicGroupDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.CourseScheduleTeachersDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.HighClassGroupDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.MusicCardDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.MusicGroupApplyGoodsDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.MusicGroupBasicDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.MusicGroupQuitDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.RegisterPayDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.SporadicPayDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.StudentApplyInstrumentDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.StudentImportDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.SubFeeSettingDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.SubjectRegisterDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.UpdateExpectedNumDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.ApprovalStatus;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.ChargeType;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.ClassGroup;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.CooperationOrgan;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.CouponPayParam;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.CourseSchedule;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.FinancialExpenditure;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.Goods;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.ImGroup;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicGroup;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicGroupBuildLog;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.*;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.*;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.*;
 | 
	
		
			
				|  |  |  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.MusicGroupPaymentCalenderStudentDetail;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicGroupPurchaseList;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicGroupQuit;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicGroupReturnFeeDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicGroupSchoolTermCourseDetail;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.MusicMemberDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.Organization;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.School;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.Student;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.StudentInstrument;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.StudentPreRegistration;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.StudentRegistration;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.Subject;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.SubjectChange;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.entity.SysUserCashAccountLog;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.CouponDetailTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.DealStatusEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.FivePlusGradeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.GoodsType;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.GradeTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.GroupType;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.ReturnFeeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.SixPlusGradeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.SysUserRoleEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.TeachTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.MusicMemberQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.event.source.GroupEventSource;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.event.source.SendSeoMessageSource;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ClassGroupService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ClassGroupStudentMapperService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ContractService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.GoodsService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ImGroupMemberService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ImGroupService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ImUserFriendService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.MusicGroupService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.PayService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.StudentPaymentOrderService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.StudentRegistrationService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.StudentService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysConfigService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysCouponCodeService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysEmployeePositionService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysMessageService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysTenantConfigService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysUserCashAccountDetailService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysUserCashAccountService;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.dal.BaseDAO;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.entity.HttpResponseResult;
 | 
	
	
		
			
				|  | @@ -208,6 +32,33 @@ import com.ym.mec.util.date.DateUtil;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.http.HttpUtil;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.json.JsonUtil;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.validator.CommonValidator;
 | 
	
		
			
				|  |  | +import org.apache.commons.collections.CollectionUtils;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | +import org.slf4j.Logger;
 | 
	
		
			
				|  |  | +import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.context.annotation.Lazy;
 | 
	
		
			
				|  |  | +import org.springframework.http.HttpStatus;
 | 
	
		
			
				|  |  | +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 | 
	
		
			
				|  |  | +import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Propagation;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.io.IOException;
 | 
	
		
			
				|  |  | +import java.math.BigDecimal;
 | 
	
		
			
				|  |  | +import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | +import java.util.*;
 | 
	
		
			
				|  |  | +import java.util.Map.Entry;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import static com.ym.mec.biz.dal.entity.ApprovalStatus.PROCESSING;
 | 
	
		
			
				|  |  | +import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
 | 
	
		
			
				|  |  | +import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
 | 
	
		
			
				|  |  | +import static com.ym.mec.biz.dal.enums.DealStatusEnum.ING;
 | 
	
		
			
				|  |  | +import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
 | 
	
		
			
				|  |  | +import static com.ym.mec.biz.dal.enums.OrderDetailTypeEnum.*;
 | 
	
		
			
				|  |  | +import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
 | 
	
		
			
				|  |  | +import static com.ym.mec.biz.dal.enums.SysUserRoleEnum.ORGAN_MANAGER;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> implements MusicGroupService {
 | 
	
	
		
			
				|  | @@ -583,13 +434,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |  						continue;
 | 
	
		
			
				|  |  |  					}
 | 
	
		
			
				|  |  |  					MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail();
 | 
	
		
			
				|  |  | +					musicGroupPaymentStudentCourseDetail.setMusicGroupId(musicGroupPaymentCalender.getMusicGroupId());
 | 
	
		
			
				|  |  |  					musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
 | 
	
		
			
				|  |  |  					//musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetail.getId());
 | 
	
		
			
				|  |  |  					musicGroupPaymentStudentCourseDetail.setUserId(si.getUserId());
 | 
	
		
			
				|  |  |  					musicGroupPaymentStudentCourseDetail.setCourseType(courseSetting.getCourseType());
 | 
	
		
			
				|  |  |  					musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(courseSetting.getCourseTotalMinuties());
 | 
	
		
			
				|  |  | +					musicGroupPaymentStudentCourseDetail.setSubCourseMinutes(courseSetting.getCourseTotalMinuties());
 | 
	
		
			
				|  |  |  					musicGroupPaymentStudentCourseDetail.setCourseOriginalPrice(courseSetting.getCourseOriginalPrice());
 | 
	
		
			
				|  |  |  					musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(courseSetting.getCourseCurrentPrice());
 | 
	
		
			
				|  |  | +					musicGroupPaymentStudentCourseDetail.setSubCourseOriginalPrice(courseSetting.getCourseOriginalPrice());
 | 
	
		
			
				|  |  | +					musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(courseSetting.getCourseCurrentPrice());
 | 
	
		
			
				|  |  |  					musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(0);
 | 
	
		
			
				|  |  |  					musicGroupPaymentStudentCourseDetail.setCreateTime(nowDate);
 | 
	
		
			
				|  |  |  					musicGroupPaymentStudentCourseDetail.setUpdateTime(nowDate);
 | 
	
	
		
			
				|  | @@ -785,6 +640,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      public boolean finishPreApply(String musicGroupId, boolean isCheckStudentNum) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if (sysUser == null || sysUser.getId() == null) {
 | 
	
		
			
				|  |  | +            throw new BizException("请重新登录");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
 | 
	
		
			
				|  |  |          if (musicGroup == null) {
 | 
	
		
			
				|  |  |              throw new BizException("乐团信息查询失败");
 | 
	
	
		
			
				|  | @@ -806,17 +666,34 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        musicGroup.setStatus(MusicGroupStatusEnum.PRE_BUILD_FEE);
 | 
	
		
			
				|  |  | +        musicGroup.setStatus(MusicGroupStatusEnum.PAY);
 | 
	
		
			
				|  |  |          musicGroup.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |          musicGroupDao.update(musicGroup);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | -        if (sysUser == null || sysUser.getId() == null) {
 | 
	
		
			
				|  |  | -            throw new BizException("请重新登录");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          //记录操作日志
 | 
	
		
			
				|  |  | -        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroup.getId(), "报名缴费项目失败(预报名 -> 准备创建缴费)", sysUser.getId(), ""));
 | 
	
		
			
				|  |  | +        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroup.getId(), "预报名完成(预报名 -> 报名缴费中)", sysUser.getId(), ""));
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        studentRegistrationDao.musicGroupOpenPay(musicGroupId, PaymentStatusEnum.OPEN);
 | 
	
		
			
				|  |  | +        MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
 | 
	
		
			
				|  |  | +        if (regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) {
 | 
	
		
			
				|  |  | +            regCalender.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.OPEN);
 | 
	
		
			
				|  |  | +            regCalender.setUpdateTime(new Date());
 | 
	
		
			
				|  |  | +            musicGroupPaymentCalenderDao.update(regCalender);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        //三方乐团不发送缴费通知
 | 
	
		
			
				|  |  | +        if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN) {
 | 
	
		
			
				|  |  | +            List<Map<Integer, String>> mapList = studentRegistrationDao.findMapByMusicGroupId(musicGroupId, 0);
 | 
	
		
			
				|  |  | +            //获取所有已报名学员列表
 | 
	
		
			
				|  |  | +            HashMap<Integer, String> map = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertMybatisMap(mapList)), HashMap.class);
 | 
	
		
			
				|  |  | +            if (map != null && map.size() > 0) {
 | 
	
		
			
				|  |  | +                String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
 | 
	
		
			
				|  |  | +//                String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
 | 
	
		
			
				|  |  | +                sysMessageService.batchSendMessage(MessageSender.AWSMS, MessageTypeEnum.SMS_PAYMENT_MESSAGE,
 | 
	
		
			
				|  |  | +                        map, null, 0, "", "", musicGroup.getName(), studentApplyUrl);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        sendSeoMessageSource.sendSeoMessage(musicGroup.getOrganId(), new SysUserRoleEnum[]{ORGAN_MANAGER}, null,
 | 
	
		
			
				|  |  | +                musicGroup.getEducationalTeacherId(), MessageTypeEnum.BACKSTAGE_ACTION_PAYMENT, musicGroup.getName());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return true;
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -1153,6 +1030,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      goodsDto.setOrderAmount(goodsDto.getOrderAmount().add(goodsGroup.getPrice()));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    //分部分润金额
 | 
	
		
			
				|  |  | +                    if(goodsGroup.getOrganShareProfit() != null){
 | 
	
		
			
				|  |  | +                    	goodsDto.setOrderAmount(goodsDto.getOrderAmount().add(goodsGroup.getOrganShareProfit()));
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              goodsDto.setOrderAmount(goodsDto.getOrderAmount().subtract(goodsDto.getRemitFee()));
 | 
	
	
		
			
				|  | @@ -1413,12 +1295,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (musicGroup.getStatus() == MusicGroupStatusEnum.DRAFT || musicGroup.getStatus() == MusicGroupStatusEnum.AUDIT_FAILED) {
 | 
	
		
			
				|  |  | -            musicGroup.setStatus(subFeeSettingDto.getMusicGroupStatus());
 | 
	
		
			
				|  |  | +            //musicGroup.setStatus(subFeeSettingDto.getMusicGroupStatus());
 | 
	
		
			
				|  |  |              musicGroup.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |              musicGroupDao.update(musicGroup);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //记录日志信息
 | 
	
		
			
				|  |  | -        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "基础信息提交审核(编辑中 -> 审核中)", sysUser.getId(), JSONObject.toJSONString(subFeeSettingDto)));
 | 
	
		
			
				|  |  | +        //musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "基础信息提交审核(编辑中 -> 审核中)", sysUser.getId(), JSONObject.toJSONString(subFeeSettingDto)));
 | 
	
		
			
				|  |  |          //删除原有的乐团声部规划
 | 
	
		
			
				|  |  |          musicGroupSubjectPlanDao.delByMusicGroupId(musicGroupId);
 | 
	
		
			
				|  |  |          //删除原有的声部商品组合
 | 
	
	
		
			
				|  | @@ -1431,12 +1313,25 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |              musicGroupSubjectPlanDao.batchAdd(musicGroupSubjectPlans, musicGroupId);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          if (subFeeSettingDto.getMusicGroupSubjectGoodsGroups() != null && subFeeSettingDto.getMusicGroupSubjectGoodsGroups().size() > 0) {
 | 
	
		
			
				|  |  | +        	//获取分部最大分润金额
 | 
	
		
			
				|  |  | +        	Organization organ = organizationDao.get(musicGroup.getOrganId());
 | 
	
		
			
				|  |  | +        	if(organ == null){
 | 
	
		
			
				|  |  | +        		throw new BizException("分部信息查询失败");
 | 
	
		
			
				|  |  | +        	}
 | 
	
		
			
				|  |  | +        	BigDecimal maxProfits = organ.getMaxMusicalInstrumentsProfits();
 | 
	
		
			
				|  |  | +        	
 | 
	
		
			
				|  |  |              for (MusicGroupSubjectGoodsGroup musicGroupSubjectGoodsGroup : subFeeSettingDto.getMusicGroupSubjectGoodsGroups()) {
 | 
	
		
			
				|  |  |                  if (musicGroupSubjectGoodsGroup.getType().equals(GoodsType.INSTRUMENT) && (musicGroupSubjectGoodsGroup.getKitGroupPurchaseTypeJson() == null
 | 
	
		
			
				|  |  |                          || musicGroupSubjectGoodsGroup.getKitGroupPurchaseTypeJson().isEmpty()
 | 
	
		
			
				|  |  |                          || musicGroupSubjectGoodsGroup.getKitGroupPurchaseTypeJson().equals("{}"))) {
 | 
	
		
			
				|  |  |                      throw new BizException(musicGroupSubjectGoodsGroup.getName() + " 请选择提供方式");
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  | +                //判断分润是否超过最大值
 | 
	
		
			
				|  |  | +                if(musicGroupSubjectGoodsGroup.getOrganShareProfit() != null && maxProfits.compareTo(musicGroupSubjectGoodsGroup.getOrganShareProfit()) < 0){
 | 
	
		
			
				|  |  | +                	throw new BizException("超过了分润最大金额[{}],请重新设置分润金额", maxProfits.doubleValue());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  |                  if (musicGroupSubjectGoodsGroup.getGroupRemissionCourseFee() == null) {
 | 
	
		
			
				|  |  |                      musicGroupSubjectGoodsGroup.setGroupRemissionCourseFee(0);
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -1546,11 +1441,43 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |          if (sysUser == null) {
 | 
	
		
			
				|  |  |              throw new BizException("用户信息获取失败");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        MusicGroup musicGroup = saveLog(musicGroupId, MusicGroupStatusEnum.DRAFT);
 | 
	
		
			
				|  |  | +        Date date = new Date();
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
 | 
	
		
			
				|  |  | +        if (musicGroup == null) {
 | 
	
		
			
				|  |  | +            throw new BizException("乐团信息不存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        if (musicGroup.getStatus() != MusicGroupStatusEnum.DRAFT && musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT_FAILED) {
 | 
	
		
			
				|  |  | +            throw new BizException("当前乐团状态不支持此操作");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<MusicGroupSubjectPlan> musicSubjectClassPlan = musicGroupSubjectPlanDao.getMusicSubjectClassPlan(musicGroupId);
 | 
	
		
			
				|  |  | +        if(CollectionUtils.isEmpty(musicSubjectClassPlan)){
 | 
	
		
			
				|  |  | +            throw new BizException("请填写乐团声部信息");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          //记录操作日志
 | 
	
		
			
				|  |  |          musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "提交审核(草稿 -> 审核中)", sysUser.getId(), ""));
 | 
	
		
			
				|  |  |          musicGroup.setStatus(MusicGroupStatusEnum.AUDIT);
 | 
	
		
			
				|  |  | +        musicGroup.setUpdateTime(date);
 | 
	
		
			
				|  |  |          musicGroupDao.update(musicGroup);
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        List<PaymentCalenderStatusEnum> statusList = new ArrayList<MusicGroupPaymentCalender.PaymentCalenderStatusEnum>();
 | 
	
		
			
				|  |  | +        statusList.add(PaymentCalenderStatusEnum.DRAFT);
 | 
	
		
			
				|  |  | +        //修改乐团报名缴费项目状态
 | 
	
		
			
				|  |  | +        List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(musicGroupId, statusList, null);
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        if(musicGroupPaymentCalenderList == null || musicGroupPaymentCalenderList.size() == 0) {
 | 
	
		
			
				|  |  | +        	throw new BizException("请先创建缴费项目");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        musicGroupPaymentCalenderList.forEach(t -> {
 | 
	
		
			
				|  |  | +        	t.setStatus(PaymentCalenderStatusEnum.AUDITING);
 | 
	
		
			
				|  |  | +        	t.setUpdateTime(date);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenderList);
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  |          sendSeoMessageSource.sendSeoMessage(musicGroup.getOrganId(), new SysUserRoleEnum[]{ORGAN_MANAGER},
 | 
	
		
			
				|  |  |                  null, null, MessageTypeEnum.BACKSTAGE_CREATE_MUSIC_GROUP_APPLY, sysUser.getRealName(), musicGroup.getName());
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -1562,20 +1489,60 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |          if (sysUser == null) {
 | 
	
		
			
				|  |  |              throw new BizException("用户信息获取失败");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        MusicGroup musicGroup = saveLog(musicGroupId, MusicGroupStatusEnum.AUDIT);
 | 
	
		
			
				|  |  | +        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
 | 
	
		
			
				|  |  | +        if (musicGroup == null) {
 | 
	
		
			
				|  |  | +            throw new BizException("乐团信息不存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (musicGroup.getTenantId() == null) {
 | 
	
		
			
				|  |  | +            throw new BizException("乐团机构信息异常,请联系管理员");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT) {
 | 
	
		
			
				|  |  | +            throw new BizException("当前乐团状态不支持此操作");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        Date date = new Date();
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  |          //记录操作日志
 | 
	
		
			
				|  |  | -        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "乐团审核失败(审核中 -> 审核失败)", sysUser.getId(), memo));
 | 
	
		
			
				|  |  | -        musicGroup.setMemo(memo);
 | 
	
		
			
				|  |  | -        musicGroup.setStatus(MusicGroupStatusEnum.AUDIT_FAILED);
 | 
	
		
			
				|  |  | -        musicGroupDao.update(musicGroup);
 | 
	
		
			
				|  |  | -        //修改缴费项目状态
 | 
	
		
			
				|  |  | -        List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
 | 
	
		
			
				|  |  | -        if (musicGroupPaymentCalenders != null && musicGroupPaymentCalenders.size() > 0) {
 | 
	
		
			
				|  |  | -            musicGroupPaymentCalenders.forEach(e -> {
 | 
	
		
			
				|  |  | -                e.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.REJECT);
 | 
	
		
			
				|  |  | +        if (musicGroup.getStatus() == MusicGroupStatusEnum.AUDIT){
 | 
	
		
			
				|  |  | +        	musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "乐团审核失败(审核中 -> 审核失败)", sysUser.getId(), memo));
 | 
	
		
			
				|  |  | +        	musicGroup.setStatus(MusicGroupStatusEnum.AUDIT_FAILED);
 | 
	
		
			
				|  |  | +            musicGroup.setMemo(memo);
 | 
	
		
			
				|  |  | +            musicGroup.setUpdateTime(date);
 | 
	
		
			
				|  |  | +            musicGroupDao.update(musicGroup);
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            List<PaymentCalenderStatusEnum> statusList = new ArrayList<MusicGroupPaymentCalender.PaymentCalenderStatusEnum>();
 | 
	
		
			
				|  |  | +            statusList.add(PaymentCalenderStatusEnum.AUDITING);
 | 
	
		
			
				|  |  | +            //修改乐团报名缴费项目状态
 | 
	
		
			
				|  |  | +            List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(musicGroupId, statusList, null);
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            musicGroupPaymentCalenderList.forEach(t -> {
 | 
	
		
			
				|  |  | +            	t.setStatus(PaymentCalenderStatusEnum.DRAFT);
 | 
	
		
			
				|  |  | +            	t.setUpdateTime(date);
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenderList);
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +        }else if(musicGroup.getStatus() == MusicGroupStatusEnum.FEE_AUDIT){
 | 
	
		
			
				|  |  | +        	musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "乐团审核失败(费用审核中 -> 费用审核失败)", sysUser.getId(), memo));
 | 
	
		
			
				|  |  | +        	List<PaymentCalenderStatusEnum> statusList = new ArrayList<MusicGroupPaymentCalender.PaymentCalenderStatusEnum>();
 | 
	
		
			
				|  |  | +            statusList.add(PaymentCalenderStatusEnum.AUDITING);
 | 
	
		
			
				|  |  | +            //修改乐团报名缴费项目状态
 | 
	
		
			
				|  |  | +            List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(musicGroupId, statusList, null);
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            musicGroupPaymentCalenderList.forEach(t -> {
 | 
	
		
			
				|  |  | +            	t.setStatus(PaymentCalenderStatusEnum.REJECT);
 | 
	
		
			
				|  |  | +            	t.setUpdateTime(date);
 | 
	
		
			
				|  |  | +            	t.setMemo(memo);
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  | -            musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenders);
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenderList);
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            //修改乐团状态
 | 
	
		
			
				|  |  | +            musicGroup.setStatus(MusicGroupStatusEnum.FEE_AUDIT_FAILED);
 | 
	
		
			
				|  |  | +            musicGroup.setUpdateTime(date);
 | 
	
		
			
				|  |  | +            musicGroupDao.update(musicGroup);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -1585,44 +1552,58 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |          if (sysUser == null) {
 | 
	
		
			
				|  |  |              throw new BizException("用户信息获取失败");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        MusicGroup musicGroup = saveLog(musicGroupId, MusicGroupStatusEnum.AUDIT);
 | 
	
		
			
				|  |  | +        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
 | 
	
		
			
				|  |  | +        if (musicGroup == null) {
 | 
	
		
			
				|  |  | +            throw new BizException("乐团信息不存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          if (musicGroup.getTenantId() == null) {
 | 
	
		
			
				|  |  |              throw new BizException("乐团机构信息异常,请联系管理员");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        //记录操作日志
 | 
	
		
			
				|  |  | -        musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "审核通过(审核中 -> 预报名)", sysUser.getId(), ""));
 | 
	
		
			
				|  |  | -        musicGroup.setStatus(MusicGroupStatusEnum.PRE_APPLY);
 | 
	
		
			
				|  |  | -        musicGroupDao.update(musicGroup);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        // 创建群
 | 
	
		
			
				|  |  | -        imGroupService.create(musicGroupId, null, "乐团预报名", null,
 | 
	
		
			
				|  |  | -                musicGroup.getName(), musicGroup.getName(), null, GroupType.MUSIC.getCode(), ImGroup.GroupTypeEnum.PARENT_MEETING);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        Map<Integer, String> userRoleMap = new HashMap<Integer, String>();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        if (musicGroup.getTeamTeacherId() != null) {
 | 
	
		
			
				|  |  | -            userRoleMap.put(musicGroup.getTeamTeacherId(), "运营主管");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        if (musicGroup.getEducationalTeacherId() != null) {
 | 
	
		
			
				|  |  | -            userRoleMap.put(musicGroup.getEducationalTeacherId(), "乐团主管");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        if (musicGroup.getDirectorUserId() != null) {
 | 
	
		
			
				|  |  | -            userRoleMap.put(musicGroup.getDirectorUserId(), "乐队指导");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        if (musicGroup.getTransactionTeacherId() != null) {
 | 
	
		
			
				|  |  | -            userRoleMap.put(musicGroup.getTransactionTeacherId(), "衔接老师");
 | 
	
		
			
				|  |  | +        if (musicGroup.getStatus() != MusicGroupStatusEnum.AUDIT) {
 | 
	
		
			
				|  |  | +            throw new BizException("当前乐团状态不支持此操作");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        // 添加成员
 | 
	
		
			
				|  |  | -        imGroupMemberService.join(musicGroupId, userRoleMap);
 | 
	
		
			
				|  |  | -        //缴费老师推送消息
 | 
	
		
			
				|  |  | -        sendSeoMessageSource.sendSeoMessage(musicGroup.getOrganId(), null,
 | 
	
		
			
				|  |  | -                null, musicGroup.getEducationalTeacherId(), MessageTypeEnum.BACKSTAGE_CREATE_MUSIC_GROUP_ADJUST_SUCCESS, musicGroup.getName());
 | 
	
		
			
				|  |  | -        Map<Integer, String> map = new HashMap<>(1);
 | 
	
		
			
				|  |  | -        map.put(musicGroup.getEducationalTeacherId(), musicGroup.getEducationalTeacherId().toString());
 | 
	
		
			
				|  |  | -        if (map != null && map.size() > 0) {
 | 
	
		
			
				|  |  | -            sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.BACKSTAGE_CREATE_MUSIC_GROUP_ADJUST_SUCCESS,
 | 
	
		
			
				|  |  | -                    map, null, 0, null, "SYSTEM", musicGroup.getName());
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        Date date = new Date();
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        if(musicGroup.getStatus() == MusicGroupStatusEnum.AUDIT){
 | 
	
		
			
				|  |  | +            //记录操作日志
 | 
	
		
			
				|  |  | +            musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "审核通过(审核中 -> 费用审核中)", sysUser.getId(), ""));
 | 
	
		
			
				|  |  | +            musicGroup.setStatus(MusicGroupStatusEnum.FEE_AUDIT);
 | 
	
		
			
				|  |  | +        }else if(musicGroup.getStatus() == MusicGroupStatusEnum.FEE_AUDIT){
 | 
	
		
			
				|  |  | +            musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "审核通过(费用审核中 -> 预报名)", sysUser.getId(), ""));
 | 
	
		
			
				|  |  | +            musicGroup.setStatus(MusicGroupStatusEnum.PRE_APPLY);
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            List<PaymentCalenderStatusEnum> statusList = new ArrayList<MusicGroupPaymentCalender.PaymentCalenderStatusEnum>();
 | 
	
		
			
				|  |  | +            statusList.add(PaymentCalenderStatusEnum.AUDITING);
 | 
	
		
			
				|  |  | +            //修改乐团报名缴费项目状态
 | 
	
		
			
				|  |  | +            List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(musicGroupId, statusList, null);
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            if(musicGroupPaymentCalenderList == null || musicGroupPaymentCalenderList.size() == 0){
 | 
	
		
			
				|  |  | +            	throw new BizException("没有审核中的缴费项目");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            musicGroupPaymentCalenderList.forEach(t -> {
 | 
	
		
			
				|  |  | +                if (t.getPayUserType() == SCHOOL) {
 | 
	
		
			
				|  |  | +                    if (t.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) > 0) {
 | 
	
		
			
				|  |  | +                        t.setStatus(PaymentCalenderStatusEnum.OPEN);
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        t.setStatus(PaymentCalenderStatusEnum.PAID);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                } else if (date.after(t.getStartPaymentDate())) {
 | 
	
		
			
				|  |  | +                    t.setStatus(PaymentCalenderStatusEnum.OPEN);
 | 
	
		
			
				|  |  | +                } else if (date.after(t.getDeadlinePaymentDate())) {
 | 
	
		
			
				|  |  | +                    t.setStatus(PaymentCalenderStatusEnum.OVER);
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    t.setStatus(PaymentCalenderStatusEnum.NO);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            	t.setUpdateTime(date);
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenderList);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        musicGroup.setUpdateTime(date);
 | 
	
		
			
				|  |  | +        musicGroupDao.update(musicGroup);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -1830,25 +1811,23 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public boolean deleteMusicGroup(String musicGroupId) {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          if (musicGroup == null) {
 | 
	
		
			
				|  |  |              throw new BizException("乐团不存在");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          if (musicGroup.getDelFlag() == true) {
 | 
	
		
			
				|  |  |              throw new BizException("乐团已删除");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          if (musicGroup.getStatus() != MusicGroupStatusEnum.CANCELED) {
 | 
	
		
			
				|  |  |              throw new BizException("乐团当前状态是{},不能删除", musicGroup.getStatus().getMsg());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +//        MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderService.findByMusicGroupRegCalender(musicGroupId);
 | 
	
		
			
				|  |  | +//        if(Objects.nonNull(musicGroupRegCalender)){
 | 
	
		
			
				|  |  | +//            musicGroupPaymentCalenderService.del(musicGroupRegCalender.getId());
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  |          musicGroup.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |          musicGroup.setDelFlag(true);
 | 
	
		
			
				|  |  |          musicGroupDao.update(musicGroup);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          return true;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1939,12 +1918,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |              throw new BizException("乐团找不到");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if (!(musicGroup.getStatus() == MusicGroupStatusEnum.APPLY ||
 | 
	
		
			
				|  |  | +        /*if (!(musicGroup.getStatus() == MusicGroupStatusEnum.APPLY ||
 | 
	
		
			
				|  |  |                  musicGroup.getStatus() == MusicGroupStatusEnum.PAY ||
 | 
	
		
			
				|  |  |                  musicGroup.getStatus() == MusicGroupStatusEnum.PREPARE ||
 | 
	
		
			
				|  |  |                  musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS)) {
 | 
	
		
			
				|  |  |              throw new BizException("乐团当前状态是[{}],不能延长缴费", musicGroup.getStatus().getMsg());
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        }*/
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Date date = new Date();
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1959,7 +1938,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |          MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderService.findByMusicGroupRegCalender(musicGroup.getId());
 | 
	
		
			
				|  |  |          if (regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) {
 | 
	
		
			
				|  |  |              regCalender.setDeadlinePaymentDate(expireDate);
 | 
	
		
			
				|  |  | -            regCalender.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.OPEN);
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            //regCalender.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.OPEN);
 | 
	
		
			
				|  |  |              regCalender.setUpdateTime(date);
 | 
	
		
			
				|  |  |              musicGroupPaymentCalenderService.update(regCalender);
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -3433,6 +3413,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 | 
	
		
			
				|  |  |          subFeeSettingDto.setMusicGroup(musicGroup);
 | 
	
		
			
				|  |  |          //获取付费主体
 | 
	
		
			
				|  |  |          subFeeSettingDto.setMusicGroupPaymentEntities(musicGroupPaymentEntitiesDao.findByMusicGroupId(musicGroupId));
 | 
	
		
			
				|  |  | +        subFeeSettingDto.setMaxMusicalInstrumentsProfits(organizationDao.get(musicGroup.getOrganId()).getMaxMusicalInstrumentsProfits());
 | 
	
		
			
				|  |  |          //获取缴费周期
 | 
	
		
			
				|  |  |          //List<Integer> paymentMonth = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId).stream().map(e -> e.getPaymentMonth()).collect(Collectors.toList());
 | 
	
		
			
				|  |  |          //subFeeSettingDto.setMonths(paymentMonth);
 |