|
@@ -131,7 +131,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);
|
|
@@ -313,8 +313,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
Float monthConsumeRate=overCoursesOfMonth.divide(overCoursesOfMonth,2,BigDecimal.ROUND_HALF_UP).floatValue();
|
|
|
vipGroup.setMonthAvg(monthConsumeRate);
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
+
|
|
|
}
|
|
|
if (count == 0) {
|
|
|
dataList = new ArrayList<>();
|
|
@@ -344,7 +344,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) {
|
|
|
//班级的教师列表
|
|
@@ -354,7 +354,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);
|
|
|
}
|
|
@@ -376,19 +376,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 {
|
|
@@ -430,7 +430,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 {
|
|
@@ -440,11 +440,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);
|
|
@@ -521,15 +521,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("还有单技班未分配合奏");
|
|
|
}
|
|
|
//设置教学主管
|
|
@@ -544,12 +544,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;
|
|
@@ -559,7 +559,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
default:
|
|
|
throw new BizException("请指定课程类型");
|
|
|
}
|
|
|
- if(CollectionUtils.isEmpty(teacherMusicClassGroup)){
|
|
|
+ if (CollectionUtils.isEmpty(teacherMusicClassGroup)) {
|
|
|
return teacherMusicClassGroup;
|
|
|
}
|
|
|
|
|
@@ -575,16 +575,16 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
|
|
|
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);
|
|
|
}
|
|
|
|
|
@@ -603,17 +603,17 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- 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, ","));
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -623,11 +623,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);
|
|
@@ -637,34 +637,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;
|
|
@@ -691,9 +691,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;
|
|
|
+ }
|
|
|
}
|