瀏覽代碼

bug修改

zouxuan 4 月之前
父節點
當前提交
3c8135e1a4

+ 14 - 12
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java

@@ -414,26 +414,28 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
                     .list();
             Map<Long, List<CourseScheduleStudentPayment>> map = list.stream().collect(Collectors.groupingBy(CourseScheduleStudentPayment::getCourseGroupId));
             //获取所有用户编号
-
             List<Long> userIds = list.stream().map(CourseScheduleStudentPayment::getUserId).distinct().collect(Collectors.toList());
             Map<Long, com.yonge.cooleshow.biz.dal.entity.SysUser> userMap = sysUserService.getMapByIds(userIds);
             for (CourseGroupWrapper.TeacherCourseGroupDto e : records) {
                 e.setSubjectName(subjectMap.get(e.getSubjectId()));
                 if(StringUtils.equals(query.getCourseType(),"PIANO_ROOM_CLASS")){
                     List<CourseScheduleStudentPayment> studentPayments = map.get(e.getCourseGroupId());
-                    e.setStudentNum(studentPayments.size());
-                    StringBuffer studentName = new StringBuffer();
-                    for (int i = 0; i < studentPayments.size(); i++) {
-                        if(studentName.length() > 0){
-                            studentName.append(",");
-                        }
-                        studentName.append(userMap.get(studentPayments.get(i).getUserId()).getUsername());
-                        if (i > 0) {
-                            studentName.append("等").append(userIds.size()).append("人");
-                            break;
+                    if(CollectionUtils.isNotEmpty(studentPayments)){
+                        List<Long> studentIds = studentPayments.stream().map(CourseScheduleStudentPayment::getUserId).distinct().collect(Collectors.toList());
+                        e.setStudentNum(studentIds.size());
+                        StringBuffer studentName = new StringBuffer();
+                        for (int i = 0; i < studentIds.size(); i++) {
+                            if(studentName.length() > 0){
+                                studentName.append(",");
+                            }
+                            studentName.append(userMap.get(studentIds.get(i)).getUsername());
+                            if (i > 0) {
+                                studentName.append("等").append(studentIds.size()).append("人");
+                                break;
+                            }
                         }
+                        e.setStudentName(studentName.toString());
                     }
-                    e.setStudentName(studentName.toString());
                 }else {
                     CourseScheduleStudentPayment studentPayment = map.get(e.getCourseGroupId()).get(0);
                     com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = userMap.get(studentPayment.getUserId());