Răsfoiți Sursa

学生学院管理
命题任务提交(一步到位式)

caozixuan 2 ani în urmă
părinte
comite
4783d7fa59
50 a modificat fișierele cu 1325 adăugiri și 387 ștergeri
  1. 11 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/ExamDetailList.java
  2. 60 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/ExamTaskStudentObjectParam.java
  3. 62 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/examTaskStudent/ExamTaskStudentObjectResult.java
  4. 116 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/examTaskStudent/StudentInfo.java
  5. 38 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamStudent.java
  6. 1 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/DictionaryEnum.java
  7. 28 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/ExamObjectType.java
  8. 21 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/StudentClazzEnum.java
  9. 2 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamStudentMapper.java
  10. 2 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamStudentService.java
  11. 19 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskService.java
  12. 12 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/PrintCommonService.java
  13. 3 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncServiceImpl.java
  14. 0 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java
  15. 8 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamStudentServiceImpl.java
  16. 166 20
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java
  17. 74 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java
  18. 4 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java
  19. 6 6
      distributed-print-business/src/main/resources/mapper/ExamStudentMapper.xml
  20. 2 2
      distributed-print-business/src/main/resources/mapper/TeachStudentMapper.xml
  21. 68 0
      distributed-print/src/main/java/com/qmth/distributed/print/api/BasicCollegeController.java
  22. 3 6
      distributed-print/src/main/java/com/qmth/distributed/print/api/BasicStudentController.java
  23. 15 5
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskController.java
  24. 6 30
      distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java
  25. 0 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/SysOrgController.java
  26. 23 2
      distributed-print/src/test/java/com/qmth/distributed/print/ServiceTest.java
  27. 2 18
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/dto/TaskPrintClassDto.java
  28. 0 12
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/dto/excel/BasicClazzImportDto.java
  29. 2 2
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/dto/excel/BasicCourseImportDto.java
  30. 0 11
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/dto/excel/BasicStudentImportDto.java
  31. 0 15
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/params/BasicClazzParams.java
  32. 43 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/params/BasicCollegeParams.java
  33. 0 13
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/params/BasicStudentParams.java
  34. 0 34
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/result/BasicClazzResult.java
  35. 50 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/result/BasicCollegeResult.java
  36. 0 12
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicClazz.java
  37. 54 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicCollege.java
  38. 0 13
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicStudent.java
  39. 32 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicCollegeMapper.java
  40. 25 1
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicStudentMapper.java
  41. 42 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicCollegeService.java
  42. 25 6
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicStudentService.java
  43. 20 18
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicCampusServiceImpl.java
  44. 6 50
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicClazzServiceImpl.java
  45. 110 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicCollegeServiceImpl.java
  46. 47 68
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicStudentServiceImpl.java
  47. 0 6
      teachcloud-common/src/main/resources/mapper/BasicClazzMapper.xml
  48. 28 0
      teachcloud-common/src/main/resources/mapper/BasicCollegeMapper.xml
  49. 3 3
      teachcloud-common/src/main/resources/mapper/BasicMajorMapper.xml
  50. 86 17
      teachcloud-common/src/main/resources/mapper/BasicStudentMapper.xml

+ 11 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/ExamDetailList.java

@@ -1,5 +1,7 @@
 package com.qmth.distributed.print.business.bean.params;
 
+import java.util.List;
+
 /**
  * @Date: 2021/4/8.
  */
@@ -13,6 +15,7 @@ public class ExamDetailList {
     private Long printHouseId;
     private String printHouseName;
     private String extendFields;
+    private List<ExamTaskStudentObjectParam> examTaskStudentObjectParamList;
 
     public String getClassId() {
         return classId;
@@ -77,4 +80,12 @@ public class ExamDetailList {
     public void setExtendFields(String extendFields) {
         this.extendFields = extendFields;
     }
+
+    public List<ExamTaskStudentObjectParam> getExamTaskStudentObjectParamList() {
+        return examTaskStudentObjectParamList;
+    }
+
+    public void setExamTaskStudentObjectParamList(List<ExamTaskStudentObjectParam> examTaskStudentObjectParamList) {
+        this.examTaskStudentObjectParamList = examTaskStudentObjectParamList;
+    }
 }

+ 60 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/ExamTaskStudentObjectParam.java

@@ -0,0 +1,60 @@
+package com.qmth.distributed.print.business.bean.params;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.distributed.print.business.enums.StudentClazzEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 命题任务提交考务考生生参数
+ * @Author: CaoZixuan
+ * @Date: 2022-08-22
+ */
+public class ExamTaskStudentObjectParam {
+    @ApiModelProperty("学生id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long studentId;
+
+    @ApiModelProperty("行政班id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long basicClazzId;
+
+    @ApiModelProperty("教学班id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long teachClazzId;
+
+    @ApiModelProperty("学生班级类型")
+    private StudentClazzEnum studentClazzType;
+
+    public Long getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Long studentId) {
+        this.studentId = studentId;
+    }
+
+    public Long getBasicClazzId() {
+        return basicClazzId;
+    }
+
+    public void setBasicClazzId(Long basicClazzId) {
+        this.basicClazzId = basicClazzId;
+    }
+
+    public Long getTeachClazzId() {
+        return teachClazzId;
+    }
+
+    public void setTeachClazzId(Long teachClazzId) {
+        this.teachClazzId = teachClazzId;
+    }
+
+    public StudentClazzEnum getStudentClazzType() {
+        return studentClazzType;
+    }
+
+    public void setStudentClazzType(StudentClazzEnum studentClazzType) {
+        this.studentClazzType = studentClazzType;
+    }
+}

+ 62 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/examTaskStudent/ExamTaskStudentObjectResult.java

@@ -0,0 +1,62 @@
+package com.qmth.distributed.print.business.bean.result.examTaskStudent;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.distributed.print.business.enums.ExamObjectType;
+import com.qmth.distributed.print.business.enums.StudentClazzEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Description: 命题任务学生数据(命题任务提交一步到位的 - 考务数据)
+ * @Author: CaoZixuan
+ * @Date: 2022-08-18
+ */
+public class ExamTaskStudentObjectResult implements Serializable {
+    @ApiModelProperty(value = "班级id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long clazzId;
+
+    @ApiModelProperty(value = "班级名称")
+    private String clazzName;
+
+    @ApiModelProperty(value = "学生信息集合")
+    private List<StudentInfo> studentInfoList;
+
+    @ApiModelProperty(value = "考试对象类型")
+    private StudentClazzEnum studentClazzType;
+
+    public Long getClazzId() {
+        return clazzId;
+    }
+
+    public void setClazzId(Long clazzId) {
+        this.clazzId = clazzId;
+    }
+
+    public String getClazzName() {
+        return clazzName;
+    }
+
+    public void setClazzName(String clazzName) {
+        this.clazzName = clazzName;
+    }
+
+    public List<StudentInfo> getStudentInfoList() {
+        return studentInfoList;
+    }
+
+    public void setStudentInfoList(List<StudentInfo> studentInfoList) {
+        this.studentInfoList = studentInfoList;
+    }
+
+    public StudentClazzEnum getStudentClazzType() {
+        return studentClazzType;
+    }
+
+    public void setStudentClazzType(StudentClazzEnum studentClazzType) {
+        this.studentClazzType = studentClazzType;
+    }
+}

+ 116 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/examTaskStudent/StudentInfo.java

@@ -0,0 +1,116 @@
+package com.qmth.distributed.print.business.bean.result.examTaskStudent;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 学生扩展信息(基础学生 + 教学班信息)
+ * @Author: CaoZixuan
+ * @Date: 2022-08-18
+ */
+public class StudentInfo implements Serializable {
+    @ApiModelProperty(value = "学生id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long studentId;
+
+    @ApiModelProperty(value = "学生名称")
+    private String studentName;
+
+    @ApiModelProperty(value = "学生编号")
+    private String studentCode;
+
+    @ApiModelProperty(value = "学生学院名称")
+    private String collegeName;
+
+    @ApiModelProperty(value = "学生专业名称")
+    private String majorName;
+
+    @ApiModelProperty(value = "教学班id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long teachClazzId;
+
+    @ApiModelProperty(value = "教学班名称")
+    private String teachClazzName;
+
+    @ApiModelProperty(value = "行政班id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long basicClazzId;
+
+    @ApiModelProperty(value = "行政班名称")
+    private String basicClazzName;
+
+    public Long getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Long studentId) {
+        this.studentId = studentId;
+    }
+
+    public String getStudentName() {
+        return studentName;
+    }
+
+    public void setStudentName(String studentName) {
+        this.studentName = studentName;
+    }
+
+    public String getStudentCode() {
+        return studentCode;
+    }
+
+    public void setStudentCode(String studentCode) {
+        this.studentCode = studentCode;
+    }
+
+    public String getCollegeName() {
+        return collegeName;
+    }
+
+    public void setCollegeName(String collegeName) {
+        this.collegeName = collegeName;
+    }
+
+    public String getMajorName() {
+        return majorName;
+    }
+
+    public void setMajorName(String majorName) {
+        this.majorName = majorName;
+    }
+
+    public Long getTeachClazzId() {
+        return teachClazzId;
+    }
+
+    public void setTeachClazzId(Long teachClazzId) {
+        this.teachClazzId = teachClazzId;
+    }
+
+    public String getTeachClazzName() {
+        return teachClazzName;
+    }
+
+    public void setTeachClazzName(String teachClazzName) {
+        this.teachClazzName = teachClazzName;
+    }
+
+    public Long getBasicClazzId() {
+        return basicClazzId;
+    }
+
+    public void setBasicClazzId(Long basicClazzId) {
+        this.basicClazzId = basicClazzId;
+    }
+
+    public String getBasicClazzName() {
+        return basicClazzName;
+    }
+
+    public void setBasicClazzName(String basicClazzName) {
+        this.basicClazzName = basicClazzName;
+    }
+}

+ 38 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamStudent.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.distributed.print.business.enums.StudentClazzEnum;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -66,6 +67,19 @@ public class ExamStudent extends BaseEntity implements Serializable {
     @TableField("clazz_name")
     private String clazzName;
 
+    @ApiModelProperty(value = "教学班id")
+    @TableField("clazz_id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long teachClazzId;
+
+    @ApiModelProperty(value = "教学班名称")
+    @TableField("teach_clazz_name")
+    private String teachClazzName;
+
+    @ApiModelProperty(value = "主体班级类型")
+    @TableField(value = "student_clazz_type")
+    private StudentClazzEnum studentClazzType;
+
     @TableField("campus_name")
     private String campusName;
 
@@ -208,4 +222,28 @@ public class ExamStudent extends BaseEntity implements Serializable {
     public void setCampusName(String campusName) {
         this.campusName = campusName;
     }
+
+    public Long getTeachClazzId() {
+        return teachClazzId;
+    }
+
+    public void setTeachClazzId(Long teachClazzId) {
+        this.teachClazzId = teachClazzId;
+    }
+
+    public String getTeachClazzName() {
+        return teachClazzName;
+    }
+
+    public void setTeachClazzName(String teachClazzName) {
+        this.teachClazzName = teachClazzName;
+    }
+
+    public StudentClazzEnum getStudentClazzType() {
+        return studentClazzType;
+    }
+
+    public void setStudentClazzType(StudentClazzEnum studentClazzType) {
+        this.studentClazzType = studentClazzType;
+    }
 }

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

@@ -8,9 +8,8 @@ import java.util.Objects;
  * @Date: 2021-11-02
  */
 public enum DictionaryEnum {
-    CAMPUS("校区"),
     SEMESTER("学期"),
-    COLLEGE("学院"),
+    COLLEGE("学生学院"),
     MAJOR("专业"),
     CLAZZ("班级"),
     ALL_CLAZZ("教学班和基础班"),

+ 28 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/ExamObjectType.java

@@ -0,0 +1,28 @@
+package com.qmth.distributed.print.business.enums;
+
+/**
+ * @Description: 考试对象类型
+ * @Author: CaoZixuan
+ * @Date: 2022-08-18
+ */
+public enum ExamObjectType {
+    TEACH_CLAZZ_STUDENT("教学班的学生", StudentClazzEnum.TEACH_CLAZZ),
+    BASIC_CLAZZ_STUDENT("行政班的学生", StudentClazzEnum.BASIC_CLAZZ),
+    IMPORT_STUDENT("导入的学生", StudentClazzEnum.BASIC_CLAZZ),
+    ;
+    private final String desc;
+    private final StudentClazzEnum studentClazzType;
+
+    ExamObjectType(String desc, StudentClazzEnum studentClazzType) {
+        this.desc = desc;
+        this.studentClazzType = studentClazzType;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public StudentClazzEnum getStudentClazzType() {
+        return studentClazzType;
+    }
+}

+ 21 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/StudentClazzEnum.java

@@ -0,0 +1,21 @@
+package com.qmth.distributed.print.business.enums;
+
+/**
+ * @Description: 学生班级类型
+ * @Author: CaoZixuan
+ * @Date: 2022-08-22
+ */
+public enum StudentClazzEnum {
+    BASIC_CLAZZ("行政班"),
+    TEACH_CLAZZ("教学班")
+    ;
+    private final String desc;
+
+    StudentClazzEnum(String desc) {
+        this.desc = desc;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+}

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamStudentMapper.java

@@ -6,6 +6,7 @@ import com.qmth.distributed.print.business.bean.dto.ExamStudentCourseDto;
 import com.qmth.distributed.print.business.bean.dto.ExamStudentPdfInfoDto;
 import com.qmth.distributed.print.business.bean.dto.SyncExamStudentDto;
 import com.qmth.distributed.print.business.entity.ExamStudent;
+import com.qmth.teachcloud.common.entity.BasicCollege;
 import com.qmth.teachcloud.common.entity.SysOrg;
 import org.apache.ibatis.annotations.Param;
 
@@ -45,7 +46,7 @@ public interface ExamStudentMapper extends BaseMapper<ExamStudent> {
      */
     List<ExamStudent> listExamStudentBySchoolIdAndClazzId(@Param("schoolId") Long schoolId, @Param("classId") String classId);
 
-    SysOrg getSysOrgByBelongOrgId(@Param("studentCode") String studentCode, @Param("schoolId") Long schoolId);
+    List<BasicCollege> getBasicCollegeByBelongOrgId(@Param("studentCode") String studentCode, @Param("schoolId") Long schoolId);
 
     ExamStudentPdfInfoDto getByStudentId(Long id);
 

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamStudentService.java

@@ -6,6 +6,7 @@ import com.qmth.distributed.print.business.bean.dto.ExamStudentPdfInfoDto;
 import com.qmth.distributed.print.business.bean.dto.SyncExamStudentDto;
 import com.qmth.distributed.print.business.entity.ExamDetailCourse;
 import com.qmth.distributed.print.business.entity.ExamStudent;
+import com.qmth.teachcloud.common.entity.BasicCollege;
 import com.qmth.teachcloud.common.entity.SysOrg;
 
 import java.util.List;
@@ -40,7 +41,7 @@ public interface ExamStudentService extends IService<ExamStudent> {
 
     List<ExamStudent> listExamStudentBySchoolIdAndClazzId(Long schoolId, String classId);
 
-    SysOrg getSysOrgByBelongOrgId(String studentCode, Long schoolId);
+    BasicCollege getBasicCollegeByBelongOrgId(String studentCode, Long schoolId);
 
     ExamStudentPdfInfoDto getByStudentId(Long id);
 

+ 19 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamTaskService.java

@@ -8,10 +8,12 @@ import com.qmth.distributed.print.business.bean.dto.examObject.ExamObjectDto;
 import com.qmth.distributed.print.business.bean.params.ExamTaskApplyParam;
 import com.qmth.distributed.print.business.bean.params.ExamTaskReApplyParam;
 import com.qmth.distributed.print.business.bean.result.WorkResult;
+import com.qmth.distributed.print.business.bean.result.examTaskStudent.ExamTaskStudentObjectResult;
 import com.qmth.distributed.print.business.entity.ExamTask;
 import com.qmth.distributed.print.business.entity.ExamTaskApplyTemp;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
 import com.qmth.distributed.print.business.entity.ExamTaskReviewLog;
+import com.qmth.distributed.print.business.enums.ExamObjectType;
 import com.qmth.distributed.print.business.enums.MakeMethodEnum;
 import com.qmth.teachcloud.common.bean.dto.BlurryUserDto;
 import com.qmth.teachcloud.common.entity.SysUser;
@@ -123,7 +125,7 @@ public interface ExamTaskService extends IService<ExamTask> {
 
     List<ExamTaskDetailDto> listTaskPaper(Long semesterId, Long examId, String courseCode, String paperNumber, Long cardRuleId, MakeMethodEnum makeMethod, Long startTime, Long endTime);
 
-    TBTask taskDownloadPdf(Long semesterId , Long examId, String courseCode, String paperNumber, Long cardRuleId, MakeMethodEnum makeMethod, Long startTime, Long endTime);
+    TBTask taskDownloadPdf(Long semesterId, Long examId, String courseCode, String paperNumber, Long cardRuleId, MakeMethodEnum makeMethod, Long startTime, Long endTime);
 
     /**
      * 获取待办任务
@@ -205,4 +207,20 @@ public interface ExamTaskService extends IService<ExamTask> {
     void applyResave(ExamTaskReApplyParam map);
 
     ExamTaskDto getByExamTaskId(Long examTaskId);
+
+    /**
+     * 查找命题任务考试对象
+     * <p>
+     * 1.选择教学班当考试对象 - TEACH_CLAZZ_STUDENT -> 以学生的教学班当考试对象集合,但学生信息中附带教学班和行政班数据。
+     * 2.选择行政班当考试对象 - BASIC_CLAZZ_STUDENT -> 以学生的行政班当考试对象集合,且学生信息只包含行政班数据。
+     * 3.选择导入学生数据当考试对象 - IMPORT_STUDENT -> 文件必传,如果导入的考生在学生库中没有则新建,以学生的行政班当考试对象集合且学生信息只包含行政班数据。
+     * </P>
+     *
+     * @param examObjectType 考试对象类型
+     * @param basicCourseId  基础课程id
+     * @param file           导入的考生文件
+     * @param requestUser    请求的用户
+     * @return 命题任务考试对象查询结果
+     */
+    List<ExamTaskStudentObjectResult> findExamTaskStudentObject(ExamObjectType examObjectType, Long basicCourseId, MultipartFile file, SysUser requestUser) throws Exception;
 }

+ 12 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/PrintCommonService.java

@@ -3,6 +3,7 @@ package com.qmth.distributed.print.business.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.itextpdf.text.DocumentException;
 import com.qmth.distributed.print.business.bean.dto.PdfDto;
+import com.qmth.distributed.print.business.bean.params.ExamTaskStudentObjectParam;
 import com.qmth.distributed.print.business.bean.params.SerialNumberParams;
 import com.qmth.distributed.print.business.entity.ExamDetail;
 import com.qmth.distributed.print.business.entity.ExamStudent;
@@ -244,6 +245,17 @@ public interface PrintCommonService {
      */
     public List<ExamStudent> createBatchStudent(Long schoolId, String extendFields, List<String> classIds, Long examDetailCourseId, SysUser sysUser);
 
+    /**
+     * 根据学生集合创建考生考务数据
+     * @param schoolId 学校id
+     * @param extendFields 扩展字段
+     * @param examTaskStudentObjectParamList 学生参数集合
+     * @param examDetailCourseId 考察表id
+     * @param sysUser 请求用户
+     * @return 结果
+     */
+    List<ExamStudent> createBatchStudentByStudentList(Long schoolId, String extendFields, List<ExamTaskStudentObjectParam> examTaskStudentObjectParamList, Long examDetailCourseId, SysUser sysUser);
+
     /**
      * 生成准考证号
      *

+ 3 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncServiceImpl.java

@@ -18,6 +18,7 @@ import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
+import com.qmth.teachcloud.common.entity.BasicCollege;
 import com.qmth.teachcloud.common.entity.SysOrg;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
@@ -461,8 +462,8 @@ public class DataSyncServiceImpl implements DataSyncService {
                 String examNumber = examStudent.getTicketNumber();
                 String studentCode = examStudent.getStudentCode();
                 String name = examStudent.getStudentName();
-                SysOrg sysOrg = examStudentService.getSysOrgByBelongOrgId(studentCode, schoolId);
-                String college = Objects.nonNull(sysOrg) && StringUtils.isNotBlank(sysOrg.getName()) ? sysOrg.getName() : "无";
+                BasicCollege basicCollege = examStudentService.getBasicCollegeByBelongOrgId(studentCode, schoolId);
+                String college = Objects.nonNull(basicCollege) && StringUtils.isNotBlank(basicCollege.getCollegeName()) ? basicCollege.getCollegeName() : "无";
                 String className = StringUtils.isBlank(examStudent.getClazzName()) ? getClassName(examStudent.getExtendFields()) : examStudent.getClazzName();
                 String teacher = "无";
                 String subjectCode = examStudent.getCourseCode() + examStudent.getPaperType() + examStudent.getSequence(); // 取试卷编号

+ 0 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -656,11 +656,6 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
             }
             basicStudentParams.setStudentCode(studentCode);
             basicStudentParams.setStudentName(studentName);
-            basicStudentParams.setCampusId(basicCampusService.getOne(new QueryWrapper<BasicCampus>()
-                            .lambda()
-                            .eq(BasicCampus::getSchoolId, schoolId)
-                            .eq(BasicCampus::getCampusName, campusName))
-                    .getId());
             basicStudentParamsList.add(basicStudentParams);
         }
         examStudentService.saveBatch(examStudentList);

+ 8 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamStudentServiceImpl.java

@@ -13,7 +13,9 @@ import com.qmth.distributed.print.business.entity.ExamStudent;
 import com.qmth.distributed.print.business.mapper.ExamDetailCourseMapper;
 import com.qmth.distributed.print.business.mapper.ExamStudentMapper;
 import com.qmth.distributed.print.business.service.ExamStudentService;
+import com.qmth.teachcloud.common.entity.BasicCollege;
 import com.qmth.teachcloud.common.entity.SysOrg;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
@@ -96,8 +98,12 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
     }
 
     @Override
-    public SysOrg getSysOrgByBelongOrgId(String studentCode, Long schoolId) {
-        return this.baseMapper.getSysOrgByBelongOrgId(studentCode, schoolId);
+    public BasicCollege getBasicCollegeByBelongOrgId(String studentCode, Long schoolId) {
+        List<BasicCollege> basicCollegeList = this.baseMapper.getBasicCollegeByBelongOrgId(studentCode, schoolId);
+        if (basicCollegeList.size() != 1){
+            throw ExceptionResultEnum.ERROR.exception("学生学院数据异常");
+        }
+        return basicCollegeList.get(0);
     }
 
     @Override

+ 166 - 20
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -1,5 +1,6 @@
 package com.qmth.distributed.print.business.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -13,15 +14,19 @@ import com.qmth.distributed.print.business.bean.dto.approvalForm.*;
 import com.qmth.distributed.print.business.bean.dto.examObject.ExamObjectDto;
 import com.qmth.distributed.print.business.bean.params.*;
 import com.qmth.distributed.print.business.bean.result.WorkResult;
+import com.qmth.distributed.print.business.bean.result.examTaskStudent.ExamTaskStudentObjectResult;
+import com.qmth.distributed.print.business.bean.result.examTaskStudent.StudentInfo;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.mapper.ExamTaskMapper;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.templete.execute.AsyncPaperReviewPdfExportService;
+import com.qmth.distributed.print.business.templete.service.TaskLogicService;
 import com.qmth.distributed.print.business.util.CreatePdfUtil;
 import com.qmth.distributed.print.business.util.HtmlToPdfUtil;
 import com.qmth.teachcloud.common.bean.dto.BlurryUserDto;
 import com.qmth.teachcloud.common.bean.dto.MqDto;
+import com.qmth.teachcloud.common.bean.result.BasicStudentResult;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.*;
@@ -51,6 +56,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.*;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * <p>
@@ -186,6 +192,24 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
     @Resource
     DictionaryConfig dictionaryConfig;
 
+    @Resource
+    TeachStudentService teachStudentService;
+
+    @Resource
+    TeachClazzService teachClazzService;
+
+    @Resource
+    BasicStudentService basicStudentService;
+
+    @Resource
+    BasicClazzService basicClazzService;
+
+    @Resource
+    TeachCourseService teachCourseService;
+
+    @Resource
+    TaskLogicService taskLogicService;
+
     @Override
     public List<ExamTask> listByCourseCode(Long schoolId, String code) {
         QueryWrapper<ExamTask> queryWrapper = new QueryWrapper<>();
@@ -1581,7 +1605,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                         examDetailCourseService.save(examDetailCourse);
 
                         // 更新实际考生数量
-                        List<ExamStudent> examStudents = printCommonService.createBatchStudent(schoolId, examDetailList.getExtendFields(), classIds, examDetailCourse.getId(), sysUser);
+                        List<ExamTaskStudentObjectParam> examTaskStudentObjectParamList = examDetailList.getExamTaskStudentObjectParamList();
+                        List<ExamStudent> examStudents = printCommonService.createBatchStudentByStudentList(schoolId,examDetailList.getExtendFields(),examTaskStudentObjectParamList,examDetailCourse.getId(),sysUser);
                         if (!CollectionUtils.isEmpty(examStudents)) {
                             examStudentService.insertBatch(examStudents);
                         }
@@ -1672,26 +1697,24 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         String paperNumber = examTask.getPaperNumber();
         String paperName = basicSemesterService.getById(basicExamService.getById(examTask.getExamId()).getSemesterId()).getName();
         Long teachingRoomId = examTask.getTeachingRoomId();
-//        SysOrg teachingRoom = sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getId, teachingRoomId).eq(SysOrg::getType, OrgTypeEnum.TEACHING_ROOM));
-//        if (Objects.isNull(teachingRoom)) {
-//            throw ExceptionResultEnum.ERROR.exception("找不到教研室");
-//        }
-        SysOrg teachingRoom = null;
+        SysOrg teachingRoom = sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getId, teachingRoomId));
+        if (Objects.isNull(teachingRoom)) {
+            throw ExceptionResultEnum.ERROR.exception("找不到教研室");
+        }
         String teachingRoomName = teachingRoom.getName();
 
         // 查询教研室所在学院
-//        List<SysOrg> collegeList = sysOrgService.findParentsByOrgId(teachingRoom.getId())
-//                .stream()
-//                .filter(e -> OrgTypeEnum.COLLEGE.equals(e.getType()))
-//                .collect(Collectors.toList());
-        List<SysOrg> collegeList = null;
-//        List<SysOrg> collegeList = sysOrgService.findByConnectByParentId(teachingRoom.getId(),true)
-//                .stream()
-//                .filter(e -> OrgTypeEnum.COLLEGE.equals(e.getType()))
-//                .collect(Collectors.toList());
-        if (CollectionUtils.isEmpty(collegeList)) {
-            throw ExceptionResultEnum.ERROR.exception("找不到学院");
+        List<SysOrg> orgList = sysOrgService.findParentsByOrgId(teachingRoom.getId());
+        List<SysOrg> schoolOrgList = orgList.stream().filter(e -> OrgTypeEnum.SCHOOL.equals(e.getType())).collect(Collectors.toList());
+        if (schoolOrgList.size() != 1){
+            throw ExceptionResultEnum.ERROR.exception("学校级机构信息异常");
+        }
+        SysOrg schoolOrg = schoolOrgList.get(0);
+        List<SysOrg> collegeList = orgList.stream().filter(e -> Objects.equals(schoolOrg.getId(), e.getParentId())).collect(Collectors.toList());
+        if (collegeList.size() != 1){
+            throw ExceptionResultEnum.ERROR.exception("学院级机构信息异常");
         }
+
         SysOrg college = collegeList.get(0);
 
 
@@ -1708,9 +1731,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         }
 
         // 2.ExamRoomInfo 部分
-//        List<PrintPlanStatusEnum> printPlanStatusEnumList = new ArrayList<>();
-//        printPlanStatusEnumList.add(PrintPlanStatusEnum.PRINTING);
-//        printPlanStatusEnumList.add(PrintPlanStatusEnum.PRINT_FINISH);
         List<ExamPackageDetail> examPackageDetailDatasource = this.baseMapper.findExamPackageDetailByPaperNumber(schoolId, examTask.getExamId(), examTask.getCourseCode(), paperNumber, null);
         if (examPackageDetailDatasource.size() == 0) {
             throw ExceptionResultEnum.ERROR.exception("缺少该命题任务对应的考务数据");
@@ -1818,6 +1838,132 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
         return this.baseMapper.getByExamTaskId(examTaskId);
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public List<ExamTaskStudentObjectResult> findExamTaskStudentObject(ExamObjectType examObjectType, Long basicCourseId, MultipartFile file, SysUser requestUser) throws Exception {
+        Long schoolId = requestUser.getSchoolId();
+        Long userId = requestUser.getId();
+        List<ExamTaskStudentObjectResult> result = new ArrayList<>();
+        switch (examObjectType) {
+            case TEACH_CLAZZ_STUDENT:
+                TeachCourse teachCourse = teachCourseService.getOne(new QueryWrapper<TeachCourse>().lambda().eq(TeachCourse::getSchoolId,schoolId).eq(TeachCourse::getBasicCourseId,basicCourseId));
+                if (Objects.isNull(teachCourse)){
+                    throw ExceptionResultEnum.ERROR.exception("未找到教学课程");
+                }
+
+                // 教学班对象
+                List<TeachStudent> teachStudentDatasource = teachStudentService.list(new QueryWrapper<TeachStudent>().lambda().eq(TeachStudent::getSchoolId, schoolId).eq(TeachStudent::getUserId, userId).eq(TeachStudent::getTeachCourseId,teachCourse.getId()));
+
+                // 教学班id集合
+                List<Long> teachClazzIdList = teachStudentDatasource.stream().map(TeachStudent::getTeachClazzId).distinct().collect(Collectors.toList());
+                for (Long teachClazzId : teachClazzIdList) {
+                    TeachClazz teachClazz = teachClazzService.getById(teachClazzId);
+                    if (Objects.isNull(teachClazz)) {
+                        throw ExceptionResultEnum.ERROR.exception("教学班数据异常");
+                    }
+                    List<TeachStudent> teachStudentList = teachStudentDatasource.stream().filter(e -> e.getTeachClazzId().equals(teachClazzId)).collect(Collectors.toList());
+
+                    // 获取学生信息数据
+                    List<StudentInfo> studentInfoList = teachStudentList.stream().flatMap(e -> {
+                        Long studentId = e.getStudentId();
+                        if (!SystemConstant.longNotNull(studentId)) {
+                            throw ExceptionResultEnum.ERROR.exception("教学学生数据异常");
+                        }
+                        BasicStudentResult basicStudentResult = basicStudentService.findById(studentId);
+                        if (Objects.isNull(basicStudentResult)) {
+                            throw ExceptionResultEnum.ERROR.exception("未找到对应的基础学生数据");
+                        }
+                        StudentInfo studentInfo = new StudentInfo();
+                        studentInfo.setStudentId(studentId);
+                        studentInfo.setStudentCode(basicStudentResult.getStudentCode());
+                        studentInfo.setStudentName(basicStudentResult.getStudentName());
+                        studentInfo.setCollegeName(basicStudentResult.getCollegeName());
+                        studentInfo.setMajorName(basicStudentResult.getMajorName());
+                        studentInfo.setTeachClazzId(teachClazzId);
+                        studentInfo.setTeachClazzName(teachClazz.getTeachClazzName());
+                        studentInfo.setBasicClazzId(basicStudentResult.getClazzId());
+                        studentInfo.setBasicClazzName(basicStudentResult.getClazz());
+                        return Stream.of(studentInfo);
+                    }).collect(Collectors.toList());
+
+                    ExamTaskStudentObjectResult examTaskStudentObjectResult = new ExamTaskStudentObjectResult();
+                    examTaskStudentObjectResult.setClazzId(teachClazzId);
+                    examTaskStudentObjectResult.setClazzName(teachClazz.getTeachClazzName());
+                    examTaskStudentObjectResult.setStudentInfoList(studentInfoList);
+                    examTaskStudentObjectResult.setStudentClazzType(examObjectType.getStudentClazzType());
+                    result.add(examTaskStudentObjectResult);
+                }
+                break;
+            case BASIC_CLAZZ_STUDENT:
+                // 基础班级对象
+                List<BasicClazz> basicClazzList = basicClazzService.list(new QueryWrapper<BasicClazz>()
+                        .lambda()
+                        .eq(BasicClazz::getSchoolId, schoolId)
+                        .eq(BasicClazz::getEnable, true)
+                        .orderByAsc(BasicClazz::getClazzName));
+
+                for (BasicClazz basicClazz : basicClazzList) {
+                    Long basicClazzId = basicClazz.getId();
+                    List<BasicStudentResult> basicStudentResultList = basicStudentService.basicStudentList(schoolId, null, null, basicClazzId, null);
+                    List<StudentInfo> studentInfoList = basicStudentResultList.stream().flatMap(e -> {
+                        StudentInfo studentInfo = new StudentInfo();
+                        studentInfo.setStudentId(e.getId());
+                        studentInfo.setStudentCode(e.getStudentCode());
+                        studentInfo.setStudentName(e.getStudentName());
+                        studentInfo.setCollegeName(e.getCollegeName());
+                        studentInfo.setMajorName(e.getMajorName());
+                        studentInfo.setBasicClazzId(e.getClazzId());
+                        studentInfo.setBasicClazzName(e.getClazz());
+                        return Stream.of(studentInfo);
+                    }).collect(Collectors.toList());
+                    ExamTaskStudentObjectResult examTaskStudentObjectResult = new ExamTaskStudentObjectResult();
+                    examTaskStudentObjectResult.setClazzId(basicClazzId);
+                    examTaskStudentObjectResult.setClazzName(basicClazz.getClazzName());
+                    examTaskStudentObjectResult.setStudentInfoList(studentInfoList);
+                    examTaskStudentObjectResult.setStudentClazzType(examObjectType.getStudentClazzType());
+                    result.add(examTaskStudentObjectResult);
+                }
+                break;
+            case IMPORT_STUDENT:
+                // 学生导入
+                if (Objects.isNull(file)) {
+                    throw ExceptionResultEnum.ERROR.exception("缺少导入文件");
+                }
+                Map<String, Object> studentImportMap = new HashMap<>();
+                studentImportMap.put("inputStream", file.getInputStream());
+                studentImportMap.put(SystemConstant.SYS_USER, requestUser);
+                taskLogicService.executeImportBasicStudentLogic(studentImportMap);
+                List<String> studentCodeList = JSONObject.parseArray(JSON.toJSONString(studentImportMap.get("studentCodeList")),String.class);
+
+                // 导入的学生信息查询
+                List<BasicStudentResult> basicStudentResultDatasource = basicStudentService.basicStudentList(schoolId, null, null, null, studentCodeList);
+                List<Long> basicClazzIdList = basicStudentResultDatasource.stream().map(BasicStudentResult::getClazzId).distinct().collect(Collectors.toList());
+                for (Long basicClazzId : basicClazzIdList) {
+                    List<BasicStudentResult> basicStudentResultList = basicStudentResultDatasource.stream()
+                            .filter(e -> basicClazzId.equals(e.getClazzId())).collect(Collectors.toList());
+                    List<StudentInfo> studentInfoList = basicStudentResultList.stream().flatMap(e -> {
+                        StudentInfo studentInfo = new StudentInfo();
+                        studentInfo.setStudentId(e.getId());
+                        studentInfo.setStudentCode(e.getStudentCode());
+                        studentInfo.setStudentName(e.getStudentName());
+                        studentInfo.setCollegeName(e.getCollegeName());
+                        studentInfo.setMajorName(e.getMajorName());
+                        studentInfo.setBasicClazzId(e.getClazzId());
+                        studentInfo.setBasicClazzName(e.getClazz());
+                        return Stream.of(studentInfo);
+                    }).collect(Collectors.toList());
+                    ExamTaskStudentObjectResult examTaskStudentObjectResult = new ExamTaskStudentObjectResult();
+                    examTaskStudentObjectResult.setClazzId(basicClazzId);
+                    examTaskStudentObjectResult.setClazzName(basicClazzService.getById(basicClazzId).getClazzName());
+                    examTaskStudentObjectResult.setStudentInfoList(studentInfoList);
+                    examTaskStudentObjectResult.setStudentClazzType(examObjectType.getStudentClazzType());
+                    result.add(examTaskStudentObjectResult);
+                }
+                break;
+        }
+        return result;
+    }
+
     /**
      * 简单校验提交参数
      *

+ 74 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java

@@ -13,10 +13,12 @@ import com.itextpdf.text.pdf.PdfReader;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.boot.tools.models.ByteArray;
 import com.qmth.distributed.print.business.bean.dto.PdfDto;
+import com.qmth.distributed.print.business.bean.params.ExamTaskStudentObjectParam;
 import com.qmth.distributed.print.business.bean.params.SerialNumberParams;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
+import com.qmth.distributed.print.business.enums.StudentClazzEnum;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.util.HtmlToPdfUtil;
 import com.qmth.distributed.print.business.util.PdfUtil;
@@ -133,6 +135,15 @@ public class PrintCommonServiceImpl implements PrintCommonService {
     @Resource
     GradeBatchPaperService gradeBatchPaperService;
 
+    @Resource
+    BasicStudentService basicStudentService;
+
+    @Resource
+    TeachClazzService teachClazzService;
+
+    @Resource
+    BasicClazzService basicClazzService;
+
     /**
      * 保存附件
      *
@@ -1090,6 +1101,69 @@ public class PrintCommonServiceImpl implements PrintCommonService {
         return examStudentAll;
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public List<ExamStudent> createBatchStudentByStudentList(Long schoolId, String extendFields, List<ExamTaskStudentObjectParam> examTaskStudentObjectParamList, Long examDetailCourseId, SysUser sysUser) {
+        AtomicInteger atomicInteger = new AtomicInteger(1);
+        SerialNumberParams ticketNumberParams = new SerialNumberParams("ticketNumber-" + schoolId, DateUtil.format(new Date(), "yyyyMM"), 6);
+
+        List<ExamStudent> examStudentList = new ArrayList<>();
+        for (ExamTaskStudentObjectParam student : examTaskStudentObjectParamList) {
+            Long studentId = student.getStudentId();
+            Long teachClazzId = student.getTeachClazzId();
+            Long basicClazzId = student.getBasicClazzId();
+            StudentClazzEnum studentClazzType = student.getStudentClazzType();
+
+            BasicStudent basicStudent = basicStudentService.getById(studentId);
+            if (Objects.isNull(basicStudent)){
+                throw ExceptionResultEnum.ERROR.exception("未找到基础学生信息");
+            }
+            if (!Objects.equals(basicStudent.getClazzId(), basicClazzId)){
+                throw ExceptionResultEnum.ERROR.exception("行政班数据不一致");
+            }
+            BasicClazz basicClazz = null;
+            if (SystemConstant.longNotNull(basicClazzId)){
+                basicClazz = basicClazzService.getById(basicClazzId);
+                if (Objects.isNull(basicClazz)){
+                    throw ExceptionResultEnum.ERROR.exception("未找到行政班");
+                }
+            }
+
+            TeachClazz teachClazz = null;
+            if (SystemConstant.longNotNull(teachClazzId)){
+                teachClazz = teachClazzService.getById(teachClazzId);
+                if (Objects.isNull(teachClazz)){
+                    throw ExceptionResultEnum.ERROR.exception("未找到教学班");
+                }
+            }
+
+            ExamStudent examStudent = new ExamStudent();
+            examStudent.setSchoolId(schoolId);
+            examStudent.setId(SystemConstant.getDbUuid());
+            examStudent.setOrgId(sysUser.getOrgId());
+            examStudent.setExamDetailCourseId(examDetailCourseId);
+            examStudent.setStudentName(basicStudent.getStudentName());
+            examStudent.setStudentCode(basicStudent.getStudentCode());
+            examStudent.setTicketNumber(createTempNumber(ticketNumberParams));
+            examStudent.setSiteNumber(String.valueOf(atomicInteger.getAndIncrement()));
+            examStudent.setExtendFields(extendFields);
+            examStudent.setCreateId(sysUser.getId());
+            // 行政班数据
+            if (Objects.nonNull(basicClazz)){
+                examStudent.setClazzId(String.valueOf(basicClazz.getId()));
+                examStudent.setClazzName(basicClazz.getClazzName());
+            }
+            // 教学班模式 教学班数据
+            if (Objects.nonNull(teachClazz)){
+                examStudent.setTeachClazzId(teachClazz.getId());
+                examStudent.setTeachClazzName(teachClazz.getTeachClazzName());
+            }
+            examStudent.setStudentClazzType(studentClazzType);
+            examStudentList.add(examStudent);
+        }
+        return examStudentList;
+    }
+
     @Override
     public String createTempNumber(SerialNumberParams serialNumberParams) {
         return convertUtil.getIncre(serialNumberParams.getPrefix(), serialNumberParams.getModel(), serialNumberParams.getDigit());

+ 4 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -1236,6 +1236,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     public Map<String, Object> executeImportBasicStudentLogic(Map<String, Object> map) throws Exception {
         InputStream inputStream = (InputStream) map.get("inputStream");
         System.out.println(inputStream);
+        List<String> studentCodeList = new ArrayList<>();
         List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(BasicStudentImportDto.class, DescribeImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
             List<ExcelError> excelErrorTemp = new ArrayList<>();
             Map<String, String> checkCodeMap = new HashMap<>();
@@ -1253,6 +1254,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     String studentCode = basicStudentImportDto.getStudentCode();
                     String phoneNumber = basicStudentImportDto.getPhoneNumber();
                     String clazzName = basicStudentImportDto.getClazzName();
+                    studentCodeList.add(studentCode);
 
                     // 检验excel中
                     // 检验学号
@@ -1287,6 +1289,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             if (excelErrorTemp.size() > 0) {
                 throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(excelErrorTemp));
             }
+            map.put("studentCodeList",studentCodeList);
             return finalExcelList;
         });
         return basicStudentService.executeBasicStudentImportLogic(finalList, map);
@@ -1476,14 +1479,13 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 for (int y = 0; y < Objects.requireNonNull(basicClazzImportDtoList).size(); y++) {
                     BasicClazzImportDto basicClazzImportDto = (BasicClazzImportDto) basicClazzImportDtoList.get(y);
                     String clazzName = basicClazzImportDto.getClazzName();
-                    String campusName = basicClazzImportDto.getCampusName();
 
                     // 检验excel中
                     // 检验学号
                     if (checkNameMap.containsKey(clazzName)) {
                         throw ExceptionResultEnum.ERROR.exception("导入的excel中包含在重复的【班级名称】:" + clazzName);
                     } else {
-                        checkNameMap.put(clazzName, campusName);
+                        checkNameMap.put(clazzName, clazzName);
                     }
 
                     excelErrorTemp.addAll(ExcelUtil.checkExcelField(basicClazzImportDto, y, i));

+ 6 - 6
distributed-print-business/src/main/resources/mapper/ExamStudentMapper.xml

@@ -25,11 +25,11 @@
     </sql>
     <insert id="insertBatch">
         insert into exam_student (id, school_id, org_id, exam_detail_course_id, student_name, student_code,
-        ticket_number, site_number, extend_fields, clazz_id, clazz_name, campus_name, create_id) values
+        ticket_number, site_number, extend_fields, clazz_id, clazz_name, teach_clazz_id, teach_clazz_name, student_clazz_type, campus_name, create_id) values
         <foreach collection="examStudents" separator="," item="item">
             (#{item.id}, #{item.schoolId}, #{item.orgId}, #{item.examDetailCourseId}, #{item.studentName},
             #{item.studentCode}, #{item.ticketNumber}, #{item.siteNumber}, #{item.extendFields}, #{item.clazzId},
-            #{item.clazzName}, #{item.campusName}, #{item.createId})
+            #{item.clazzName},#{item.teachClazzId},#{item.teachClazzName},#{item.studentClazzType},#{item.campusName}, #{item.createId})
         </foreach>
     </insert>
     <select id="getStudentDetail" resultType="java.util.Map">
@@ -168,12 +168,12 @@
         </where>
         ) t0;
     </select>
-    <select id="getSysOrgByBelongOrgId" resultType="com.qmth.teachcloud.common.entity.SysOrg">
-        SELECT so.id,
-               so.name
+    <select id="getBasicCollegeByBelongOrgId" resultType="com.qmth.teachcloud.common.entity.BasicCollege">
+        SELECT bc.id,
+               bc.college_name
         FROM basic_student bs
                  LEFT JOIN
-             sys_org so ON bs.belong_org_id = so.id
+             basic_college bc ON bs.belong_org_id = bc.id
         WHERE bs.student_code = #{studentCode}
           and bs.school_id = #{schoolId}
     </select>

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

@@ -8,7 +8,7 @@
             ts.id AS id,
             bs.student_name AS studentName,
             bs.student_code AS studentCode,
-            so.name AS belongOrgName,
+            bce.college_name AS belongOrgName,
             bm.name AS majorName,
             bc.clazz_name AS clazzName
         FROM
@@ -16,7 +16,7 @@
                 LEFT JOIN
             basic_student bs ON ts.student_id = bs.id
                 LEFT JOIN
-            sys_org so ON bs.belong_org_id = so.id
+            basic_college bce ON bs.belong_org_id = bce.id
                 LEFT JOIN
             basic_major bm ON bs.major_id = bm.id
                 LEFT JOIN

+ 68 - 0
distributed-print/src/main/java/com/qmth/distributed/print/api/BasicCollegeController.java

@@ -0,0 +1,68 @@
+package com.qmth.distributed.print.api;
+
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.distributed.print.business.bean.result.EditResult;
+import com.qmth.teachcloud.common.bean.params.BasicCollegeParams;
+import com.qmth.teachcloud.common.bean.result.BasicCollegeResult;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.SysUser;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.service.BasicCollegeService;
+import com.qmth.teachcloud.common.util.Result;
+import com.qmth.teachcloud.common.util.ResultUtil;
+import com.qmth.teachcloud.common.util.ServletUtil;
+import io.swagger.annotations.*;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 基础学院前端控制器
+ * @Author: CaoZixuan
+ * @Date: 2022-08-17
+ */
+@Api(tags = "学生学院管理controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.basic}/college")
+public class BasicCollegeController {
+    @Resource
+    private BasicCollegeService basicCollegeService;
+
+    @ApiOperation(value = "学生学院管理-查询")
+    @RequestMapping(value = "/query", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = BasicCollegeResult.class)})
+    public Result findBasicCollegeList(@ApiParam(value = "学生学院名称") @RequestParam(required = false) String collegeName,
+                                       @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                                       @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
+        return ResultUtil.ok(basicCollegeService.basicCollegePage(schoolId, collegeName, pageNumber, pageSize));
+    }
+
+    @ApiOperation(value = "学生学院管理-新增/编辑")
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "更新成功", response = EditResult.class)})
+    public Result saveBasicCollege(@Valid @RequestBody BasicCollegeParams basicCollegeParams, BindingResult bindingResult) throws IllegalAccessException {
+        if (bindingResult.hasErrors()) {
+            return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
+        }
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        return ResultUtil.ok(basicCollegeService.saveBasicCollege(basicCollegeParams, sysUser));
+    }
+
+    @ApiOperation(value = "学生学院管理-删除")
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "删除成功", response = EditResult.class)})
+    public Result deleteBasicCollege(@ApiParam(value = "学生学院id", required = true) @RequestParam List<String> idList) {
+        if (idList.size() == 0) {
+            throw ExceptionResultEnum.ERROR.exception("请选择要删除的学生学院");
+        }
+        List<Long> newIdList = idList.stream().map(SystemConstant::convertIdToLong).collect(Collectors.toList());
+        return ResultUtil.ok(basicCollegeService.deleteBasicCollegeByIdList(newIdList));
+    }
+}

+ 3 - 6
distributed-print/src/main/java/com/qmth/distributed/print/api/BasicStudentController.java

@@ -53,7 +53,6 @@ public class BasicStudentController {
     @RequestMapping(value = "/query", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
     public Result findBasicStudentList(@ApiParam(value = "查询参数(学生学号或姓名)") @RequestParam(required = false) String queryParams,
-                                       @ApiParam(value = "校区主键") @RequestParam(required = false) String campusId,
                                        @ApiParam(value = "学院主键") @RequestParam(required = false) String collegeId,
                                        @ApiParam(value = "专业主键") @RequestParam(required = false) String majorId,
                                        @ApiParam(value = "班级主键") @RequestParam(required = false) String clazzId,
@@ -65,7 +64,7 @@ public class BasicStudentController {
         } else {
             clazzIdSet = null;
         }
-        return ResultUtil.ok(basicStudentService.basicStudentPage(queryParams, SystemConstant.convertIdToLong(campusId), SystemConstant.convertIdToLong(collegeId), SystemConstant.convertIdToLong(majorId), clazzIdSet, pageNumber, pageSize));
+        return ResultUtil.ok(basicStudentService.basicStudentPage(queryParams, SystemConstant.convertIdToLong(collegeId), SystemConstant.convertIdToLong(majorId), clazzIdSet, pageNumber, pageSize));
     }
 
     @ApiOperation(value = "学生基本信息管理-新增/编辑")
@@ -90,7 +89,6 @@ public class BasicStudentController {
     @RequestMapping(value = "/delete_by_condition", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
     public Result deleteBasicStudentByCondition(@ApiParam(value = "查询参数(学生学号或姓名)") @RequestParam(required = false) String queryParams,
-                                                @ApiParam(value = "校区主键") @RequestParam(required = false) String campusId,
                                                 @ApiParam(value = "学院主键") @RequestParam(required = false) String collegeId,
                                                 @ApiParam(value = "专业主键") @RequestParam(required = false) String majorId,
                                                 @ApiParam(value = "班级主键") @RequestParam(required = false) String clazzId) {
@@ -100,11 +98,10 @@ public class BasicStudentController {
         } else {
             clazzIdSet = null;
         }
-        if (!SystemConstant.strNotNull(queryParams) && !SystemConstant.strNotNull(campusId) && !SystemConstant.strNotNull(collegeId) && !SystemConstant.strNotNull(majorId) && clazzIdSet == null) {
+        if (!SystemConstant.strNotNull(queryParams) && !SystemConstant.strNotNull(collegeId) && !SystemConstant.strNotNull(majorId) && clazzIdSet == null) {
             throw ExceptionResultEnum.ERROR.exception("请选择要删除的条件");
         }
-        return ResultUtil.ok(basicStudentService.removeBasicStudentByCondition(queryParams, SystemConstant.convertIdToLong(campusId),
-                SystemConstant.convertIdToLong(collegeId), SystemConstant.convertIdToLong(majorId), clazzIdSet));
+        return ResultUtil.ok(basicStudentService.removeBasicStudentByCondition(queryParams, SystemConstant.convertIdToLong(collegeId), SystemConstant.convertIdToLong(majorId), clazzIdSet));
     }
 
     @ApiOperation(value = "学生基本信息管理-批量导入(异步)")

+ 15 - 5
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskController.java

@@ -1,5 +1,6 @@
 package com.qmth.distributed.print.api;
 
+import com.alibaba.fastjson.JSON;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailCardDto;
@@ -12,10 +13,7 @@ import com.qmth.distributed.print.business.bean.params.ExamTaskPrintParams;
 import com.qmth.distributed.print.business.bean.params.ExamTaskReApplyParam;
 import com.qmth.distributed.print.business.bean.result.EditResult;
 import com.qmth.distributed.print.business.entity.*;
-import com.qmth.distributed.print.business.enums.ExamStatusEnum;
-import com.qmth.distributed.print.business.enums.MakeMethodEnum;
-import com.qmth.distributed.print.business.enums.MessageEnum;
-import com.qmth.distributed.print.business.enums.ReviewStatusEnum;
+import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.templete.execute.AsyncTaskReviewSampleExportService;
 import com.qmth.teachcloud.common.bean.params.ArraysParams;
@@ -35,6 +33,7 @@ import com.qmth.teachcloud.common.util.ServletUtil;
 import io.swagger.annotations.*;
 import org.activiti.engine.TaskService;
 import org.activiti.engine.task.Task;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.annotation.Validated;
@@ -651,6 +650,7 @@ public class ExamTaskController {
     @RequestMapping(value = "/submit_task_apply", method = RequestMethod.POST)
 //    @OperationLogDetail(detail = "入库申请-新建任务(一步到位)",level = LevelEnum.PRIMARY)
     public Result submitTaskApply(@RequestBody ExamTaskApplyTemp examTaskApplyTemp) throws IOException {
+        System.out.println("请求参数 examTaskApplyTemp :\n" + JSON.toJSONString(examTaskApplyTemp));
         ExamTask examTask = examTaskService.submitTaskApply(examTaskApplyTemp);
         if (!examTask.getReview()) {
             // 校验是否可以提交打印状态
@@ -795,7 +795,7 @@ public class ExamTaskController {
                                        @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
                                        @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
         Set<Long> classIds = Arrays.stream(classId.split(",")).map(SystemConstant::convertIdToLong).collect(Collectors.toSet());
-        return ResultUtil.ok(basicStudentService.basicStudentPage(null, null, null, null, classIds, pageNumber, pageSize));
+        return ResultUtil.ok(basicStudentService.basicStudentPage(null, null, null, classIds, pageNumber, pageSize));
     }
 
     /**
@@ -843,5 +843,15 @@ public class ExamTaskController {
         return ResultUtil.ok((Object) examTaskService.findExamObjectDtoByPaperNumber(paperNumber));
     }
 
+    @ApiOperation(value = "入库申请-考生对象查询")
+    @RequestMapping(value = "/find_exam_task_student_object", method = RequestMethod.POST)
+    @Transactional(rollbackFor = Exception.class)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
+    public Result findExamTaskStudentObject(@RequestParam(required = false) MultipartFile file,
+                                            @RequestParam ExamObjectType examObjectType,
+                                            @RequestParam(required = false) String basicCourseId) throws Exception {
+        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
+        return ResultUtil.ok(examTaskService.findExamTaskStudentObject(examObjectType, SystemConstant.convertIdToLong(basicCourseId), file, requestUser));
+    }
 }
 

+ 6 - 30
distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java

@@ -110,7 +110,7 @@ public class SysController {
     TBSyncTaskService tbSyncTaskService;
 
     @Resource
-    BasicCampusService basicCampusService;
+    BasicCollegeService basicCollegeService;
 
     @Resource
     AuthInfoService authInfoService;
@@ -571,26 +571,14 @@ public class SysController {
     @ApiOperation(value = "共用接口-查询字典")
     @RequestMapping(value = "/get_dictionary", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
-    public Result findDictionaryList(@ApiParam(value = "校区id") @RequestParam(required = false) String campusId,
-                                     @ApiParam(value = "学期id") @RequestParam(required = false) String semesterId,
-                                     @ApiParam(value = "学院id") @RequestParam(required = false) String collegeId,
+    public Result findDictionaryList(@ApiParam(value = "学生学院id") @RequestParam(required = false) String collegeId,
                                      @ApiParam(value = "专业id") @RequestParam(required = false) String majorId,
                                      @ApiParam(value = "班级id") @RequestParam(required = false) String clazzId,
                                      @ApiParam(value = "学生id") @RequestParam(required = false) String studentId,
-                                     @ApiParam(value = "查询字典对象") @RequestParam(required = true) DictionaryEnum dictionaryEnum) {
+                                     @ApiParam(value = "查询字典对象",required = true) @RequestParam DictionaryEnum dictionaryEnum) {
         Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
         List<DictionaryResult> dictionaryResultList = new ArrayList<>();
         switch (dictionaryEnum) {
-            case CAMPUS:
-                List<BasicCampus> basicCampusList = basicCampusService.list(new QueryWrapper<BasicCampus>().lambda().eq(BasicCampus::getSchoolId, schoolId));
-                dictionaryResultList = basicCampusList.stream().map(e -> {
-                    DictionaryResult dictionaryResult = new DictionaryResult();
-                    dictionaryResult.setName(e.getCampusName());
-                    dictionaryResult.setCode(e.getCampusCode());
-                    dictionaryResult.setId(e.getId());
-                    return dictionaryResult;
-                }).collect(Collectors.toList());
-                break;
             case SEMESTER:
                 List<BasicSemester> basicSemesterList = basicSemesterService.list(new QueryWrapper<BasicSemester>().lambda().eq(BasicSemester::getSchoolId, schoolId).eq(BasicSemester::getEnable, true));
                 dictionaryResultList = basicSemesterList.stream().map(e -> {
@@ -602,12 +590,11 @@ public class SysController {
                 }).collect(Collectors.toList());
                 break;
             case COLLEGE:
-                List<SysOrg> sysOrgList = sysOrgService.findDeepByOrgIdAndType(null);
-                dictionaryResultList = sysOrgList.stream().map(e -> {
+                List<BasicCollege> basicCollegeList = basicCollegeService.list();
+                dictionaryResultList = basicCollegeList.stream().map(e -> {
                     DictionaryResult dictionaryResult = new DictionaryResult();
                     dictionaryResult.setId(e.getId());
-                    dictionaryResult.setCode(e.getCode());
-                    dictionaryResult.setName(e.getName());
+                    dictionaryResult.setName(e.getCollegeName());
                     return dictionaryResult;
                 }).collect(Collectors.toList());
                 break;
@@ -682,9 +669,6 @@ public class SysController {
             case CLAZZ:
                 QueryWrapper<BasicClazz> clazzQueryWrapper = new QueryWrapper<>();
                 clazzQueryWrapper.lambda().eq(BasicClazz::getSchoolId, schoolId).eq(BasicClazz::getEnable, true);
-                if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(campusId))) {
-                    clazzQueryWrapper.lambda().eq(BasicClazz::getCampusId, campusId);
-                }
                 if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(majorId))) {
                     clazzQueryWrapper.lambda().eq(BasicClazz::getMajorId, majorId);
                 }
@@ -703,9 +687,6 @@ public class SysController {
             case ALL_CLAZZ: //针对归档管理临时处理用
                 QueryWrapper<BasicClazz> basicClazzQueryWrapper = new QueryWrapper<>();
                 basicClazzQueryWrapper.lambda().eq(BasicClazz::getSchoolId, schoolId).eq(BasicClazz::getEnable, true);
-                if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(campusId))) {
-                    basicClazzQueryWrapper.lambda().eq(BasicClazz::getCampusId, campusId);
-                }
                 if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(majorId))) {
                     basicClazzQueryWrapper.lambda().eq(BasicClazz::getMajorId, majorId);
                 }
@@ -740,9 +721,6 @@ public class SysController {
             case STUDENT:
                 QueryWrapper<BasicStudent> studentQueryWrapper = new QueryWrapper<>();
                 studentQueryWrapper.lambda().eq(BasicStudent::getSchoolId, schoolId).eq(BasicStudent::getEnable, true);
-                if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(campusId))) {
-                    studentQueryWrapper.lambda().eq(BasicStudent::getCampusId, campusId);
-                }
                 if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(collegeId))) {
                     studentQueryWrapper.lambda().eq(BasicStudent::getBelongOrgId, collegeId);
                 }
@@ -764,8 +742,6 @@ public class SysController {
                     return dictionaryResult;
                 }).collect(Collectors.toList());
                 break;
-            default:
-                break;
         }
         return ResultUtil.ok(dictionaryResultList);
     }

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

@@ -15,7 +15,6 @@ import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import io.swagger.annotations.*;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;

+ 23 - 2
distributed-print/src/test/java/com/qmth/distributed/print/ServiceTest.java

@@ -3,12 +3,13 @@ package com.qmth.distributed.print;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.qmth.boot.tools.io.IOUtils;
 import com.qmth.distributed.print.business.bean.dto.examObject.ExamObjectDto;
 import com.qmth.distributed.print.business.bean.marking.CardJpgResult;
-import com.qmth.distributed.print.business.bean.result.TemplatePrintInfoResult;
 import com.qmth.distributed.print.business.entity.ExamCardDetail;
 import com.qmth.distributed.print.business.entity.ExamPrintPlan;
 import com.qmth.distributed.print.business.entity.ExamStudent;
+import com.qmth.distributed.print.business.enums.ExamObjectType;
 import com.qmth.distributed.print.business.enums.MessageEnum;
 import com.qmth.distributed.print.business.mapper.ExamStudentMapper;
 import com.qmth.distributed.print.business.service.*;
@@ -16,17 +17,21 @@ import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
 import com.qmth.teachcloud.common.entity.BasicCourse;
 import com.qmth.teachcloud.common.entity.BasicPrintConfig;
+import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.service.BasicCourseService;
 import com.qmth.teachcloud.common.service.BasicVerifyCodeService;
 import com.qmth.teachcloud.common.util.ConvertUtil;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -186,4 +191,20 @@ public class ServiceTest {
         System.out.println(JSON.toJSONString(resultList));
     }
 
+    @Test
+    public void testFindExamObject() throws Exception {
+        Long basicCourseId = 293036122005573632L;
+        ExamObjectType examObjectType = ExamObjectType.TEACH_CLAZZ_STUDENT;
+
+        File file = new File("E:" + File.separator + "file" + File.separator + "学生导入模板.xlsx");
+        FileInputStream input = new FileInputStream(file);
+        MultipartFile multipartFile =new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(input));
+
+        SysUser requestUser = new SysUser();
+        requestUser.setId(293030757817909248L);
+        requestUser.setSchoolId(292366699577999360L);
+
+        System.out.println(JSON.toJSONString(examTaskService.findExamTaskStudentObject(examObjectType,basicCourseId,multipartFile,requestUser)));
+    }
+
 }

+ 2 - 18
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/dto/TaskPrintClassDto.java

@@ -9,8 +9,8 @@ public class TaskPrintClassDto {
 
     private String classId;
     private String className;
-    private String printHouseId;
-    private String printHouseName;
+//    private String printHouseId;
+//    private String printHouseName;
     private Integer studentCount;
     private TeachBasicEnum teachBasicEnum;
 
@@ -30,22 +30,6 @@ public class TaskPrintClassDto {
         this.className = className;
     }
 
-    public String getPrintHouseId() {
-        return printHouseId;
-    }
-
-    public void setPrintHouseId(String printHouseId) {
-        this.printHouseId = printHouseId;
-    }
-
-    public String getPrintHouseName() {
-        return printHouseName;
-    }
-
-    public void setPrintHouseName(String printHouseName) {
-        this.printHouseName = printHouseName;
-    }
-
     public Integer getStudentCount() {
         return studentCount;
     }

+ 0 - 12
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/dto/excel/BasicClazzImportDto.java

@@ -17,10 +17,6 @@ public class BasicClazzImportDto implements Serializable {
     @NotNull
     private String clazzName;
 
-    @ExcelNote(value = "校区名称")
-    @NotNull
-    private String campusName;
-
     public String getClazzName() {
         return clazzName;
     }
@@ -28,12 +24,4 @@ public class BasicClazzImportDto implements Serializable {
     public void setClazzName(String clazzName) {
         this.clazzName = clazzName;
     }
-
-    public String getCampusName() {
-        return campusName;
-    }
-
-    public void setCampusName(String campusName) {
-        this.campusName = campusName;
-    }
 }

+ 2 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/dto/excel/BasicCourseImportDto.java

@@ -24,8 +24,8 @@ public class BasicCourseImportDto implements Serializable {
     @NotNull
     private String courseCode;
 
-    @ExcelNote(value = "所属教研室")
-    @ExcelProperty(name = "所属教研室", width = 30, index = 3)
+    @ExcelNote(value = "所属部门")
+    @ExcelProperty(name = "所属部门", width = 30, index = 3)
     @NotNull
     private String teachingRoomName;
 

+ 0 - 11
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/dto/excel/BasicStudentImportDto.java

@@ -24,9 +24,6 @@ public class BasicStudentImportDto implements Serializable {
     @ExcelNote(value = "手机号")
     private String phoneNumber;
 
-    @ExcelNote(value = "校区")
-    private String campusName;
-
     @ExcelNote(value = "学院")
     private String collegeName;
 
@@ -60,14 +57,6 @@ public class BasicStudentImportDto implements Serializable {
         this.phoneNumber = phoneNumber;
     }
 
-    public String getCampusName() {
-        return campusName;
-    }
-
-    public void setCampusName(String campusName) {
-        this.campusName = campusName;
-    }
-
     public String getCollegeName() {
         return collegeName;
     }

+ 0 - 15
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/params/BasicClazzParams.java

@@ -21,13 +21,6 @@ public class BasicClazzParams {
     @DBVerify(value = "班级id")
     private Long id;
 
-    @JsonSerialize(using = ToStringSerializer.class)
-    @ApiModelProperty(value = "校区主键")
-    @NotNull(message = "请选择校区")
-    @Range(min = 1L, message = "请选择校区")
-    @DBVerify(value = "校区",required = true)
-    private Long campusId;
-
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "专业id")
     @NotNull(message = "请选择专业")
@@ -53,14 +46,6 @@ public class BasicClazzParams {
         this.id = id;
     }
 
-    public Long getCampusId() {
-        return campusId;
-    }
-
-    public void setCampusId(Long campusId) {
-        this.campusId = campusId;
-    }
-
     public String getClazzCode() {
         return clazzCode;
     }

+ 43 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/params/BasicCollegeParams.java

@@ -0,0 +1,43 @@
+package com.qmth.teachcloud.common.bean.params;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.annotation.DBVerify;
+import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description: 学生学院参数
+ * @Author: CaoZixuan
+ * @Date: 2022-08-17
+ */
+public class BasicCollegeParams {
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "学院id(编辑时必填)")
+    private Long id;
+
+    @ApiModelProperty(value = "学院名称")
+    @NotNull(message = "学院名称")
+    @Length(min = 1,message = "学院名称")
+    @DBVerify(value = "学院名称",required = true)
+    private String collegeName;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getCollegeName() {
+        return collegeName;
+    }
+
+    public void setCollegeName(String collegeName) {
+        this.collegeName = collegeName;
+    }
+}

+ 0 - 13
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/params/BasicStudentParams.java

@@ -5,7 +5,6 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.common.annotation.DBVerify;
 import io.swagger.annotations.ApiModelProperty;
 import org.hibernate.validator.constraints.Length;
-import org.hibernate.validator.constraints.Range;
 
 import javax.validation.constraints.NotNull;
 
@@ -36,10 +35,6 @@ public class BasicStudentParams {
     @ApiModelProperty(value = "手机号码")
     private String phoneNumber;
 
-    @JsonSerialize(using = ToStringSerializer.class)
-    @ApiModelProperty(value = "校区主键")
-    private Long campusId;
-
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "学院主键")
     private Long collegeId;
@@ -84,14 +79,6 @@ public class BasicStudentParams {
         this.phoneNumber = phoneNumber;
     }
 
-    public Long getCampusId() {
-        return campusId;
-    }
-
-    public void setCampusId(Long campusId) {
-        this.campusId = campusId;
-    }
-
     public Long getCollegeId() {
         return collegeId;
     }

+ 0 - 34
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/result/BasicClazzResult.java

@@ -25,16 +25,6 @@ public class BasicClazzResult {
     @ApiModelProperty(value = "班级名称")
     private String clazzName;
 
-    @JsonSerialize(using = ToStringSerializer.class)
-    @ApiModelProperty(value = "校区id")
-    private String campusId;
-
-    @ApiModelProperty(value = "校区名称")
-    private String campusName;
-
-    @ApiModelProperty(value = "校区编号")
-    private String campusCode;
-
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "专业id")
     private String majorId;
@@ -84,30 +74,6 @@ public class BasicClazzResult {
         this.clazzName = clazzName;
     }
 
-    public String getCampusId() {
-        return campusId;
-    }
-
-    public void setCampusId(String campusId) {
-        this.campusId = campusId;
-    }
-
-    public String getCampusName() {
-        return campusName;
-    }
-
-    public void setCampusName(String campusName) {
-        this.campusName = campusName;
-    }
-
-    public String getCampusCode() {
-        return campusCode;
-    }
-
-    public void setCampusCode(String campusCode) {
-        this.campusCode = campusCode;
-    }
-
     public String getMajorId() {
         return majorId;
     }

+ 50 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/result/BasicCollegeResult.java

@@ -0,0 +1,50 @@
+package com.qmth.teachcloud.common.bean.result;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description:
+ * @Author: CaoZixuan
+ * @Date:
+ */
+public class BasicCollegeResult implements Serializable {
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    @ApiModelProperty(value = "学院名称")
+    private String collegeName;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "创建时间")
+    private Long createTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getCollegeName() {
+        return collegeName;
+    }
+
+    public void setCollegeName(String collegeName) {
+        this.collegeName = collegeName;
+    }
+
+    public Long getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Long createTime) {
+        this.createTime = createTime;
+    }
+}

+ 0 - 12
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicClazz.java

@@ -23,10 +23,6 @@ public class BasicClazz extends BaseEntity implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     private Long schoolId;
 
-    @ApiModelProperty(value = "校区id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long campusId;
-
     @ApiModelProperty(value = "专业id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long majorId;
@@ -57,14 +53,6 @@ public class BasicClazz extends BaseEntity implements Serializable {
         this.schoolId = schoolId;
     }
 
-    public Long getCampusId() {
-        return campusId;
-    }
-
-    public void setCampusId(Long campusId) {
-        this.campusId = campusId;
-    }
-
     public String getClazzCode() {
         return clazzCode;
     }

+ 54 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicCollege.java

@@ -0,0 +1,54 @@
+package com.qmth.teachcloud.common.entity;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.base.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 学生学院表
+ * @Author: CaoZixuan
+ * @Date: 2022-08-17
+ */
+@ApiModel(value = "BasicCollege对象", description = "基础学院表")
+public class BasicCollege extends BaseEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "学校id")
+    private Long schoolId;
+
+    @ApiModelProperty(value = "学院名称")
+    private String collegeName;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "数据权限id")
+    private Long orgId;
+
+    public Long getSchoolId() {
+        return schoolId;
+    }
+
+    public void setSchoolId(Long schoolId) {
+        this.schoolId = schoolId;
+    }
+
+    public String getCollegeName() {
+        return collegeName;
+    }
+
+    public void setCollegeName(String collegeName) {
+        this.collegeName = collegeName;
+    }
+
+    public Long getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(Long orgId) {
+        this.orgId = orgId;
+    }
+}

+ 0 - 13
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicStudent.java

@@ -37,11 +37,6 @@ public class BasicStudent extends BaseEntity implements Serializable {
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String phoneNumber;
 
-    @ApiModelProperty(value = "校区主键")
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
-    private Long campusId;
-
     @ApiModelProperty(value = "班级id")
     @JsonSerialize(using = ToStringSerializer.class)
     @TableField(updateStrategy = FieldStrategy.IGNORED)
@@ -116,14 +111,6 @@ public class BasicStudent extends BaseEntity implements Serializable {
         this.phoneNumber = phoneNumber;
     }
 
-    public Long getCampusId() {
-        return campusId;
-    }
-
-    public void setCampusId(Long campusId) {
-        this.campusId = campusId;
-    }
-
     public Long getClazzId() {
         return clazzId;
     }

+ 32 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicCollegeMapper.java

@@ -0,0 +1,32 @@
+package com.qmth.teachcloud.common.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.teachcloud.common.bean.result.BasicCollegeResult;
+import com.qmth.teachcloud.common.bean.result.BasicMajorResult;
+import com.qmth.teachcloud.common.entity.BasicCollege;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Set;
+
+/**
+ * @Description: 学生学院mapper
+ * @Author: CaoZixuan
+ * @Date: 2022-08-17
+ */
+public interface BasicCollegeMapper extends BaseMapper<BasicCollege> {
+    /**
+     * 分页查询基础专业信息
+     *
+     * @param iPage       分页参数
+     * @param schoolId    学校id
+     * @param collegeName 学院名称
+     * @param orgIds      数据权限集合
+     * @return 基础专业分页参数
+     */
+    IPage<BasicCollegeResult> findBasicCollegePage(@Param("iPage") Page<BasicCollegeResult> iPage,
+                                                   @Param("schoolId") Long schoolId,
+                                                   @Param("collegeName") String collegeName,
+                                                   @Param("orgIds") Set<Long> orgIds);
+}

+ 25 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicStudentMapper.java

@@ -27,7 +27,6 @@ public interface BasicStudentMapper extends BaseMapper<BasicStudent> {
     IPage<BasicStudentResult> findBasicStudentPage(@Param("iPage") Page<BasicStudentResult> iPage,
                                                    @Param("queryParams") String queryParams,
                                                    @Param("schoolId") Long schoolId,
-                                                   @Param("campusId") Long campusId,
                                                    @Param("collegeId") Long collegeId,
                                                    @Param("majorId") Long majorId,
                                                    @Param("clazzIdList") Set<Long> clazzIdList,
@@ -35,8 +34,33 @@ public interface BasicStudentMapper extends BaseMapper<BasicStudent> {
 
     /**
      * 根据基础学生主键同步删除教学学生信息
+     *
      * @param idSet 基础学生id集合
      * @return 删除的行数
      */
     int deleteTeachStudentByBasicStudentIdSet(@Param("idSet") Set<Long> idSet);
+
+    /**
+     * 根据id查找学生信息
+     *
+     * @param id id
+     * @return 结果
+     */
+    BasicStudentResult findById(@Param("id") Long id);
+
+    /**
+     * 根据第三方字典id查找学生集合
+     *
+     * @param schoolId        学校id
+     * @param collegeId       学生学院id
+     * @param majorId         专业id
+     * @param clazzId         班级id
+     * @param studentCodeList 学号集合
+     * @return 学生查询结果
+     */
+    List<BasicStudentResult> findBasicStudentList(@Param("schoolId") Long schoolId,
+                                                  @Param("collegeId") Long collegeId,
+                                                  @Param("majorId") Long majorId,
+                                                  @Param("clazzId") Long clazzId,
+                                                  @Param("studentCodeList") List<String> studentCodeList);
 }

+ 42 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicCollegeService.java

@@ -0,0 +1,42 @@
+package com.qmth.teachcloud.common.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.teachcloud.common.bean.params.BasicCollegeParams;
+import com.qmth.teachcloud.common.bean.result.BasicCollegeResult;
+import com.qmth.teachcloud.common.entity.BasicCollege;
+import com.qmth.teachcloud.common.entity.SysUser;
+
+import java.util.List;
+
+/**
+ * @Description: 学生学院接口服务类
+ * @Author: CaoZixuan
+ * @Date: 2022-08-17
+ */
+public interface BasicCollegeService extends IService<BasicCollege> {
+    
+    /**
+     * 基础专业分页查询
+     * @param schoolId 学校id
+     * @param collegeName 专业名称模糊查询
+     * @param pageNumber 分页页数
+     * @param pageSize 分页容量
+     * @return 分页结果
+     */
+    IPage<BasicCollegeResult> basicCollegePage(Long schoolId, String collegeName, int pageNumber, int pageSize);
+
+    /**
+     * 基础专业编辑
+     * @param basicCollegeParams 编辑参数
+     * @return 编辑后该专业id
+     */
+    Long saveBasicCollege(BasicCollegeParams basicCollegeParams, SysUser requestUser) throws IllegalAccessException;
+
+    /**
+     * 专业删除
+     * @param idList 专业主键id集合
+     * @return 是否删除成功
+     */
+    boolean deleteBasicCollegeByIdList(List<Long> idList);
+}

+ 25 - 6
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicStudentService.java

@@ -32,7 +32,6 @@ public interface BasicStudentService extends IService<BasicStudent> {
      * 学生基础信息分页查询
      *
      * @param queryParams 查询参数(学生学号或姓名)
-     * @param campusId    校区主键
      * @param collegeId   校区主键
      * @param majorId     专业主键
      * @param clazzIdList 班级主键集合
@@ -40,7 +39,27 @@ public interface BasicStudentService extends IService<BasicStudent> {
      * @param pageSize    分页容量
      * @return 分页结果
      */
-    IPage<BasicStudentResult> basicStudentPage(String queryParams, Long campusId, Long collegeId, Long majorId, Set<Long> clazzIdList, int pageNumber, int pageSize);
+    IPage<BasicStudentResult> basicStudentPage(String queryParams, Long collegeId, Long majorId, Set<Long> clazzIdList, int pageNumber, int pageSize);
+
+    /**
+     * 根据id查询基础学生数据
+     *
+     * @param id 学生id
+     * @return 学生信息
+     */
+    BasicStudentResult findById(Long id);
+
+    /**
+     * 学生基础信息查询
+     *
+     * @param schoolId        学校id
+     * @param collegeId       学院id
+     * @param majorId         专业id
+     * @param clazzId         班级id
+     * @param studentCodeList 学号集合
+     * @return 学生查询结果
+     */
+    List<BasicStudentResult> basicStudentList(Long schoolId, Long collegeId, Long majorId, Long clazzId, List<String> studentCodeList);
 
     /**
      * 新增/编辑 学生基础信息
@@ -69,14 +88,14 @@ public interface BasicStudentService extends IService<BasicStudent> {
 
     /**
      * 根据条件删除基础学生信息
+     *
      * @param queryParams 学生参数(学号或姓名)
-     * @param campusId 校区主键
-     * @param collegeId 学院主键
-     * @param majorId 专业主键
+     * @param collegeId   学院主键
+     * @param majorId     专业主键
      * @param clazzIdList 班级主键集合
      * @return 是否删除成功
      */
-    Boolean removeBasicStudentByCondition(String queryParams, Long campusId, Long collegeId, Long majorId, Set<Long> clazzIdList);
+    Boolean removeBasicStudentByCondition(String queryParams, Long collegeId, Long majorId, Set<Long> clazzIdList);
 
     /**
      * 执行批量导入学生逻辑

+ 20 - 18
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicCampusServiceImpl.java

@@ -102,9 +102,9 @@ public class BasicCampusServiceImpl extends ServiceImpl<BasicCampusMapper, Basic
     @Override
     public Boolean removeBasicCampusById(Long id) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        if (basicClazzService.list(new QueryWrapper<BasicClazz>().lambda().eq(BasicClazz::getCampusId,id)).size() > 0){
-            throw ExceptionResultEnum.ERROR.exception("基础班级中绑定了要删除的校区,无法删除");
-        }
+//        if (basicClazzService.list(new QueryWrapper<BasicClazz>().lambda().eq(BasicClazz::getCampusId,id)).size() > 0){
+//            throw ExceptionResultEnum.ERROR.exception("基础班级中绑定了要删除的校区,无法删除");
+//        }
         return this.removeById(id);
     }
 
@@ -124,20 +124,22 @@ public class BasicCampusServiceImpl extends ServiceImpl<BasicCampusMapper, Basic
 
     @Override
     public String findCampusNamesByClazzIdList(List<Long> clazzIdList, String separator) {
-        String campusNames = "";
-//        Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
-        List<Long> campusId = basicClazzService.list(new QueryWrapper<BasicClazz>().lambda()
-                .in(BasicClazz::getId,clazzIdList))
-                .stream()
-                .map(BasicClazz::getCampusId)
-                .distinct()
-                .collect(Collectors.toList());
-        if (!CollectionUtils.isEmpty(campusId)){
-            List<BasicCampus> basicCampusList = this.list(new QueryWrapper<BasicCampus>().lambda()
-//                    .eq(BasicCampus::getSchoolId,schoolId)
-                    .in(BasicCampus::getId,campusId));
-            campusNames = basicCampusList.stream().map(BasicCampus::getCampusName).distinct().collect(Collectors.joining(separator));
-        }
-        return campusNames;
+        // TODO: 2022/8/17 czx - 校区相关
+//        String campusNames = "";
+////        Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
+//        List<Long> campusId = basicClazzService.list(new QueryWrapper<BasicClazz>().lambda()
+//                .in(BasicClazz::getId,clazzIdList))
+//                .stream()
+//                .map(BasicClazz::getCampusId)
+//                .distinct()
+//                .collect(Collectors.toList());
+//        if (!CollectionUtils.isEmpty(campusId)){
+//            List<BasicCampus> basicCampusList = this.list(new QueryWrapper<BasicCampus>().lambda()
+////                    .eq(BasicCampus::getSchoolId,schoolId)
+//                    .in(BasicCampus::getId,campusId));
+//            campusNames = basicCampusList.stream().map(BasicCampus::getCampusName).distinct().collect(Collectors.joining(separator));
+//        }
+//        return campusNames;
+        return "";
     }
 }

+ 6 - 50
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicClazzServiceImpl.java

@@ -40,17 +40,13 @@ public class BasicClazzServiceImpl extends ServiceImpl<BasicClazzMapper, BasicCl
     @Resource
     private BasicUserCourseService basicUserCourseService;
     @Resource
-    private BasicCampusService basicCampusService;
-    @Resource
     private BasicMajorService basicMajorService;
 
     @Override
     public IPage<BasicClazzResult> basicClazzPage(String queryParams, int pageNumber, int pageSize) {
         Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
-//        Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
-        Set<Long> orgIds = null;
         queryParams = SystemConstant.translateSpecificSign(queryParams);
-        return basicClazzMapper.findBasicClazzPage(new Page<>(pageNumber, pageSize), queryParams, schoolId, orgIds);
+        return basicClazzMapper.findBasicClazzPage(new Page<>(pageNumber, pageSize), queryParams, schoolId, null);
     }
 
     @Transactional(rollbackFor = Exception.class)
@@ -70,7 +66,6 @@ public class BasicClazzServiceImpl extends ServiceImpl<BasicClazzMapper, BasicCl
         if (idList.size() == 0) {
             throw ExceptionResultEnum.ERROR.exception("请选择要删除的目标");
         }
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         // 业务处理 - 判断'exam_task_print'表中是否已经选中该班级
         List<Map<Object, Object>> mapList = basicClazzMapper.findExamTaskPrintByClazzIdSet(schoolId, idList);
         if (mapList.size() > 0) {
@@ -122,7 +117,6 @@ public class BasicClazzServiceImpl extends ServiceImpl<BasicClazzMapper, BasicCl
     @Deprecated
     public Map<String, Object> executeBasicClazzImportLogic(List<LinkedMultiValueMap<Integer, Object>> finalList, Map<String, Object> map) throws IllegalAccessException {
         SysUser sysUser = (SysUser) map.get(SystemConstant.SYS_USER);
-        Long schoolId = sysUser.getSchoolId();
 
         List<BasicClazzParams> addBasicClazzParamsList = new ArrayList<>();
         for (int i = 0; i < finalList.size(); i++) {
@@ -140,44 +134,13 @@ public class BasicClazzServiceImpl extends ServiceImpl<BasicClazzMapper, BasicCl
             }).collect(Collectors.toList());
             map.put("dataCount", datasource.size());
 
-
-            // 新校区名称集合
-            Set<String> newCampusNameSet = datasource.stream().map(BasicClazzImportDto::getCampusName).collect(Collectors.toSet());
-            // 旧校区集合
-            List<BasicCampus> basicCampusList = basicCampusService.list(new QueryWrapper<BasicCampus>().lambda().eq(BasicCampus::getEnable, true).eq(BasicCampus::getSchoolId, schoolId));
-            Set<String> oldCampusNameSet = basicCampusList.stream().map(BasicCampus::getCampusName).collect(Collectors.toSet());
-
-            // 需要新增的校区集合
-            Set<String> addCampusNameSet = newCampusNameSet.stream().filter(e -> !oldCampusNameSet.contains(e)).collect(Collectors.toSet());
-            List<BasicCampus> addBasicCampusList = new ArrayList<>();
-            for (String campusName : addCampusNameSet) {
-                BasicCampus basicCampus = new BasicCampus();
-                Long id = SystemConstant.getDbUuid();
-                basicCampus.setSchoolId(schoolId);
-                basicCampus.setCampusName(campusName);
-                basicCampus.setId(id);
-                basicCampus.setCampusCode(String.valueOf(id));
-                basicCampus.setEnable(true);
-                basicCampus.setCreateId(sysUser.getId());
-                addBasicCampusList.add(basicCampus);
-            }
-            // 批量新增校区
-            basicCampusService.saveBatch(addBasicCampusList);
-
             for (int y = 0; y < Objects.requireNonNull(basicClazzImportDtoList).size(); y++) {
                 BasicClazzImportDto basicClazzImportDto = (BasicClazzImportDto) basicClazzImportDtoList.get(y);
 
                 // 取值
                 String clazzName = basicClazzImportDto.getClazzName();
-                String campusName = basicClazzImportDto.getCampusName();
-
 
                 BasicClazzParams basicClazzParams = new BasicClazzParams();
-                basicClazzParams.setCampusId(basicCampusService.getOne(new QueryWrapper<BasicCampus>().lambda()
-                                .eq(BasicCampus::getSchoolId, schoolId)
-                                .eq(BasicCampus::getCampusName, campusName)
-                                .eq(BasicCampus::getEnable, true))
-                        .getId());
                 basicClazzParams.setClazzName(clazzName);
 
                 BasicClazz tmp = this.getOne(new QueryWrapper<BasicClazz>().lambda()
@@ -196,16 +159,15 @@ public class BasicClazzServiceImpl extends ServiceImpl<BasicClazzMapper, BasicCl
         return map;
     }
 
+    @Deprecated
     @Override
     public List<ClazzDatasourceResult> findClazzDatasource(Long campusId) {
+        // TODO: 2022/8/17 czx - 废弃方法
         Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
         QueryWrapper<BasicClazz> basicClazzQueryWrapper = new QueryWrapper<>();
 
         basicClazzQueryWrapper.lambda().eq(BasicClazz::getEnable, true)
                 .eq(BasicClazz::getSchoolId, schoolId);
-        if (SystemConstant.longNotNull(campusId)) {
-            basicClazzQueryWrapper.lambda().eq(BasicClazz::getCampusId, campusId);
-        }
 
         return this.list(basicClazzQueryWrapper).stream()
                 .map(e -> {
@@ -231,15 +193,11 @@ public class BasicClazzServiceImpl extends ServiceImpl<BasicClazzMapper, BasicCl
             SystemConstant.verifyDBFields(basicClazzParams, basicClazzParams.getClass());
             // 普通参数
             Long id = basicClazzParams.getId();
-            Long campusId = basicClazzParams.getCampusId();
             String clazzCode = basicClazzParams.getClazzCode();
             String clazzName = basicClazzParams.getClazzName();
             Long majorId = basicClazzParams.getMajorId();
 
-            // 校验校区不存在
-            if (Objects.isNull(basicCampusService.getById(campusId))) {
-                throw ExceptionResultEnum.ERROR.exception("所选校区不存在");
-            }
+            // 校验专业不存在
             if (Objects.isNull(basicMajorService.getById(majorId))) {
                 throw ExceptionResultEnum.ERROR.exception("所选专业不存在");
             }
@@ -257,7 +215,6 @@ public class BasicClazzServiceImpl extends ServiceImpl<BasicClazzMapper, BasicCl
             // 组装基础参数
             Long orgId;
             BasicClazz basicClazz = new BasicClazz();
-            basicClazz.setCampusId(campusId);
             basicClazz.setSchoolId(schoolId);
             basicClazz.setMajorId(majorId);
             if (SystemConstant.strNotNull(clazzCode)) {
@@ -282,14 +239,13 @@ public class BasicClazzServiceImpl extends ServiceImpl<BasicClazzMapper, BasicCl
                 orgId = old.getOrgId();
                 basicClazz.setId(id);
                 basicClazz.setUpdateId(sysUser.getId());
-                // 如果更新了班级所属的专业或校区则更新学生级联关系
-                if (!majorId.equals(old.getMajorId()) || !campusId.equals(old.getCampusId())) {
+                // 如果更新了班级所属的专业则更新学生级联关系
+                if (!majorId.equals(old.getMajorId())) {
                     List<BasicStudent> basicStudentList = basicStudentService.list(new QueryWrapper<BasicStudent>().lambda()
                             .eq(BasicStudent::getClazzId, id));
                     basicStudentList.forEach(e -> {
                         e.setBelongOrgId(basicMajorService.getById(majorId).getBelongOrgId());
                         e.setMajorId(majorId);
-                        e.setCampusId(campusId);
                     });
                     basicStudentService.updateBatchById(basicStudentList);
                 }

+ 110 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicCollegeServiceImpl.java

@@ -0,0 +1,110 @@
+package com.qmth.teachcloud.common.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.teachcloud.common.bean.params.BasicCollegeParams;
+import com.qmth.teachcloud.common.bean.result.BasicCollegeResult;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.*;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.mapper.BasicCollegeMapper;
+import com.qmth.teachcloud.common.service.BasicCollegeService;
+import com.qmth.teachcloud.common.service.BasicMajorService;
+import com.qmth.teachcloud.common.service.BasicStudentService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 学生学院服务实现类
+ * @Author: CaoZixuan
+ * @Date: 2022-08-17
+ */
+@Service
+public class BasicCollegeServiceImpl extends ServiceImpl<BasicCollegeMapper, BasicCollege> implements BasicCollegeService {
+    @Resource
+    private BasicMajorService basicMajorService;
+    @Resource
+    private BasicStudentService basicStudentService;
+
+    @Override
+    public IPage<BasicCollegeResult> basicCollegePage(Long schoolId, String collegeName, int pageNumber, int pageSize) {
+        collegeName = SystemConstant.translateSpecificSign(collegeName);
+        return this.baseMapper.findBasicCollegePage(new Page<>(pageNumber, pageSize), schoolId, collegeName, null);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public Long saveBasicCollege(BasicCollegeParams basicCollegeParams, SysUser requestUser) throws IllegalAccessException {
+        SystemConstant.verifyDBFields(basicCollegeParams, basicCollegeParams.getClass());
+
+        Long id = basicCollegeParams.getId();
+        Long schoolId = requestUser.getSchoolId();
+        String collegeName = basicCollegeParams.getCollegeName();
+
+        // 校验专业唯一性(名称在学院下)
+        BasicCollege checkName = this.getOne(new QueryWrapper<BasicCollege>().lambda()
+                .eq(BasicCollege::getSchoolId, schoolId)
+                .eq(BasicCollege::getCollegeName, collegeName));
+        if (Objects.nonNull(checkName) && !checkName.getId().equals(id)) {
+            throw ExceptionResultEnum.ERROR.exception("学生学院名称【" + collegeName + "】重复");
+        }
+        if (SystemConstant.longNotNull(id)) {
+            // 编辑
+            BasicCollege old = this.getById(id);
+            if (Objects.isNull(old)) {
+                throw ExceptionResultEnum.ERROR.exception("所选学生学院不存在");
+            }
+            this.update(new UpdateWrapper<BasicCollege>().lambda()
+                    .eq(BasicCollege::getId, id)
+                    .set(BasicCollege::getCollegeName, collegeName));
+
+        } else {
+            // 新增
+            id = SystemConstant.getDbUuid();
+            BasicCollege basicCollege = new BasicCollege();
+            basicCollege.setId(id);
+            basicCollege.setCollegeName(collegeName);
+            basicCollege.setSchoolId(schoolId);
+            basicCollege.setOrgId(requestUser.getOrgId());
+            this.save(basicCollege);
+        }
+        return id;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public boolean deleteBasicCollegeByIdList(List<Long> idList) {
+        // 判断专业
+        List<BasicMajor> basicMajorList = basicMajorService.list(new QueryWrapper<BasicMajor>().lambda().in(BasicMajor::getBelongOrgId, idList));
+        if (basicMajorList.size() > 0) {
+            List<Long> collegeIdList = basicMajorList.stream().map(BasicMajor::getBelongOrgId).distinct().collect(Collectors.toList());
+            String collegeNames = this.list(new QueryWrapper<BasicCollege>()
+                            .lambda()
+                            .in(BasicCollege::getId, collegeIdList))
+                    .stream()
+                    .map(BasicCollege::getCollegeName)
+                    .collect(Collectors.joining(","));
+            throw ExceptionResultEnum.ERROR.exception("学生学院【" + collegeNames + "】被专业绑定,无法优先删除");
+        }
+
+        // 判断学生
+        List<BasicStudent> basicStudentList = basicStudentService.list(new QueryWrapper<BasicStudent>().lambda().in(BasicStudent::getBelongOrgId, idList));
+        if (basicStudentList.size() > 0) {
+            List<Long> collegeIdList = basicStudentList.stream().map(BasicStudent::getBelongOrgId).distinct().collect(Collectors.toList());
+            String collegeNames = this.list(new QueryWrapper<BasicCollege>().lambda().in(BasicCollege::getId, collegeIdList))
+                    .stream()
+                    .map(BasicCollege::getCollegeName)
+                    .collect(Collectors.joining(","));
+            throw ExceptionResultEnum.ERROR.exception("学生学院【" + collegeNames + "】被学生绑定,无法优先删除");
+        }
+        return this.removeByIds(idList);
+    }
+}

+ 47 - 68
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicStudentServiceImpl.java

@@ -10,6 +10,7 @@ import com.qmth.teachcloud.common.bean.dto.TaskPrintClassDto;
 import com.qmth.teachcloud.common.bean.dto.excel.BasicStudentImportDto;
 import com.qmth.teachcloud.common.bean.dto.excel.DescribeImportDto;
 import com.qmth.teachcloud.common.bean.params.BasicClazzParams;
+import com.qmth.teachcloud.common.bean.params.BasicCollegeParams;
 import com.qmth.teachcloud.common.bean.params.BasicMajorParams;
 import com.qmth.teachcloud.common.bean.params.BasicStudentParams;
 import com.qmth.teachcloud.common.bean.result.BasicStudentResult;
@@ -46,17 +47,28 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
     @Resource
     private BasicMajorService basicMajorService;
     @Resource
-    private SysOrgService sysOrgService;
-    @Resource
-    private BasicCampusService basicCampusService;
+    private BasicCollegeService basicCollegeService;
+
 
     @Override
-    public IPage<BasicStudentResult> basicStudentPage(String queryParams, Long campusId,Long collegeId,Long majorId, Set<Long> clazzIdList, int pageNumber, int pageSize) {
+    public IPage<BasicStudentResult> basicStudentPage(String queryParams, Long collegeId, Long majorId, Set<Long> clazzIdList, int pageNumber, int pageSize) {
         Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
-//        Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
-        Set<Long> orgIds = null;
         queryParams = SystemConstant.translateSpecificSign(queryParams);
-        return basicStudentMapper.findBasicStudentPage(new Page<>(pageNumber, pageSize), queryParams, schoolId, campusId,collegeId,majorId, clazzIdList, orgIds);
+        return basicStudentMapper.findBasicStudentPage(new Page<>(pageNumber, pageSize), queryParams, schoolId, collegeId, majorId, clazzIdList, null);
+    }
+
+    @Override
+    public BasicStudentResult findById(Long id) {
+        BasicStudentResult basicStudentResult = null;
+        if (SystemConstant.longNotNull(id)) {
+            basicStudentResult = this.baseMapper.findById(id);
+        }
+        return basicStudentResult;
+    }
+
+    @Override
+    public List<BasicStudentResult> basicStudentList(Long schoolId, Long collegeId, Long majorId, Long clazzId, List<String> studentCodeList) {
+        return this.baseMapper.findBasicStudentList(schoolId, collegeId, majorId, clazzId, studentCodeList);
     }
 
     @Override
@@ -86,8 +98,8 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
 
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public void saveOrUpdateBasicStudentBatch(List<BasicStudentParams> basicStudentParamsList,SysUser requestUser) {
-        this.saveOrUpdateBatch(this.editEntityHelp(basicStudentParamsList,requestUser));
+    public void saveOrUpdateBasicStudentBatch(List<BasicStudentParams> basicStudentParamsList, SysUser requestUser) {
+        this.saveOrUpdateBatch(this.editEntityHelp(basicStudentParamsList, requestUser));
     }
 
     @Transactional(rollbackFor = Exception.class)
@@ -106,22 +118,19 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
 
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public Boolean removeBasicStudentByCondition(String queryParams, Long campusId, Long collegeId, Long majorId, Set<Long> clazzIdList) {
+    public Boolean removeBasicStudentByCondition(String queryParams, Long collegeId, Long majorId, Set<Long> clazzIdList) {
         LambdaQueryWrapper<BasicStudent> basicStudentQueryWrapper = new QueryWrapper<BasicStudent>().lambda();
-        if (SystemConstant.strNotNull(queryParams)){
-            basicStudentQueryWrapper.and(e -> e.like(BasicStudent::getStudentName,queryParams).or().like(BasicStudent::getStudentCode,queryParams));
+        if (SystemConstant.strNotNull(queryParams)) {
+            basicStudentQueryWrapper.and(e -> e.like(BasicStudent::getStudentName, queryParams).or().like(BasicStudent::getStudentCode, queryParams));
         }
-        if (SystemConstant.longNotNull(campusId)){
-            basicStudentQueryWrapper.eq(BasicStudent::getCampusId,campusId);
+        if (SystemConstant.longNotNull(collegeId)) {
+            basicStudentQueryWrapper.eq(BasicStudent::getBelongOrgId, collegeId);
         }
-        if (SystemConstant.longNotNull(collegeId)){
-            basicStudentQueryWrapper.eq(BasicStudent::getBelongOrgId,collegeId);
+        if (SystemConstant.longNotNull(majorId)) {
+            basicStudentQueryWrapper.eq(BasicStudent::getMajorId, majorId);
         }
-        if (SystemConstant.longNotNull(majorId)){
-            basicStudentQueryWrapper.eq(BasicStudent::getMajorId,majorId);
-        }
-        if (clazzIdList != null && clazzIdList.size() > 0){
-            basicStudentQueryWrapper.in(BasicStudent::getClazzId,clazzIdList);
+        if (clazzIdList != null && clazzIdList.size() > 0) {
+            basicStudentQueryWrapper.in(BasicStudent::getClazzId, clazzIdList);
         }
         List<BasicStudent> willDeleteStudent = this.list(basicStudentQueryWrapper);
 
@@ -141,10 +150,8 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
         SysUser sysUser = (SysUser) map.get(SystemConstant.SYS_USER);
         Long schoolId = sysUser.getSchoolId();
         final String link = "-";
-        // key = campusName
-        Map<String, BasicCampus> campusMap = new HashMap<>();
         // key = collegeName
-        Map<String, SysOrg> collegeMap = new HashMap<>();
+        Map<String, Long> collegeMap = new HashMap<>();
         // key = schoolId + "-" + majorName
         Map<String, Long> majorMap = new HashMap<>();
         // key = schoolId + "-" + clazzName
@@ -173,45 +180,30 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
                 String studentName = basicStudentImportDto.getStudentName();
                 String studentCode = basicStudentImportDto.getStudentCode();
                 String phoneNumber = basicStudentImportDto.getPhoneNumber();
-                String campusName = basicStudentImportDto.getCampusName();
                 String collegeName = basicStudentImportDto.getCollegeName();
                 String majorName = basicStudentImportDto.getMajorName();
                 String clazzName = basicStudentImportDto.getClazzName();
 
-                // 校区
-                Long campusId = null;
-                if (SystemConstant.strNotNull(campusName)) {
-                    BasicCampus basicCampus;
-                    if (campusMap.containsKey(campusName)) {
-                        basicCampus = campusMap.get(campusName);
-                    } else {
-                        basicCampus = basicCampusService.getOne(new QueryWrapper<BasicCampus>().lambda()
-                                .eq(BasicCampus::getSchoolId, schoolId)
-                                .eq(BasicCampus::getCampusName, campusName));
-                        if (Objects.isNull(basicCampus)) {
-                            throw ExceptionResultEnum.ERROR.exception("系统中不存在【校区】:" + campusName);
-                        }
-                        campusMap.put(campusName, basicCampus);
-                    }
-                    campusId = basicCampus.getId();
-                }
-
                 // 学院
                 Long collegeId = null;
                 if (SystemConstant.strNotNull(collegeName)) {
-                    SysOrg sysOrg;
+                    BasicCollege basicCollege;
                     if (collegeMap.containsKey(collegeName)) {
-                        sysOrg = collegeMap.get(collegeName);
+                        collegeId = collegeMap.get(collegeName);
                     } else {
-                        sysOrg = sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
-                                .eq(SysOrg::getSchoolId, schoolId)
-                                .eq(SysOrg::getName, collegeName));
-                        if (Objects.isNull(sysOrg)) {
-                            throw ExceptionResultEnum.ERROR.exception("系统中不存在【学院】:" + collegeName);
+                        basicCollege = basicCollegeService.getOne(new QueryWrapper<BasicCollege>().lambda()
+                                .eq(BasicCollege::getSchoolId, schoolId)
+                                .eq(BasicCollege::getCollegeName, collegeName));
+                        if (Objects.isNull(basicCollege)) {
+                            // 新增一个basicCollege
+                            BasicCollegeParams basicCollegeParams = new BasicCollegeParams();
+                            basicCollegeParams.setCollegeName(collegeName);
+                            collegeId = basicCollegeService.saveBasicCollege(basicCollegeParams, sysUser);
+                        } else {
+                            collegeId = basicCollege.getId();
                         }
-                        collegeMap.put(collegeName, sysOrg);
+                        collegeMap.put(collegeName, collegeId);
                     }
-                    collegeId = sysOrg.getId();
                 }
 
                 // 专业
@@ -243,9 +235,6 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
                 // 班级
                 Long clazzId = null;
                 if (SystemConstant.strNotNull(clazzName)) {
-                    if (!SystemConstant.longNotNull(campusId)) {
-                        throw ExceptionResultEnum.ERROR.exception("学生班级信息缺失校区信息异常");
-                    }
                     if (!SystemConstant.longNotNull(collegeId)) {
                         throw ExceptionResultEnum.ERROR.exception("学生班级信息缺失学院信息异常");
                     }
@@ -264,7 +253,6 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
                         if (Objects.isNull(basicClazz)) {
                             // 新增一个clazz
                             BasicClazzParams basicClazzParams = new BasicClazzParams();
-                            basicClazzParams.setCampusId(campusId);
                             basicClazzParams.setMajorId(majorId);
                             basicClazzParams.setClazzName(clazzName);
                             clazzId = basicClazzService.saveBasicClazz(basicClazzParams, sysUser);
@@ -279,9 +267,6 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
                 basicStudentParams.setStudentName(studentName);
                 basicStudentParams.setStudentCode(studentCode);
                 basicStudentParams.setPhoneNumber(phoneNumber);
-                if (SystemConstant.longNotNull(campusId)) {
-                    basicStudentParams.setCampusId(campusId);
-                }
                 if (SystemConstant.longNotNull(collegeId)) {
                     basicStudentParams.setCollegeId(collegeId);
                 }
@@ -324,7 +309,6 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
             String studentCode = basicStudentParams.getStudentCode();
             String phoneNumber = basicStudentParams.getPhoneNumber();
             Long clazzId = basicStudentParams.getClazzId();
-            Long campusId = basicStudentParams.getCampusId();
             Long majorId = basicStudentParams.getMajorId();
             Long collegeId = basicStudentParams.getCollegeId();
 
@@ -335,12 +319,6 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
                 if (Objects.isNull(basicClazz)) {
                     throw ExceptionResultEnum.ERROR.exception("所选班级不存在");
                 }
-                if (SystemConstant.longNotNull(campusId)) {
-                    if (!campusId.equals(basicClazz.getCampusId())) {
-                        String exception = "学生信息【" + studentName + "(" + studentCode + ")" + "-" + basicCampusService.getById(campusId).getCampusName() + "】中的校区和学生所属班级信息【" + basicClazz.getClazzName() + "-" + basicCampusService.getById(basicClazz.getCampusId()).getCampusName() + "】中的校区不对应";
-                        throw ExceptionResultEnum.ERROR.exception(exception);
-                    }
-                }
                 if (SystemConstant.longNotNull(majorId)) {
                     if (!majorId.equals(basicClazz.getMajorId())) {
                         String exception = "学生信息【" + studentName + "(" + studentCode + ")" + "-" + basicMajorService.getById(majorId).getName() + "】中的专业和学生所属班级信息【" + basicClazz.getClazzName() + "-" + basicMajorService.getById(basicClazz.getMajorId()).getName() + "】中的专业不对应";
@@ -358,7 +336,9 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
                 }
                 if (SystemConstant.longNotNull(collegeId)) {
                     if (!collegeId.equals(basicMajor.getBelongOrgId())) {
-                        String exception = "学生信息【" + studentName + "(" + studentCode + ")" + "-" + sysOrgService.getById(collegeId).getName() + "】中的学院和学生所属专业信息【" + basicMajor.getName() + "-" + sysOrgService.getById(basicMajor.getBelongOrgId()).getName() + "】中的学院不对应";
+                        String exception = "学生信息【" + studentName + "(" + studentCode + ")" + "-" + basicCollegeService.getById(collegeId).getCollegeName() +
+                                "】中的学院和学生所属专业信息【" +
+                                basicMajor.getName() + "-" + basicCollegeService.getById(basicMajor.getBelongOrgId()).getCollegeName() + "】中的学院不对应";
                         throw ExceptionResultEnum.ERROR.exception(exception);
                     }
                 }
@@ -395,7 +375,6 @@ public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, Bas
             basicStudent.setStudentCode(studentCode);
             basicStudent.setStudentName(studentName);
             basicStudent.setPhoneNumber(phoneNumber);
-            basicStudent.setCampusId(campusId);
             basicStudent.setBelongOrgId(collegeId);
             basicStudent.setMajorId(majorId);
             basicStudent.setClazzId(clazzId);

+ 0 - 6
teachcloud-common/src/main/resources/mapper/BasicClazzMapper.xml

@@ -7,22 +7,16 @@
         SELECT
             clz.id,
             clz.school_id AS schoolId,
-            clz.campus_id AS campusId,
             clz.clazz_code AS clazzCode,
             clz.clazz_name AS clazzName,
             clz.enable,
             clz.create_id AS createId,
             clz.create_time AS createTime,
-            cap.campus_name AS campusName,
-            cap.campus_code AS campusCode,
             bm.id AS majorId,
             bm.name AS majorName
         FROM
             basic_clazz clz
                 LEFT JOIN
-            basic_campus cap ON clz.campus_id = cap.id
-                AND cap.enable = TRUE
-                LEFT JOIN
             basic_major bm ON bm.id = clz.major_id
                 AND bm.enable = TRUE
         <where>

+ 28 - 0
teachcloud-common/src/main/resources/mapper/BasicCollegeMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qmth.teachcloud.common.mapper.BasicCollegeMapper">
+
+    <select id="findBasicCollegePage" resultType="com.qmth.teachcloud.common.bean.result.BasicCollegeResult">
+        SELECT
+            id,
+            college_name as collegeName,
+            create_time as createTime
+        FROM
+            basic_college
+        <where>
+            <if test="schoolId != null and schoolId != ''">
+                AND school_id = #{schoolId}
+            </if>
+            <if test="collegeName != null and collegeName != ''">
+                AND college_name LIKE CONCAT('%',#{collegeName},'%')
+            </if>
+            <if test="orgIds != null and orgIds != '' and orgIds.size > 0">
+                AND org_id IN
+                <foreach collection="orgIds" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        ORDER BY create_time DESC
+    </select>
+</mapper>

+ 3 - 3
teachcloud-common/src/main/resources/mapper/BasicMajorMapper.xml

@@ -10,12 +10,12 @@
             bm.code AS majorCode,
             bm.create_id AS createId,
             bm.create_time AS createTime,
-            so.id AS collegeId,
-            so.name AS collegeName
+            bc.id AS collegeId,
+            bc.college_name AS collegeName
         FROM
             basic_major bm
                 LEFT JOIN
-            sys_org so ON bm.belong_org_id = so.id
+            basic_college bc ON bm.belong_org_id = bc.id
         <where>
             AND bm.enable = true
             <if test="schoolId != null and schoolId != ''">

+ 86 - 17
teachcloud-common/src/main/resources/mapper/BasicStudentMapper.xml

@@ -15,17 +15,17 @@
         SELECT
             s.clazz_id classId,
             clz.clazz_name className,
-            bc.print_house_id printHouseId,
-            so.name printHouseName,
+#             bc.print_house_id printHouseId,
+#             so.name printHouseName,
             COUNT(1) studentCount
         FROM
             basic_student s
                 LEFT JOIN
             basic_clazz clz ON s.clazz_id = clz.id and clz.enable = true
-                LEFT JOIN
-            basic_campus bc ON clz.campus_id = bc.id
-                LEFT JOIN
-            sys_org so ON bc.print_house_id = so.id
+#                 LEFT JOIN
+#             basic_campus bc ON clz.campus_id = bc.id
+#                 LEFT JOIN
+#             sys_org so ON bc.print_house_id = so.id
         WHERE
             s.school_id = #{schoolId}
             <if test="stringList != null and stringList != '' and stringList.size > 0">
@@ -34,7 +34,7 @@
                     #{cla}
                 </foreach>
             </if>
-        GROUP BY s.clazz_id, clz.clazz_name, bc.print_house_id
+        GROUP BY s.clazz_id, clz.clazz_name
     </select>
 
     <select id="findBasicStudentPage"
@@ -44,10 +44,8 @@
             student_name AS studentName,
             student_code AS studentCode,
             phone_number AS phoneNumber,
-            stu.campus_id AS campusId,
-            cam.campus_name AS campusName,
-            so.id AS collegeId,
-            so.name AS collegeName,
+            bc.id AS collegeId,
+            bc.college_name AS collegeName,
             bm.id AS majorId,
             bm.name AS majorName,
             clazz_id AS clazzId,
@@ -58,13 +56,11 @@
         FROM
             basic_student stu
                 LEFT JOIN
-            basic_campus cam ON stu.campus_id = cam.id AND cam.enable = TRUE
-                LEFT JOIN
             basic_clazz clz ON stu.clazz_id = clz.id AND clz.enable = TRUE
                 LEFT JOIN
             basic_major bm ON stu.major_id = bm.id AND bm.enable = TRUE
                 LEFT JOIN
-            sys_org so ON stu.belong_org_id = so.id AND so.enable = TRUE
+            basic_college bc ON stu.belong_org_id = bc.id
         <where>
             and stu.enable = true
             <if test="queryParams != null and queryParams != ''">
@@ -73,9 +69,6 @@
             <if test="schoolId != null and schoolId != ''">
                 and stu.school_id = #{schoolId}
             </if>
-            <if test="campusId != null and campusId != ''">
-                and stu.campus_Id = #{campusId}
-            </if>
             <if test="collegeId != null and collegeId != ''">
                 and stu.belong_org_id = #{collegeId}
             </if>
@@ -97,4 +90,80 @@
         </where>
         ORDER BY stu.create_time DESC
     </select>
+    <select id="findById" resultType="com.qmth.teachcloud.common.bean.result.BasicStudentResult">
+        SELECT
+            stu.id,
+            student_name AS studentName,
+            student_code AS studentCode,
+            phone_number AS phoneNumber,
+            bc.id AS collegeId,
+            bc.college_name AS collegeName,
+            bm.id AS majorId,
+            bm.name AS majorName,
+            clazz_id AS clazzId,
+            clz.clazz_name AS clazz,
+            stu.enable,
+            stu.create_id AS createId,
+            stu.create_time AS createTime
+        FROM
+            basic_student stu
+                LEFT JOIN
+            basic_clazz clz ON stu.clazz_id = clz.id AND clz.enable = TRUE
+                LEFT JOIN
+            basic_major bm ON stu.major_id = bm.id AND bm.enable = TRUE
+                LEFT JOIN
+            basic_college bc ON stu.belong_org_id = bc.id
+        <where>
+            and stu.enable = true
+            <if test="id != null and id != ''">
+                AND stu.id = #{id}
+            </if>
+        </where>
+    </select>
+    <select id="findBasicStudentList" resultType="com.qmth.teachcloud.common.bean.result.BasicStudentResult">
+        SELECT
+            stu.id,
+            student_name AS studentName,
+            student_code AS studentCode,
+            phone_number AS phoneNumber,
+            bc.id AS collegeId,
+            bc.college_name AS collegeName,
+            bm.id AS majorId,
+            bm.name AS majorName,
+            clazz_id AS clazzId,
+            clz.clazz_name AS clazz,
+            stu.enable,
+            stu.create_id AS createId,
+            stu.create_time AS createTime
+        FROM
+            basic_student stu
+                LEFT JOIN
+            basic_clazz clz ON stu.clazz_id = clz.id AND clz.enable = TRUE
+                LEFT JOIN
+            basic_major bm ON stu.major_id = bm.id AND bm.enable = TRUE
+                LEFT JOIN
+            basic_college bc ON stu.belong_org_id = bc.id
+        <where>
+            and stu.enable = true
+            <if test="schoolId != null and schoolId != ''">
+                and stu.school_id = #{schoolId}
+            </if>
+            <if test="collegeId != null and collegeId != ''">
+                and stu.belong_org_id = #{collegeId}
+            </if>
+            <if test="majorId != null and majorId != ''">
+                and stu.major_id = #{majorId}
+            </if>
+            <if test="clazzId != null and clazzId != ''">
+                and stu.clazz_id = #{clazzId}
+            </if>
+            <if test="studentCodeList != null and studentCodeList != '' and studentCodeList.size > 0">
+                AND stu.student_code IN
+                <foreach collection="studentCodeList" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        ORDER BY stu.create_time DESC
+    </select>
 </mapper>