Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

Joburgess 4 vuotta sitten
vanhempi
commit
140ccbf2ac

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

@@ -409,5 +409,5 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      * @param studentId
      * @return
      */
-    List<CourseScheduleStudentPayment> queryCourseByIdsAndStudentId(@Param("courseIds") List<Long> courseIds, @Param("studentId") Integer studentId);
+    List<CourseScheduleStudentPayment> queryCourseByIdsAndStudentId(@Param("courseIds") List<Long> courseIds, @Param("studentId") Integer studentId, @Param("courseType") String courseType);
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -277,4 +277,13 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
      * @param calenderIds
      */
     void delByIds(@Param("calenderIds") List<Long> calenderIds);
+
+    /**
+     * 根据批次号,学员编号和课程类型查询
+     * @author zouxuan
+     * @param batchNo
+     * @param studentId
+     * @return
+     */
+    Set<Long> findByBatchNoAndStudentId(@Param("batchNo") String batchNo, @Param("studentId") Integer studentId);
 }

+ 6 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroup4MixDto.java

@@ -57,15 +57,15 @@ public class ClassGroup4MixDto {
     @ApiModelProperty(value = "班级剩余时长,用于自动排课", required = true)
     private String classCourseMinute;
 
-    @ApiModelProperty(value = "批次号,用于自动排课", required = true)
-    private String batchNo;
+    @ApiModelProperty(value = "申请编号,用于自动排课", required = true)
+    private Integer musicGroupStudentClassAdjustId;
 
-    public String getBatchNo() {
-        return batchNo;
+    public Integer getMusicGroupStudentClassAdjustId() {
+        return musicGroupStudentClassAdjustId;
     }
 
-    public void setBatchNo(String batchNo) {
-        this.batchNo = batchNo;
+    public void setMusicGroupStudentClassAdjustId(Integer musicGroupStudentClassAdjustId) {
+        this.musicGroupStudentClassAdjustId = musicGroupStudentClassAdjustId;
     }
 
     public String getClassCourseMinute() {

+ 0 - 14
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MergeClassSplitClassAffirmDto.java

@@ -1,10 +1,6 @@
 package com.ym.mec.biz.dal.dto;
 
 
-import com.alibaba.fastjson.JSON;
-import org.json.JSONArray;
-import org.json.JSONObject;
-
 import java.util.List;
 
 public class MergeClassSplitClassAffirmDto {
@@ -16,16 +12,6 @@ public class MergeClassSplitClassAffirmDto {
 
     private List<Integer> studentIds;
 
-    private List<String> classGroupStudents;
-
-    public List<String> getClassGroupStudents() {
-        return classGroupStudents;
-    }
-
-    public void setClassGroupStudents(List<String> classGroupStudents) {
-        this.classGroupStudents = classGroupStudents;
-    }
-
     public List<Integer> getStudentIds() {
         return studentIds;
     }

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleStudentPayment.java

@@ -51,6 +51,10 @@ public class CourseScheduleStudentPayment implements Comparable<CourseScheduleSt
 
 	private String batchNo;
 
+	private String openPlayMidi;
+
+	private String examSongDownloadJson;
+
 	public CourseScheduleStudentPayment() {
 	}
 
@@ -66,6 +70,22 @@ public class CourseScheduleStudentPayment implements Comparable<CourseScheduleSt
 		this.courseScheduleId = courseScheduleId;
 	}
 
+	public String getExamSongDownloadJson() {
+		return examSongDownloadJson;
+	}
+
+	public void setExamSongDownloadJson(String examSongDownloadJson) {
+		this.examSongDownloadJson = examSongDownloadJson;
+	}
+
+	public String getOpenPlayMidi() {
+		return openPlayMidi;
+	}
+
+	public void setOpenPlayMidi(String openPlayMidi) {
+		this.openPlayMidi = openPlayMidi;
+	}
+
 	public void setId(Long id){
 		this.id = id;
 	}

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

@@ -78,12 +78,11 @@ public interface CourseScheduleStudentPaymentService extends BaseService<Long, C
 	 * @describe 创建课程缴费记录-乐团-用于合班拆班自动排课
 	 * @author zouxuan
 	 * @date 2020.10.27
-	 * @param musicGroupId: 乐团编号
 	 * @param courseSchedules: 课程计划列表
 	 * @param studentIds: 课程学员列表
 	 * @return void
 	 */
-	void createForMusicGroup(String musicGroupId, List<CourseSchedule> courseSchedules, List<Integer> studentIds,String batchNo);
+	void createForMusicGroup(List<CourseSchedule> courseSchedules, List<Integer> studentIds,Integer musicGroupStudentClassAdjustId);
 
 	/**
 	 * @describe 根据缴费日历更新乐团课程学院课程价格

+ 19 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -167,6 +167,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Autowired
     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
     @Autowired
+    private MusicGroupPaymentCalenderDetailService musicGroupPaymentCalenderDetailService;
+    @Autowired
     private IdGeneratorService idGeneratorService;
     @Autowired
     private MusicGroupStudentClassAdjustDao musicGroupStudentClassAdjustDao;
@@ -1675,7 +1677,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         }
         //准备自动排课数据
         List<ClassGroup4MixDto> classGroup4MixDtosBackup = Arrays.asList(new ClassGroup4MixDto[classGroup4MixDtos.size()]);
-        String batchNo = classGroup4MixDtos.get(0).getBatchNo();
+        Integer musicGroupStudentClassAdjustId = classGroup4MixDtos.get(0).getMusicGroupStudentClassAdjustId();
         if(StringUtils.isNotEmpty(classGroup4MixDtos.get(0).getClassCourseMinute())){
             try {
                 Collections.copy(classGroup4MixDtosBackup,classGroup4MixDtos);
@@ -1879,7 +1881,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     }
                     courseSchedule.setTeacherId(teacherId);
                     courseSchedule.setActualTeacherId(teacherId);
-//                    courseScheduleDao.insert(courseSchedule);
+                    courseScheduleDao.insert(courseSchedule);
                     courseScheduleList.add(courseSchedule);
                     courseSchedules.add(courseSchedule);
 
@@ -2015,7 +2017,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             if(StringUtils.isEmpty(classCourseMinute)){
                 courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList);
             }else {
-                courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList,batchNo);
+                courseScheduleStudentPaymentService.createForMusicGroup(courseScheduleList, studentIdList,musicGroupStudentClassAdjustId);
             }
         }
         return classGroup;
@@ -3345,11 +3347,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //生成缴费记录,同一个批次
         MusicGroupPaymentCalender.PaymentCalenderStatusEnum status = null;
         String batchNo = null;
-                List<MusicGroupPaymentCalenderDto> paymentCalenderDtos = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos();
+        List<MusicGroupPaymentCalenderDto> paymentCalenderDtos = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos();
         if(paymentCalenderDtos != null && paymentCalenderDtos.size() > 0){
             batchNo = idGeneratorService.generatorId() + "";
             for (MusicGroupPaymentCalenderDto calenderDto : paymentCalenderDtos) {
-                if(status != null && status != AUDITING){
+                if(status == null || status != AUDITING){
                     List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = calenderDto.getMusicGroupPaymentCalenderCourseSettingsList();
                     for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
                         OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
@@ -3395,13 +3397,20 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         musicGroupStudentClassAdjust.setSubLockCourseIds(JSON.toJSONString(courseIds));
         //计算新增班级的可排课时长,总课次*默认时长  (用学员剩余的课程时长加上购买的时长,可能导致同一班级学员时长不一致)
         musicGroupStudentClassAdjust.setClassCourseMinute(JSON.toJSONString(findClassCourseMinuteMap(classGroupIds)));
-
+        if(status == null || status != AUDITING){
+            musicGroupStudentClassAdjust.setCourseFlag(true);
+        }
+        musicGroupStudentClassAdjustDao.insert(musicGroupStudentClassAdjust);
         //如果需要审核,校验参数配置
         checkMergeClassSplitClassAffirmParam(classGroup4MixDtos);
         //如果缴费项目不需要审核,那么生成班级以及课表
         if(status == null || status != AUDITING){
+
             ClassGroup4MixDto classGroup4MixDto = classGroup4MixDtos.get(0);
+            classGroup4MixDto.setMusicGroupStudentClassAdjustId(musicGroupStudentClassAdjust.getId());
+            //保存课程时长
             classGroup4MixDto.setClassCourseMinute(musicGroupStudentClassAdjust.getClassCourseMinute());
+            //拷贝课程类型
             List<CourseTimeDto> courseTimeDtoList = classGroup4MixDto.getCourseTimeDtoList();
             List<CourseTimeDto> courseTimeDtoListBackup = Arrays.asList(new CourseTimeDto[courseTimeDtoList.size()]);
             Collections.copy(courseTimeDtoListBackup,courseTimeDtoList);
@@ -3412,16 +3421,17 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 classGroup4MixDto.setCourseTimeDtoList(courseTimeDtos);
                 classGroupService.classGroupAdjust(classGroup4MixDtos);
             }
-            musicGroupStudentClassAdjust.setCourseFlag(true);
             //排课完成后删除所选课程
-            courseScheduleDao.batchDeleteByCourseSchedules(courseIds);
+            courseScheduleDao.batchDeleteCourseSchedules(courseIds);
+            courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseIds);
+            teacherAttendanceDao.batchDeleteByCourseSchedules(courseIds);
+            courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseIds);
         }else {
             //冻结班级
             classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds,1);
             //冻结所选班级的课程
             courseScheduleDao.batchUpdateLockByCourseIds(allLockCourseIds,1);
         }
-        musicGroupStudentClassAdjustDao.insert(musicGroupStudentClassAdjust);
     }
 
     private void checkMergeClassSplitClassAffirmParam(List<ClassGroup4MixDto> classGroup4MixDtos){

+ 68 - 19
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.CourseScheduleStudentListDto;
@@ -67,6 +68,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 	private StudentRegistrationService studentRegistrationService;
 	@Autowired
 	private MusicGroupStudentClassAdjustDao musicGroupStudentClassAdjustDao;
+	@Autowired
+	private SysConfigDao sysConfigDao;
 
 	@Override
 	public BaseDAO<Long, CourseScheduleStudentPayment> getDAO() {
@@ -308,33 +311,79 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 
 	@Override
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
-	public void createForMusicGroup(String musicGroupId, List<CourseSchedule> courseSchedules, List<Integer> studentIds,String batchNo) {
-		//获取合班时的缴费项目
-		MusicGroupStudentClassAdjust byBatchNo = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
+	public void createForMusicGroup(List<CourseSchedule> courseSchedules, List<Integer> studentIds,Integer musicGroupStudentClassAdjustId) {
 		//获取提交的合班申请
-		MusicGroupStudentClassAdjust classAdjust = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
+		MusicGroupStudentClassAdjust classAdjust = musicGroupStudentClassAdjustDao.get(musicGroupStudentClassAdjustId);
 		List<Long> courseIds = JSON.parseArray(classAdjust.getSubLockCourseIds(), Long.class);
-		for (Integer studentId : studentIds) {
-			//优先处理之前剩余的课程
-			List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentDao.queryCourseByIdsAndStudentId(courseIds,studentId);
-			Map<Long, List<CourseScheduleStudentPayment>> collect = null;
-			if(studentPayments != null && studentPayments.size() >0 ){
-				collect = studentPayments.stream().collect(Collectors.groupingBy(CourseScheduleStudentPayment::getCourseScheduleId));
-			}
-			for (CourseSchedule courseSchedule : courseSchedules) {
-				//
-				if(studentPayments != null && studentPayments.size() >0 ){
-					List<CourseScheduleStudentPayment> payments = collect.get(courseSchedule.getId());
-					if(payments != null && payments.size() > 0){
+		String batchNo = classAdjust.getBatchNo();
+
+		List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
 
+		//获取默认的排课时长
+		String courseDefaultMinutes = sysConfigDao.findConfigValue("music_course_default_minutes");
+		JSONObject jsonObject = JSON.parseObject(courseDefaultMinutes);
+
+		for (Integer studentId : studentIds) {
+			for (int i = 0; i < courseSchedules.size(); i++) {
+				CourseSchedule courseSchedule = courseSchedules.get(i);
+				//优先处理之前的剩余课程
+				//获取调班之前,学员剩余的课程列表
+				if(courseIds != null && courseIds.size() > 0){
+					List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentDao.queryCourseByIdsAndStudentId(courseIds,studentId,courseSchedule.getType().getCode());
+					if(studentPayments != null && studentPayments.size() > 0){
+						CourseScheduleStudentPayment studentPayment = studentPayments.get(0);
+						courseIds.remove(studentPayment.getCourseScheduleId());
+						studentPayment.setCourseScheduleId(courseSchedule.getId());
+						studentPayment.setClassGroupId(courseSchedule.getClassGroupId());
+						studentPayment.setOpenPlayMidi(null);
+						studentPayment.setSettlementTime(null);
+						studentPayment.setExamSongDownloadJson(null);
+						studentPayment.setId(null);
+						courseScheduleStudentPayments.add(studentPayment);
+						continue ;
 					}
 				}
-				//如果合班时生成了缴费项目
-				if(byBatchNo != null){
-
+				//处理缴费的排课信息
+				List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetails = musicGroupPaymentStudentCourseDetailDao.getUnUseWithStudentAndCourseTypeAndCourseMinutes(batchNo, studentId,courseSchedule.getType());
+				//获取合班时的缴费项目
+				Set<Long> calenderIds = musicGroupPaymentCalenderDao.findByBatchNoAndStudentId(batchNo,studentId);
+				List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalendersAndCourseType(calenderIds, null);
+				MusicGroupPaymentCalenderCourseSettings courseSetting = musicGroupPaymentCalenderCourseSettings.get(0);
+				//课程每分钟原价
+				BigDecimal unitMinuteOriginalPrice = courseSetting.getCourseOriginalPrice().divide(new BigDecimal(courseSetting.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
+				//课程每分钟现价
+				BigDecimal unitMinuteCurrentPrice = courseSetting.getCourseCurrentPrice().divide(new BigDecimal(courseSetting.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
+
+				//默认课程时长
+				int courseDuration = Integer.parseInt(jsonObject.get(courseSchedule.getType().getCode()).toString());
+				BigDecimal courseOriginalPrice = unitMinuteOriginalPrice.multiply(new BigDecimal(courseDuration)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
+				//课程现价
+				BigDecimal courseCurrentPrice = unitMinuteCurrentPrice.multiply(new BigDecimal(courseDuration)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
+				CourseScheduleStudentPayment cssp = new CourseScheduleStudentPayment();
+				cssp.setGroupType(courseSchedule.getGroupType());
+				cssp.setMusicGroupId(courseSchedule.getMusicGroupId());
+				cssp.setCourseScheduleId(courseSchedule.getId());
+				cssp.setClassGroupId(courseSchedule.getClassGroupId());
+				cssp.setBatchNo(batchNo);
+				cssp.setUserId(studentId);
+				cssp.setOriginalPrice(courseOriginalPrice);
+				cssp.setExpectPrice(courseCurrentPrice);
+				cssp.setActualPrice(BigDecimal.ZERO);
+				courseScheduleStudentPayments.add(cssp);
+				int typeCourseDuration = Integer.parseInt(jsonObject.get(courseSchedule.getType().getCode()).toString());
+				for (MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail : musicGroupPaymentStudentCourseDetails) {
+					if(typeCourseDuration > musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes()){
+						musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes());
+						typeCourseDuration = typeCourseDuration-musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes();
+					}else{
+						musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(typeCourseDuration);
+						typeCourseDuration = 0;
+					}
 				}
+				musicGroupPaymentStudentCourseDetailDao.batchUpdate(musicGroupPaymentStudentCourseDetails);
 			}
 		}
+		courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
 	}
 
 

+ 33 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -26,6 +26,7 @@ import com.alibaba.fastjson.JSON;
 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.service.*;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -46,10 +47,6 @@ import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
-import com.ym.mec.biz.service.ClassGroupService;
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
@@ -99,6 +96,15 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 	@Autowired
 	private CourseScheduleDao courseScheduleDao;
+
+	@Autowired
+	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
+
+	@Autowired
+	private TeacherAttendanceDao teacherAttendanceDao;
+
+	@Autowired
+	private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 	@Autowired
 	private MusicGroupBuildLogDao musicGroupBuildLogDao;
 	@Autowired
@@ -115,6 +121,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	private CourseScheduleStudentPaymentServiceImpl courseScheduleStudentPaymentService;
 	@Autowired
 	private MusicGroupStudentClassAdjustDao musicGroupStudentClassAdjustDao;
+	@Autowired
+	private MusicGroupPaymentCalenderDetailService musicGroupPaymentCalenderDetailService;
 
 	@Override
 	public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -348,6 +356,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			musicGroupPaymentCalender.setBatchNo(batchNo);
 			musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
 
+
 			List<MusicGroupPaymentCalenderCourseSettings> currentMusicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalender
 					.getMusicGroupPaymentCalenderCourseSettingsList();
 
@@ -356,6 +365,12 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
 					addStudent(musicGroupPaymentCalender, currentMusicGroupPaymentCalenderCourseSettings);
 				}
+				if(StringUtils.isEmpty(musicGroupPaymentCalenderDto.getBatchNo())){
+					//缴费项目添加学员
+					int[] ints = Arrays.stream(musicGroupPaymentCalenderDto.getStudentIds().split(",")).mapToInt(Integer::parseInt).toArray();
+					List<Integer> list2 = Arrays.stream(ints).boxed().collect(Collectors.toList());
+					musicGroupPaymentCalenderDetailService.batchAdd(musicGroupPaymentCalender.getId(),list2);
+				}
 			}
 
 			if (currentMusicGroupPaymentCalenderCourseSettings.size() > 0) {
@@ -400,7 +415,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId()),
 					MessageTypeEnum.BACKSTAGE_PAYMENT_CALENDER_AUDIT, "", organization.getName(), musicGroup.getName());
 		}
-
 		return batchNo;
 	}
 
@@ -878,6 +892,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		List<ClassGroup4MixDto> classGroup4MixDtos = JSON.parseArray(musicGroupStudentClassAdjust.getNewClassGroupJson(), ClassGroup4MixDto.class);
 		//开始排课
 		ClassGroup4MixDto classGroup4MixDto = classGroup4MixDtos.get(0);
+		classGroup4MixDto.setMusicGroupStudentClassAdjustId(musicGroupStudentClassAdjust.getId());
 		classGroup4MixDto.setClassCourseMinute(musicGroupStudentClassAdjust.getClassCourseMinute());
 		List<CourseTimeDto> courseTimeDtoList = classGroup4MixDto.getCourseTimeDtoList();
 		List<CourseTimeDto> courseTimeDtoListBackup = Arrays.asList(new CourseTimeDto[courseTimeDtoList.size()]);
@@ -886,6 +901,14 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		} catch (Exception e) {
 			throw new BizException("拷贝课程信息异常");
 		}
+
+		List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByBatchNo(batchNo);
+		for (MusicGroupPaymentCalender calender : musicGroupPaymentCalenders) {
+			//缴费项目添加学员
+			int[] ints = Arrays.stream(calender.getStudentIds().split(",")).mapToInt(Integer::parseInt).toArray();
+			List<Integer> list2 = Arrays.stream(ints).boxed().collect(Collectors.toList());
+			musicGroupPaymentCalenderDetailService.batchAdd(calender.getId(),list2);
+		}
 		//每种课程类型单独排课
 		for (CourseTimeDto courseTimeDto : courseTimeDtoListBackup) {
 			List<CourseTimeDto> courseTimeDtos = new ArrayList<>();
@@ -896,7 +919,11 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		musicGroupStudentClassAdjust.setCourseFlag(true);
 		//排课完成后删除所选课程
 		List<Long> courseIds = JSON.parseArray(musicGroupStudentClassAdjust.getSubLockCourseIds(), Long.class);
-		courseScheduleDao.batchDeleteByCourseSchedules(courseIds);
+//		courseScheduleDao.batchDeleteByCourseSchedules(courseIds);
+		courseScheduleDao.batchDeleteCourseSchedules(courseIds);
+		courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseIds);
+		teacherAttendanceDao.batchDeleteByCourseSchedules(courseIds);
+		courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseIds);
 		//解冻课程
 		List<Long> allCourseIds = JSON.parseArray(musicGroupStudentClassAdjust.getAllLockCourseIds(), Long.class);
 		courseScheduleDao.batchUpdateLockByCourseIds(allCourseIds,0);

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

@@ -1317,8 +1317,7 @@
           AND group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
           AND NOW() &lt; CONCAT(class_date_, " ", start_class_time_);
     </update>
-
-    <update id="batchUpdateLockByClassGroupIds">
+    <update id="batchUpdateLockByCourseIds">
         UPDATE course_schedule
         SET is_lock_ = #{isLock}, update_time_ = NOW()
         WHERE id_ IN

+ 4 - 2
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -635,10 +635,12 @@
 			OR ( cs.status_ = 'NOT_START' AND (cssp.actual_price_ IS NOT NULL AND cssp.actual_price_ &gt; 0)))
 	</select>
 	<select id="queryCourseByIdsAndStudentId" resultMap="CourseScheduleStudentPayment">
-		SELECT * FROM course_schedule_student_payment WHERE course_schedule_id_ IN
+		SELECT cssp.* FROM course_schedule_student_payment cssp
+		LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
+		WHERE cssp.course_schedule_id_ IN
 		<foreach collection="courseIds" open="(" item="item" close=")" separator=",">
 			#{item}
 		</foreach>
-		AND user_id_ = #{studentId}
+		AND cssp.user_id_ = #{studentId} AND cs.type_ = #{courseType}
 	</select>
 </mapper>

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

@@ -119,7 +119,9 @@
 			<foreach collection="calenderIds" item="calenderId" open="(" close=")" separator=",">
 				#{calenderId}
 			</foreach>
-			AND course_type_=#{courseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+			<if test="courseType != null">
+				AND course_type_=#{courseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+			</if>
 	</select>
 
 	<delete id="deleteByMusicGroupPaymentCalenderId">

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

@@ -532,4 +532,9 @@
         </foreach>
         GROUP BY mgpcd.user_id_
     </select>
+    <select id="findByBatchNoAndStudentId" resultType="Long">
+        SELECT DISTINCT mgpc.id_ FROM music_group_payment_calender mgpc
+        LEFT JOIN music_group_payment_calender_detail mgpcd ON mgpcd.music_group_payment_calender_id_ = mgpc.id_
+        WHERE batch_no_ = #{batchNo} AND mgpcd.user_id_ = #{studentId}
+    </select>
 </mapper>