|
@@ -1,9 +1,6 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
-import com.ym.mec.biz.dal.dao.ClassGroupDao;
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
|
|
|
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
|
|
|
-import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.*;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
@@ -17,13 +14,11 @@ import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
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.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
import java.time.Instant;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
@@ -42,7 +37,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Autowired
|
|
|
private ClassGroupRelationService classGroupRelationService;
|
|
|
@Autowired
|
|
|
- private ClassGroupStudentMapperService classGroupStudentMapperService;
|
|
|
+ private ClassGroupStudentMapperDao classGroupStudentMapperDao;
|
|
|
+ @Autowired
|
|
|
+ private ClassGroupRelationDao classGroupRelationDao;
|
|
|
@Autowired
|
|
|
private ClassGroupTeacherMapperService classGroupTeacherMapperService;
|
|
|
@Autowired
|
|
@@ -52,8 +49,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Autowired
|
|
|
private StudentRegistrationService studentRegistrationService;
|
|
|
@Autowired
|
|
|
- private ClassGroupTeacherSalaryService classGroupTeacherSalaryService;
|
|
|
- @Autowired
|
|
|
private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
|
|
|
|
|
|
@Override
|
|
@@ -98,8 +93,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public ClassGroup addClassGroup(ClassGroup classGroup) throws Exception {
|
|
|
- Date date;
|
|
|
- date = new Date();
|
|
|
+ Date date = new Date();
|
|
|
classGroup.setCreateTime(date);
|
|
|
classGroup.setUpdateTime(date);
|
|
|
classGroup.setType(ClassGroupTypeEnum.NORMAL);
|
|
@@ -107,25 +101,25 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
String[] userIdArr = userIds.split(",");
|
|
|
|
|
|
classGroup.setStudentNum(userIdArr.length);
|
|
|
- Long classGroupId = this.insert(classGroup);
|
|
|
+ insert(classGroup);
|
|
|
|
|
|
//2、插入班级学生关联关系
|
|
|
List<ClassGroupStudentMapper> classGroupStudentList = new ArrayList<>();
|
|
|
for (String userId : userIdArr) {
|
|
|
ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
- classGroupStudentMapper.setClassGroupId(classGroupId.intValue());
|
|
|
- classGroupStudentMapper.setUserId(Integer.getInteger(userId));
|
|
|
+ classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupStudentMapper.setUserId(Integer.parseInt(userId));
|
|
|
classGroupStudentMapper.setCreateTime(date);
|
|
|
classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
classGroupStudentList.add(classGroupStudentMapper);
|
|
|
StudentRegistration studentRegistration = new StudentRegistration();
|
|
|
- studentRegistration.setClassGroupId(classGroupId.intValue());
|
|
|
+ studentRegistration.setClassGroupId(classGroup.getId());
|
|
|
studentRegistration.setUserId(Integer.getInteger(userId));
|
|
|
studentRegistration.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
studentRegistrationService.updateByUserIdAndMusicGroupId(studentRegistration);
|
|
|
}
|
|
|
|
|
|
- classGroupStudentMapperService.classGroupStudentsInsert(classGroupStudentList);
|
|
|
+ classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentList);
|
|
|
|
|
|
return classGroup;
|
|
|
}
|
|
@@ -152,13 +146,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
classGroup.setType(ClassGroupTypeEnum.MIX);
|
|
|
classGroup.setCreateTime(date);
|
|
|
classGroup.setUpdateTime(date);
|
|
|
- Long classGroupId = this.insert(classGroup);
|
|
|
+ insert(classGroup);
|
|
|
|
|
|
//2、插入班级关联关系
|
|
|
List<ClassGroupRelation> classGroupRelationList = new ArrayList<>();
|
|
|
for (ClassGroup cGroup : classGroups) {
|
|
|
ClassGroupRelation classGroupRelation = new ClassGroupRelation();
|
|
|
- classGroupRelation.setClassGroupId(classGroupId.intValue());
|
|
|
+ classGroupRelation.setClassGroupId(classGroup.getId());
|
|
|
classGroupRelation.setSubClassGroupId(cGroup.getId());
|
|
|
classGroupRelation.setCreateTime(date);
|
|
|
classGroupRelationList.add(classGroupRelation);
|
|
@@ -182,12 +176,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
highClassGroup.setCreateTime(date);
|
|
|
highClassGroup.setUpdateTime(date);
|
|
|
highClassGroup.setType(ClassGroupTypeEnum.HIGH);
|
|
|
- Long classGroupId = this.insert(highClassGroup);
|
|
|
+ insert(highClassGroup);
|
|
|
|
|
|
//2、插入班级关联老师
|
|
|
ClassGroupTeacherMapper classGroupTeacherMapper = new ClassGroupTeacherMapper();
|
|
|
classGroupTeacherMapper.setMusicGroupId(highClassGroup.getUserId());
|
|
|
- classGroupTeacherMapper.setClassGroupId(classGroupId.intValue());
|
|
|
+ classGroupTeacherMapper.setClassGroupId(highClassGroup.getId());
|
|
|
classGroupTeacherMapper.setTeacherRole(TeachTypeEnum.BISHOP);
|
|
|
classGroupTeacherMapper.setUserId(highClassGroup.getUserId());
|
|
|
classGroupTeacherMapper.setCreateTime(date);
|
|
@@ -207,7 +201,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
Instant instant = now.atZone(ZoneId.systemDefault()).toInstant();
|
|
|
Date classDate = Date.from(instant);
|
|
|
|
|
|
- courseSchedule.setClassGroupId(classGroupId.intValue());
|
|
|
+ courseSchedule.setClassGroupId(highClassGroup.getUserId());
|
|
|
courseSchedule.setStatus(CourseStatusEnum.NOT_START);
|
|
|
courseSchedule.setClassDate(classDate);
|
|
|
courseSchedule.setStartClassTime(highClassGroup.getStartClassTime());
|
|
@@ -420,7 +414,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
classGroupStudentMapper.setUserId(userId);
|
|
|
classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
classGroupStudentMapper.setCreateTime(date);
|
|
|
- classGroupStudentMapperService.insert(classGroupStudentMapper);
|
|
|
+ classGroupStudentMapperDao.insert(classGroupStudentMapper);
|
|
|
return classGroup;
|
|
|
}
|
|
|
|
|
@@ -428,4 +422,22 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
public List<ClassGroup> findNoClassSubjects(String musicGroupId) {
|
|
|
return classGroupDao.findNoClassSubjects(musicGroupId);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void delSingle(Integer classGroupId) {
|
|
|
+ //删除学员班级关联关系
|
|
|
+ classGroupStudentMapperDao.deleteByClassId(classGroupId);
|
|
|
+ //删除班级
|
|
|
+ classGroupDao.delete(classGroupId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void delMix(Integer classGroupId) {
|
|
|
+ //删除班级关系
|
|
|
+ classGroupRelationDao.deleteByClassId(classGroupId);
|
|
|
+ //删除合奏班
|
|
|
+ classGroupDao.delete(classGroupId);
|
|
|
+ }
|
|
|
}
|