zouxuan преди 4 години
родител
ревизия
cdbda25d71

+ 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;
     }

+ 0 - 11
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupStudentClassAdjust.java

@@ -34,9 +34,6 @@ public class MusicGroupStudentClassAdjust {
 	@ApiModelProperty(value = "所选学员冻结的课程列表", required = false)
 	private String subLockCourseIds;
 
-	@ApiModelProperty(value = "学员对应的缴费项目", required = false)
-	private String studentCalenderIds;
-
 	@ApiModelProperty(value = "是否排课", required = false)
 	private boolean courseFlag;
 
@@ -46,14 +43,6 @@ public class MusicGroupStudentClassAdjust {
 
 	private Date updateTime;
 
-	public String getStudentCalenderIds() {
-		return studentCalenderIds;
-	}
-
-	public void setStudentCalenderIds(String studentCalenderIds) {
-		this.studentCalenderIds = studentCalenderIds;
-	}
-
 	public Integer getId() {
 		return 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 根据缴费日历更新乐团课程学院课程价格

+ 15 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -1675,7 +1675,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);
@@ -2015,7 +2015,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;
@@ -3346,11 +3346,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         MusicGroupPaymentCalender.PaymentCalenderStatusEnum status = null;
         String batchNo = null;
         List<MusicGroupPaymentCalenderDto> paymentCalenderDtos = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos();
-        List<Map<String,String>> studentCalenderIds = new ArrayList<>();
         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(
@@ -3374,17 +3373,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 }
                 //指定批次
                 calenderDto.setBatchNo(batchNo);
-                String calenderIds = musicGroupPaymentCalenderService.create(calenderDto);
-                Map<String,String> studentCalenderIdMap = new HashMap<>(1);
-                studentCalenderIdMap.put(calenderDto.getStudentIds(),calenderIds);
-                studentCalenderIds.add(studentCalenderIdMap);
+                musicGroupPaymentCalenderService.create(calenderDto);
             }
         }
 
         //记录申请信息
         MusicGroupStudentClassAdjust musicGroupStudentClassAdjust = new MusicGroupStudentClassAdjust();
         musicGroupStudentClassAdjust.setBatchNo(batchNo);
-        musicGroupStudentClassAdjust.setStudentCalenderIds(JSON.toJSONString(studentCalenderIds));
         musicGroupStudentClassAdjust.setCourseFlag(false);
         musicGroupStudentClassAdjust.setMusicGroupId(musicGroup.getId());
         musicGroupStudentClassAdjust.setOperatorId(sysUser.getId());
@@ -3400,13 +3395,19 @@ 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);
@@ -3417,16 +3418,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){

+ 49 - 48
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

@@ -311,78 +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) {
-		//获取合班时的缴费项目
-		List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.findByBatchNo(batchNo);
+	public void createForMusicGroup(List<CourseSchedule> courseSchedules, List<Integer> studentIds,Integer musicGroupStudentClassAdjustId) {
 		//获取提交的合班申请
-		MusicGroupStudentClassAdjust classAdjust = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
-		List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
+		MusicGroupStudentClassAdjust classAdjust = musicGroupStudentClassAdjustDao.get(musicGroupStudentClassAdjustId);
 		List<Long> courseIds = JSON.parseArray(classAdjust.getSubLockCourseIds(), Long.class);
+		String batchNo = classAdjust.getBatchNo();
 
-		Map<CourseSchedule.CourseScheduleType, Integer> courseTypeCourseDurationMap = new HashMap<>();
-		Map<CourseSchedule.CourseScheduleType, List<CourseSchedule>> typeCourseMap = courseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getType));
-		for (Map.Entry<CourseSchedule.CourseScheduleType, List<CourseSchedule>> typeCoursesEntry : typeCourseMap.entrySet()) {
-			int totalCourseDuration = 0;
-			for (CourseSchedule courseSchedule : typeCoursesEntry.getValue()) {
-				//课程时长
-				int courseDuration = DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime());
-				totalCourseDuration += courseDuration;
-			}
-			courseTypeCourseDurationMap.put(typeCoursesEntry.getKey(), totalCourseDuration);
-		}
+		List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
 
 		//获取默认的排课时长
 		String courseDefaultMinutes = sysConfigDao.findConfigValue("music_course_default_minutes");
 		JSONObject jsonObject = JSON.parseObject(courseDefaultMinutes);
 
 		for (Integer studentId : studentIds) {
-			//优先处理之前剩余的课程
-			List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentDao.queryCourseByIdsAndStudentId(courseIds,studentId);
-			for (int i = 0; i < courseSchedules.size(); i++) {
+			noPayment:for (int i = 0; i < courseSchedules.size(); i++) {
 				CourseSchedule courseSchedule = courseSchedules.get(i);
 				//优先处理之前的剩余课程
+				//获取调班之前,学员剩余的课程列表
+				List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentDao.queryCourseByIdsAndStudentId(courseIds,studentId,courseSchedule.getType().getCode());
 				if(studentPayments != null && studentPayments.size() > 0 && i < studentPayments.size()){
 					for (int j = 0; j < studentPayments.size(); j++) {
-						CourseScheduleStudentPayment studentPayment = studentPayments.get(i);
+						CourseScheduleStudentPayment studentPayment = studentPayments.get(j);
 						studentPayment.setCourseScheduleId(courseSchedule.getId());
 						studentPayment.setClassGroupId(courseSchedule.getClassGroupId());
 						studentPayment.setOpenPlayMidi(null);
 						studentPayment.setSettlementTime(null);
 						studentPayment.setExamSongDownloadJson(null);
+						studentPayment.setId(null);
 						courseScheduleStudentPayments.add(studentPayment);
-						break;
 					}
-					Set<Long> calenderIds = musicGroupPaymentCalenders.stream().map(e -> e.getId()).collect(Collectors.toSet());
-					List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalendersAndCourseType(calenderIds, null);
-					Map<Long, List<MusicGroupPaymentCalenderCourseSettings>> collect = musicGroupPaymentCalenderCourseSettings.stream().collect(Collectors.groupingBy(MusicGroupPaymentCalenderCourseSettings::getMusicGroupPaymentCalenderId));
-					for (MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenders) {
-						MusicGroupPaymentCalenderCourseSettings courseSetting = collect.get(musicGroupPaymentCalender.getId()).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);
-
+					i = studentPayments.size() - 1;
+					break noPayment;
+				}
+				//处理缴费的排课信息
+				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);
 	}
 
 

+ 14 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -99,6 +99,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
@@ -238,8 +247,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}
 		});
 
-		//获取缴费项目编号列表
-		StringBuffer calenderIds = new StringBuffer();
 		for (int i = 0; i < musicGroupPaymentDateRangeList.size(); i++) {
 
 			MusicGroupPaymentDateRange musicGroupPaymentDateRange = musicGroupPaymentDateRangeList.get(i);
@@ -349,10 +356,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			// 设置批次号
 			musicGroupPaymentCalender.setBatchNo(batchNo);
 			musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
-			if(calenderIds.length() > 0){
-				calenderIds.append(",");
-			}
-			calenderIds.append(musicGroupPaymentCalender.getId());
 
 			List<MusicGroupPaymentCalenderCourseSettings> currentMusicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalender
 					.getMusicGroupPaymentCalenderCourseSettingsList();
@@ -406,9 +409,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId()),
 					MessageTypeEnum.BACKSTAGE_PAYMENT_CALENDER_AUDIT, "", organization.getName(), musicGroup.getName());
 		}
-		if(StringUtils.isNotEmpty(musicGroupPaymentCalenderDto.getBatchNo())){
-			return calenderIds.toString();
-		}
 		return batchNo;
 	}
 
@@ -904,7 +904,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);

+ 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>

+ 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>