|
@@ -31,7 +31,6 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -85,6 +84,8 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
@Autowired
|
|
|
private EmployeeDao employeeDao;
|
|
|
@Autowired
|
|
|
+ private StudentTeacherMapperDao studentTeacherMapperDao;
|
|
|
+ @Autowired
|
|
|
private OrganizationService organizationService;
|
|
|
@Autowired
|
|
|
private SysUserCashAccountDao sysUserCashAccountDao;
|
|
@@ -605,135 +606,128 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public StatDto exportOrganStudentData(StudentQueryInfo queryInfo) {
|
|
|
- PageInfo<EduOrganStudentListExportDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
- Map<String, Object> params = new HashMap<String, Object>();
|
|
|
- MapUtil.populateMap(params, queryInfo);
|
|
|
+ public int countOrganStudentData(Map<String, Object> params) {
|
|
|
+ return studentDao.countCloudStudyStudentData(params);
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public List<EduOrganStudentListExportDto> exportOrganStudentData(Map<String, Object> params) {
|
|
|
+ List<EduOrganStudentListDto> dataList1 = studentDao.queryCloudStudyStudentData(params);
|
|
|
+ List<Integer> studentIds = dataList1.stream().map(EduOrganStudentListDto::getStudentId).collect(Collectors.toList());
|
|
|
+ Set<Integer> organIds = dataList1.stream().map(EduOrganStudentListDto::getOrganId).collect(Collectors.toSet());
|
|
|
+ Map<Integer,String> organMap = MapUtil.convertMybatisMap(organizationDao.findOrganNameMapList(organIds));
|
|
|
|
|
|
- List<EduOrganStudentListDto> dataList1 = new ArrayList<>();
|
|
|
- List<EduOrganStudentListExportDto> dataList = new ArrayList<>();
|
|
|
- int count = studentDao.countCloudStudyStudentData(params);
|
|
|
- if (count > 0) {
|
|
|
- pageInfo.setTotal(count);
|
|
|
- params.put("offset", pageInfo.getOffset());
|
|
|
- dataList1 = studentDao.queryCloudStudyStudentData(params);
|
|
|
- List<Integer> studentIds = dataList1.stream().map(EduOrganStudentListDto::getStudentId).collect(Collectors.toList());
|
|
|
- Set<Integer> organIds = dataList1.stream().map(EduOrganStudentListDto::getOrganId).collect(Collectors.toSet());
|
|
|
- Map<Integer,String> organMap = MapUtil.convertMybatisMap(organizationDao.findOrganNameMapList(organIds));
|
|
|
+ List<Map<Integer, String>> studentGroupNamesMapList = studentRegistrationDao.queryStudentMusicGroupNamesMap(studentIds);
|
|
|
+ Map<Integer, String> studentGroupNamesMap = MapUtil.convertIntegerMap(studentGroupNamesMapList);
|
|
|
|
|
|
- List<Map<Integer, String>> studentGroupNamesMapList = studentRegistrationDao.queryStudentMusicGroupNamesMap(studentIds);
|
|
|
- Map<Integer, String> studentGroupNamesMap = MapUtil.convertIntegerMap(studentGroupNamesMapList);
|
|
|
+ List<Map<Integer, String>> studentGroupEduMapList = studentRegistrationDao.queryStudentMusicGroupEduMap(studentIds);
|
|
|
+ Map<Integer, String> studentGroupEduMap = MapUtil.convertIntegerMap(studentGroupEduMapList);
|
|
|
|
|
|
- List<Map<Integer, String>> studentGroupEduMapList = studentRegistrationDao.queryStudentMusicGroupEduMap(studentIds);
|
|
|
- Map<Integer, String> studentGroupEduMap = MapUtil.convertIntegerMap(studentGroupEduMapList);
|
|
|
+ List<Map<Long, BigDecimal>> activeAmountMapList = cloudTeacherOrderDao.queryActiveAmountMap(studentIds);
|
|
|
+ Map<Long, BigDecimal> activeAmountMap = MapUtil.convertIntegerMap(activeAmountMapList);
|
|
|
|
|
|
- List<Map<Long, BigDecimal>> activeAmountMapList = cloudTeacherOrderDao.queryActiveAmountMap(studentIds);
|
|
|
- Map<Long, BigDecimal> activeAmountMap = MapUtil.convertIntegerMap(activeAmountMapList);
|
|
|
+ Set<Integer> hasVipCourseStudentIds = courseScheduleStudentPaymentDao.getHasVipCourseStudentIds(studentIds);
|
|
|
|
|
|
- Set<Integer> hasVipCourseStudentIds = courseScheduleStudentPaymentDao.getHasVipCourseStudentIds(studentIds);
|
|
|
+ List<Map<Integer, String>> studentSchoolNamesMapList = studentDao.getStudentCooperationNameMap(studentIds);
|
|
|
+ Map<Integer, String> studentSchoolNamesMap = MapUtil.convertIntegerMap(studentSchoolNamesMapList);
|
|
|
|
|
|
- List<Map<Integer, String>> studentSchoolNamesMapList = studentDao.getStudentCooperationNameMap(studentIds);
|
|
|
- Map<Integer, String> studentSchoolNamesMap = MapUtil.convertIntegerMap(studentSchoolNamesMapList);
|
|
|
-
|
|
|
- List<SysUser> users = employeeDao.getUsers(studentIds);
|
|
|
- Map<Integer, SysUser> idUserMap = new HashMap<>();
|
|
|
- if(!CollectionUtils.isEmpty(users)){
|
|
|
- idUserMap = users.stream().collect(Collectors.toMap(SysUser::getId, u -> u, (u1, u2) -> u1));
|
|
|
- }
|
|
|
-
|
|
|
- List<Student> students = studentDao.findByStudentIds(studentIds);
|
|
|
- Map<Integer, Student> idStudentMap = new HashMap<>();
|
|
|
- if(!CollectionUtils.isEmpty(students)){
|
|
|
- idStudentMap = students.stream().collect(Collectors.toMap(Student::getUserId, s->s, (s1, s2)->s1));
|
|
|
- }
|
|
|
-
|
|
|
- List<Map<Integer, Integer>> studentNotStartCourseNumMapList = courseScheduleStudentPaymentDao.countStudentsNotStartCourseNumWithCourseType(studentIds, null);
|
|
|
- Map<Integer, Long> studentNotStartCourseNumMap = new HashMap<>();
|
|
|
- if(!CollectionUtils.isEmpty(studentNotStartCourseNumMapList)){
|
|
|
- studentNotStartCourseNumMap = MapUtil.convertIntegerMap(studentNotStartCourseNumMapList);
|
|
|
- }
|
|
|
- List<Map<Integer, Integer>> studentNotStartVipCourseNumMapList = courseScheduleStudentPaymentDao.countStudentsNotStartCourseNumWithCourseType(studentIds, CourseSchedule.CourseScheduleType.VIP);
|
|
|
- Map<Integer, Long> studentNotStartVipCourseNumMap = new HashMap<>();
|
|
|
- if(!CollectionUtils.isEmpty(studentNotStartVipCourseNumMapList)){
|
|
|
- studentNotStartVipCourseNumMap = MapUtil.convertIntegerMap(studentNotStartVipCourseNumMapList);
|
|
|
- }
|
|
|
- List<Map<Integer, Integer>> studentNotStartPracticeCourseNumMapList = courseScheduleStudentPaymentDao.countStudentsNotStartCourseNumWithCourseType(studentIds, CourseSchedule.CourseScheduleType.PRACTICE);
|
|
|
- Map<Integer, Long> studentNotStartPracticeCourseNumMap = new HashMap<>();
|
|
|
- if(!CollectionUtils.isEmpty(studentNotStartPracticeCourseNumMapList)){
|
|
|
- studentNotStartPracticeCourseNumMap = MapUtil.convertIntegerMap(studentNotStartPracticeCourseNumMapList);
|
|
|
- }
|
|
|
- Map<Integer, String> subjectMap = subjectService.getMap("subject", "id_", "name_", false, 1, Integer.class, String.class);
|
|
|
- //获取分部年级列表
|
|
|
- Map<Integer, String> gradeList = organizationService.getGradeList(1);
|
|
|
- for (EduOrganStudentListDto eduOrganStudentListDto : dataList1) {
|
|
|
- EduOrganStudentListExportDto data = JSON.parseObject(JSON.toJSONString(eduOrganStudentListDto),EduOrganStudentListExportDto.class);
|
|
|
- data.setOrganName(organMap.get(data.getOrganId()));
|
|
|
- data.setSubjectName(subjectMap.get(data.getSubjectId()));
|
|
|
- if (StringUtils.isNotEmpty(eduOrganStudentListDto.getCurrentGradeNum())) {
|
|
|
- data.setCurrentGradeNum(eduOrganStudentListDto.getCurrentGradeNum());
|
|
|
- String grade = gradeList.get(Integer.parseInt(eduOrganStudentListDto.getCurrentGradeNum()));
|
|
|
- if (StringUtils.isNotEmpty(grade)) {
|
|
|
- data.setCurrentGradeNum(grade);
|
|
|
- }
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(eduOrganStudentListDto.getCurrentClass())) {
|
|
|
- data.setCurrentClass(eduOrganStudentListDto.getCurrentClass());
|
|
|
- }
|
|
|
- if(activeAmountMap.containsKey(data.getStudentId().longValue())){
|
|
|
- data.setActiveAmount(activeAmountMap.get(data.getStudentId().longValue()));
|
|
|
- }
|
|
|
- if(studentGroupEduMap.containsKey(data.getStudentId())){
|
|
|
- data.setEducationName(studentGroupEduMap.get(data.getStudentId()));
|
|
|
- }
|
|
|
- if(studentGroupNamesMap.containsKey(data.getStudentId())){
|
|
|
- data.setMusicGroupNames(studentGroupNamesMap.get(data.getStudentId()));
|
|
|
- }
|
|
|
- if(studentSchoolNamesMap.containsKey(data.getStudentId())){
|
|
|
- data.setSchoolNames(studentSchoolNamesMap.get(data.getStudentId()));
|
|
|
- }
|
|
|
- if(hasVipCourseStudentIds.contains(data.getStudentId())){
|
|
|
- data.setHasVipGroup(1);
|
|
|
- }
|
|
|
- if(data.getCloudStudyUseNum()>0 && data.getCloudStudyUseTime()>0){
|
|
|
- data.setCloudStudyUseAvgTime(data.getCloudStudyUseTime()/data.getCloudStudyUseNum());
|
|
|
- }
|
|
|
- data.setCloudStudyUseTime(data.getCloudStudyUseTime()/60);
|
|
|
- data.setCloudStudyUseAvgTime(data.getCloudStudyUseAvgTime()/60);
|
|
|
+ List<SysUser> users = employeeDao.getUsers(studentIds);
|
|
|
+ Map<Integer, SysUser> idUserMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(users)){
|
|
|
+ idUserMap = users.stream().collect(Collectors.toMap(SysUser::getId, u -> u, (u1, u2) -> u1));
|
|
|
+ }
|
|
|
|
|
|
- if(idUserMap.containsKey(eduOrganStudentListDto.getStudentId())){
|
|
|
- SysUser sysUser = idUserMap.get(data.getStudentId());
|
|
|
- data.setPhone(sysUser.getPhone());
|
|
|
- data.setEnable(StringUtils.isNotBlank(sysUser.getPassword()));
|
|
|
+ List<Student> students = studentDao.findByStudentIds(studentIds);
|
|
|
+ Map<Integer, Student> idStudentMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(students)){
|
|
|
+ idStudentMap = students.stream().collect(Collectors.toMap(Student::getUserId, s->s, (s1, s2)->s1));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<Integer, Integer>> studentNotStartCourseNumMapList = courseScheduleStudentPaymentDao.countStudentsNotStartCourseNumWithCourseType(studentIds, null);
|
|
|
+ Map<Integer, Long> studentNotStartCourseNumMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(studentNotStartCourseNumMapList)){
|
|
|
+ studentNotStartCourseNumMap = MapUtil.convertIntegerMap(studentNotStartCourseNumMapList);
|
|
|
+ }
|
|
|
+ List<Map<Integer, Integer>> studentNotStartVipCourseNumMapList = courseScheduleStudentPaymentDao.countStudentsNotStartCourseNumWithCourseType(studentIds, CourseSchedule.CourseScheduleType.VIP);
|
|
|
+ Map<Integer, Long> studentNotStartVipCourseNumMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(studentNotStartVipCourseNumMapList)){
|
|
|
+ studentNotStartVipCourseNumMap = MapUtil.convertIntegerMap(studentNotStartVipCourseNumMapList);
|
|
|
+ }
|
|
|
+ List<Map<Integer, Integer>> studentNotStartPracticeCourseNumMapList = courseScheduleStudentPaymentDao.countStudentsNotStartCourseNumWithCourseType(studentIds, CourseSchedule.CourseScheduleType.PRACTICE);
|
|
|
+ Map<Integer, Long> studentNotStartPracticeCourseNumMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(studentNotStartPracticeCourseNumMapList)){
|
|
|
+ studentNotStartPracticeCourseNumMap = MapUtil.convertIntegerMap(studentNotStartPracticeCourseNumMapList);
|
|
|
+ }
|
|
|
+ Map<Integer, String> subjectMap = subjectService.getMap("subject", "id_", "name_", false, 1, Integer.class, String.class);
|
|
|
+ //获取分部年级列表
|
|
|
+ Map<Integer, String> gradeList = organizationService.getGradeList(1);
|
|
|
+ //获取学员指导老师
|
|
|
+ Map<Integer,String> teacherMapper = MapUtil.convertMybatisMap(studentTeacherMapperDao.queryTeacherMapper(studentIds,"NORMAL"));
|
|
|
+ List<EduOrganStudentListExportDto> dataList = new ArrayList<>();
|
|
|
+ for (EduOrganStudentListDto eduOrganStudentListDto : dataList1) {
|
|
|
+ EduOrganStudentListExportDto data = JSON.parseObject(JSON.toJSONString(eduOrganStudentListDto),EduOrganStudentListExportDto.class);
|
|
|
+ data.setOrganName(organMap.get(data.getOrganId()));
|
|
|
+ data.setSubjectName(subjectMap.get(data.getSubjectId()));
|
|
|
+ if (StringUtils.isNotEmpty(eduOrganStudentListDto.getCurrentGradeNum())) {
|
|
|
+ data.setCurrentGradeNum(eduOrganStudentListDto.getCurrentGradeNum());
|
|
|
+ String grade = gradeList.get(Integer.parseInt(eduOrganStudentListDto.getCurrentGradeNum()));
|
|
|
+ if (StringUtils.isNotEmpty(grade)) {
|
|
|
+ data.setCurrentGradeNum(grade);
|
|
|
}
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(eduOrganStudentListDto.getCurrentClass())) {
|
|
|
+ data.setCurrentClass(eduOrganStudentListDto.getCurrentClass());
|
|
|
+ }
|
|
|
+ if(activeAmountMap.containsKey(data.getStudentId().longValue())){
|
|
|
+ data.setActiveAmount(activeAmountMap.get(data.getStudentId().longValue()));
|
|
|
+ }
|
|
|
+ if(studentGroupEduMap.containsKey(data.getStudentId())){
|
|
|
+ data.setEducationName(studentGroupEduMap.get(data.getStudentId()));
|
|
|
+ }
|
|
|
+ if(studentGroupNamesMap.containsKey(data.getStudentId())){
|
|
|
+ data.setMusicGroupNames(studentGroupNamesMap.get(data.getStudentId()));
|
|
|
+ }
|
|
|
+ if(studentSchoolNamesMap.containsKey(data.getStudentId())){
|
|
|
+ data.setSchoolNames(studentSchoolNamesMap.get(data.getStudentId()));
|
|
|
+ }
|
|
|
+ if(hasVipCourseStudentIds.contains(data.getStudentId())){
|
|
|
+ data.setHasVipGroup(1);
|
|
|
+ }
|
|
|
+ if(data.getCloudStudyUseNum()>0 && data.getCloudStudyUseTime()>0){
|
|
|
+ data.setCloudStudyUseAvgTime(data.getCloudStudyUseTime()/data.getCloudStudyUseNum());
|
|
|
+ }
|
|
|
+ data.setCloudStudyUseTime(data.getCloudStudyUseTime()/60);
|
|
|
+ data.setCloudStudyUseAvgTime(data.getCloudStudyUseAvgTime()/60);
|
|
|
|
|
|
- if(idStudentMap.containsKey(data.getStudentId())){
|
|
|
- Student student = idStudentMap.get(data.getStudentId());
|
|
|
- data.setNewUser(student.getIsNewUser());
|
|
|
- data.setServiceTag(Objects.isNull(student.getServiceTag())?0:student.getServiceTag());
|
|
|
- data.setOperatingTag(Objects.isNull(student.getOperatingTag())?0:student.getOperatingTag());
|
|
|
- data.setCarePackage(Objects.nonNull(student.getCarePackage())?student.getCarePackage():0);
|
|
|
- data.setComeOnPackage(Objects.isNull(student.getComeOnPackage())?0:student.getComeOnPackage());
|
|
|
- }
|
|
|
+ if(idUserMap.containsKey(eduOrganStudentListDto.getStudentId())){
|
|
|
+ SysUser sysUser = idUserMap.get(data.getStudentId());
|
|
|
+ data.setPhone(sysUser.getPhone());
|
|
|
+ data.setEnable(StringUtils.isNotBlank(sysUser.getPassword()));
|
|
|
+ }
|
|
|
|
|
|
- if(studentNotStartCourseNumMap.containsKey(data.getStudentId())){
|
|
|
- data.setNotStartCourseNum(studentNotStartCourseNumMap.get(data.getStudentId()).intValue());
|
|
|
- }
|
|
|
- if(studentNotStartVipCourseNumMap.containsKey(data.getStudentId())){
|
|
|
- data.setNotStartVipCourseNum(studentNotStartVipCourseNumMap.get(data.getStudentId()).intValue());
|
|
|
- }
|
|
|
- if(studentNotStartPracticeCourseNumMap.containsKey(data.getStudentId())){
|
|
|
- data.setNotStartPracticeCourseNum(studentNotStartPracticeCourseNumMap.get(data.getStudentId()).intValue());
|
|
|
- }
|
|
|
+ if(idStudentMap.containsKey(data.getStudentId())){
|
|
|
+ Student student = idStudentMap.get(data.getStudentId());
|
|
|
+ data.setNewUser(student.getIsNewUser());
|
|
|
+ data.setServiceTag(Objects.isNull(student.getServiceTag())?0:student.getServiceTag());
|
|
|
+ data.setOperatingTag(Objects.isNull(student.getOperatingTag())?0:student.getOperatingTag());
|
|
|
+ data.setCarePackage(Objects.nonNull(student.getCarePackage())?student.getCarePackage():0);
|
|
|
+ data.setComeOnPackage(Objects.isNull(student.getComeOnPackage())?0:student.getComeOnPackage());
|
|
|
+ }
|
|
|
|
|
|
- dataList.add(data);
|
|
|
+ if(studentNotStartCourseNumMap.containsKey(data.getStudentId())){
|
|
|
+ data.setNotStartCourseNum(studentNotStartCourseNumMap.get(data.getStudentId()).intValue());
|
|
|
+ }
|
|
|
+ if(studentNotStartVipCourseNumMap.containsKey(data.getStudentId())){
|
|
|
+ data.setNotStartVipCourseNum(studentNotStartVipCourseNumMap.get(data.getStudentId()).intValue());
|
|
|
+ }
|
|
|
+ if(studentNotStartPracticeCourseNumMap.containsKey(data.getStudentId())){
|
|
|
+ data.setNotStartPracticeCourseNum(studentNotStartPracticeCourseNumMap.get(data.getStudentId()).intValue());
|
|
|
}
|
|
|
+ data.setCloudStudyUseTime(Math.round(data.getCloudStudyUseTime()));
|
|
|
+ data.setCloudStudyUseAvgTime(Math.round(data.getCloudStudyUseAvgTime()));
|
|
|
+ data.setSubjectTeacherName(teacherMapper.get(data.getStudentId()));
|
|
|
+ dataList.add(data);
|
|
|
}
|
|
|
- pageInfo.setRows(dataList);
|
|
|
-
|
|
|
- StatDto result = new StatDto();
|
|
|
- result.setDetail(pageInfo);
|
|
|
-
|
|
|
- return result;
|
|
|
+ return dataList;
|
|
|
}
|
|
|
|
|
|
@Override
|