Joburgess 5 years ago
parent
commit
baa7edff5c

+ 32 - 32
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -383,38 +383,38 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                             throw new BizException(errInfo.toString());
                         }
                         //助教冲突检测
-//						if(Objects.isNull(preCourseSchedule.getId())){
-//							IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(preCourseSchedule.getClassGroupId());
-//							if(Objects.nonNull(integerAndIntegerListDto)){
-//								preCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
-//							}
-//						}else if(existCourseScheduleIds.contains(preCourseSchedule.getId())){
-//							IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(preCourseSchedule.getId());
-//							if(Objects.nonNull(integerAndIntegerListDto)){
-//								preCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
-//							}
-//						}
-//						if(Objects.isNull(backCourseSchedule.getId())){
-//							IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(backCourseSchedule.getClassGroupId());
-//							if(Objects.nonNull(integerAndIntegerListDto)){
-//								backCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
-//							}
-//						}else if(existCourseScheduleIds.contains(backCourseSchedule.getId())){
-//							IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(backCourseSchedule.getId());
-//							if(Objects.nonNull(integerAndIntegerListDto)){
-//								backCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
-//							}
-//						}
-//						if(!CollectionUtils.isEmpty(preCourseSchedule.getTeachingTeacherIdList())
-//							&&!CollectionUtils.isEmpty(backCourseSchedule.getTeachingTeacherIdList())){
-//							List<Integer> repeatIds = preCourseSchedule.getTeachingTeacherIdList()
-//									.stream().filter(backCourseSchedule.getTeachingTeacherIdList()::contains)
-//									.collect(Collectors.toList());
-//							if(!CollectionUtils.isEmpty(repeatIds)){
-//								errInfo.append("安排的助教存在冲突");
-//								throw new BizException(errInfo.toString());
-//							}
-//						}
+						if(Objects.isNull(preCourseSchedule.getId())){
+							IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(preCourseSchedule.getClassGroupId());
+							if(Objects.nonNull(integerAndIntegerListDto)){
+								preCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
+							}
+						}else if(existCourseScheduleIds.contains(preCourseSchedule.getId())){
+							IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(preCourseSchedule.getId());
+							if(Objects.nonNull(integerAndIntegerListDto)){
+								preCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
+							}
+						}
+						if(Objects.isNull(backCourseSchedule.getId())){
+							IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(backCourseSchedule.getClassGroupId());
+							if(Objects.nonNull(integerAndIntegerListDto)){
+								backCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
+							}
+						}else if(existCourseScheduleIds.contains(backCourseSchedule.getId())){
+							IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(backCourseSchedule.getId());
+							if(Objects.nonNull(integerAndIntegerListDto)){
+								backCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
+							}
+						}
+						if(!CollectionUtils.isEmpty(preCourseSchedule.getTeachingTeacherIdList())
+							&&!CollectionUtils.isEmpty(backCourseSchedule.getTeachingTeacherIdList())){
+							List<Integer> repeatIds = preCourseSchedule.getTeachingTeacherIdList()
+									.stream().filter(backCourseSchedule.getTeachingTeacherIdList()::contains)
+									.collect(Collectors.toList());
+							if(!CollectionUtils.isEmpty(repeatIds)){
+								errInfo.append("安排的助教存在冲突");
+								throw new BizException(errInfo.toString());
+							}
+						}
                         //学生冲突检测
                         if(preCourseSchedule.getClassGroupId().equals(backCourseSchedule.getClassGroupId())){
                             //如果班级相同,则学生肯定存在冲突

+ 9 - 17
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMessageServiceImpl.java

@@ -1,22 +1,5 @@
 package com.ym.mec.biz.service.impl;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Random;
-import java.util.Set;
-
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Service;
-
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.SysMessageDao;
@@ -35,6 +18,15 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.ym.mec.util.string.MessageFormatter;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.Map.Entry;
 
 @Service
 public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> implements SysMessageService {

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

@@ -1119,7 +1119,7 @@
 
     <resultMap id="IntegerAndIntegerListDto" type="com.ym.mec.biz.dal.dto.IntegerAndIntegerListDto">
         <result property="id" column="id_"/>
-        <collection property="ids" ofType="string" javaType="list">
+        <collection property="ids" ofType="int" javaType="list">
             <result column="relate_ids"/>
         </collection>
     </resultMap>