|  | @@ -1,5 +1,6 @@
 | 
											
												
													
														|  |  package com.ym.mec.biz.service.impl;
 |  |  package com.ym.mec.biz.service.impl;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +import com.ym.mec.auth.api.entity.SysUser;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dao.*;
 |  |  import com.ym.mec.biz.dal.dao.*;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.dto.*;
 |  |  import com.ym.mec.biz.dal.dto.*;
 | 
											
												
													
														|  |  import com.ym.mec.biz.dal.entity.*;
 |  |  import com.ym.mec.biz.dal.entity.*;
 | 
											
										
											
												
													
														|  | @@ -20,6 +21,7 @@ import com.ym.mec.util.collection.MapUtil;
 | 
											
												
													
														|  |  import com.ym.mec.util.date.DateUtil;
 |  |  import com.ym.mec.util.date.DateUtil;
 | 
											
												
													
														|  |  import org.apache.commons.lang3.StringUtils;
 |  |  import org.apache.commons.lang3.StringUtils;
 | 
											
												
													
														|  |  import org.apache.poi.ss.formula.functions.T;
 |  |  import org.apache.poi.ss.formula.functions.T;
 | 
											
												
													
														|  | 
 |  | +import org.springframework.beans.BeanUtils;
 | 
											
												
													
														|  |  import org.springframework.beans.factory.annotation.Autowired;
 |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  |  import org.springframework.transaction.annotation.Transactional;
 |  |  import org.springframework.transaction.annotation.Transactional;
 | 
											
										
											
												
													
														|  | @@ -74,6 +76,9 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
 | 
											
												
													
														|  |      @Autowired
 |  |      @Autowired
 | 
											
												
													
														|  |      private IndexBaseMonthDataDao indexBaseMonthDataDao;
 |  |      private IndexBaseMonthDataDao indexBaseMonthDataDao;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    @Autowired
 | 
											
												
													
														|  | 
 |  | +    private EmployeeDao employeeDao;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public BaseDAO<Integer, Student> getDAO() {
 |  |      public BaseDAO<Integer, Student> getDAO() {
 | 
											
												
													
														|  |          return studentDao;
 |  |          return studentDao;
 | 
											
										
											
												
													
														|  | @@ -511,6 +516,111 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @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);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        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());
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            List<Map<Integer, String>> studentGroupNamesMapList = studentRegistrationDao.queryStudentMusicGroupNamesMap(studentIds);
 | 
											
												
													
														|  | 
 |  | +            Map<Integer, String> studentGroupNamesMap = MapUtil.convertIntegerMap(studentGroupNamesMapList);
 | 
											
												
													
														|  | 
 |  | +            Set<Integer> hasVipCourseStudentIds = courseScheduleStudentPaymentDao.getHasVipCourseStudentIds(studentIds);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            List<Map<Integer, String>> studentSchoolNamesMapList = studentRegistrationDao.queryStudentSchoolNamesMap(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);
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            for (EduOrganStudentListDto eduOrganStudentListDto : dataList1) {
 | 
											
												
													
														|  | 
 |  | +                EduOrganStudentListExportDto data = new EduOrganStudentListExportDto();
 | 
											
												
													
														|  | 
 |  | +                BeanUtils.copyProperties(eduOrganStudentListDto, data);
 | 
											
												
													
														|  | 
 |  | +                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(idUserMap.containsKey(eduOrganStudentListDto.getStudentId())){
 | 
											
												
													
														|  | 
 |  | +                    SysUser sysUser = idUserMap.get(data.getStudentId());
 | 
											
												
													
														|  | 
 |  | +                    data.setPhone(sysUser.getPhone());
 | 
											
												
													
														|  | 
 |  | +                    data.setEnable(StringUtils.isNotBlank(sysUser.getPassword()));
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +                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(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());
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +                dataList.add(data);
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        pageInfo.setRows(dataList);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        StatDto result = new StatDto();
 | 
											
												
													
														|  | 
 |  | +        result.setDetail(pageInfo);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        return result;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Override
 | 
											
												
													
														|  |      public List<EduOrganStudentDataDto> organStudentOverView(List<Integer> organIds) {
 |  |      public List<EduOrganStudentDataDto> organStudentOverView(List<Integer> organIds) {
 | 
											
												
													
														|  |          List<Organization> organs = organizationDao.getOrgans(organIds);
 |  |          List<Organization> organs = organizationDao.getOrgans(organIds);
 | 
											
												
													
														|  |  
 |  |  
 |