Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 years ago
parent
commit
c6a3ac8998

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

@@ -1375,7 +1375,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 times++;
 
                 for (ClassGroupTeacherMapper classGroupTeacherMapper : newClassGroupTeacherMapperList) {
-                    List<TeacherDefaultMusicGroupSalary> teacherSalaryList = teacherDefaultMusicGroupSalaryService.getTeacherSalaryByUserIdAndType(classGroupTeacherMapper.getUserId(), "SINGLE", musicGroup.getSettlementType());
+                    List<TeacherDefaultMusicGroupSalary> teacherSalaryList = teacherDefaultMusicGroupSalaryService.getTeacherSalaryByUserIdAndType(classGroupTeacherMapper.getUserId(), null, null);
                     BigDecimal salary = new BigDecimal("0");
 
                     Map<CourseSchedule.CourseScheduleType, TeacherDefaultMusicGroupSalary> collect = teacherSalaryList.stream().collect(Collectors.toMap(TeacherDefaultMusicGroupSalary::getCourseScheduleType, teacherDefaultMusicGroupSalary -> teacherDefaultMusicGroupSalary));

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

@@ -564,12 +564,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if(existCourseSchedules ==null || existCourseSchedules.size()==0){
 			return null;
 		}
-		//新课程对应的班级编号列表
-		List<Integer> newCourseScheduleClassGroupIds = courseSchedules
-				.stream()
-				.map(CourseSchedule::getClassGroupId)
-				.distinct()
-				.collect(Collectors.toList());
+
 
 		List<Long> existCourseScheduleIds = existCourseSchedules.stream()
 				.map(CourseSchedule::getId)
@@ -582,6 +577,14 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		}else{
 			allCourseSchedules = courseSchedules;
 		}
+
+		//新课程对应的班级编号列表
+		List<Integer> newCourseScheduleClassGroupIds = allCourseSchedules
+				.stream()
+				.map(CourseSchedule::getClassGroupId)
+				.distinct()
+				.collect(Collectors.toList());
+
 		//所有课程的班级编号
 		List<Integer> classGroupIds = allCourseSchedules
 				.stream()
@@ -624,7 +627,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				boolean isTeacherRepeat = false;
 				boolean isStudentRepeat = false;
 				//检测老师冲突
-				existCourseSchedule.setTeachingTeacherIdList(courseScheduleTeacherMap.get(existCourseSchedule.getId().intValue()).getIds());
+				if(courseScheduleTeacherMap.containsKey(existCourseSchedule.getId().intValue())){
+					existCourseSchedule.setTeachingTeacherIdList(courseScheduleTeacherMap.get(existCourseSchedule.getId().intValue()).getIds());
+				}else {
+					existCourseSchedule.setTeachingTeacherIdList(classGroupTeachingTeacherMap.get(existCourseSchedule.getClassGroupId()).getIds());
+				}
 				newCourseSchedule.setTeachingTeacherIdList(classGroupTeachingTeacherMap.get(newCourseSchedule.getClassGroupId()).getIds());
 
 				if(!CollectionUtils.isEmpty(newCourseSchedule.getTeachingTeacherIdList())
@@ -645,19 +652,23 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				//如果班级不同,则需要检测两个班级是否存在重复的学生
 				List<ClassGroupStudentMapper> preClassGroupStudents=classGroupStudentsMap.get(newCourseSchedule.getClassGroupId());
 				List<ClassGroupStudentMapper> backClassGroupStudents=classGroupStudentsMap.get(existCourseSchedule.getClassGroupId());
-				//当前课程所在班级的学生编号列表
-				List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
-						.map(ClassGroupStudentMapper::getUserId)
-						.collect(Collectors.toList());
-				//后面一节课程所在班级的学生编号列表
-				List<Integer> backClassGroupStudentIds = backClassGroupStudents.stream()
-						.map(ClassGroupStudentMapper::getUserId)
-						.collect(Collectors.toList());
-				List<Integer> repeatStudentIds = preClassGroupStudentIds.stream()
-						.filter(backClassGroupStudentIds::contains)
-						.collect(Collectors.toList());
-				if(!CollectionUtils.isEmpty(repeatStudentIds)){
-					isStudentRepeat = true;
+
+				List<Integer> repeatStudentIds = new ArrayList<>();
+				if(classGroupStudentsMap.containsKey(newCourseSchedule.getClassGroupId()) && classGroupStudentsMap.containsKey(existCourseSchedule.getClassGroupId())) {
+					//当前课程所在班级的学生编号列表
+					List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
+							.map(ClassGroupStudentMapper::getUserId)
+							.collect(Collectors.toList());
+					//后面一节课程所在班级的学生编号列表
+					List<Integer> backClassGroupStudentIds = backClassGroupStudents.stream()
+							.map(ClassGroupStudentMapper::getUserId)
+							.collect(Collectors.toList());
+					repeatStudentIds = preClassGroupStudentIds.stream()
+							.filter(backClassGroupStudentIds::contains)
+							.collect(Collectors.toList());
+					if (!CollectionUtils.isEmpty(repeatStudentIds)) {
+						isStudentRepeat = true;
+					}
 				}
 				if(!isTeacherRepeat && !isStudentRepeat){
 					continue;

+ 48 - 0
mec-student/src/main/java/com/ym/mec/student/controller/SysConfigController.java

@@ -0,0 +1,48 @@
+package com.ym.mec.student.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.common.controller.BaseController;
+
+/** 
+ * 系统配置控制层
+ */
+@RestController
+@Api(tags = "系统参数设置")
+@RequestMapping(value = "sysConfig")
+public class SysConfigController extends BaseController {
+
+	@Autowired
+	private SysConfigService sysConfigService;
+
+	@ApiOperation(value = "参数列表")
+	@GetMapping(value = "list")
+	public Object configList(String group) {
+		Map<String,Object> params = new HashMap<String, Object>();
+		params.put("group", group);
+		List<SysConfig> configs = sysConfigService.findAll(params);
+		return succeed(configs);
+	}
+
+	@ApiOperation(value = "查询参数")
+	@GetMapping(value = "queryByParamName")
+	public Object queryByParamName(String paramName) {
+		if(StringUtils.isBlank(paramName)){
+			return failed("参数不能为空");
+		}
+		return succeed(sysConfigService.findByParamName(paramName));
+	}
+}

+ 48 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/SysConfigController.java

@@ -0,0 +1,48 @@
+package com.ym.mec.teacher.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.common.controller.BaseController;
+
+/** 
+ * 系统配置控制层
+ */
+@RestController
+@Api(tags = "系统参数设置")
+@RequestMapping(value = "sysConfig")
+public class SysConfigController extends BaseController {
+
+	@Autowired
+	private SysConfigService sysConfigService;
+
+	@ApiOperation(value = "参数列表")
+	@GetMapping(value = "list")
+	public Object configList(String group) {
+		Map<String,Object> params = new HashMap<String, Object>();
+		params.put("group", group);
+		List<SysConfig> configs = sysConfigService.findAll(params);
+		return succeed(configs);
+	}
+
+	@ApiOperation(value = "查询参数")
+	@GetMapping(value = "queryByParamName")
+	public Object queryByParamName(String paramName) {
+		if(StringUtils.isBlank(paramName)){
+			return failed("参数不能为空");
+		}
+		return succeed(sysConfigService.findByParamName(paramName));
+	}
+}