caozixuan vor 1 Jahr
Ursprung
Commit
580b24d4fe

+ 24 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/BasicExamStudentResult.java

@@ -15,6 +15,14 @@ public class BasicExamStudentResult {
     @JsonSerialize(using = ToStringSerializer.class)
     private Long id;
 
+    @ApiModelProperty("学期id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long semesterId;
+
+    @ApiModelProperty("考试id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long examId;
+
     @ApiModelProperty("课程名称")
     private String courseName;
 
@@ -71,6 +79,22 @@ public class BasicExamStudentResult {
         this.id = id;
     }
 
+    public Long getSemesterId() {
+        return semesterId;
+    }
+
+    public void setSemesterId(Long semesterId) {
+        this.semesterId = semesterId;
+    }
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
     public String getCourseName() {
         return courseName;
     }

+ 1 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/DictionaryEnum.java

@@ -13,6 +13,7 @@ public enum DictionaryEnum {
     MAJOR("专业"),
     CLAZZ("班级"),
     ALL_CLAZZ("教学班和基础班"),
+    COURSE("课程"),
     STUDENT("学生");
     private final String desc;
 

+ 2 - 0
distributed-print-business/src/main/resources/mapper/BasicExamStudentMapper.xml

@@ -6,6 +6,8 @@
             resultType="com.qmth.distributed.print.business.bean.result.BasicExamStudentResult">
         SELECT
             bes.id,
+            bes.semester_id AS semesterId,
+            bes.exam_id AS examId,
             bc.name AS courseName,
             bes.course_code AS courseCode,
             bes.student_name AS studentName,

+ 1 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskApplyController.java

@@ -255,7 +255,7 @@ public class ExamTaskApplyController {
         SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
         // TODO: 2024/3/15 测试用
         if (!SystemConstant.strNotNull(examId)){
-            examId = "497405213984948224";
+            examId = "502120560860332032";
         }
         return ResultUtil.ok(examTaskService.findExamTaskStudentObject(examObjectType, SystemConstant.convertIdToLong(examId), courseCode, requestUser));
     }

+ 133 - 125
distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java

@@ -99,6 +99,9 @@ public class SysController {
     @Resource
     BasicStudentService basicStudentService;
 
+    @Resource
+    BasicCourseService basicCourseService;
+
     @Resource
     BasicSemesterService basicSemesterService;
 
@@ -666,131 +669,136 @@ public class SysController {
         Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
         List<DictionaryResult> dictionaryResultList = new ArrayList<>();
         switch (dictionaryEnum) {
-            case SEMESTER:
-                List<BasicSemester> basicSemesterList = basicSemesterService.list(new QueryWrapper<BasicSemester>()
-                        .lambda()
-                        .eq(BasicSemester::getSchoolId, schoolId)
-                        .eq(BasicSemester::getEnable, true)
-                        .orderByDesc(BasicSemester::getCreateTime));
-                dictionaryResultList = basicSemesterList.stream().map(e -> {
-                    DictionaryResult dictionaryResult = new DictionaryResult();
-                    dictionaryResult.setId(e.getId());
-                    dictionaryResult.setCode(e.getCode());
-                    dictionaryResult.setName(e.getName());
-                    return dictionaryResult;
-                }).collect(Collectors.toList());
-                break;
-            case COLLEGE:
-                List<SysOrg> sysOrgs = conditionService.listCollege();
-                dictionaryResultList = sysOrgs.stream().map(e -> {
-                    DictionaryResult dictionaryResult = new DictionaryResult();
-                    dictionaryResult.setId(e.getId());
-                    dictionaryResult.setName(e.getName());
-                    return dictionaryResult;
-                }).collect(Collectors.toList());
-                break;
-//            case COLLEGE:
-//                if (Objects.nonNull(semesterId)) {
-//                    QueryWrapper<BasicExam> basicExamQueryWrapper = new QueryWrapper<>();
-//                    basicExamQueryWrapper.lambda().eq(BasicExam::getSemesterId, SystemConstant.convertIdToLong(semesterId));
-//                    List<BasicExam> basicExamList = basicExamService.list(basicExamQueryWrapper);
-//                    if (Objects.nonNull(basicExamList) && basicExamList.size() > 0) {
-//                        List<Long> examIdList = basicExamList.stream().map(BaseEntity::getId).collect(Collectors.toList());
-//                        QueryWrapper<ExamPrintPlan> examPrintPlanQueryWrapper = new QueryWrapper<>();
-//                        examPrintPlanQueryWrapper.lambda().in(ExamPrintPlan::getExamId, examIdList);
-//                        List<ExamPrintPlan> examPrintPlanList = examPrintPlanService.list(examPrintPlanQueryWrapper);
-//                        if (Objects.nonNull(examPrintPlanList) && examPrintPlanList.size() > 0) {
-//                            Set<Long> orgIdSet = examPrintPlanList.stream().map(ExamPrintPlan::getOrgId).collect(Collectors.toSet());
-//                            QueryWrapper<SysOrg> sysOrgQueryWrapper = new QueryWrapper<>();
-//                            sysOrgQueryWrapper.lambda().in(SysOrg::getId, orgIdSet);
-//                            List<SysOrg> sysOrgList = sysOrgService.list(sysOrgQueryWrapper);
-//                            List<SysOrg> newSysOrgList = new ArrayList<>(sysOrgList);
-//                            for (SysOrg s : sysOrgList) {
-//                                if (s.getType() == OrgTypeEnum.SCHOOL) {
-//                                    newSysOrgList.addAll(sysOrgService.findByConnectByRootOrgId(s.getId()));
-//                                } else if (s.getType() == OrgTypeEnum.TEACHING_ROOM || s.getType() == OrgTypeEnum.FACULTY || s.getType() == OrgTypeEnum.PRINTING_HOUSE) {
-//                                    newSysOrgList.addAll(sysOrgService.findByConnectByParentId(s.getId(), true, false));
-//                                }
-//                            }
-//                            Map<Long, SysOrg> sysOrgMap = new LinkedHashMap<>();
-//                            for (SysOrg s : newSysOrgList) {
-//                                if (s.getType() == OrgTypeEnum.COLLEGE) {
-//                                    sysOrgMap.put(s.getId(), s);
-//                                }
-//                            }
-//                            List<DictionaryResult> finalDictionaryResultList = dictionaryResultList;
-//                            sysOrgMap.forEach((k, v) -> {
-//                                DictionaryResult dictionaryResult = new DictionaryResult();
-//                                dictionaryResult.setId(v.getId());
-//                                dictionaryResult.setCode(v.getCode());
-//                                dictionaryResult.setName(v.getName());
-//                                finalDictionaryResultList.add(dictionaryResult);
-//                            });
-//                        }
-//                    }
-//                } else {
-//                    List<SysOrg> sysOrgList = sysOrgService.list(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getSchoolId, schoolId).eq(SysOrg::getEnable, true));
-//                    dictionaryResultList = sysOrgList.stream().map(e -> {
-//                        DictionaryResult dictionaryResult = new DictionaryResult();
-//                        dictionaryResult.setId(e.getId());
-//                        dictionaryResult.setCode(e.getCode());
-//                        dictionaryResult.setName(e.getName());
-//                        return dictionaryResult;
-//                    }).collect(Collectors.toList());
-//                }
-//                break;
-            case MAJOR:
-                QueryWrapper<BasicMajor> majorQueryWrapper = new QueryWrapper<>();
-                majorQueryWrapper.lambda()
-                        .eq(BasicMajor::getSchoolId, schoolId)
-                        .eq(BasicMajor::getEnable, true);
-
-                if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(collegeId))) {
-                    majorQueryWrapper.lambda().eq(BasicMajor::getBelongOrgId, collegeId);
-                }
-                List<BasicMajor> basicMajorList = basicMajorService.list(majorQueryWrapper);
-                dictionaryResultList = basicMajorList.stream().map(e -> {
-                    DictionaryResult dictionaryResult = new DictionaryResult();
-                    dictionaryResult.setId(e.getId());
-                    dictionaryResult.setCode(e.getCode());
-                    dictionaryResult.setName(e.getName());
-                    return dictionaryResult;
-                }).collect(Collectors.toList());
-                break;
-            case CLAZZ:
-                QueryWrapper<BasicTeachClazz> clazzQueryWrapper = new QueryWrapper<>();
-                clazzQueryWrapper.lambda().eq(BasicTeachClazz::getSchoolId, schoolId).eq(BasicTeachClazz::getExamId, examId);
-                List<BasicTeachClazz> basicTeachClazzList = basicTeachClazzService.list(clazzQueryWrapper);
-                List<DictionaryResult> resultBasicClazzList = basicTeachClazzList.stream().map(e -> {
-                    DictionaryResult dictionaryResult = new DictionaryResult();
-                    dictionaryResult.setId(e.getId());
-                    dictionaryResult.setName(e.getClazzName());
-                    return dictionaryResult;
-                }).collect(Collectors.toList());
-                dictionaryResultList.addAll(resultBasicClazzList);
-                break;
-            case ALL_CLAZZ: //针对归档管理临时处理用
-                throw ExceptionResultEnum.ERROR.exception("使用枚举[CLAZZ]");
-            case STUDENT:
-                QueryWrapper<BasicExamStudent> studentQueryWrapper = new QueryWrapper<>();
-                studentQueryWrapper.lambda().eq(BasicExamStudent::getSchoolId, schoolId);
-                if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(clazzId))) {
-                    studentQueryWrapper.lambda().eq(BasicExamStudent::getClazzId, clazzId);
-                }
-                if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(studentId))) {
-                    studentQueryWrapper.lambda().eq(BasicExamStudent::getId, studentId);
-                }
-                List<BasicExamStudent> basicExamStudentList = basicExamStudentService.list(studentQueryWrapper);
-                dictionaryResultList = basicExamStudentList.stream().map(e -> {
-                    DictionaryResult dictionaryResult = new DictionaryResult();
-                    dictionaryResult.setId(e.getId());
-                    dictionaryResult.setCode(e.getStudentCode());
-                    dictionaryResult.setName(e.getStudentName());
-                    return dictionaryResult;
-                }).collect(Collectors.toList());
-                break;
-            default:
-                break;
+        case SEMESTER:
+            List<BasicSemester> basicSemesterList = basicSemesterService.list(
+                    new QueryWrapper<BasicSemester>().lambda().eq(BasicSemester::getSchoolId, schoolId).eq(BasicSemester::getEnable, true).orderByDesc(BasicSemester::getCreateTime));
+            dictionaryResultList = basicSemesterList.stream().map(e -> {
+                DictionaryResult dictionaryResult = new DictionaryResult();
+                dictionaryResult.setId(e.getId());
+                dictionaryResult.setCode(e.getCode());
+                dictionaryResult.setName(e.getName());
+                return dictionaryResult;
+            }).collect(Collectors.toList());
+            break;
+        case COLLEGE:
+            List<SysOrg> sysOrgs = conditionService.listCollege();
+            dictionaryResultList = sysOrgs.stream().map(e -> {
+                DictionaryResult dictionaryResult = new DictionaryResult();
+                dictionaryResult.setId(e.getId());
+                dictionaryResult.setName(e.getName());
+                return dictionaryResult;
+            }).collect(Collectors.toList());
+            break;
+        //            case COLLEGE:
+        //                if (Objects.nonNull(semesterId)) {
+        //                    QueryWrapper<BasicExam> basicExamQueryWrapper = new QueryWrapper<>();
+        //                    basicExamQueryWrapper.lambda().eq(BasicExam::getSemesterId, SystemConstant.convertIdToLong(semesterId));
+        //                    List<BasicExam> basicExamList = basicExamService.list(basicExamQueryWrapper);
+        //                    if (Objects.nonNull(basicExamList) && basicExamList.size() > 0) {
+        //                        List<Long> examIdList = basicExamList.stream().map(BaseEntity::getId).collect(Collectors.toList());
+        //                        QueryWrapper<ExamPrintPlan> examPrintPlanQueryWrapper = new QueryWrapper<>();
+        //                        examPrintPlanQueryWrapper.lambda().in(ExamPrintPlan::getExamId, examIdList);
+        //                        List<ExamPrintPlan> examPrintPlanList = examPrintPlanService.list(examPrintPlanQueryWrapper);
+        //                        if (Objects.nonNull(examPrintPlanList) && examPrintPlanList.size() > 0) {
+        //                            Set<Long> orgIdSet = examPrintPlanList.stream().map(ExamPrintPlan::getOrgId).collect(Collectors.toSet());
+        //                            QueryWrapper<SysOrg> sysOrgQueryWrapper = new QueryWrapper<>();
+        //                            sysOrgQueryWrapper.lambda().in(SysOrg::getId, orgIdSet);
+        //                            List<SysOrg> sysOrgList = sysOrgService.list(sysOrgQueryWrapper);
+        //                            List<SysOrg> newSysOrgList = new ArrayList<>(sysOrgList);
+        //                            for (SysOrg s : sysOrgList) {
+        //                                if (s.getType() == OrgTypeEnum.SCHOOL) {
+        //                                    newSysOrgList.addAll(sysOrgService.findByConnectByRootOrgId(s.getId()));
+        //                                } else if (s.getType() == OrgTypeEnum.TEACHING_ROOM || s.getType() == OrgTypeEnum.FACULTY || s.getType() == OrgTypeEnum.PRINTING_HOUSE) {
+        //                                    newSysOrgList.addAll(sysOrgService.findByConnectByParentId(s.getId(), true, false));
+        //                                }
+        //                            }
+        //                            Map<Long, SysOrg> sysOrgMap = new LinkedHashMap<>();
+        //                            for (SysOrg s : newSysOrgList) {
+        //                                if (s.getType() == OrgTypeEnum.COLLEGE) {
+        //                                    sysOrgMap.put(s.getId(), s);
+        //                                }
+        //                            }
+        //                            List<DictionaryResult> finalDictionaryResultList = dictionaryResultList;
+        //                            sysOrgMap.forEach((k, v) -> {
+        //                                DictionaryResult dictionaryResult = new DictionaryResult();
+        //                                dictionaryResult.setId(v.getId());
+        //                                dictionaryResult.setCode(v.getCode());
+        //                                dictionaryResult.setName(v.getName());
+        //                                finalDictionaryResultList.add(dictionaryResult);
+        //                            });
+        //                        }
+        //                    }
+        //                } else {
+        //                    List<SysOrg> sysOrgList = sysOrgService.list(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getSchoolId, schoolId).eq(SysOrg::getEnable, true));
+        //                    dictionaryResultList = sysOrgList.stream().map(e -> {
+        //                        DictionaryResult dictionaryResult = new DictionaryResult();
+        //                        dictionaryResult.setId(e.getId());
+        //                        dictionaryResult.setCode(e.getCode());
+        //                        dictionaryResult.setName(e.getName());
+        //                        return dictionaryResult;
+        //                    }).collect(Collectors.toList());
+        //                }
+        //                break;
+        case MAJOR:
+            QueryWrapper<BasicMajor> majorQueryWrapper = new QueryWrapper<>();
+            majorQueryWrapper.lambda().eq(BasicMajor::getSchoolId, schoolId).eq(BasicMajor::getEnable, true);
+
+            if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(collegeId))) {
+                majorQueryWrapper.lambda().eq(BasicMajor::getBelongOrgId, collegeId);
+            }
+            List<BasicMajor> basicMajorList = basicMajorService.list(majorQueryWrapper);
+            dictionaryResultList = basicMajorList.stream().map(e -> {
+                DictionaryResult dictionaryResult = new DictionaryResult();
+                dictionaryResult.setId(e.getId());
+                dictionaryResult.setCode(e.getCode());
+                dictionaryResult.setName(e.getName());
+                return dictionaryResult;
+            }).collect(Collectors.toList());
+            break;
+        case CLAZZ:
+            QueryWrapper<BasicTeachClazz> clazzQueryWrapper = new QueryWrapper<>();
+            clazzQueryWrapper.lambda().eq(BasicTeachClazz::getSchoolId, schoolId).eq(BasicTeachClazz::getExamId, examId);
+            List<BasicTeachClazz> basicTeachClazzList = basicTeachClazzService.list(clazzQueryWrapper);
+            List<DictionaryResult> resultBasicClazzList = basicTeachClazzList.stream().map(e -> {
+                DictionaryResult dictionaryResult = new DictionaryResult();
+                dictionaryResult.setId(e.getId());
+                dictionaryResult.setName(e.getClazzName());
+                return dictionaryResult;
+            }).collect(Collectors.toList());
+            dictionaryResultList.addAll(resultBasicClazzList);
+            break;
+        case ALL_CLAZZ: //针对归档管理临时处理用
+            throw ExceptionResultEnum.ERROR.exception("使用枚举[CLAZZ]");
+        case COURSE: // 考生字典查询课程
+            dictionaryResultList = basicCourseService.list(
+                    new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)).stream().flatMap(e -> {
+                DictionaryResult dictionaryResult = new DictionaryResult();
+                dictionaryResult.setId(e.getId());
+                dictionaryResult.setCode(e.getCode());
+                dictionaryResult.setName(e.getName());
+                return Stream.of(dictionaryResult);
+            }).collect(Collectors.toList());
+            break;
+        case STUDENT:
+            QueryWrapper<BasicExamStudent> studentQueryWrapper = new QueryWrapper<>();
+            studentQueryWrapper.lambda().eq(BasicExamStudent::getSchoolId, schoolId);
+            if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(clazzId))) {
+                studentQueryWrapper.lambda().eq(BasicExamStudent::getClazzId, clazzId);
+            }
+            if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(studentId))) {
+                studentQueryWrapper.lambda().eq(BasicExamStudent::getId, studentId);
+            }
+            List<BasicExamStudent> basicExamStudentList = basicExamStudentService.list(studentQueryWrapper);
+            dictionaryResultList = basicExamStudentList.stream().map(e -> {
+                DictionaryResult dictionaryResult = new DictionaryResult();
+                dictionaryResult.setId(e.getId());
+                dictionaryResult.setCode(e.getStudentCode());
+                dictionaryResult.setName(e.getStudentName());
+                return dictionaryResult;
+            }).collect(Collectors.toList());
+            break;
+        default:
+            break;
         }
         return ResultUtil.ok(dictionaryResultList);
     }