刘帅
2026-09-21 2bccc6b024d504d5cafae96e74ec08a8a93a2f7b
cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java
@@ -355,13 +355,19 @@
            }
            Store store = storeClient.queryStoreById(re.getStoreId());
            TAppUser appUser = appUserClient.queryAppUser1(re.getAppUserId());
            String studentId = re.getStudentId();
            String[] split = studentId.split(";");
            StringBuilder stringBuilder = new StringBuilder("");
            for (String s : split) {
                Student student = studentClient.queryStudentById(Integer.valueOf(s));
                stringBuilder.append(student.getName()+",");
            String studentId = re.getStudentId();
            if (studentId != null && !studentId.trim().isEmpty()) {
                String[] split = studentId.split(";");
                for (String s : split) {
                    if (s == null || s.trim().isEmpty()) {
                        continue;
                    }
                    Student student = studentClient.queryStudentById(Integer.valueOf(s));
                    if (student != null) {
                        stringBuilder.append(student.getName()).append(",");
                    }
                }
            }
            String string = stringBuilder.toString();
            if (string.length() > 0) {
@@ -491,11 +497,23 @@
                }
            }
            TAppUser appUser = appUserClient.queryAppUser1(re.getAppUserId());
            String[] split = re.getStudentIds().split(",");
            Student student = studentClient.queryStudentById(Integer.valueOf(split[0]));
            re.setPayStudent(student.getName());
            re.setPayUser(appUser.getName());
            re.setPhone(appUser.getPhone());
            // 统计接口只关心订单金额;历史订单可能没有关联学员或用户,不能因此整批查询失败。
            re.setPayStudent("无");
            if (re.getStudentIds() != null && !re.getStudentIds().trim().isEmpty()) {
                try {
                    String[] split = re.getStudentIds().split(",");
                    Student student = studentClient.queryStudentById(Integer.valueOf(split[0]));
                    if (student != null && student.getName() != null) {
                        re.setPayStudent(student.getName());
                    }
                } catch (NumberFormatException ignored) {
                    // 历史脏数据按“无学员”返回,避免影响其他有效订单。
                }
            }
            if (appUser != null) {
                re.setPayUser(appUser.getName());
                re.setPhone(appUser.getPhone());
            }
        }
        return res;
    }