Browse Source

update:退团(临时合课)

yonge 4 năm trước cách đây
mục cha
commit
7cc86a3f16

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

@@ -50,7 +50,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      * @param courseScheduleList
      * @return
      */
-    int deleteStudentCourseSchedule(@Param("userId") Integer userId, @Param("courseScheduleList") List<CourseSchedule> courseScheduleList);
+    int deleteStudentCourseSchedule(@Param("userId") Integer userId, @Param("courseScheduleIdList") List<Long> courseScheduleIdList);
 
     /**
      * @param courseScheduleIds: 课程编号列表

+ 41 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -2,19 +2,40 @@ package com.ym.mec.biz.service.impl;
 
 import java.io.IOException;
 import java.math.BigDecimal;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
 import java.util.stream.Collectors;
 
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.entity.*;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import com.alibaba.fastjson.JSON;
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
+import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dto.ClassGroupStudentInfoDto;
+import com.ym.mec.biz.dal.entity.ClassGroup;
+import com.ym.mec.biz.dal.entity.ClassGroupRelation;
+import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
+import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
+import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.dal.entity.TeacherDefaultMusicGroupSalary;
 import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
@@ -35,7 +56,6 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.util.http.HttpUtil;
-import org.springframework.util.CollectionUtils;
 
 @Service
 public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, ClassGroupStudentMapper> implements ClassGroupStudentMapperService {
@@ -69,6 +89,9 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
     private CourseScheduleDao courseScheduleDao;
     @Autowired
     private ClassGroupDao classGroupDao;
+    
+    @Autowired
+    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 
     private static String holidayUrl = "http://tool.bitefu.net/jiari/?d=";
 
@@ -110,7 +133,19 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         //3、删除学生对应班级的课程
         List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
         if (courseScheduleList.size() > 0) {
-            courseScheduleStudentPaymentService.deleteStudentCourseSchedule(userId, courseScheduleList);
+
+            //临时合课的情况
+            List<Long> tempMergedCourseIdList = new ArrayList<Long>();
+            for(CourseSchedule courseSchedule : courseScheduleList){
+            	if(courseSchedule.getNewCourseId() != null){
+            		tempMergedCourseIdList.add(courseSchedule.getNewCourseId());
+            	}
+            }
+            
+            tempMergedCourseIdList.addAll(courseScheduleList.stream().map(CourseSchedule :: getId).collect(Collectors.toList()));
+            if(tempMergedCourseIdList.size() > 0){
+            	courseScheduleStudentPaymentDao.deleteStudentCourseSchedule(userId, tempMergedCourseIdList);
+            }
         }
 
         //4、调整未上课课酬

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

@@ -177,7 +177,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 		if(courseScheduleList.size() == 0){
 			return 0;
 		}
-		return courseScheduleStudentPaymentDao.deleteStudentCourseSchedule(userId,courseScheduleList);
+		List<Long> courseScheduleIdList = courseScheduleList.stream().map(CourseSchedule :: getId).collect(Collectors.toList());
+		return courseScheduleStudentPaymentDao.deleteStudentCourseSchedule(userId,courseScheduleIdList);
     }
 
 	@Override

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

@@ -395,8 +395,8 @@
 
 	<delete id="deleteStudentCourseSchedule">
 		DELETE FROM course_schedule_student_payment WHERE user_id_ = #{userId} AND course_schedule_id_ IN
-		<foreach collection="courseScheduleList" item="courseSchedule" index="index" open="(" close=")" separator=",">
-			#{courseSchedule.id}
+		<foreach collection="courseScheduleIdList" item="courseScheduleId" index="index" open="(" close=")" separator=",">
+			#{courseScheduleId}
 		</foreach>
 	</delete>
     <delete id="deleteByCourseSchedule">