|
@@ -4,10 +4,7 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.*;
|
|
|
-import com.ym.mec.biz.dal.entity.Student;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentRegistration;
|
|
|
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
|
|
|
-import com.ym.mec.biz.dal.entity.Teacher;
|
|
|
+import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.YesOrNoEnum;
|
|
|
import com.ym.mec.biz.dal.page.*;
|
|
|
import com.ym.mec.biz.service.StudentManageService;
|
|
@@ -67,6 +64,8 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
private StudentDao studentDao;
|
|
|
@Autowired
|
|
|
private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupQuitDao musicGroupQuitDao;
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
|
|
@@ -78,35 +77,35 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
params.put("offset", pageInfo.getOffset());
|
|
|
int count = 0;
|
|
|
Set<Integer> paramUserIds = null;
|
|
|
- if(hasPracticeCourse != null){
|
|
|
+ if (hasPracticeCourse != null) {
|
|
|
//是否有陪练课
|
|
|
- if(hasPracticeCourse){
|
|
|
+ if (hasPracticeCourse) {
|
|
|
paramUserIds = studentManageDao.queryHasPracticeCourse(params);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
paramUserIds = studentManageDao.queryNotPracticeCourse(params);
|
|
|
}
|
|
|
- if(paramUserIds.size() == 0){
|
|
|
+ if (paramUserIds.size() == 0) {
|
|
|
return pageInfo;
|
|
|
}
|
|
|
- params.put("userIds",paramUserIds);
|
|
|
+ params.put("userIds", paramUserIds);
|
|
|
}
|
|
|
- if(hasCourse != null){
|
|
|
- if(hasCourse){
|
|
|
+ if (hasCourse != null) {
|
|
|
+ if (hasCourse) {
|
|
|
paramUserIds = studentManageDao.queryHasCourse(params);
|
|
|
count = studentManageDao.countHasCourse(params);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
paramUserIds = studentManageDao.queryNotCourse(params);
|
|
|
count = studentManageDao.countNotCourse(params);
|
|
|
}
|
|
|
- if(paramUserIds.size() == 0){
|
|
|
+ if (paramUserIds.size() == 0) {
|
|
|
return pageInfo;
|
|
|
}
|
|
|
params.remove("offset");
|
|
|
- params.put("userIds",paramUserIds);
|
|
|
- }else {
|
|
|
+ params.put("userIds", paramUserIds);
|
|
|
+ } else {
|
|
|
count = studentManageDao.countStudentByOrganId(params);
|
|
|
}
|
|
|
- if(queryInfo.getIsExport() && count > 50000){
|
|
|
+ if (queryInfo.getIsExport() && count > 50000) {
|
|
|
throw new BizException("数据集太大,不能导出.最大数据集不能超过50000");
|
|
|
}
|
|
|
List<StudentManageListDto> dataList = null;
|
|
@@ -118,21 +117,21 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
List<SysUserCashAccount> byUserIds = sysUserCashAccountDao.findByUserIds(userIds);
|
|
|
Map<Integer, SysUserCashAccount> collect = byUserIds.stream()
|
|
|
.collect(Collectors.toMap(SysUserCashAccount::getUserId, sysUserCashAccount -> sysUserCashAccount));
|
|
|
- Map<Integer,Integer> hasPracticeCourseMap = MapUtil.convertIntegerMap(studentManageDao.getHasPracticeCourse(userIds));
|
|
|
+ Map<Integer, Integer> hasPracticeCourseMap = MapUtil.convertIntegerMap(studentManageDao.getHasPracticeCourse(userIds));
|
|
|
//获取用户分部
|
|
|
- Map<Integer,String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMapList(organIds));
|
|
|
+ Map<Integer, String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMapList(organIds));
|
|
|
//获取所在乐团
|
|
|
- Map<Integer,String> musicGroupNames = MapUtil.convertMybatisMap(musicGroupDao.queryUserMusicNames(userIds));
|
|
|
+ Map<Integer, String> musicGroupNames = MapUtil.convertMybatisMap(musicGroupDao.queryUserMusicNames(userIds));
|
|
|
//获取所在vip
|
|
|
- Map<Integer,String> vipGroupNames = MapUtil.convertMybatisMap(vipGroupDao.queryUserVipNames(userIds));
|
|
|
+ Map<Integer, String> vipGroupNames = MapUtil.convertMybatisMap(vipGroupDao.queryUserVipNames(userIds));
|
|
|
//获取所在乐团状态
|
|
|
- Map<Integer,String> musicGroupStatus = MapUtil.convertMybatisMap(musicGroupDao.queryUserMusicStatus(userIds));
|
|
|
+ Map<Integer, String> musicGroupStatus = MapUtil.convertMybatisMap(musicGroupDao.queryUserMusicStatus(userIds));
|
|
|
//获取所在vip状态
|
|
|
- Map<Integer,String> vipGroupStatus = MapUtil.convertMybatisMap(vipGroupDao.queryUserVipStatus(userIds));
|
|
|
+ Map<Integer, String> vipGroupStatus = MapUtil.convertMybatisMap(vipGroupDao.queryUserVipStatus(userIds));
|
|
|
//获取所在声部
|
|
|
- Map<Integer,String> subjectNames = MapUtil.convertMybatisMap(studentManageDao.querySubjectNames(userIds));
|
|
|
+ Map<Integer, String> subjectNames = MapUtil.convertMybatisMap(studentManageDao.querySubjectNames(userIds));
|
|
|
//学员是否有课
|
|
|
- Map<Integer,Integer> hasCourseMap = MapUtil.convertMybatisMap(studentManageDao.queryHasCourseMap(userIds));
|
|
|
+ Map<Integer, Integer> hasCourseMap = MapUtil.convertMybatisMap(studentManageDao.queryHasCourseMap(userIds));
|
|
|
dataList.forEach(e -> {
|
|
|
e.setOrganName(organNames.get(e.getOrganId()));
|
|
|
e.setMusicGroupName(musicGroupNames.get(e.getUserId().longValue()));
|
|
@@ -140,7 +139,7 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
e.setSubjectName(subjectNames.get(e.getUserId().longValue()));
|
|
|
e.setMusicGroupStatus(musicGroupStatus.get(e.getUserId().longValue()));
|
|
|
e.setVipGroupStatus(vipGroupStatus.get(e.getUserId()));
|
|
|
- e.setHasCourse(hasCourseMap.get(e.getUserId())==null?YesOrNoEnum.NO:YesOrNoEnum.YES);
|
|
|
+ e.setHasCourse(hasCourseMap.get(e.getUserId()) == null ? YesOrNoEnum.NO : YesOrNoEnum.YES);
|
|
|
/*if(hasCourse == null){
|
|
|
Integer course = studentManageDao.getHasCourse(e.getUserId());
|
|
|
e.setHasCourse(course==null?YesOrNoEnum.NO:course==0?YesOrNoEnum.NO:YesOrNoEnum.YES);
|
|
@@ -151,8 +150,8 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
e.setHasCourse(YesOrNoEnum.NO);
|
|
|
}
|
|
|
}*/
|
|
|
- e.setHasPracticeCourse(hasPracticeCourseMap.get(e.getUserId()) == null?YesOrNoEnum.NO:YesOrNoEnum.YES);
|
|
|
- if(collect.get(e.getUserId()) != null){
|
|
|
+ e.setHasPracticeCourse(hasPracticeCourseMap.get(e.getUserId()) == null ? YesOrNoEnum.NO : YesOrNoEnum.YES);
|
|
|
+ if (collect.get(e.getUserId()) != null) {
|
|
|
e.setCourseBalance(collect.get(e.getUserId()).getCourseBalance());
|
|
|
}
|
|
|
});
|
|
@@ -171,19 +170,19 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
|
|
|
Teacher teacher = teacherDao.get(queryInfo.getTeacherId());
|
|
|
- if(Objects.isNull(teacher)){
|
|
|
+ if (Objects.isNull(teacher)) {
|
|
|
return null;
|
|
|
}
|
|
|
- List<Integer> organIds=new ArrayList<>();
|
|
|
- if(Objects.nonNull(teacher.getTeacherOrganId())){
|
|
|
+ List<Integer> organIds = new ArrayList<>();
|
|
|
+ if (Objects.nonNull(teacher.getTeacherOrganId())) {
|
|
|
organIds.add(teacher.getTeacherOrganId());
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(teacher.getFlowOrganRange())){
|
|
|
+ if (StringUtils.isNotBlank(teacher.getFlowOrganRange())) {
|
|
|
List<Integer> flowOrganRangeIds = Arrays.stream(teacher.getFlowOrganRange().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
|
|
|
organIds.addAll(flowOrganRangeIds);
|
|
|
}
|
|
|
|
|
|
- if(CollectionUtils.isEmpty(organIds)){
|
|
|
+ if (CollectionUtils.isEmpty(organIds)) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -212,11 +211,20 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
public List<StudentManageBaseInfoOfMusicGroupDto> findStudentMusicGroupsByUserId(Integer userId) {
|
|
|
List<StudentManageBaseInfoOfMusicGroupDto> musicGroups = studentManageDao.findStudentMusicGroupsByUserId(userId);
|
|
|
//获取学员报名时所选乐器
|
|
|
- if(musicGroups != null && musicGroups.size() > 0){
|
|
|
- for (StudentManageBaseInfoOfMusicGroupDto e:musicGroups) {
|
|
|
- e.setUserGoodsDtos(studentPaymentOrderDao.findGoodsIds(e.getMusicGroupId(),e.getUserId()));
|
|
|
+ if (musicGroups.size() > 0) {
|
|
|
+ for (StudentManageBaseInfoOfMusicGroupDto e : musicGroups) {
|
|
|
+ e.setUserGoodsDtos(studentPaymentOrderDao.findGoodsIds(e.getMusicGroupId(), e.getUserId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<MusicGroupQuit> userMusicQuits = musicGroupQuitDao.getUserMusicQuit(userId);
|
|
|
+ for (StudentManageBaseInfoOfMusicGroupDto musicGroup : musicGroups) {
|
|
|
+ for (MusicGroupQuit userMusicQuit : userMusicQuits) {
|
|
|
+ if (musicGroup.getMusicGroupId().equals(userMusicQuit.getMusicGroupId())) {
|
|
|
+ musicGroup.setQuitMusicGroupDate(userMusicQuit.getQuitDate());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return musicGroups;
|
|
|
}
|
|
|
|
|
@@ -313,7 +321,7 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
|
|
|
List<MusicGroupStudentsDto> dataList = null;
|
|
|
int count = studentManageDao.countMusicGroupStudent(params);
|
|
|
- if(queryInfo.getIsExport() && count > 50000){
|
|
|
+ if (queryInfo.getIsExport() && count > 50000) {
|
|
|
throw new BizException("数据集太大,不能导出.最大数据集不能超过50000");
|
|
|
}
|
|
|
if (count > 0) {
|
|
@@ -334,13 +342,13 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
|
|
|
@Override
|
|
|
public Object musicGroupStudentsSum(String musicGroupId) {
|
|
|
- Map<String,Integer> resultMap = new HashMap<>(3);
|
|
|
+ Map<String, Integer> resultMap = new HashMap<>(3);
|
|
|
//乐团在读人数
|
|
|
- resultMap.put("studying",studentManageDao.countStudyNum(musicGroupId));
|
|
|
+ resultMap.put("studying", studentManageDao.countStudyNum(musicGroupId));
|
|
|
//退团人数
|
|
|
- resultMap.put("quit",studentManageDao.countQuitNum(musicGroupId));
|
|
|
+ resultMap.put("quit", studentManageDao.countQuitNum(musicGroupId));
|
|
|
//新增人数
|
|
|
- resultMap.put("add",studentManageDao.countAddNum(musicGroupId));
|
|
|
+ resultMap.put("add", studentManageDao.countAddNum(musicGroupId));
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
@@ -366,7 +374,7 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
|
|
|
@Override
|
|
|
public List<ConditionDto> queryStudentClassGroup(String musicGroupId, Integer teacherId) {
|
|
|
- return classGroupDao.queryStudentClassGroup(musicGroupId,teacherId);
|
|
|
+ return classGroupDao.queryStudentClassGroup(musicGroupId, teacherId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -396,7 +404,7 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
teacherIds.addAll(dataList.stream().map(e -> e.getEduTeacherId()).collect(Collectors.toSet()));
|
|
|
List<Map<Integer, String>> maps = teacherDao.queryNameByIds(StringUtils.join(teacherIds, ","));
|
|
|
Map<Integer, String> teacherNameMap = MapUtil.convertMybatisMap(maps);
|
|
|
- dataList.forEach(e->{
|
|
|
+ dataList.forEach(e -> {
|
|
|
e.setTeacherName(teacherNameMap.get(e.getTeacherId()));
|
|
|
e.setEduTeacherName(teacherNameMap.get(e.getEduTeacherId()));
|
|
|
});
|
|
@@ -411,14 +419,14 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public int studentRegister(SysUser sysUser) {
|
|
|
- if(sysUser == null || StringUtils.isEmpty(sysUser.getPhone())){
|
|
|
+ if (sysUser == null || StringUtils.isEmpty(sysUser.getPhone())) {
|
|
|
throw new BizException("参数校验失败");
|
|
|
}
|
|
|
SysUser sysUser1 = sysUserFeignService.queryUserByMobile(sysUser.getPhone());
|
|
|
- if(sysUser1 != null){
|
|
|
- if(sysUser1.getUserType().contains("STUDENT")){
|
|
|
+ if (sysUser1 != null) {
|
|
|
+ if (sysUser1.getUserType().contains("STUDENT")) {
|
|
|
throw new BizException("手机号已被占用");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sysUser.setId(sysUser1.getId());
|
|
|
sysUser.setUserType(sysUser1.getUserType() + ",STUDENT");
|
|
|
teacherDao.updateUser(sysUser);
|
|
@@ -444,21 +452,21 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public int studentUpdate(SysUser sysUser) {
|
|
|
Integer userId = sysUser.getId();
|
|
|
- if(userId == null || StringUtils.isEmpty(sysUser.getPhone())){
|
|
|
+ if (userId == null || StringUtils.isEmpty(sysUser.getPhone())) {
|
|
|
throw new BizException("参数校验失败");
|
|
|
}
|
|
|
SysUser sysUser1 = sysUserFeignService.queryUserByMobile(sysUser.getPhone());
|
|
|
- if(sysUser1 != null && !userId.equals(sysUser1.getId())){
|
|
|
+ if (sysUser1 != null && !userId.equals(sysUser1.getId())) {
|
|
|
throw new BizException("手机号已被占用");
|
|
|
}
|
|
|
teacherDao.updateUser(sysUser);
|
|
|
Student student = new Student(userId, studentRegistrationDao.getSubjectIds(userId));
|
|
|
student.setOperatingTag(sysUser.getOperatingTag());
|
|
|
- student.setOperatingTempTag(0);
|
|
|
- student.setServiceTag(sysUser.getServiceTag()==0?2:1);
|
|
|
+ student.setOperatingTempTag(0);
|
|
|
+ student.setServiceTag(sysUser.getServiceTag() == 0 ? 2 : 1);
|
|
|
student.setTeacherId(sysUser.getTeacherId());
|
|
|
studentService.upSet(student);
|
|
|
- if(new Integer(2).equals(student.getServiceTag())){
|
|
|
+ if (new Integer(2).equals(student.getServiceTag())) {
|
|
|
studentExtracurricularExercisesSituationDao.deleteByStudent(sysUser.getId());
|
|
|
}
|
|
|
return userId;
|
|
@@ -493,17 +501,17 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
public Map<String, Integer> sumStudentAttendance(Integer courseScheduleId) {
|
|
|
Map<String, Integer> sum = new HashMap<>(5);
|
|
|
Integer studentNum = scheduleStudentPaymentDao.countStudentNum(courseScheduleId);
|
|
|
- sum.put("studentNum",studentNum);
|
|
|
+ sum.put("studentNum", studentNum);
|
|
|
Integer signInNum = studentManageDao.countStudentSignInNum(courseScheduleId, "NORMAL");
|
|
|
- sum.put("signInNum",signInNum);
|
|
|
+ sum.put("signInNum", signInNum);
|
|
|
Integer leaveNum = studentManageDao.countStudentSignInNum(courseScheduleId, "LEAVE");
|
|
|
- sum.put("leaveNum",leaveNum);
|
|
|
- studentNum = studentNum==null?0:studentNum;
|
|
|
- signInNum = signInNum==null?0:signInNum;
|
|
|
- leaveNum = leaveNum==null?0:leaveNum;
|
|
|
- sum.put("truantNum",studentNum-signInNum-leaveNum);
|
|
|
- sum.put("homeworkNum",studentManageDao.countHomeworkNum(courseScheduleId));
|
|
|
- sum.put("repliedNum",studentManageDao.countRepliedNum(courseScheduleId));
|
|
|
+ sum.put("leaveNum", leaveNum);
|
|
|
+ studentNum = studentNum == null ? 0 : studentNum;
|
|
|
+ signInNum = signInNum == null ? 0 : signInNum;
|
|
|
+ leaveNum = leaveNum == null ? 0 : leaveNum;
|
|
|
+ sum.put("truantNum", studentNum - signInNum - leaveNum);
|
|
|
+ sum.put("homeworkNum", studentManageDao.countHomeworkNum(courseScheduleId));
|
|
|
+ sum.put("repliedNum", studentManageDao.countRepliedNum(courseScheduleId));
|
|
|
return sum;
|
|
|
}
|
|
|
|
|
@@ -517,7 +525,7 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
|
|
|
List<Student4operating> dataList = new ArrayList<>();
|
|
|
|
|
|
- if(count > 0){
|
|
|
+ if (count > 0) {
|
|
|
pageInfo.setTotal(count);
|
|
|
dataList = studentDao.getOperatingStudents(params);
|
|
|
}
|
|
@@ -527,6 +535,6 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
|
|
|
@Override
|
|
|
public List<BasicUserDto> queryCanAddStudent(String musicGroupId, Long musicGroupPaymentCalenderId) {
|
|
|
- return studentManageDao.queryCanAddStudent(musicGroupId,musicGroupPaymentCalenderId);
|
|
|
+ return studentManageDao.queryCanAddStudent(musicGroupId, musicGroupPaymentCalenderId);
|
|
|
}
|
|
|
}
|