Browse Source

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

yonge 5 years ago
parent
commit
d46229345e
18 changed files with 431 additions and 179 deletions
  1. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java
  2. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupStudentFeeDao.java
  3. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupStudentFee.java
  4. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java
  5. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicCalenderDetailQueryInfo.java
  6. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderDetailService.java
  7. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupStudentFeeService.java
  8. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  9. 4 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  10. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupStudentFeeServiceImpl.java
  11. 318 136
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OnlineMusicGroupServiceImpl.java
  12. 21 23
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml
  13. 1 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  14. 11 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupStudentFeeMapper.xml
  15. 1 1
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  16. 4 4
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java
  17. 11 0
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupStudentFeeController.java
  18. 5 5
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduOnlineMusicGroupController.java

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -271,5 +271,5 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      * @return
      * @return
      */
      */
     int countStudentNotStartCourseNumWithCourseType(@Param("studentId") Integer studentId,
     int countStudentNotStartCourseNumWithCourseType(@Param("studentId") Integer studentId,
-                                                    @Param("type")CourseSchedule.CourseScheduleType courseScheduleType);
+                                                    @Param("courseScheduleType")CourseSchedule.CourseScheduleType courseScheduleType);
 }
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupStudentFeeDao.java

@@ -168,4 +168,11 @@ public interface MusicGroupStudentFeeDao extends BaseDAO<Long, MusicGroupStudent
 	 * @param musicGroupId
 	 * @param musicGroupId
 	 */
 	 */
 	void updateCalender(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
 	void updateCalender(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
+
+	/**
+	 * 修改课程费用
+	 * @param ids
+	 * @param courseFee
+	 */
+    void batchUpdateCourseFee(@Param("ids") String ids, @Param("courseFee") BigDecimal courseFee);
 }
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupStudentFee.java

@@ -81,6 +81,8 @@ public class MusicGroupStudentFee {
 
 
 	private String subjectName;
 	private String subjectName;
 
 
+	private Integer remainNetworkClassTimes;
+
 	public MusicGroupStudentFee(String musicGroupId, Integer userId, Integer subjectId,
 	public MusicGroupStudentFee(String musicGroupId, Integer userId, Integer subjectId,
 								BigDecimal courseFee, Date nextPaymentDate, BigDecimal temporaryCourseFee,PaymentStatus paymentStatus) {
 								BigDecimal courseFee, Date nextPaymentDate, BigDecimal temporaryCourseFee,PaymentStatus paymentStatus) {
 		this.musicGroupId = musicGroupId;
 		this.musicGroupId = musicGroupId;
@@ -224,6 +226,13 @@ public class MusicGroupStudentFee {
 		this.temporaryCourseFee = temporaryCourseFee;
 		this.temporaryCourseFee = temporaryCourseFee;
 	}
 	}
 
 
+	public Integer getRemainNetworkClassTimes() {
+		return remainNetworkClassTimes;
+	}
+
+	public void setRemainNetworkClassTimes(Integer remainNetworkClassTimes) {
+		this.remainNetworkClassTimes = remainNetworkClassTimes;
+	}
 	@Override
 	@Override
 	public String toString() {
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);
 		return ToStringBuilder.reflectionToString(this);

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java

@@ -62,6 +62,10 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     TRIAL_PRACTICE_CREATE_STUDENT_PUSH("TRIAL_PRACTICE_CREATE_STUDENT_PUSH", "试听课安排"),
     TRIAL_PRACTICE_CREATE_STUDENT_PUSH("TRIAL_PRACTICE_CREATE_STUDENT_PUSH", "试听课安排"),
     TRIAL_PRACTICE_CREATE_TEACHER_PUSH("TRIAL_PRACTICE_CREATE_TEACHER_PUSH", "试听课安排"),
     TRIAL_PRACTICE_CREATE_TEACHER_PUSH("TRIAL_PRACTICE_CREATE_TEACHER_PUSH", "试听课安排"),
 
 
+    /**乐团网管课*/
+    MUSIC_NETWORK_CRATE_TEACHER("MUSIC_NETWORK_CRATE_TEACHER", "乐团网管课安排"),
+    MUSIC_NETWORK_CRATE_STUDENT("MUSIC_NETWORK_CRATE_STUDENT", "乐团课通知"),
+
     /** 课外训练消息 */
     /** 课外训练消息 */
     EXTRA_REMIND_PUSH("EXTRA_REMIND_PUSH", "作业提醒"),
     EXTRA_REMIND_PUSH("EXTRA_REMIND_PUSH", "作业提醒"),
     EXTRA_REMIND_IM("EXTRA_REMIND_IM", "作业提醒"),
     EXTRA_REMIND_IM("EXTRA_REMIND_IM", "作业提醒"),

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicCalenderDetailQueryInfo.java

@@ -11,8 +11,18 @@ public class MusicCalenderDetailQueryInfo extends QueryInfo {
 
 
 	private Integer subjectId;
 	private Integer subjectId;
 
 
+	private String musicGroupId;
+
 	private Long id;
 	private Long id;
 
 
+	public String getMusicGroupId() {
+		return musicGroupId;
+	}
+
+	public void setMusicGroupId(String musicGroupId) {
+		this.musicGroupId = musicGroupId;
+	}
+
 	public Integer getSubjectId() {
 	public Integer getSubjectId() {
 		return subjectId;
 		return subjectId;
 	}
 	}

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

@@ -11,11 +11,11 @@ public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long
 
 
     /**
     /**
      * 修改学员预计缴费金额
      * 修改学员预计缴费金额
-     * @param actualAmount
+     * @param expectAmount
      * @param ids
      * @param ids
      * @return
      * @return
      */
      */
-    void updateActualAmount(BigDecimal actualAmount,String ids);
+    void updateExpectAmount(BigDecimal expectAmount,String ids);
 
 
     /**
     /**
      * 开启缴费
      * 开启缴费

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupStudentFeeService.java

@@ -4,6 +4,8 @@ import com.ym.mec.biz.dal.dto.UpdateStudentFeeDto;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.common.service.BaseService;
 import com.ym.mec.common.service.BaseService;
 
 
+import java.math.BigDecimal;
+
 public interface MusicGroupStudentFeeService extends BaseService<Long, MusicGroupStudentFee> {
 public interface MusicGroupStudentFeeService extends BaseService<Long, MusicGroupStudentFee> {
 
 
 	/**
 	/**
@@ -33,4 +35,10 @@ public interface MusicGroupStudentFeeService extends BaseService<Long, MusicGrou
 	void updateStudentFeeIsLock(UpdateStudentFeeDto studentFeeDto);
 	void updateStudentFeeIsLock(UpdateStudentFeeDto studentFeeDto);
 
 
 
 
+	/**
+	 * 批量修改课程费用
+	 * @param ids
+	 * @param courseFee
+	 */
+    void batchUpdateCourseFee(String ids, BigDecimal courseFee);
 }
 }

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -35,8 +35,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 
 
 	@Override
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	@Transactional(rollbackFor = Exception.class)
-	public void updateActualAmount(BigDecimal actualAmount,String ids) {
-		if(actualAmount == null || StringUtils.isEmpty(ids)){
+	public void updateExpectAmount(BigDecimal expectAmount,String ids) {
+		if(expectAmount == null || StringUtils.isEmpty(ids)){
 			throw new BizException("参数校验失败");
 			throw new BizException("参数校验失败");
 		}
 		}
 		String[] split = ids.split(",");
 		String[] split = ids.split(",");
@@ -51,7 +51,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 				throw new BizException("修改失败,缴费状态不匹配");
 				throw new BizException("修改失败,缴费状态不匹配");
 			}
 			}
 			e.setUpdateTime(date);
 			e.setUpdateTime(date);
-			e.setActualAmount(actualAmount);
+			e.setExpectAmount(expectAmount);
 		});
 		});
 		musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);
 		musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);
 	}
 	}

+ 4 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -1684,6 +1684,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             musicGroupStudentFee.setLatestPaidTime(date);
             musicGroupStudentFee.setLatestPaidTime(date);
             musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
             musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
             musicGroupStudentFee.setTemporaryCourseFee(new BigDecimal(0));
             musicGroupStudentFee.setTemporaryCourseFee(new BigDecimal(0));
+            Integer getRemainNetworkClassTimes = musicGroupStudentFee.getRemainNetworkClassTimes() == null ? 0 : musicGroupStudentFee.getRemainNetworkClassTimes();
+            musicGroupStudentFee.setRemainNetworkClassTimes(getRemainNetworkClassTimes+1);
 //            musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId, musicGroupStudentFee.getNextPaymentDate(), musicGroupStudentFee));
 //            musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId, musicGroupStudentFee.getNextPaymentDate(), musicGroupStudentFee));
             musicGroupStudentFeeDao.update(musicGroupStudentFee);
             musicGroupStudentFeeDao.update(musicGroupStudentFee);
 
 
@@ -1700,8 +1702,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
 
             //更新实际缴费人数
             //更新实际缴费人数
             MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.getForLock(userLastCalenderDetail.getMusicGroupPaymentCalenderId());
             MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.getForLock(userLastCalenderDetail.getMusicGroupPaymentCalenderId());
-            Integer actualNum = musicGroupPaymentCalender.getActualNum() ==null ? 0:musicGroupPaymentCalender.getActualNum();
-            musicGroupPaymentCalender.setActualNum(actualNum);
+            Integer actualNum = musicGroupPaymentCalender.getActualNum() == null ? 0:musicGroupPaymentCalender.getActualNum();
+            musicGroupPaymentCalender.setActualNum(actualNum+1);
             musicGroupPaymentCalender.setUpdateTime(date);
             musicGroupPaymentCalender.setUpdateTime(date);
             musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
             musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
 
 

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupStudentFeeServiceImpl.java

@@ -15,10 +15,12 @@ import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.*;
 
 
 @Service
 @Service
@@ -102,4 +104,13 @@ public class MusicGroupStudentFeeServiceImpl extends BaseServiceImpl<Long, Music
 		musicGroupStudentFeeDao.updateStudentFeeIsLock(studentFeeDto);
 		musicGroupStudentFeeDao.updateStudentFeeIsLock(studentFeeDto);
 	}
 	}
 
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void batchUpdateCourseFee(String ids, BigDecimal courseFee) {
+		if(StringUtils.isEmpty(ids) || courseFee == null){
+			throw new BizException("参数校验失败");
+		}
+		musicGroupStudentFeeDao.batchUpdateCourseFee(ids,courseFee);
+	}
+
 }
 }

+ 318 - 136
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OnlineMusicGroupServiceImpl.java

@@ -9,14 +9,16 @@ import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.enums.*;
-import com.ym.mec.biz.service.CourseScheduleService;
-import com.ym.mec.biz.service.EduPracticeGroupService;
-import com.ym.mec.biz.service.OnlineMusicGroupService;
-import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.constant.CommonConstants;
+import com.ym.mec.common.entity.ImGroupMember;
+import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.im.ImFeignService;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Isolation;
@@ -37,6 +39,8 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
     @Autowired
     @Autowired
     private MusicGroupDao musicGroupDao;
     private MusicGroupDao musicGroupDao;
     @Autowired
     @Autowired
+    private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
+    @Autowired
     private StudentDao studentDao;
     private StudentDao studentDao;
     @Autowired
     @Autowired
     private TeacherDao teacherDao;
     private TeacherDao teacherDao;
@@ -67,7 +71,11 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
     @Autowired
     @Autowired
     private TeacherFreeTimeDao teacherFreeTimeDao;
     private TeacherFreeTimeDao teacherFreeTimeDao;
     @Autowired
     @Autowired
-    private EduPracticeGroupService eduPracticeGroupService;
+    private PracticeGroupService practiceGroupService;
+    @Autowired
+    private ImFeignService imFeignService;
+    @Autowired
+    private SysMessageService sysMessageService;
 
 
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.DEFAULT)
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.DEFAULT)
     @Override
     @Override
@@ -84,13 +92,18 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
         if(Objects.isNull(onlineMusicGroupCourseInfo.getTeacherId())){
         if(Objects.isNull(onlineMusicGroupCourseInfo.getTeacherId())){
             throw new BizException("请指定教师");
             throw new BizException("请指定教师");
         }
         }
-        if(Objects.isNull(onlineMusicGroupCourseInfo.getFirstCourseTime())){
+        if(Objects.isNull(onlineMusicGroupCourseInfo.getCourseCreateStartTime())){
             throw new BizException("请指定首次上课时间");
             throw new BizException("请指定首次上课时间");
         }
         }
         MusicGroup musicGroup = musicGroupDao.get(onlineMusicGroupCourseInfo.getMusicGroupId());
         MusicGroup musicGroup = musicGroupDao.get(onlineMusicGroupCourseInfo.getMusicGroupId());
         if(Objects.isNull(musicGroupDao)){
         if(Objects.isNull(musicGroupDao)){
             throw new BizException("乐团不存在");
             throw new BizException("乐团不存在");
         }
         }
+        MusicGroupStudentFee studentFee = musicGroupStudentFeeDao.findByUser(onlineMusicGroupCourseInfo.getStudentId(), musicGroup.getId());
+        if(Objects.isNull(studentFee)){
+            throw new BizException("学员缴费信息不存在");
+        }
+
         SysUser student = studentDao.lockUserReturnInfo(onlineMusicGroupCourseInfo.getStudentId());
         SysUser student = studentDao.lockUserReturnInfo(onlineMusicGroupCourseInfo.getStudentId());
         if(Objects.isNull(student)){
         if(Objects.isNull(student)){
             throw new BizException("学员不存在");
             throw new BizException("学员不存在");
@@ -107,7 +120,15 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
         onlineMusicGroupCourseInfo.setCourseCount(8);
         onlineMusicGroupCourseInfo.setCourseCount(8);
         onlineMusicGroupCourseInfo.setSingleClassMinutes(25);
         onlineMusicGroupCourseInfo.setSingleClassMinutes(25);
         onlineMusicGroupCourseInfo.setTeachMode(TeachModeEnum.ONLINE);
         onlineMusicGroupCourseInfo.setTeachMode(TeachModeEnum.ONLINE);
+        CourseTimeDto courseTimeDto=new CourseTimeDto();
+        LocalDateTime courseStartLocalDate = LocalDateTime.ofInstant(onlineMusicGroupCourseInfo.getCourseCreateStartTime().toInstant(), DateUtil.zoneId);
+        courseTimeDto.setDayOfWeek(courseStartLocalDate.getDayOfWeek().getValue());
+        courseTimeDto.setStartClassTime(DateUtil.dateToString(onlineMusicGroupCourseInfo.getCourseCreateStartTime(), "HH:mm:ss"));
+        List<CourseTimeDto> ts=new ArrayList<>();
+        ts.add(courseTimeDto);
+        onlineMusicGroupCourseInfo.setCourseTimes(ts);
         List<CourseSchedule> courses = courseScheduleService.createCourses(onlineMusicGroupCourseInfo, true);
         List<CourseSchedule> courses = courseScheduleService.createCourses(onlineMusicGroupCourseInfo, true);
+        courses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
 
 
         Date now=new Date();
         Date now=new Date();
 
 
@@ -155,7 +176,10 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
             //课表
             //课表
             courseSchedule.setMusicGroupId(onlineMusicGroupCourseInfo.getMusicGroupId());
             courseSchedule.setMusicGroupId(onlineMusicGroupCourseInfo.getMusicGroupId());
             courseSchedule.setClassGroupId(classGroup.getId());
             courseSchedule.setClassGroupId(classGroup.getId());
+            courseSchedule.setName(classGroup.getName());
             courseSchedule.setStatus(CourseStatusEnum.NOT_START);
             courseSchedule.setStatus(CourseStatusEnum.NOT_START);
+            courseSchedule.setTeacherId(onlineMusicGroupCourseInfo.getTeacherId());
+            courseSchedule.setActualTeacherId(onlineMusicGroupCourseInfo.getTeacherId());
             courseSchedule.setCreateTime(now);
             courseSchedule.setCreateTime(now);
             courseSchedule.setUpdateTime(now);
             courseSchedule.setUpdateTime(now);
             courseSchedule.setTeachMode(TeachModeEnum.ONLINE);
             courseSchedule.setTeachMode(TeachModeEnum.ONLINE);
@@ -166,6 +190,9 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
         }
         }
         courseScheduleDao.batchAddCourseSchedules(courses);
         courseScheduleDao.batchAddCourseSchedules(courses);
         TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = teacherDefaultMusicGroupSalaryDao.findByTeacherAndCourseType(onlineMusicGroupCourseInfo.getTeacherId(), CourseSchedule.CourseScheduleType.MUSIC_NETWORK.getCode());
         TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = teacherDefaultMusicGroupSalaryDao.findByTeacherAndCourseType(onlineMusicGroupCourseInfo.getTeacherId(), CourseSchedule.CourseScheduleType.MUSIC_NETWORK.getCode());
+        if(Objects.isNull(teacherDefaultMusicGroupSalary)){
+            throw new BizException("请设置教师课酬");
+        }
         BigDecimal teacherDefaultSalary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal("1");
         BigDecimal teacherDefaultSalary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal("1");
         BigDecimal studentSingleCourseCost=BigDecimal.ZERO;
         BigDecimal studentSingleCourseCost=BigDecimal.ZERO;
         for (CourseSchedule courseSchedule : courses) {
         for (CourseSchedule courseSchedule : courses) {
@@ -208,10 +235,41 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
         courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
         courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
         teacherAttendanceDao.batchInsert(teacherAttendances);
         teacherAttendanceDao.batchInsert(teacherAttendances);
 
 
-        List<String> courseTimes = courses.stream().map(c -> DateUtil.dateToString(c.getStartClassTime(), "yyyy-MM-dd HH:mm:ss")).collect(Collectors.toList());
+        try{
+            List<String> cdstrs=new ArrayList<>();
+            for(int i=0;i<courses.size();i++){
+                cdstrs.add((i+1)+","+DateUtil.dateToString(courses.get(i).getStartClassTime(), "yyyy年MM月dd日 HH时mm分"));
+            }
+
+            Map<Integer, String> userMap = new HashMap<>();
+            userMap.put(onlineMusicGroupCourseInfo.getStudentId(), onlineMusicGroupCourseInfo.getStudentId().toString());
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.MUSIC_NETWORK_CRATE_STUDENT,
+                    userMap, null, 0, null, "STUDENT", student.getUsername(), musicGroup.getName(),
+                    teacher.getRealName(), DateUtil.dateToString(courses.get(0).getStartClassTime(),"yyyy年MM月dd日 HH时mm分"));
+
+            Map<Integer, String> teacherMap = new HashMap<>();
+            teacherMap.put(onlineMusicGroupCourseInfo.getTeacherId(), onlineMusicGroupCourseInfo.getTeacherId().toString());
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.MUSIC_NETWORK_CRATE_STUDENT,
+                    teacherMap, null, 0, null, "TEACHER", teacher.getRealName(), classGroup.getName(),
+                    StringUtils.join(cdstrs, ","));
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+        List<ImGroupMember> imGroupMemberList = new ArrayList<>();
+        if(Objects.nonNull(musicGroup.getEducationalTeacherId())){
+            imGroupMemberList.add(new ImGroupMember(musicGroup.getEducationalTeacherId().toString()));
+        }
+        imGroupMemberList.add(new ImGroupMember(onlineMusicGroupCourseInfo.getStudentId().toString()));
+        imGroupMemberList.add(new ImGroupMember(onlineMusicGroupCourseInfo.getTeacherId().toString()));
+        ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]);
+        // 创建群组
+        imFeignService.groupCreate(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
+
+        List<String> courseTimes = courses.stream().map(c -> DateUtil.dateToString(c.getStartClassTime(), "yyyy-MM-dd HH:mm")).collect(Collectors.toList());
 
 
         Map<String, Object> result=new HashMap<>();
         Map<String, Object> result=new HashMap<>();
-        result.put("courseTimes", StringUtils.join(courses,","));
+        result.put("courseTimes", StringUtils.join(courseTimes,","));
         return result;
         return result;
     }
     }
 
 
@@ -294,7 +352,7 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
     }
     }
 
 
     @Override
     @Override
-    public Map getTeacherFreeTimes(Integer studentId, Integer teacherId) {
+    public Map getTeacherFreeTimes(Integer studentId, Integer teacherId){
         if (Objects.isNull(teacherId)) {
         if (Objects.isNull(teacherId)) {
             throw new BizException("请选择教师");
             throw new BizException("请选择教师");
         }
         }
@@ -310,9 +368,8 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
             throw new BizException("教师不存在");
             throw new BizException("教师不存在");
         }
         }
         Map result = new HashMap();
         Map result = new HashMap();
-        Set<Integer> disableApplyWeekDay = new HashSet<>();
+        Set<Date> allTeacherFreeDates = new HashSet<>();
 
 
-        //课程时长暂时与网管课共用
         SysConfig practiceCourseMinutesConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
         SysConfig practiceCourseMinutesConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
         Integer practiceCourseMinutes = practiceCourseMinutesConfig.getParanValue(Integer.class);
         Integer practiceCourseMinutes = practiceCourseMinutesConfig.getParanValue(Integer.class);
 
 
@@ -323,67 +380,106 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
             checkTeacherLeaveDate = false;
             checkTeacherLeaveDate = false;
         }
         }
 
 
+        Set<Integer> disableApplyWeekNum = new HashSet<>();
+        Set<Integer> disableApplyWeekDay = new HashSet<>();
+
         TeacherFreeTime teacherFreeTime = teacherFreeTimeDao.findTeacherFreeTime(teacherId);
         TeacherFreeTime teacherFreeTime = teacherFreeTimeDao.findTeacherFreeTime(teacherId);
         JSONObject teacherFreeTimes=new JSONObject();
         JSONObject teacherFreeTimes=new JSONObject();
+        Integer maxTeacherCourses = null;
         int holiday = 0;
         int holiday = 0;
         if (Objects.nonNull(teacherFreeTime)) {
         if (Objects.nonNull(teacherFreeTime)) {
+            if (Objects.nonNull(teacherFreeTime.getTotalTimes())) {
+                maxTeacherCourses = teacherFreeTime.getTotalTimes();
+            }
             if (Objects.nonNull(teacherFreeTime.getHoliday())) {
             if (Objects.nonNull(teacherFreeTime.getHoliday())) {
-                holiday = teacherFreeTime.getHoliday();
+                holiday = DateUtil.normalWeekNumCalendarWeekNumMap.get(teacherFreeTime.getHoliday());
             }
             }
             if(StringUtils.isNotBlank(teacherFreeTime.getMonday())){
             if(StringUtils.isNotBlank(teacherFreeTime.getMonday())){
-                teacherFreeTimes.put(String.valueOf(DayOfWeek.MONDAY.getValue()), JSON.parseArray(teacherFreeTime.getMonday()));
+                teacherFreeTimes.put(String.valueOf(Calendar.MONDAY), JSON.parseArray(teacherFreeTime.getMonday()));
             }else{
             }else{
-                disableApplyWeekDay.add(DayOfWeek.MONDAY.getValue());
+                disableApplyWeekDay.add(Calendar.MONDAY);
             }
             }
             if(StringUtils.isNotBlank(teacherFreeTime.getTuesday())){
             if(StringUtils.isNotBlank(teacherFreeTime.getTuesday())){
-                teacherFreeTimes.put(String.valueOf(DayOfWeek.TUESDAY.getValue()), JSON.parseArray(teacherFreeTime.getTuesday()));
+                teacherFreeTimes.put(String.valueOf(Calendar.TUESDAY), JSON.parseArray(teacherFreeTime.getTuesday()));
             }else{
             }else{
-                disableApplyWeekDay.add(DayOfWeek.TUESDAY.getValue());
+                disableApplyWeekDay.add(Calendar.TUESDAY);
             }
             }
             if(StringUtils.isNotBlank(teacherFreeTime.getWednesday())){
             if(StringUtils.isNotBlank(teacherFreeTime.getWednesday())){
-                teacherFreeTimes.put(String.valueOf(DayOfWeek.WEDNESDAY.getValue()), JSON.parseArray(teacherFreeTime.getWednesday()));
+                teacherFreeTimes.put(String.valueOf(Calendar.WEDNESDAY), JSON.parseArray(teacherFreeTime.getWednesday()));
             }else{
             }else{
-                disableApplyWeekDay.add(DayOfWeek.WEDNESDAY.getValue());
+                disableApplyWeekDay.add(Calendar.WEDNESDAY);
             }
             }
             if(StringUtils.isNotBlank(teacherFreeTime.getThursday())){
             if(StringUtils.isNotBlank(teacherFreeTime.getThursday())){
-                teacherFreeTimes.put(String.valueOf(DayOfWeek.THURSDAY.getValue()), JSON.parseArray(teacherFreeTime.getThursday()));
+                teacherFreeTimes.put(String.valueOf(Calendar.THURSDAY), JSON.parseArray(teacherFreeTime.getThursday()));
             }else{
             }else{
-                disableApplyWeekDay.add(DayOfWeek.THURSDAY.getValue());
+                disableApplyWeekDay.add(Calendar.THURSDAY);
             }
             }
             if(StringUtils.isNotBlank(teacherFreeTime.getFriday())){
             if(StringUtils.isNotBlank(teacherFreeTime.getFriday())){
-                teacherFreeTimes.put(String.valueOf(DayOfWeek.FRIDAY.getValue()), JSON.parseArray(teacherFreeTime.getFriday()));
+                teacherFreeTimes.put(String.valueOf(Calendar.FRIDAY), JSON.parseArray(teacherFreeTime.getFriday()));
             }else{
             }else{
-                disableApplyWeekDay.add(DayOfWeek.FRIDAY.getValue());
+                disableApplyWeekDay.add(Calendar.FRIDAY);
             }
             }
             if(StringUtils.isNotBlank(teacherFreeTime.getSaturday())){
             if(StringUtils.isNotBlank(teacherFreeTime.getSaturday())){
-                teacherFreeTimes.put(String.valueOf(DayOfWeek.SATURDAY.getValue()), JSON.parseArray(teacherFreeTime.getSaturday()));
+                teacherFreeTimes.put(String.valueOf(Calendar.SATURDAY), JSON.parseArray(teacherFreeTime.getSaturday()));
             }else{
             }else{
-                disableApplyWeekDay.add(DayOfWeek.SATURDAY.getValue());
+                disableApplyWeekDay.add(Calendar.SATURDAY);
             }
             }
             if(StringUtils.isNotBlank(teacherFreeTime.getSunday())){
             if(StringUtils.isNotBlank(teacherFreeTime.getSunday())){
-                teacherFreeTimes.put(String.valueOf(DayOfWeek.SUNDAY.getValue()), JSON.parseArray(teacherFreeTime.getSunday()));
+                teacherFreeTimes.put(String.valueOf(Calendar.SUNDAY), JSON.parseArray(teacherFreeTime.getSunday()));
             }else{
             }else{
-                disableApplyWeekDay.add(DayOfWeek.SUNDAY.getValue());
+                disableApplyWeekDay.add(Calendar.SUNDAY);
             }
             }
+        }else{
+            result.put("teacherFreeDays", new ArrayList<>());
+            return result;
         }
         }
 
 
-        DateTimeFormatter ddtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        DateTimeFormatter ddf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss");
-        WeekFields weekFields = WeekFields.of(DayOfWeek.MONDAY, 1);
-        ZoneId zoneId = ZoneId.systemDefault();
-
-        LocalDate startDay = LocalDate.now().plusDays(1);
-        LocalDate endDay = startDay.plusDays(14);
-
-        LocalDate monday = startDay.with(weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
-        LocalDate sunday = endDay.with(weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
-
-
-        Map<Integer, List<String>> weekNumApplyTimesMap = eduPracticeGroupService.getEnableApplyDatesWithWeek(monday.getDayOfWeek().getValue());
-        List<CourseSchedule> allTeacherCourses = courseScheduleDao.findTeacherCoursesWithDateRange(teacherId, Date.from(startDay.atStartOfDay(zoneId).toInstant()), Date.from(endDay.atStartOfDay(zoneId).toInstant()));
+        Date now = new Date();
+        Calendar calendar = Calendar.getInstance();
+        calendar.setFirstDayOfWeek(Calendar.MONDAY);
+        calendar.setTime(now);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        calendar.add(Calendar.DATE, 1);
+        Date applyStartDate = DateUtil.addDays(calendar.getTime(), 1);
+        Date applyEndDate = DateUtil.addDays(applyStartDate, 14);
+        Date firstMonday = DateUtil.getWeekDayWithDate(applyStartDate, Calendar.MONDAY);
+        Date secondSunday = DateUtil.getWeekDayWithDate(applyEndDate, Calendar.SUNDAY);
+
+        List<Date> enableApplyDates = practiceGroupService.getEnableApplyDates(applyStartDate, applyEndDate);
+        List<CourseSchedule> allTeacherCourses = courseScheduleDao.findTeacherCoursesWithDateRange(teacherId, firstMonday, secondSunday);
         allTeacherCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
         allTeacherCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
 
 
+        List<CourseSchedule> applyDateRangeCourses = new ArrayList<>();
+        Calendar courseCalendar = Calendar.getInstance();
+        courseCalendar.setFirstDayOfWeek(Calendar.MONDAY);
+        int courseWeekNum = 0;
+        int practiceCourseNum = 0;
+        for (int i = 0; i < allTeacherCourses.size(); i++) {
+            CourseSchedule teacherCourse = allTeacherCourses.get(i);
+            if ((!teacherCourse.getClassDate().before(applyStartDate))
+                    && (teacherCourse.getClassDate().before(applyEndDate) || DateUtil.isSameDay(teacherCourse.getClassDate(), applyEndDate))) {
+                applyDateRangeCourses.add(teacherCourse);
+            }
+            courseCalendar.setTime(teacherCourse.getClassDate());
+            if (i == 0 && teacherCourse.getGroupType().equals(GroupType.PRACTICE)) {
+                practiceCourseNum += 1;
+                courseWeekNum = courseCalendar.get(Calendar.WEEK_OF_YEAR);
+            }
+            if (Objects.nonNull(maxTeacherCourses) && practiceCourseNum >= maxTeacherCourses) {
+                disableApplyWeekNum.add(courseWeekNum);
+            }
+            if (courseCalendar.get(Calendar.WEEK_OF_YEAR) != courseWeekNum) {
+                courseWeekNum = courseCalendar.get(Calendar.WEEK_OF_YEAR);
+                practiceCourseNum = 0;
+            }
+            if (teacherCourse.getGroupType().equals(GroupType.PRACTICE)) {
+                practiceCourseNum += 1;
+            }
+        }
+
         JSONObject teacherLeaveData = null;
         JSONObject teacherLeaveData = null;
         if (checkTeacherLeaveDate) {
         if (checkTeacherLeaveDate) {
             teacherLeaveData = allTeacherLeaveData.getJSONObject(teacherId.toString());
             teacherLeaveData = allTeacherLeaveData.getJSONObject(teacherId.toString());
@@ -393,78 +489,53 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
             checkTeacherLeaveDate = false;
             checkTeacherLeaveDate = false;
         }
         }
 
 
-        weekNumApplyTimesMap.remove(holiday);
-
-        if (teacherId == 100473) {
-            List<String> timeStrs = weekNumApplyTimesMap.get(DateUtil.calendarWeekNumNormalWeekNumMap.get(Calendar.MONDAY));
-            LocalTime noonStartTime = LocalTime.parse("11:30:00", dtf);
-            LocalTime noonEndTime = LocalTime.parse("14:30:00", dtf);
-            LocalTime nightStartTime = LocalTime.parse("20:30:00", dtf);
-            LocalTime defaultApplyTime;
-            Iterator<String> iterator = timeStrs.iterator();
-            while (iterator.hasNext()) {
-                defaultApplyTime = LocalTime.parse(iterator.next(), dtf);
-                LocalTime defaultApplyEndTime = defaultApplyTime.plusMinutes(practiceCourseMinutes);
-                if (defaultApplyTime.compareTo(noonStartTime) <= 0
-                        && defaultApplyEndTime.compareTo(noonEndTime) >= 0) {
-                    iterator.remove();
-                    continue;
-                }
-                if (defaultApplyEndTime.compareTo(nightStartTime) < 0) {
-                    iterator.remove();
-                    continue;
-                }
-            }
-            weekNumApplyTimesMap.remove(DateUtil.calendarWeekNumNormalWeekNumMap.get(Calendar.SATURDAY));
-            weekNumApplyTimesMap.put(DateUtil.calendarWeekNumNormalWeekNumMap.get(Calendar.MONDAY), timeStrs);
-            weekNumApplyTimesMap.put(DateUtil.calendarWeekNumNormalWeekNumMap.get(Calendar.SUNDAY), timeStrs);
-        } else if (checkTeacherLeaveDate) {
-            for (String dateStr : teacherLeaveData.keySet()) {
-                LocalDate parse = LocalDate.parse(dateStr, ddf);
-                LocalDate tempDate = LocalDate.parse(dateStr, ddf);
-                if (tempDate.compareTo(startDay)<0
-                        ||tempDate.compareTo(tempDate)>=0){
-                    continue;
-                }
-                List<String> applyTimeStrs = weekNumApplyTimesMap.get(parse.getDayOfWeek().getValue());
-                if(CollectionUtils.isEmpty(applyTimeStrs)){
-                    continue;
-                }
-                Iterator<String> iterator = applyTimeStrs.iterator();
-                JSONObject leaveDateData = teacherLeaveData.getJSONObject(dateStr);
-                LocalTime leaveStartTime = LocalDateTime.parse(leaveDateData.getString("leave_start_time"), ddtf).toLocalTime();
-                LocalTime leaveEndTime = LocalDateTime.parse(leaveDateData.getString("leave_end_time"), ddtf).toLocalTime();
-                LocalTime defaultApplyTime;
-                while (iterator.hasNext()) {
-                    defaultApplyTime = LocalTime.parse(iterator.next(), dtf);
-                    LocalTime defaultApplyEndTime = defaultApplyTime.plusMinutes(practiceCourseMinutes);
-                    if (defaultApplyTime.compareTo(leaveEndTime) <= 0
-                            && defaultApplyEndTime.compareTo(leaveStartTime) >= 0) {
-                        iterator.remove();
+        if (CollectionUtils.isEmpty(applyDateRangeCourses)) {
+            for (Date enableApplyDate : enableApplyDates) {
+                Date enableApplyDateCourseEndTime = DateUtil.addMinutes(enableApplyDate, practiceCourseMinutes);
+                if (teacherId == 100473) {
+                    checkTeacherLeaveDate = false;
+                    Calendar tempCalendar = Calendar.getInstance();
+                    tempCalendar.setFirstDayOfWeek(Calendar.MONDAY);
+                    tempCalendar.setTime(enableApplyDate);
+                    if (tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY
+                            || tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
+                        String date_str = DateUtil.dateToString(enableApplyDate, "yyyy-MM-dd");
+                        Date date1 = DateUtil.stringToDate(date_str + " 11:30:00");
+                        Date date2 = DateUtil.stringToDate(date_str + " 14:30:00");
+                        Date date3 = DateUtil.stringToDate(date_str + " 20:30:00");
+                        if (enableApplyDate.before(date2)
+                                && enableApplyDateCourseEndTime.after(date1)) {
+                            continue;
+                        }
+                        if (date3.before(enableApplyDateCourseEndTime)) {
+                            continue;
+                        }
+                    }
+                    if (tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
                         continue;
                         continue;
                     }
                     }
                 }
                 }
-                if(!CollectionUtils.isEmpty(applyTimeStrs)){
-                    weekNumApplyTimesMap.put(parse.getDayOfWeek().getValue(), applyTimeStrs);
-                }else{
-                    weekNumApplyTimesMap.remove(parse.getDayOfWeek().getValue());
+                if (checkTeacherLeaveDate) {
+                    String dateStr = DateUtil.dateToString(enableApplyDate, "yyyy-MM-dd");
+                    JSONObject leaveDateData = teacherLeaveData.getJSONObject(dateStr);
+                    if (Objects.nonNull(leaveDateData)) {
+                        Date leaveStartTime = leaveDateData.getDate("leave_start_time");
+                        Date leaveEndTime = leaveDateData.getDate("leave_end_time");
+                        if (enableApplyDateCourseEndTime.after(leaveStartTime)
+                                && enableApplyDate.before(leaveEndTime)) {
+                            continue;
+                        }
+                    }
                 }
                 }
-            }
-        }
-
-        Iterator<Integer> weekNumApplyTimeIterator = weekNumApplyTimesMap.keySet().iterator();
-        while (weekNumApplyTimeIterator.hasNext()) {
-            Integer weekNum=weekNumApplyTimeIterator.next();
-            JSONArray teacherWeekDayFreeTimes = teacherFreeTimes.getJSONArray(String.valueOf(weekNum));
-            if(Objects.nonNull(teacherWeekDayFreeTimes)){
-                List<String> applyTimeStrs = weekNumApplyTimesMap.get(weekNum);
-                if(CollectionUtils.isEmpty(applyTimeStrs)){
+                calendar.setTime(enableApplyDate);
+                int dayOfWeek=calendar.get(Calendar.DAY_OF_WEEK);
+                if(disableApplyWeekDay.contains(dayOfWeek)){
                     continue;
                     continue;
                 }
                 }
-                Iterator<String> iterator = applyTimeStrs.iterator();
-                while (iterator.hasNext()) {
-                    LocalTime enableApplyStartTime=LocalTime.parse(iterator.next(), dtf);
-                    LocalTime enableApplyEndTime=enableApplyStartTime.plusMinutes(practiceCourseMinutes);
+                JSONArray teacherWeekDayFreeTimes = teacherFreeTimes.getJSONArray(String.valueOf(dayOfWeek));
+                if(Objects.nonNull(teacherWeekDayFreeTimes)){
+                    LocalTime enableApplyStartTime=LocalDateTime.ofInstant(enableApplyDate.toInstant(),DateUtil.zoneId).toLocalTime();
+                    LocalTime enableApplyEndTime=LocalDateTime.ofInstant(enableApplyDateCourseEndTime.toInstant(),DateUtil.zoneId).toLocalTime();
                     boolean isInclude=false;
                     boolean isInclude=false;
                     for (Object teacherWeekDayFreeTimeObject : teacherWeekDayFreeTimes) {
                     for (Object teacherWeekDayFreeTimeObject : teacherWeekDayFreeTimes) {
                         JSONObject teacherWeekDayFreeTime=JSONObject.parseObject(teacherWeekDayFreeTimeObject.toString());
                         JSONObject teacherWeekDayFreeTime=JSONObject.parseObject(teacherWeekDayFreeTimeObject.toString());
@@ -477,49 +548,160 @@ public class OnlineMusicGroupServiceImpl implements OnlineMusicGroupService {
                         }
                         }
                     }
                     }
                     if(!isInclude){
                     if(!isInclude){
-                        iterator.remove();
+                        continue;
                     }
                     }
                 }
                 }
-                if(CollectionUtils.isEmpty(applyTimeStrs)){
-                    weekNumApplyTimeIterator.remove();
-                }else{
-                    weekNumApplyTimesMap.put(weekNum,applyTimeStrs);
+                if (dayOfWeek != holiday) {
+                    allTeacherFreeDates.add(enableApplyDate);
                 }
                 }
-            }else{
-                weekNumApplyTimeIterator.remove();
             }
             }
-        }
-
-        if (CollectionUtils.isEmpty(allTeacherCourses)) {
-            result.put("teacherFreeDays", weekNumApplyTimesMap);
+            if (!CollectionUtils.isEmpty(allTeacherFreeDates)) {
+                List<Date> tempDates = new ArrayList<>();
+                if (CollectionUtils.isEmpty(tempDates)) {
+                    tempDates = new ArrayList<>(allTeacherFreeDates);
+                }
+                tempDates.sort(Comparator.comparing(Date::getTime));
+                Set<String> days = tempDates.stream()
+                        .map(date -> DateUtil.dateToString(date, "yyyy-MM-dd")).collect(Collectors.toSet());
+                List<Date> tempDays = days.stream().map(dateStr -> DateUtil.stringToDate(dateStr, "yyyy-MM-dd")).collect(Collectors.toList());
+                tempDays.sort(Comparator.comparing(Date::getTime));
+                result.put("teacherFreeDays", tempDays.stream().map(day -> DateUtil.dateToString(day, "yyyy-MM-dd")).collect(Collectors.toList()));
+                result.put("teacherFreeDates", tempDates);
+            } else {
+                result.put("teacherFreeDays", new ArrayList<>());
+            }
             return result;
             return result;
         }
         }
 
 
-        for (CourseSchedule teacherCourse : allTeacherCourses) {
-            LocalDateTime courseStartTime = LocalDateTime.ofInstant(teacherCourse.getStartClassTime().toInstant(), zoneId);
-            LocalDateTime courseEndTime = LocalDateTime.ofInstant(teacherCourse.getEndClassTime().toInstant(), zoneId);
-            List<String> applyTimeStrs = weekNumApplyTimesMap.get(courseStartTime.getDayOfWeek().getValue());
-            if (CollectionUtils.isEmpty(applyTimeStrs)) {
+        List<Date> tempEnableApplyDates = new ArrayList<>();
+        for (Date enableApplyDate : enableApplyDates) {
+            Date enableApplyDateCourseEndTime = DateUtil.addMinutes(enableApplyDate, practiceCourseMinutes);
+
+            if (teacherId == 100473) {
+                checkTeacherLeaveDate = false;
+                Calendar tempCalendar = Calendar.getInstance();
+                tempCalendar.setFirstDayOfWeek(Calendar.MONDAY);
+                tempCalendar.setTime(enableApplyDate);
+                if (tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY
+                        || tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
+                    String date_str = DateUtil.dateToString(enableApplyDate, "yyyy-MM-dd");
+                    Date date1 = DateUtil.stringToDate(date_str + " 11:30:00");
+                    Date date2 = DateUtil.stringToDate(date_str + " 14:30:00");
+                    Date date3 = DateUtil.stringToDate(date_str + " 20:30:00");
+                    if (enableApplyDate.before(date2)
+                            && enableApplyDateCourseEndTime.after(date1)) {
+                        continue;
+                    }
+                    if (date3.before(enableApplyDateCourseEndTime)) {
+                        continue;
+                    }
+                }
+                if (tempCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
+                    continue;
+                }
+            }
+            if (checkTeacherLeaveDate) {
+                String dateStr = DateUtil.dateToString(enableApplyDate, "yyyy-MM-dd");
+                JSONObject leaveDateData = teacherLeaveData.getJSONObject(dateStr);
+                if (Objects.nonNull(leaveDateData)) {
+                    Date leaveStartTime = leaveDateData.getDate("leave_start_time");
+                    Date leaveEndTime = leaveDateData.getDate("leave_end_time");
+                    if (enableApplyDateCourseEndTime.after(leaveStartTime)
+                            && enableApplyDate.before(leaveEndTime)) {
+                        continue;
+                    }
+                }
+            }
+            calendar.setTime(enableApplyDate);
+
+            int dayOfWeek=calendar.get(Calendar.DAY_OF_WEEK);
+            if(disableApplyWeekDay.contains(dayOfWeek)){
                 continue;
                 continue;
             }
             }
-            Iterator<String> iterator = applyTimeStrs.iterator();
-            LocalTime defaultApplyTime;
-            while (iterator.hasNext()) {
-                defaultApplyTime = LocalTime.parse(iterator.next(), dtf);
-                LocalTime defaultApplyEndTime = defaultApplyTime.plusMinutes(practiceCourseMinutes);
-                if (defaultApplyTime.compareTo(courseEndTime.toLocalTime()) <= 0
-                        && defaultApplyEndTime.compareTo(courseStartTime.toLocalTime()) >= 0) {
-                    iterator.remove();
+            JSONArray teacherWeekDayFreeTimes = teacherFreeTimes.getJSONArray(String.valueOf(dayOfWeek));
+            if(Objects.nonNull(teacherWeekDayFreeTimes)){
+                LocalTime enableApplyStartTime=LocalDateTime.ofInstant(enableApplyDate.toInstant(),DateUtil.zoneId).toLocalTime();
+                LocalTime enableApplyEndTime=LocalDateTime.ofInstant(enableApplyDateCourseEndTime.toInstant(),DateUtil.zoneId).toLocalTime();
+                boolean isInclude=false;
+                for (Object teacherWeekDayFreeTimeObject : teacherWeekDayFreeTimes) {
+                    JSONObject teacherWeekDayFreeTime=JSONObject.parseObject(teacherWeekDayFreeTimeObject.toString());
+                    LocalTime teacherFreeStartTime=LocalTime.parse(teacherWeekDayFreeTime.getString("startTime"),DateUtil.timeFormatter);
+                    LocalTime teacherFreeEndTime=LocalTime.parse(teacherWeekDayFreeTime.getString("endTime"),DateUtil.timeFormatter);
+                    if(enableApplyEndTime.compareTo(teacherFreeEndTime)<=0
+                            &&enableApplyStartTime.compareTo(teacherFreeStartTime)>=0){
+                        isInclude=true;
+                        break;
+                    }
+                }
+                if(!isInclude){
                     continue;
                     continue;
                 }
                 }
             }
             }
-            if(CollectionUtils.isEmpty(applyTimeStrs)){
-                weekNumApplyTimesMap.remove(courseStartTime.getDayOfWeek().getValue());
-            }else{
-                weekNumApplyTimesMap.put(courseStartTime.getDayOfWeek().getValue(), applyTimeStrs);
+
+            if (dayOfWeek == holiday) {
+                continue;
+            }
+
+            if (!disableApplyWeekNum.contains(calendar.get(Calendar.WEEK_OF_YEAR))) {
+                tempEnableApplyDates.add(enableApplyDate);
+            }
+        }
+
+        applyDateRangeCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
+        for (int j = 0; j < applyDateRangeCourses.size(); j++) {
+            CourseSchedule preCourseSchedule = applyDateRangeCourses.get(j);
+            CourseSchedule backCourseSchedule = j >= applyDateRangeCourses.size() - 1 ? preCourseSchedule : applyDateRangeCourses.get(j + 1);
+            if (preCourseSchedule.getEndClassTime().after(backCourseSchedule.getEndClassTime())) {
+                backCourseSchedule.setEndClassTime(preCourseSchedule.getEndClassTime());
+            }
+            if (j == 0) {
+                for (Date enableApplyDate : tempEnableApplyDates) {
+                    Date enableApplyDateCourseEndTime = DateUtil.addMinutes(enableApplyDate, practiceCourseMinutes);
+                    if (!enableApplyDateCourseEndTime.after(preCourseSchedule.getStartClassTime())) {
+                        allTeacherFreeDates.add(enableApplyDate);
+                    }
+                }
             }
             }
+            if (j == applyDateRangeCourses.size() - 1) {
+                for (Date enableApplyDate : tempEnableApplyDates) {
+                    if (!enableApplyDate.before(backCourseSchedule.getEndClassTime())) {
+                        allTeacherFreeDates.add(enableApplyDate);
+                    }
+                }
+            }
+            if (j >= applyDateRangeCourses.size() - 1) {
+                break;
+            }
+            for (Date enableApplyDate : tempEnableApplyDates) {
+                Date enableApplyDateCourseEndTime = DateUtil.addMinutes(enableApplyDate, practiceCourseMinutes);
+                if (!enableApplyDate.before(preCourseSchedule.getEndClassTime())
+                        && !enableApplyDateCourseEndTime.after(backCourseSchedule.getStartClassTime())) {
+                    allTeacherFreeDates.add(enableApplyDate);
+                }
+            }
+        }
+        if (!CollectionUtils.isEmpty(allTeacherFreeDates)) {
+            List<Date> tempDates = new ArrayList<>();
+            if (CollectionUtils.isEmpty(tempDates)) {
+                tempDates = new ArrayList<>(allTeacherFreeDates);
+            }
+            tempDates.sort(Comparator.comparing(Date::getTime));
+            Map<String, List<String>> rt=new HashMap<>();
+            for (Date tempDate : tempDates) {
+                String dateStr = DateUtil.dateToString(tempDate, "yyyy-MM-dd");
+                String timeStr = DateUtil.dateToString(tempDate, "HH:mm:ss");
+                if(!rt.containsKey(dateStr)){
+                    rt.put(dateStr, new ArrayList<>());
+                }
+                rt.get(dateStr).add(timeStr);
+            }
+            Set<String> days = tempDates.stream()
+                    .map(date -> DateUtil.dateToString(date, "yyyy-MM-dd")).collect(Collectors.toSet());
+            List<Date> tempDays = days.stream().map(dateStr -> DateUtil.stringToDate(dateStr, "yyyy-MM-dd")).collect(Collectors.toList());
+            tempDays.sort(Comparator.comparing(Date::getTime));
+
+            result.put("teacherFreeDays", rt);
         }
         }
-        result.put("teacherFreeDays", weekNumApplyTimesMap);
         return result;
         return result;
     }
     }
 }
 }

+ 21 - 23
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml

@@ -23,6 +23,7 @@
 		</association>
 		</association>
 		<association property="studentRegistration" javaType="com.ym.mec.biz.dal.entity.StudentRegistration">
 		<association property="studentRegistration" javaType="com.ym.mec.biz.dal.entity.StudentRegistration">
 			<result column="subject_names_" property="subjectName" />
 			<result column="subject_names_" property="subjectName" />
+			<result column="music_group_status_" property="musicGroupStatus" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 		</association>
 		</association>
 	</resultMap>
 	</resultMap>
 
 
@@ -144,20 +145,22 @@
 	<!-- 分页查询 -->
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="MusicGroupPaymentCalenderDetail"
 	<select id="queryPage" resultMap="MusicGroupPaymentCalenderDetail"
 		parameterType="map">
 		parameterType="map">
-		SELECT mgpc.*,su.username_,st.name_ subject_names_
-		FROM music_group_payment_calender_detail mgpc
-		LEFT JOIN sys_user su ON su.id_ = mgpc.user_id_
-		LEFT JOIN student_registration sr ON sr.user_id_ = mgpc.user_id_
+		SELECT mgpcd.*,su.username_,st.name_ subject_names_,sr.music_group_status_
+		FROM music_group_payment_calender_detail mgpcd
+		LEFT JOIN sys_user su ON su.id_ = mgpcd.user_id_
+		LEFT JOIN student_registration sr ON sr.user_id_ = mgpcd.user_id_
 		LEFT JOIN `subject` st ON st.id_ = sr.actual_subject_id_
 		LEFT JOIN `subject` st ON st.id_ = sr.actual_subject_id_
+		LEFT JOIN music_group_payment_calender mgpc ON mgpc.id_ = mgpcd.music_group_payment_calender_id_
 		<where>
 		<where>
+			mgpc.music_group_id_ = sr.music_group_id_
 			<if test="userId != null">
 			<if test="userId != null">
-				AND mgpc.user_id_ = #{userId}
+				AND mgpcd.user_id_ = #{userId}
 			</if>
 			</if>
 			<if test="id != null">
 			<if test="id != null">
-				AND mgpc.music_group_payment_calender_id_ = #{id}
+				AND mgpcd.music_group_payment_calender_id_ = #{id}
 			</if>
 			</if>
 			<if test="paymentStatus != null">
 			<if test="paymentStatus != null">
-				AND mgpc.payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+				AND mgpcd.payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
 			</if>
 			<if test="subjectId != null">
 			<if test="subjectId != null">
 				AND #{subjectId} = sr.actual_subject_id_
 				AND #{subjectId} = sr.actual_subject_id_
@@ -169,21 +172,21 @@
 
 
 	<!-- 查询当前表的总记录数 -->
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(mgpc.id_) FROM music_group_payment_calender_detail mgpc
-		LEFT JOIN student_registration sr ON sr.user_id_ = mgpc.user_id_
+		SELECT COUNT(DISTINCT mgpcd.id_) FROM music_group_payment_calender_detail mgpcd
+		LEFT JOIN student_registration sr ON sr.user_id_ = mgpcd.user_id_
 		LEFT JOIN `subject` st ON st.id_ = sr.actual_subject_id_
 		LEFT JOIN `subject` st ON st.id_ = sr.actual_subject_id_
 		<where>
 		<where>
 			<if test="userId != null">
 			<if test="userId != null">
-				AND mgpc.user_id_ = #{userId}
+				AND mgpcd.user_id_ = #{userId}
 			</if>
 			</if>
 			<if test="id != null">
 			<if test="id != null">
-				AND mgpc.music_group_payment_calender_id_ = #{id}
+				AND mgpcd.music_group_payment_calender_id_ = #{id}
 			</if>
 			</if>
 			<if test="subjectId != null">
 			<if test="subjectId != null">
 				AND #{subjectId} = sr.actual_subject_id_
 				AND #{subjectId} = sr.actual_subject_id_
 			</if>
 			</if>
 			<if test="paymentStatus != null">
 			<if test="paymentStatus != null">
-				AND mgpc.payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+				AND mgpcd.payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
 			</if>
 		</where>
 		</where>
 	</select>
 	</select>
@@ -195,17 +198,12 @@
 		SELECT * FROM music_group_payment_calender_detail where music_group_payment_calender_id_ = #{calenderId}
 		SELECT * FROM music_group_payment_calender_detail where music_group_payment_calender_id_ = #{calenderId}
 	</select>
 	</select>
     <select id="findMusicGroupStudentWithSubject" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
     <select id="findMusicGroupStudentWithSubject" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
-		SELECT
-		DISTINCT su.id_ userId,su.username_ userName, su.avatar_ avatar, su.phone_ phone
-		FROM music_group_payment_calender_detail mgpcd
-		LEFT JOIN student_registration sr ON sr.user_id_=mgpcd.user_id_
-		LEFT JOIN sys_user su ON su.id_=mgpcd.user_id_
-		WHERE sr.music_group_id_=#{musicGroupId}
-		AND sr.subject_id_= #{subjectId}
-		AND music_group_payment_calender_id_ IN
-		(SELECT id_ FROM (SELECT id_ FROM music_group_payment_calender
-		WHERE music_group_id_=#{musicGroupId} AND payment_status_ IN (1,2)
-		ORDER BY start_payment_date_ DESC LIMIT 1) t);
+		SELECT DISTINCT su.id_ userId,su.username_ userName, su.avatar_ avatar, su.phone_ phone
+		from music_group_student_fee_ mgstf
+		LEFT JOIN sys_user su ON su.id_=mgstf.user_id_
+		WHERE mgstf.music_group_id_=#{musicGroupId}
+		AND mgstf.subject_id_=#{subjectId}
+		AND mgstf.remain_network_class_times_>0
 	</select>
 	</select>
 	<select id="sumActualAmount" resultType="java.math.BigDecimal">
 	<select id="sumActualAmount" resultType="java.math.BigDecimal">
 		SELECT SUM(mgpcd.actual_amount_) FROM music_group_payment_calender_detail mgpcd
 		SELECT SUM(mgpcd.actual_amount_) FROM music_group_payment_calender_detail mgpcd

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -173,6 +173,6 @@
     <select id="queryIntersectionByPaymentDate" resultType="int" parameterType="map">
     <select id="queryIntersectionByPaymentDate" resultType="int" parameterType="map">
         SELECT count(*) FROM music_group_payment_calender mgpc
         SELECT count(*) FROM music_group_payment_calender mgpc
         WHERE music_group_id_ = #{musicGroupId} 
         WHERE music_group_id_ = #{musicGroupId} 
-        and (start_payment_date_ betwwen #{startPaymentDate} and #{deadlinePaymentDate} or deadline_payment_date_ betwwen #{startPaymentDate} and #{deadlinePaymentDate})
+        and (start_payment_date_ between #{startPaymentDate} and #{deadlinePaymentDate} or deadline_payment_date_ between #{startPaymentDate} and #{deadlinePaymentDate})
     </select>
     </select>
 </mapper>
 </mapper>

+ 11 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupStudentFeeMapper.xml

@@ -22,6 +22,7 @@
         <result column="temporary_course_fee_" property="temporaryCourseFee"/>
         <result column="temporary_course_fee_" property="temporaryCourseFee"/>
         <result column="is_lock_" property="isLock"/>
         <result column="is_lock_" property="isLock"/>
         <result column="payment_period_list_" property="paymentPeriodList"/>
         <result column="payment_period_list_" property="paymentPeriodList"/>
+        <result column="remain_network_class_times_" property="remainNetworkClassTimes" />
         <association property="sysUser" javaType="com.ym.mec.auth.api.entity.SysUser">
         <association property="sysUser" javaType="com.ym.mec.auth.api.entity.SysUser">
             <result column="username_" property="username" />
             <result column="username_" property="username" />
             <result column="phone_" property="phone" />
             <result column="phone_" property="phone" />
@@ -87,6 +88,9 @@
             <if test="temporaryCourseFee != null">
             <if test="temporaryCourseFee != null">
                 temporary_course_fee_ = #{temporaryCourseFee},
                 temporary_course_fee_ = #{temporaryCourseFee},
             </if>
             </if>
+            <if test="remainNetworkClassTimes != null">
+                remain_network_class_times_ = #{remainNetworkClassTimes},
+            </if>
             <if test="isLock != null">
             <if test="isLock != null">
                 is_lock_ = #{isLock},
                 is_lock_ = #{isLock},
             </if>
             </if>
@@ -130,6 +134,7 @@
         LEFT JOIN sys_user su ON su.id_ = mgsf.user_id_
         LEFT JOIN sys_user su ON su.id_ = mgsf.user_id_
         LEFT JOIN `subject` s ON s.id_ = mgsf.subject_id_
         LEFT JOIN `subject` s ON s.id_ = mgsf.subject_id_
         <where>
         <where>
+            mgsf.music_group_id_ = #{musicGroupId}
             <if test="search != null and search != ''">
             <if test="search != null and search != ''">
                 AND (mgsf.user_id_ = #{search}
                 AND (mgsf.user_id_ = #{search}
                 OR su.username_ LIKE CONCAT('%',#{search},'%')
                 OR su.username_ LIKE CONCAT('%',#{search},'%')
@@ -148,6 +153,7 @@
         SELECT COUNT(mgsf.id_) FROM music_group_student_fee_ mgsf
         SELECT COUNT(mgsf.id_) FROM music_group_student_fee_ mgsf
         LEFT JOIN sys_user su ON su.id_ = mgsf.user_id_
         LEFT JOIN sys_user su ON su.id_ = mgsf.user_id_
         <where>
         <where>
+            mgsf.music_group_id_ = #{musicGroupId}
             <if test="search != null and search != ''">
             <if test="search != null and search != ''">
                 AND (mgsf.user_id_ = #{search}
                 AND (mgsf.user_id_ = #{search}
                 OR su.username_ LIKE CONCAT('%',#{search},'%')
                 OR su.username_ LIKE CONCAT('%',#{search},'%')
@@ -160,7 +166,7 @@
 	</select>
 	</select>
 
 
     <select id="findByUser" resultMap="MusicGroupStudentFee">
     <select id="findByUser" resultMap="MusicGroupStudentFee">
-        SELECT * FROM music_group_student_fee_ WHERE music_group_id_ = #{musicGroupId} AND user_id_ = #{userId}
+        SELECT * FROM music_group_student_fee_ WHERE music_group_id_ = #{musicGroupId} AND user_id_ = #{userId} FOR UPDATE
     </select>
     </select>
     
     
     <update id="updateNextPaymentDate" parameterType="map">
     <update id="updateNextPaymentDate" parameterType="map">
@@ -264,4 +270,8 @@
         SELECT GROUP_CONCAT(mgpc.payment_month_) FROM music_group_payment_calender mgpc WHERE mgpc.music_group_id_ = mgsf.music_group_id_)
         SELECT GROUP_CONCAT(mgpc.payment_month_) FROM music_group_payment_calender mgpc WHERE mgpc.music_group_id_ = mgsf.music_group_id_)
         WHERE mgsf.music_group_id_ = #{musicGroupId} AND mgsf.user_id_ = #{userId}
         WHERE mgsf.music_group_id_ = #{musicGroupId} AND mgsf.user_id_ = #{userId}
     </update>
     </update>
+    <update id="batchUpdateCourseFee">
+        UPDATE music_group_student_fee_ mgsf SET mgsf.course_fee_ = #{courseFee}
+        WHERE FIND_IN_SET(mgsf.id_,#{ids})
+    </update>
 </mapper>
 </mapper>

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -610,7 +610,7 @@
     </select>
     </select>
     <select id="findMusicGroupAllStudentSubjects" resultMap="com.ym.mec.biz.dal.dao.SubjectDao.Subject">
     <select id="findMusicGroupAllStudentSubjects" resultMap="com.ym.mec.biz.dal.dao.SubjectDao.Subject">
         SELECT DISTINCT s.* FROM student_registration sr
         SELECT DISTINCT s.* FROM student_registration sr
-        LEFT JOIN subject s ON sr.subject_id_=s.id_
+        LEFT JOIN subject s ON sr.actual_subject_id_=s.id_
         WHERE sr.music_group_id_=#{musicGroupId};
         WHERE sr.music_group_id_=#{musicGroupId};
     </select>
     </select>
 </mapper>
 </mapper>

+ 4 - 4
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java

@@ -30,10 +30,10 @@ public class MusicGroupPaymentCalenderDetailController extends BaseController {
     }
     }
 
 
     @ApiOperation(value = "修改学员预计缴费金额")
     @ApiOperation(value = "修改学员预计缴费金额")
-    @PostMapping("/updateActualAmount")
-    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/updateActualAmount')")
-    public Object updateActualAmount(BigDecimal actualAmount,String ids) {
-        musicGroupPaymentCalenderDetailService.updateActualAmount(actualAmount,ids);
+    @PostMapping("/updateExpectAmount")
+    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/updateExpectAmount')")
+    public Object updateExpectAmount(BigDecimal expectAmount,String ids) {
+        musicGroupPaymentCalenderDetailService.updateExpectAmount(expectAmount,ids);
         return succeed();
         return succeed();
     }
     }
 
 

+ 11 - 0
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupStudentFeeController.java

@@ -8,9 +8,12 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
+import java.math.BigDecimal;
+
 @RequestMapping("musicGroupStudentFee")
 @RequestMapping("musicGroupStudentFee")
 @Api(tags = "乐团学生费用")
 @Api(tags = "乐团学生费用")
 @RestController
 @RestController
@@ -26,4 +29,12 @@ public class MusicGroupStudentFeeController extends BaseController {
         return succeed(musicGroupStudentFeeService.queryPage(queryInfo));
         return succeed(musicGroupStudentFeeService.queryPage(queryInfo));
     }
     }
 
 
+    @ApiOperation(value = "批量修改课程费用")
+    @PostMapping("/batchUpdateCourseFee")
+    @PreAuthorize("@pcs.hasPermissions('musicGroupStudentFee/batchUpdateCourseFee')")
+    public Object batchUpdateCourseFee(String ids, BigDecimal courseFee) {
+        musicGroupStudentFeeService.batchUpdateCourseFee(ids,courseFee);
+        return succeed();
+    }
+
 }
 }

+ 5 - 5
mec-web/src/main/java/com/ym/mec/web/controller/education/EduOnlineMusicGroupController.java

@@ -23,10 +23,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.List;
 import java.util.List;
@@ -126,7 +123,10 @@ public class EduOnlineMusicGroupController extends BaseController {
         if (sysUser == null) {
         if (sysUser == null) {
             return failed("用户信息获取失败");
             return failed("用户信息获取失败");
         }
         }
-
+        int i = courseScheduleStudentPaymentDao.countStudentNotStartCourseNumWithCourseType(onlineMusicGroupCourseInfo.getStudentId(), CourseSchedule.CourseScheduleType.MUSIC_NETWORK);
+        if(i>0){
+            return failed("该学生存在进行中的乐团网管课");
+        }
         return succeed(onlineMusicGroupService.createOnlineMusicClassGroup(onlineMusicGroupCourseInfo));
         return succeed(onlineMusicGroupService.createOnlineMusicClassGroup(onlineMusicGroupCourseInfo));
     }
     }