|
@@ -104,6 +104,10 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
private SysEmployeePositionService employeePositionService;
|
|
|
@Autowired
|
|
|
private TenantInfoService tenantInfoService;
|
|
|
+ @Autowired
|
|
|
+ private OrganizationDao organizationDao;
|
|
|
+ @Autowired
|
|
|
+ private StudentTeacherMapperDao studentTeacherMapperDao;
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
|
|
@@ -127,6 +131,71 @@ public class StudentManageServiceImpl implements StudentManageService {
|
|
|
pageInfo.setTotal(count);
|
|
|
params.put("offset", pageInfo.getOffset());
|
|
|
dataList = studentManageDao.findStudentsByOrganId(params);
|
|
|
+ Set<Integer> userIds = dataList.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
|
|
|
+ List<Integer> organIds = dataList.stream().map(e -> e.getOrganId()).distinct().collect(Collectors.toList());
|
|
|
+ organIds.removeAll(Collections.singleton(null));
|
|
|
+ List<SysUserCashAccount> accounts = sysUserCashAccountDao.findByUserIds(userIds);
|
|
|
+ Map<Integer, Organization> organMap = null;
|
|
|
+ if(!CollectionUtils.isEmpty(organIds)){
|
|
|
+ List<Organization> organs = organizationDao.findOrgans(organIds);
|
|
|
+ organMap = organs.stream().collect(Collectors.groupingBy(Organization::getId, Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))));
|
|
|
+ }
|
|
|
+ Map<Integer, SysUserCashAccount> accountMap = null;
|
|
|
+ if(!CollectionUtils.isEmpty(accounts)){
|
|
|
+ accountMap = accounts.stream().collect(Collectors.groupingBy(SysUserCashAccount::getUserId, Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))));
|
|
|
+ }
|
|
|
+ List<String> subjectIds = dataList.stream().map(e -> e.getSubjectIdList()).distinct().collect(Collectors.toList());
|
|
|
+ subjectIds.removeAll(Collections.singleton(null));
|
|
|
+ Map<String, String> subjectMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(subjectIds)){
|
|
|
+ subjectMap = sysConfigService.getMap("subject", "id_", "name_", subjectIds, queryInfo.getTenantId(), String.class, String.class);
|
|
|
+ }
|
|
|
+ List<Integer> cooIds = dataList.stream().map(e -> e.getCooperationOrganId()).distinct().collect(Collectors.toList());
|
|
|
+ cooIds.removeAll(Collections.singleton(null));
|
|
|
+ Map<Integer, String> cooMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(cooIds)) {
|
|
|
+ cooMap = sysConfigService.getMap("cooperation_organ", "id_", "name_", cooIds, queryInfo.getTenantId(), Integer.class, String.class);
|
|
|
+ }
|
|
|
+ //获取学员关联的老师列表
|
|
|
+ List<StudentTeacherMapperDto> mappers = studentTeacherMapperDao.queryDtoByStudent(userIds);
|
|
|
+ Map<Integer, List<StudentTeacherMapperDto>> mappersMap = null;
|
|
|
+ if(!CollectionUtils.isEmpty(mappers)){
|
|
|
+ mappersMap = mappers.stream().collect(Collectors.groupingBy(StudentTeacherMapperDto::getStudentId));
|
|
|
+ }
|
|
|
+ for (StudentManageListDto dto : dataList) {
|
|
|
+ if(!CollectionUtils.isEmpty(organMap)){
|
|
|
+ Organization organization = organMap.get(dto.getOrganId());
|
|
|
+ if(Objects.nonNull(organization)){
|
|
|
+ dto.setOrganName(organization.getName());
|
|
|
+ dto.setGradeType(organization.getGradeType());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(organMap)){
|
|
|
+ SysUserCashAccount account = accountMap.get(dto.getUserId());
|
|
|
+ if(Objects.nonNull(account)){
|
|
|
+ dto.setCourseBalance(account.getCourseBalance());
|
|
|
+ dto.setBalance(account.getBalance());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dto.setSubjectName(subjectMap.get(dto.getSubjectIdList()));
|
|
|
+ dto.setCooperationOrganName(cooMap.get(dto.getCooperationOrganId()));
|
|
|
+ List<StudentTeacherMapperDto> mapperList = mappersMap.get(dto.getUserId());
|
|
|
+ if(!CollectionUtils.isEmpty(mapperList)){
|
|
|
+ Map<String, List<StudentTeacherMapperDto>> collect = mapperList.stream().collect(Collectors.groupingBy(StudentTeacherMapperDto::getTeacherType));
|
|
|
+ for (String s : collect.keySet()) {
|
|
|
+ String teacherName = collect.get(s).stream().map(e -> e.getTeacherName()).collect(Collectors.joining(","));
|
|
|
+ if("VIP".equals(s)){
|
|
|
+ dto.setVipTeacherName(teacherName);
|
|
|
+ }else if("PRACTICE".equals(s)){
|
|
|
+ dto.setPracticeTeacherName(teacherName);
|
|
|
+ }else if("NORMAL".equals(s)){
|
|
|
+ dto.setNormalTeacherName(teacherName);
|
|
|
+ }else {
|
|
|
+ dto.setMixTeacherName(teacherName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (dataList == null) {
|
|
|
dataList = new ArrayList<>();
|