|
@@ -21,15 +21,19 @@ import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.format.datetime.DateFormatter;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.DateFormat;
|
|
|
import java.time.Instant;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -68,6 +72,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
private SubjectService subjectService;
|
|
|
@Autowired
|
|
|
private ClassGroupTeacherMapperDao classGroupTeacherMapperDao;
|
|
|
+ @Autowired
|
|
|
+ private CourseScheduleDao courseScheduleDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, ClassGroup> getDAO() {
|
|
@@ -131,7 +137,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
classGroupStudentList.add(classGroupStudentMapper);
|
|
|
StudentRegistration studentRegistration = new StudentRegistration();
|
|
|
- studentRegistration.setClassGroupId(classGroup.getId());
|
|
|
+ studentRegistration.setClassGroupId(classGroup.getId().toString());
|
|
|
studentRegistration.setUserId(Integer.getInteger(userId));
|
|
|
studentRegistration.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
studentRegistrationDao.updateByUserIdAndMusicGroupId(studentRegistration);
|
|
@@ -205,6 +211,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
highClassGroup.setCreateTime(date);
|
|
|
highClassGroup.setUpdateTime(date);
|
|
|
highClassGroup.setType(ClassGroupTypeEnum.HIGH);
|
|
|
+ highClassGroup.setTotalClassTimes(highClassGroup.getCourseTimes());
|
|
|
+ highClassGroup.setCurrentClassTimes(0);
|
|
|
insert(highClassGroup);
|
|
|
|
|
|
//2、插入班级关联老师
|
|
@@ -219,21 +227,21 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
//3、插入班级排课信息
|
|
|
List<CourseSchedule> courseScheduleList = new ArrayList<>();
|
|
|
- int i = 0;
|
|
|
- LocalDateTime now = LocalDateTime.ofInstant(highClassGroup.getStartDate().toInstant(), ZoneId.systemDefault());
|
|
|
+ int times = 0;
|
|
|
+ //LocalDateTime now = LocalDateTime.ofInstant(highClassGroup.getStartDate().toInstant(), ZoneId.systemDefault());
|
|
|
+ LocalDateTime now = LocalDate.parse(highClassGroup.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
|
|
+
|
|
|
while (true) {
|
|
|
- now = now.plusDays(i);
|
|
|
int dayOfWeek = now.getDayOfWeek().getValue();
|
|
|
-
|
|
|
if (highClassGroup.getDayOfWeek().equals(dayOfWeek)) {
|
|
|
CourseSchedule courseSchedule = new CourseSchedule();
|
|
|
Instant instant = now.atZone(ZoneId.systemDefault()).toInstant();
|
|
|
Date classDate = Date.from(instant);
|
|
|
- String startClassTime = DateUtil.getDate(classDate) + " " + highClassGroup.getStartClassTime();
|
|
|
- String endClassTime = DateUtil.getDate(classDate) + " " + highClassGroup.getEndClassTime();
|
|
|
+ String startClassTime = DateUtil.getDate(classDate) + " " + highClassGroup.getStartClassTime()+":00";
|
|
|
+ String endClassTime = DateUtil.getDate(classDate) + " " + highClassGroup.getEndClassTime()+":00";
|
|
|
|
|
|
courseSchedule.setSchoolId(schoolId);
|
|
|
- courseSchedule.setClassGroupId(highClassGroup.getUserId());
|
|
|
+ courseSchedule.setClassGroupId(highClassGroup.getId());
|
|
|
courseSchedule.setStatus(CourseStatusEnum.NOT_START);
|
|
|
courseSchedule.setClassDate(classDate);
|
|
|
courseSchedule.setStartClassTime(DateUtil.stringToDate(startClassTime));
|
|
@@ -243,14 +251,19 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
courseSchedule.setCreateTime(date);
|
|
|
courseSchedule.setUpdateTime(date);
|
|
|
courseSchedule.setTeachMode(TeachModeEnum.OFFLINE);
|
|
|
+ courseSchedule.setType(CourseSchedule.CourseScheduleType.HIGH);
|
|
|
+ Subject subject = subjectService.get(Integer.parseInt(highClassGroup.getSubjectIdList()));
|
|
|
+ courseSchedule.setName(subject.getName()+"-"+CourseSchedule.CourseScheduleType.HIGH.getMsg());
|
|
|
+
|
|
|
courseScheduleList.add(courseSchedule);
|
|
|
- i++;
|
|
|
+ times++;
|
|
|
}
|
|
|
- if (highClassGroup.getCourseTimes().equals(i)) {
|
|
|
+ now = now.plusDays(1);
|
|
|
+ if (highClassGroup.getCourseTimes().equals(times)) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- courseScheduleService.batchAddCourseSchedule(courseScheduleList);
|
|
|
+ courseScheduleDao.batchAddCourseSchedules(courseScheduleList);
|
|
|
}
|
|
|
return highClassGroupList;
|
|
|
}
|
|
@@ -296,14 +309,22 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
List<Map<Integer,String>> names = vipGroupActivityDao.queryNamesById(StringUtils.join(activityIds,","));
|
|
|
Map<Integer,String> nameMap = MapUtil.convertMybatisMap(names);
|
|
|
//计算月度平均消耗值(已上课时 / 消耗月份)
|
|
|
- Date date = new Date();
|
|
|
- dataList.forEach(e->{
|
|
|
- e.setActivityName(nameMap.get(e.getActivityId()));
|
|
|
- int days = DateUtil.daysBetween(e.getPaymentExpireDate(), date);
|
|
|
- if(days <= 0){
|
|
|
- e.setMonthAvg(0f);
|
|
|
- }else {
|
|
|
- e.setMonthAvg(e.getCurrentClassTimes()/(days/30));
|
|
|
+ List<Long> vipGroupIds = dataList.stream().map(vipGroup -> vipGroup.getVipClassId()).collect(Collectors.toList());
|
|
|
+ List<Map<Long, Integer>> vipGroupOverCourses = vipGroupDao.countVipGroupOverCourse(vipGroupIds);
|
|
|
+ Map<Long,Integer> vipGroupOverCourseMaps = MapUtil.convertMybatisMap(vipGroupOverCourses);
|
|
|
+ dataList.forEach(vipGroup -> {
|
|
|
+ Integer overCourses = vipGroupOverCourseMaps.get(vipGroup.getVipClassId());
|
|
|
+ if(Objects.isNull(overCourses)){
|
|
|
+ overCourses=0;
|
|
|
+ }
|
|
|
+ Integer totalClassTimes=vipGroup.getTotalClassTimes();
|
|
|
+ if(Objects.isNull(totalClassTimes)){
|
|
|
+ vipGroup.setMonthAvg(Float.parseFloat("0.0"));
|
|
|
+ }else{
|
|
|
+ BigDecimal overCoursesOfMonth=new BigDecimal(overCourses),allClassTimes=new BigDecimal(totalClassTimes);
|
|
|
+
|
|
|
+ Float monthConsumeRate=overCoursesOfMonth.divide(overCoursesOfMonth,2,BigDecimal.ROUND_HALF_UP).floatValue();
|
|
|
+ vipGroup.setMonthAvg(monthConsumeRate);
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -336,7 +357,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Override
|
|
|
public List<ClassGroupTeachersDto> getClassGroupAndTeacherSalary(String musicGroupId, SalarySettlementTypeEnum type) throws Exception {
|
|
|
//乐团班级及班级老师
|
|
|
- List<ClassGroupTeachersDto> classGroupAndTeachers = getClassGroupAndTeachers(musicGroupId,"NORMAL,MIX,HIGH");
|
|
|
+ List<ClassGroupTeachersDto> classGroupAndTeachers = getClassGroupAndTeachers(musicGroupId, "NORMAL,MIX,HIGH");
|
|
|
|
|
|
for (ClassGroupTeachersDto classGroupAndTeacher : classGroupAndTeachers) {
|
|
|
//班级的教师列表
|
|
@@ -346,7 +367,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
String courseType = classGroupAndTeacher.getType().equals(ClassGroupTypeEnum.NORMAL) ? "SINGLE" : classGroupAndTeacher.getType().getCode();
|
|
|
List<TeacherDefaultMusicGroupSalary> teacherSalaryByUserIdAndType = teacherDefaultMusicGroupSalaryService.getTeacherSalaryByUserIdAndType(classGroupTeacherMapper.getUserId(), courseType, type);
|
|
|
if (teacherSalaryByUserIdAndType == null) {
|
|
|
- throw new Exception("userId:"+classGroupTeacherMapper.getUserId()+"名字:"+classGroupTeacherMapper.getUserName()+" 老师没有设置课酬");
|
|
|
+ throw new Exception("userId:" + classGroupTeacherMapper.getUserId() + "名字:" + classGroupTeacherMapper.getUserName() + " 老师没有设置课酬");
|
|
|
}
|
|
|
classGroupTeacherMapper.setTeacherDefaultMusicGroupSalaryList(teacherSalaryByUserIdAndType);
|
|
|
}
|
|
@@ -368,19 +389,19 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
params.put("offset", pageInfo.getOffset());
|
|
|
courseListDtos = classGroupDao.queryCoursePage(params);
|
|
|
courseListDtos.forEach(e -> {
|
|
|
- if (ClassGroupTypeEnum.VIP==e.getType()) {
|
|
|
+ if (ClassGroupTypeEnum.VIP == e.getType()) {
|
|
|
//获取vip课的学生名称列表
|
|
|
List<String> vipStuNames = classGroupDao.findVipStuNames(e.getMusicGroupId());
|
|
|
if (vipStuNames != null && vipStuNames.size() > 0) {
|
|
|
e.setStudentNames(StringUtils.join(vipStuNames, ","));
|
|
|
}
|
|
|
- if(e.getOffLineClassesNum()>0&&e.getOffLineClassesNum()<=0){
|
|
|
+ if (e.getOffLineClassesNum() > 0 && e.getOffLineClassesNum() <= 0) {
|
|
|
e.setClassMode(1);
|
|
|
- }else if(e.getOffLineClassesNum()>0&&e.getOffLineClassesNum()>0){
|
|
|
+ } else if (e.getOffLineClassesNum() > 0 && e.getOffLineClassesNum() > 0) {
|
|
|
e.setClassMode(3);
|
|
|
- }else if(e.getOnlineClassesNum()<0&&e.getOffLineClassesNum()>=0){
|
|
|
+ } else if (e.getOnlineClassesNum() < 0 && e.getOffLineClassesNum() >= 0) {
|
|
|
e.setClassMode(2);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
e.setClassMode(0);
|
|
|
}
|
|
|
} else {
|
|
@@ -422,7 +443,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
teachers.removeAll(Collections.singleton(null));
|
|
|
//获取乐团群用户总数
|
|
|
BigDecimal count = musicGroupUserNumMap.get(e.getId());
|
|
|
- e.setCount(count == null?0:count.intValue() + teachers.size());
|
|
|
+ e.setCount(count == null ? 0 : count.intValue() + teachers.size());
|
|
|
e.setId("mg" + e.getId());
|
|
|
});
|
|
|
} else {
|
|
@@ -432,11 +453,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
if (imGroupModels1 != null && imGroupModels1.size() > 0) {
|
|
|
Set<String> classGroupIds = imGroupModels1.stream().map(e -> e.getId()).collect(Collectors.toSet());
|
|
|
//获取班级老师总数map
|
|
|
- List<Map<Integer, Integer>> nums = classGroupDao.countTeacherNums(StringUtils.join(classGroupIds,","));
|
|
|
+ List<Map<Integer, Integer>> nums = classGroupDao.countTeacherNums(StringUtils.join(classGroupIds, ","));
|
|
|
Map<Integer, Integer> numsMap = MapUtil.convertMybatisMap(nums);
|
|
|
imGroupModels1.forEach(e -> {
|
|
|
Integer num = numsMap.get(e.getId());
|
|
|
- e.setCount(num == null?0:num + e.getCount());
|
|
|
+ e.setCount(num == null ? 0 : num + e.getCount());
|
|
|
e.setId("cg" + e.getId());
|
|
|
});
|
|
|
imGroupModels.addAll(imGroupModels1);
|
|
@@ -513,15 +534,15 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void addMusicGroupTeam(Integer teacherId, String musicGroupId,Integer improventClassesNum) throws Exception {
|
|
|
+ public void addMusicGroupTeam(Integer teacherId, String musicGroupId, Integer improventClassesNum) throws Exception {
|
|
|
//所有学员都已经分配
|
|
|
List<StudentRegistration> students = studentRegistrationDao.getNoClassStuBySubjectId(musicGroupId, null);
|
|
|
- if(students != null && students.size() > 0){
|
|
|
+ if (students != null && students.size() > 0) {
|
|
|
throw new Exception("还有学员未分配班级");
|
|
|
}
|
|
|
//所有单技班都有合奏班
|
|
|
List<ClassGroup> classGroupList = classGroupDao.findNoClassSubjects(musicGroupId);
|
|
|
- if(classGroupList != null && classGroupList.size() > 0){
|
|
|
+ if (classGroupList != null && classGroupList.size() > 0) {
|
|
|
throw new Exception("还有单技班未分配合奏");
|
|
|
}
|
|
|
//设置教学主管
|
|
@@ -536,12 +557,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Override
|
|
|
public List<TeacherClassGroupDto> findTeacherClassGroups(String type) {
|
|
|
SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if(Objects.isNull(user)){
|
|
|
+ if (Objects.isNull(user)) {
|
|
|
throw new BizException("请登录");
|
|
|
}
|
|
|
|
|
|
List<TeacherClassGroupDto> teacherMusicClassGroup;
|
|
|
- switch (type){
|
|
|
+ switch (type) {
|
|
|
case "VIP":
|
|
|
teacherMusicClassGroup = classGroupDao.findTeacherVipClassGroup(user.getId().longValue());
|
|
|
break;
|
|
@@ -551,7 +572,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
default:
|
|
|
throw new BizException("请指定课程类型");
|
|
|
}
|
|
|
- if(CollectionUtils.isEmpty(teacherMusicClassGroup)){
|
|
|
+ if (CollectionUtils.isEmpty(teacherMusicClassGroup)) {
|
|
|
return teacherMusicClassGroup;
|
|
|
}
|
|
|
|
|
@@ -562,32 +583,50 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
List<Map<Long, Integer>> musicGroupIdAndNumList = musicGroupStudentFeeDao.countContinuosAbsenteeismStudentNum(musicGroupIds);
|
|
|
Map<Long, Integer> musicGroupIdAndNum = MapUtil.convertMybatisMap(musicGroupIdAndNumList);
|
|
|
|
|
|
+ List<Map<Long, Integer>> vipGroupOverCourses = vipGroupDao.countVipGroupOverCourse(musicGroupIds);
|
|
|
+ Map<Long,Integer> vipGroupOverCourseMaps = MapUtil.convertMybatisMap(vipGroupOverCourses);
|
|
|
+
|
|
|
teacherMusicClassGroup.forEach(teacherClassGroupDto -> {
|
|
|
|
|
|
- if(teacherClassGroupDto.getType()==ClassGroupTypeEnum.VIP){
|
|
|
+ if (teacherClassGroupDto.getType() == ClassGroupTypeEnum.VIP) {
|
|
|
String[] studentNums = classGroupStudentMapperDao.findStudentNumByClassGroupId(teacherClassGroupDto.getClassGroupId());
|
|
|
- teacherClassGroupDto.setStudentNames(StringUtils.join(studentNums,","));
|
|
|
- if(teacherClassGroupDto.getOffLineClassesNum()>0&&teacherClassGroupDto.getOffLineClassesNum()<=0){
|
|
|
+ teacherClassGroupDto.setStudentNames(StringUtils.join(studentNums, ","));
|
|
|
+ if (teacherClassGroupDto.getOffLineClassesNum() > 0 && teacherClassGroupDto.getOffLineClassesNum() <= 0) {
|
|
|
teacherClassGroupDto.setClassMode(1);
|
|
|
- }else if(teacherClassGroupDto.getOffLineClassesNum()>0&&teacherClassGroupDto.getOffLineClassesNum()>0){
|
|
|
+ } else if (teacherClassGroupDto.getOffLineClassesNum() > 0 && teacherClassGroupDto.getOffLineClassesNum() > 0) {
|
|
|
teacherClassGroupDto.setClassMode(3);
|
|
|
- }else if(teacherClassGroupDto.getOnlineClassesNum()<0&&teacherClassGroupDto.getOffLineClassesNum()>=0){
|
|
|
+ } else if (teacherClassGroupDto.getOnlineClassesNum() < 0 && teacherClassGroupDto.getOffLineClassesNum() >= 0) {
|
|
|
teacherClassGroupDto.setClassMode(2);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
teacherClassGroupDto.setClassMode(0);
|
|
|
}
|
|
|
+
|
|
|
+ Integer overCourses = vipGroupOverCourseMaps.get(teacherClassGroupDto.getMusicGroupId());
|
|
|
+ if(Objects.isNull(overCourses)){
|
|
|
+ overCourses=0;
|
|
|
+ }
|
|
|
+ Integer totalClassTimes=teacherClassGroupDto.getTotalClassTimes();
|
|
|
+ if(Objects.isNull(totalClassTimes)||totalClassTimes==0){
|
|
|
+ teacherClassGroupDto.setAvgClassTimesOfMonth(0.0);
|
|
|
+ }else{
|
|
|
+ BigDecimal overCoursesOfMonth=new BigDecimal(overCourses),allClassTimes=new BigDecimal(totalClassTimes);
|
|
|
+
|
|
|
+ Double monthConsumeRate=overCoursesOfMonth.divide(allClassTimes,1,BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ teacherClassGroupDto.setAvgClassTimesOfMonth(monthConsumeRate);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- String subjectIdList=teacherClassGroupDto.getSubjectIdList();
|
|
|
- if(StringUtils.isNotEmpty(subjectIdList)){
|
|
|
- if(Objects.nonNull(musicGroupIdAndNum)&&Objects.nonNull(musicGroupIdAndNum.get(teacherClassGroupDto.getMusicGroupId()))){
|
|
|
+ String subjectIdList = teacherClassGroupDto.getSubjectIdList();
|
|
|
+ if (StringUtils.isNotEmpty(subjectIdList)) {
|
|
|
+ if (Objects.nonNull(musicGroupIdAndNum) && Objects.nonNull(musicGroupIdAndNum.get(teacherClassGroupDto.getMusicGroupId()))) {
|
|
|
teacherClassGroupDto.setThreeClassNoAttendanceStudentNum(musicGroupIdAndNum.get(teacherClassGroupDto.getMusicGroupId()));
|
|
|
}
|
|
|
String[] subjectIds = subjectIdList.split(",");
|
|
|
- List<String> subjectNameList=new ArrayList<>();
|
|
|
+ List<String> subjectNameList = new ArrayList<>();
|
|
|
for (String subjectId : subjectIds) {
|
|
|
subjectNameList.add(subjectMapBySubjectIdsList.get(Integer.parseInt(subjectId)));
|
|
|
}
|
|
|
- teacherClassGroupDto.setSubjectNames(StringUtils.join(subjectNameList,","));
|
|
|
+ teacherClassGroupDto.setSubjectNames(StringUtils.join(subjectNameList, ","));
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -597,11 +636,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public boolean updateClassStudentNum(Long classGroupId, Integer num) {
|
|
|
- ClassGroup classGroup=classGroupDao.lockClassGroup(classGroupId);
|
|
|
- if(Objects.isNull(classGroup)){
|
|
|
+ ClassGroup classGroup = classGroupDao.lockClassGroup(classGroupId);
|
|
|
+ if (Objects.isNull(classGroup)) {
|
|
|
throw new BizException("班级不存在");
|
|
|
}
|
|
|
- classGroup.setStudentNum(classGroup.getStudentNum()+num);
|
|
|
+ classGroup.setStudentNum(classGroup.getStudentNum() + num);
|
|
|
classGroup.setUpdateTime(new Date());
|
|
|
|
|
|
classGroupDao.update(classGroup);
|
|
@@ -611,34 +650,34 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
@Override
|
|
|
public TeacherClassHeadInfo findTeacherClassGroupInfo(Long classGroupId) {
|
|
|
- if(Objects.isNull(classGroupId)){
|
|
|
+ if (Objects.isNull(classGroupId)) {
|
|
|
throw new BizException("请指定班级");
|
|
|
}
|
|
|
|
|
|
ClassGroup classGroup = classGroupDao.get(classGroupId.intValue());
|
|
|
|
|
|
- if(Objects.isNull(classGroup)){
|
|
|
+ if (Objects.isNull(classGroup)) {
|
|
|
throw new BizException("未找到该班级");
|
|
|
}
|
|
|
|
|
|
- TeacherClassHeadInfo teacherClassHeadInfo=new TeacherClassHeadInfo();
|
|
|
+ TeacherClassHeadInfo teacherClassHeadInfo = new TeacherClassHeadInfo();
|
|
|
teacherClassHeadInfo.setStudentNum(classGroup.getStudentNum());
|
|
|
teacherClassHeadInfo.setCurrentClassTimes(classGroup.getCurrentClassTimes());
|
|
|
teacherClassHeadInfo.setTotalClassTimes(classGroup.getTotalClassTimes());
|
|
|
ClassGroupTeacherMapper bishopTeacher = classGroupTeacherMapperDao.findByClassGroupAndRole(classGroupId, TeachTypeEnum.BISHOP);
|
|
|
- if(Objects.nonNull(bishopTeacher)){
|
|
|
+ if (Objects.nonNull(bishopTeacher)) {
|
|
|
teacherClassHeadInfo.setBishopTeacherId(bishopTeacher.getId());
|
|
|
teacherClassHeadInfo.setBishopTeacher(bishopTeacher.getUserName());
|
|
|
}
|
|
|
ClassGroupTeacherMapper teachingTeacher = classGroupTeacherMapperDao.findByClassGroupAndRole(classGroupId, TeachTypeEnum.TEACHING);
|
|
|
- if(Objects.nonNull(teachingTeacher)){
|
|
|
+ if (Objects.nonNull(teachingTeacher)) {
|
|
|
teacherClassHeadInfo.setTeachingTeacherId(teachingTeacher.getId());
|
|
|
teacherClassHeadInfo.setTeachingTeacher(teachingTeacher.getUserName());
|
|
|
}
|
|
|
|
|
|
- if(classGroup.getType()==ClassGroupTypeEnum.VIP){
|
|
|
+ if (classGroup.getType() == ClassGroupTypeEnum.VIP) {
|
|
|
String[] studentNums = classGroupStudentMapperDao.findStudentNumByClassGroupId(classGroupId);
|
|
|
- teacherClassHeadInfo.setStudentNames(StringUtils.join(studentNums,","));
|
|
|
+ teacherClassHeadInfo.setStudentNames(StringUtils.join(studentNums, ","));
|
|
|
}
|
|
|
|
|
|
return teacherClassHeadInfo;
|
|
@@ -665,9 +704,61 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
@Override
|
|
|
public List<StudentAttendanceViewDto> findAttendanceStudentByCourse(Long courseScheduleId) {
|
|
|
- if(Objects.isNull(courseScheduleId)){
|
|
|
+ if (Objects.isNull(courseScheduleId)) {
|
|
|
throw new BizException("请指定课程编号");
|
|
|
}
|
|
|
return classGroupStudentMapperDao.findStudentByCourse(courseScheduleId);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public ClassGroup classGroupAdjust(ClassGroupAdjustDto classGroupAdjustDto) throws Exception {
|
|
|
+ Date date = new Date();
|
|
|
+
|
|
|
+ List<ClassGroupStudentMapperDto> classGroupStudentMapperDtoList = classGroupAdjustDto.getClassGroupStudentMapperDtoList();
|
|
|
+ String subject_id_list_ = "";
|
|
|
+ for (ClassGroupStudentMapper classGroupStudentMapperDto : classGroupStudentMapperDtoList) {
|
|
|
+ //1、永久调整,删除学生班级关联关系
|
|
|
+ if (classGroupAdjustDto.getType().equals(YesOrNoEnum.YES)) {
|
|
|
+ ClassGroupStudentMapper classStudentMapper = classGroupStudentMapperDao.query(classGroupStudentMapperDto.getClassGroupId(), classGroupStudentMapperDto.getUserId());
|
|
|
+ classStudentMapper.setStatus(ClassGroupStudentStatusEnum.QUIT);
|
|
|
+ classGroupStudentMapperDao.update(classStudentMapper);
|
|
|
+ }
|
|
|
+ subject_id_list_ += classGroupStudentMapperDto.getUserId() + ",";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ subject_id_list_ = subject_id_list_.substring(0, subject_id_list_.length() - 1);
|
|
|
+
|
|
|
+ //2、新建班级
|
|
|
+ ClassGroup classGroup = new ClassGroup();
|
|
|
+ classGroup.setMusicGroupId(classGroupAdjustDto.getMusicGroupId());
|
|
|
+ classGroup.setSubjectIdList(subject_id_list_);
|
|
|
+ classGroup.setName(classGroupAdjustDto.getClassGroupName());
|
|
|
+ classGroup.setExpectStudentNum(classGroupStudentMapperDtoList.size());
|
|
|
+ classGroup.setStudentNum(classGroupStudentMapperDtoList.size());
|
|
|
+ classGroup.setType(ClassGroupTypeEnum.NORMAL);
|
|
|
+ classGroup.setDelFlag(YesOrNoEnum.NO);
|
|
|
+ classGroup.setCreateTime(date);
|
|
|
+ classGroup.setUpdateTime(date);
|
|
|
+ classGroupDao.insert(classGroup);
|
|
|
+
|
|
|
+ //3、将学生加入新班级(学生注册表,关联表)
|
|
|
+ List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
|
|
|
+ for (ClassGroupStudentMapperDto classGroupStudentMapperDto : classGroupStudentMapperDtoList) {
|
|
|
+ classGroupStudentMapperDto.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupStudentMapperList.add(classGroupStudentMapperDto);
|
|
|
+ }
|
|
|
+ classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
|
|
|
+
|
|
|
+
|
|
|
+ //4、将老师加入关联关系
|
|
|
+ List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroupAdjustDto.getClassGroupTeacherMapperList();
|
|
|
+ for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
|
|
|
+ classGroupTeacherMapper.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupTeacherMapper.setMusicGroupId(classGroupAdjustDto.getMusicGroupId());
|
|
|
+ }
|
|
|
+ classGroupTeacherMapperDao.classGroupTeachersInsert(classGroupTeacherMapperList);
|
|
|
+ return classGroup;
|
|
|
+ }
|
|
|
}
|