Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

Joburgess vor 4 Jahren
Ursprung
Commit
4de624501d

+ 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: 课程编号列表

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RemainCourseTypeDurationDto.java

@@ -7,6 +7,8 @@ public class RemainCourseTypeDurationDto {
 	private CourseScheduleType courseType;
 	
 	private Integer remainMinutes;
+	
+	private Integer tempMergedCourseNum;
 
 	public CourseScheduleType getCourseType() {
 		return courseType;
@@ -23,4 +25,12 @@ public class RemainCourseTypeDurationDto {
 	public void setRemainMinutes(Integer remainMinutes) {
 		this.remainMinutes = remainMinutes;
 	}
+
+	public Integer getTempMergedCourseNum() {
+		return tempMergedCourseNum;
+	}
+
+	public void setTempMergedCourseNum(Integer tempMergedCourseNum) {
+		this.tempMergedCourseNum = tempMergedCourseNum;
+	}
 }

+ 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 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -45,6 +45,7 @@
     <resultMap type="com.ym.mec.biz.dal.dto.RemainCourseTypeDurationDto" id="RemainCourseTypeDurationDto">
         <result column="course_type_" property="courseType"/>
         <result column="remain_minutes_" property="remainMinutes"/>
+        <result column="temp_merged_course_num_" property="tempMergedCourseNum"/>
     </resultMap>
 
     <resultMap id="CourseScheduleEndDto" type="com.ym.mec.biz.dal.dto.CourseScheduleEndDto" extends="CourseSchedule">
@@ -3324,7 +3325,7 @@
 
     <select id="queryRemainCourseTypeDuration" resultMap="RemainCourseTypeDurationDto">
         SELECT cs.type_ course_type_,SUM(TIMESTAMPDIFF(MINUTE,STR_TO_DATE(concat(cs.class_date_,' ',cs.start_class_time_),'%Y-%m-%d %H:%i:%s'),
-        STR_TO_DATE(concat(cs.class_date_,' ',cs.end_class_time_),'%Y-%m-%d %H:%i:%s'))) remain_minutes_
+        STR_TO_DATE(concat(cs.class_date_,' ',cs.end_class_time_),'%Y-%m-%d %H:%i:%s'))) remain_minutes_,sum(case when cs.new_course_id_ is null then 0 else 1 end) temp_merged_course_num_
 		from course_schedule cs where FIND_IN_SET(cs.class_group_id_,#{classgroupId}) and cs.status_ = 'NOT_START' group by cs.type_
     </select>
 

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

+ 11 - 1
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java

@@ -1,6 +1,7 @@
 package com.ym.mec.web.controller;
 
 import com.ym.mec.biz.dal.dto.MergeClassSplitClassAffirmDto;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -25,6 +26,7 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.ClassGroup4MixDto;
 import com.ym.mec.biz.dal.dto.HighClassGroupDto;
+import com.ym.mec.biz.dal.dto.RemainCourseTypeDurationDto;
 import com.ym.mec.biz.dal.dto.TestDto;
 import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
@@ -38,6 +40,7 @@ import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.ClassGroupTeacherMapperService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 
@@ -332,7 +335,14 @@ public class ClassGroupController extends BaseController {
     @GetMapping("/queryRemainCourseTypeDuration")
     @PreAuthorize("@pcs.hasPermissions('classGroup/queryRemainCourseTypeDuration')")
     public HttpResponseResult queryRemainCourseTypeDuration(String classGroupIdList){
-        return succeed(classGroupService.queryRemainCourseTypeDuration(classGroupIdList));
+    	
+    	List<RemainCourseTypeDurationDto> remainCourseTypeDurationDtoList = classGroupService.queryRemainCourseTypeDuration(classGroupIdList);
+    	for (RemainCourseTypeDurationDto dto : remainCourseTypeDurationDtoList) {
+			if(dto.getTempMergedCourseNum() > 0){
+				throw new BizException("班级中含有临时合并的课程,不能");
+			}
+		}
+        return succeed(remainCourseTypeDurationDtoList);
     }
 
     @ApiOperation(value = "进行中乐团-修改-班级详情-学员班级调整-班级剩余课次")