Browse Source

3.4.0 update

xiaofei 1 year ago
parent
commit
6433fb70f6
61 changed files with 1431 additions and 4530 deletions
  1. 211 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/importFile/BasicExamStudentImport.java
  2. 31 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/importFile/BasicExamStudentParseDto.java
  3. 13 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/examRule/CodeNameEnableValue.java
  4. 56 19
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/BasicExamStudentParam.java
  5. 22 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/BasicExamStudentResult.java
  6. 30 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/BasicExamRule.java
  7. 0 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/DictionaryEnum.java
  8. 4 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/RequiredFieldsEnum.java
  9. 2 14
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/BasicTeachClazzService.java
  10. 21 91
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java
  11. 0 21
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicTeachClazzServiceImpl.java
  12. 10 21
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java
  13. 2 8
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java
  14. 2 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCStatisticsServiceImpl.java
  15. 0 84
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncStudentDataImportService.java
  16. 85 134
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/SyncBasicExamStudentImportService.java
  17. 3 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/SyncObjectiveStructImportService.java
  18. 3 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/SyncSubjectiveStructImportService.java
  19. 0 34
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/importData/AsyncImportTaskTemplete.java
  20. 56 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/ImportLogicService.java
  21. 0 46
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/TaskLogicService.java
  22. 763 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/ImportLogicServiceImpl.java
  23. 0 5
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/PdfTaskLogicServiceImpl.java
  24. 11 730
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java
  25. 16 9
      distributed-print-business/src/main/resources/mapper/BasicExamStudentMapper.xml
  26. 10 1
      distributed-print/install/mysql/upgrade/3.4.0.sql
  27. 0 76
      distributed-print/src/main/java/com/qmth/distributed/print/api/BasicClazzController.java
  28. 1 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/BasicExamStudentController.java
  29. 0 75
      distributed-print/src/main/java/com/qmth/distributed/print/api/BasicMajorController.java
  30. 0 131
      distributed-print/src/main/java/com/qmth/distributed/print/api/BasicStudentController.java
  31. 0 18
      distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java
  32. 0 281
      distributed-print/src/test/java/com/qmth/distributed/print/BasicDataImportTest.java
  33. 0 277
      distributed-print/src/test/java/com/qmth/distributed/print/BasicUserImportTest.java
  34. 26 0
      distributed-print/src/test/java/com/qmth/distributed/print/ExcelReaderTest.java
  35. 10 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java
  36. 0 106
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicClazz.java
  37. 32 10
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicExamStudent.java
  38. 0 96
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicMajor.java
  39. 0 137
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicStudent.java
  40. 0 107
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicUserCourse.java
  41. 0 36
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicClazzMapper.java
  42. 0 35
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicMajorMapper.java
  43. 0 75
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicStudentMapper.java
  44. 0 20
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicUserCourseMapper.java
  45. 0 63
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicClazzService.java
  46. 0 46
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicMajorService.java
  47. 0 115
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicStudentService.java
  48. 0 35
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicUserCourseService.java
  49. 1 1
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysUserService.java
  50. 0 297
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicClazzServiceImpl.java
  51. 4 34
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicCourseServiceImpl.java
  52. 0 139
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicMajorServiceImpl.java
  53. 0 653
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicStudentServiceImpl.java
  54. 0 85
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicUserCourseServiceImpl.java
  55. 2 2
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserServiceImpl.java
  56. 0 61
      teachcloud-common/src/main/resources/mapper/BasicClazzMapper.xml
  57. 0 41
      teachcloud-common/src/main/resources/mapper/BasicMajorMapper.xml
  58. 0 210
      teachcloud-common/src/main/resources/mapper/BasicStudentMapper.xml
  59. 0 35
      teachcloud-common/src/main/resources/mapper/BasicUserCourseMapper.xml
  60. 3 3
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java
  61. 1 1
      teachcloud-mark/src/main/resources/mapper/MarkPaperMapper.xml

+ 211 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/importFile/BasicExamStudentImport.java

@@ -0,0 +1,211 @@
+package com.qmth.distributed.print.business.bean.dto.importFile;
+
+import com.qmth.distributed.print.business.bean.examRule.CodeNameEnableValue;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BasicExamStudentImport {
+
+    @ApiModelProperty(value = "课程代码")
+    private String courseCode;
+    @ApiModelProperty(value = "课程名称")
+    private String courseName;
+    @ApiModelProperty(value = "开课学院")
+    private String teachingRoomName;
+    @ApiModelProperty(value = "教学班")
+    private String teachClassName;
+    @ApiModelProperty(value = "行政班")
+    private String className;
+    @ApiModelProperty(value = "试卷编号")
+    private String paperNumber;
+    @ApiModelProperty(value = "姓名")
+    private String studentName;
+    @ApiModelProperty(value = "学号")
+    private String studentCode;
+    @ApiModelProperty(value = "座位号")
+    private String siteNumber;
+    @ApiModelProperty(value = "学院")
+    private String collegeName;
+    @ApiModelProperty(value = "专业")
+    private String majorName;
+    @ApiModelProperty(value = "任课教师")
+    private String teacherName;
+    @ApiModelProperty(value = "任课教师工号")
+    private String teacherCode;
+    @ApiModelProperty(value = "考试日期")
+    private String examDate;
+    @ApiModelProperty(value = "考试时间")
+    private String examTime;
+    @ApiModelProperty("考点(校区)")
+    private String examPlace;
+    @ApiModelProperty("考场(考试教室)")
+    private String examRoom;
+    @ApiModelProperty("必填字段集合")
+    private List<CodeNameEnableValue> requiredFieldList = new ArrayList<>();
+    @ApiModelProperty("扩展字段集合")
+    private List<CodeNameEnableValue> extendFieldList = new ArrayList<>();
+    @ApiModelProperty("错误信息")
+    private String errorMsg;
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getTeachingRoomName() {
+        return teachingRoomName;
+    }
+
+    public void setTeachingRoomName(String teachingRoomName) {
+        this.teachingRoomName = teachingRoomName;
+    }
+
+    public String getTeachClassName() {
+        return teachClassName;
+    }
+
+    public void setTeachClassName(String teachClassName) {
+        this.teachClassName = teachClassName;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public String getPaperNumber() {
+        return paperNumber;
+    }
+
+    public void setPaperNumber(String paperNumber) {
+        this.paperNumber = paperNumber;
+    }
+
+    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 getSiteNumber() {
+        return siteNumber;
+    }
+
+    public void setSiteNumber(String siteNumber) {
+        this.siteNumber = siteNumber;
+    }
+
+    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 String getTeacherName() {
+        return teacherName;
+    }
+
+    public void setTeacherName(String teacherName) {
+        this.teacherName = teacherName;
+    }
+
+    public String getTeacherCode() {
+        return teacherCode;
+    }
+
+    public void setTeacherCode(String teacherCode) {
+        this.teacherCode = teacherCode;
+    }
+
+    public String getExamDate() {
+        return examDate;
+    }
+
+    public void setExamDate(String examDate) {
+        this.examDate = examDate;
+    }
+
+    public String getExamTime() {
+        return examTime;
+    }
+
+    public void setExamTime(String examTime) {
+        this.examTime = examTime;
+    }
+
+    public String getExamPlace() {
+        return examPlace;
+    }
+
+    public void setExamPlace(String examPlace) {
+        this.examPlace = examPlace;
+    }
+
+    public String getExamRoom() {
+        return examRoom;
+    }
+
+    public void setExamRoom(String examRoom) {
+        this.examRoom = examRoom;
+    }
+
+    public List<CodeNameEnableValue> getRequiredFieldList() {
+        return requiredFieldList;
+    }
+
+    public void setRequiredFieldList(List<CodeNameEnableValue> requiredFieldList) {
+        this.requiredFieldList = requiredFieldList;
+    }
+
+    public List<CodeNameEnableValue> getExtendFieldList() {
+        return extendFieldList;
+    }
+
+    public void setExtendFieldList(List<CodeNameEnableValue> extendFieldList) {
+        this.extendFieldList = extendFieldList;
+    }
+
+    public String getErrorMsg() {
+        return errorMsg;
+    }
+
+    public void setErrorMsg(String errorMsg) {
+        this.errorMsg = errorMsg;
+    }
+}

+ 31 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/importFile/BasicExamStudentParseDto.java

@@ -0,0 +1,31 @@
+package com.qmth.distributed.print.business.bean.dto.importFile;
+
+import com.qmth.distributed.print.business.bean.examRule.CodeNameEnableValue;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BasicExamStudentParseDto {
+
+    @ApiModelProperty(value = "表头")
+    private String[] columnNames;
+    @ApiModelProperty(value = "解析数据集合")
+    private List<BasicExamStudentImport> basicExamStudentImportList;
+
+    public String[] getColumnNames() {
+        return columnNames;
+    }
+
+    public void setColumnNames(String[] columnNames) {
+        this.columnNames = columnNames;
+    }
+
+    public List<BasicExamStudentImport> getBasicExamStudentImportList() {
+        return basicExamStudentImportList;
+    }
+
+    public void setBasicExamStudentImportList(List<BasicExamStudentImport> basicExamStudentImportList) {
+        this.basicExamStudentImportList = basicExamStudentImportList;
+    }
+}

+ 13 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/examRule/CodeNameEnableValue.java

@@ -7,6 +7,19 @@ public class CodeNameEnableValue extends CodeNameEnable{
 
     private String value;
 
+    public CodeNameEnableValue()
+    {
+    }
+
+    public CodeNameEnableValue(String value) {
+        this.value = value;
+    }
+
+    public CodeNameEnableValue(String code, String name, Boolean enable, String value) {
+        super(code, name, enable);
+        this.value = value;
+    }
+
     public String getValue() {
         return value;
     }

+ 56 - 19
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/BasicExamStudentParam.java

@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
 import org.hibernate.validator.constraints.Length;
 import org.hibernate.validator.constraints.Range;
 
+import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 
 /**
@@ -45,14 +46,23 @@ public class BasicExamStudentParam {
     @Length(min = 1, message = "请输入学号")
     private String studentCode;
 
+    @ApiModelProperty("座位号")
+    private String siteNumber;
+
     @ApiModelProperty("学院")
-    private String college;
+    @NotNull(message = "请输入学院")
+    @Length(min = 1, message = "请输入学院")
+    private String collegeName;
 
     @ApiModelProperty("专业")
-    private String major;
+    private String majorName;
 
     @ApiModelProperty("教学班")
-    private String teachClazz;
+    @NotNull(message = "请输入教学班")
+    @Length(min = 1, message = "请输入教学班")
+    private String teachClassName;
+    @ApiModelProperty("行政班")
+    private String className;
 
     @ApiModelProperty("试卷编号")
     private String paperNumber;
@@ -64,18 +74,21 @@ public class BasicExamStudentParam {
     private String teacherCode;
 
     @ApiModelProperty("考试开始时间")
-    @JsonSerialize(using = ToStringSerializer.class)
+    @NotNull(message = "请选择考试时间")
     private Long examStartTime;
 
     @ApiModelProperty("考试结束时间")
-    @JsonSerialize(using = ToStringSerializer.class)
+    @NotNull(message = "请选择考试时间")
     private Long examEndTime;
 
-    @ApiModelProperty("考点(校区)")
+    @ApiModelProperty("校区(考点)")
     private String examPlace;
 
-    @ApiModelProperty("考场(考试教室)")
+    @ApiModelProperty("考试教室(考场)")
+    @NotBlank(message = "请输入考试教室(考场)")
     private String examRoom;
+    @ApiModelProperty("扩展字段")
+    private String extendFields;
 
     public Long getId() {
         return id;
@@ -125,28 +138,44 @@ public class BasicExamStudentParam {
         this.studentCode = studentCode;
     }
 
-    public String getCollege() {
-        return college;
+    public String getSiteNumber() {
+        return siteNumber;
+    }
+
+    public void setSiteNumber(String siteNumber) {
+        this.siteNumber = siteNumber;
+    }
+
+    public String getCollegeName() {
+        return collegeName;
     }
 
-    public void setCollege(String college) {
-        this.college = college;
+    public void setCollegeName(String collegeName) {
+        this.collegeName = collegeName;
     }
 
-    public String getMajor() {
-        return major;
+    public String getMajorName() {
+        return majorName;
     }
 
-    public void setMajor(String major) {
-        this.major = major;
+    public void setMajorName(String majorName) {
+        this.majorName = majorName;
     }
 
-    public String getTeachClazz() {
-        return teachClazz;
+    public String getTeachClassName() {
+        return teachClassName;
     }
 
-    public void setTeachClazz(String teachClazz) {
-        this.teachClazz = teachClazz;
+    public void setTeachClassName(String teachClassName) {
+        this.teachClassName = teachClassName;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
     }
 
     public String getPaperNumber() {
@@ -204,4 +233,12 @@ public class BasicExamStudentParam {
     public void setExamRoom(String examRoom) {
         this.examRoom = examRoom;
     }
+
+    public String getExtendFields() {
+        return extendFields;
+    }
+
+    public void setExtendFields(String extendFields) {
+        this.extendFields = extendFields;
+    }
 }

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

@@ -24,6 +24,8 @@ public class BasicExamStudentResult extends BasicExamStudent {
 
     @ApiModelProperty("课程代码")
     private String courseCode;
+    @ApiModelProperty("开课学院")
+    private String teachingRoomName;
 
     @ApiModelProperty("任课老师")
     private String teacherName;
@@ -36,6 +38,8 @@ public class BasicExamStudentResult extends BasicExamStudent {
 
     @ApiModelProperty("考试时间")
     private String examTime;
+    @ApiModelProperty("扩展字段")
+    private String extendFields;
 
     public Long getStudentId() {
         return super.getId();
@@ -63,6 +67,14 @@ public class BasicExamStudentResult extends BasicExamStudent {
         this.courseCode = courseCode;
     }
 
+    public String getTeachingRoomName() {
+        return teachingRoomName;
+    }
+
+    public void setTeachingRoomName(String teachingRoomName) {
+        this.teachingRoomName = teachingRoomName;
+    }
+
     public String getTeacherName() {
         return teacherName;
     }
@@ -94,4 +106,14 @@ public class BasicExamStudentResult extends BasicExamStudent {
     public void setExamTime(String examTime) {
         this.examTime = examTime;
     }
+
+    @Override
+    public String getExtendFields() {
+        return extendFields;
+    }
+
+    @Override
+    public void setExtendFields(String extendFields) {
+        this.extendFields = extendFields;
+    }
 }

+ 30 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/BasicExamRule.java

@@ -1,15 +1,23 @@
 package com.qmth.distributed.print.business.entity;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.annotation.FieldStrategy;
 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.teachcloud.common.enums.EnumResult;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.PrintMethodEnum;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * <p>
@@ -52,6 +60,12 @@ public class BasicExamRule extends BaseEntity implements Serializable {
     @TableField("package_scope")
     private String packageScope;
 
+    @TableField(exist = false)
+    private List<EnumResult> requiredFieldList;
+
+    @TableField(exist = false)
+    private List<EnumResult> extendFieldList;
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }
@@ -103,4 +117,20 @@ public class BasicExamRule extends BaseEntity implements Serializable {
     public void setPackageScope(String packageScope) {
         this.packageScope = packageScope;
     }
+
+    public List<EnumResult> getRequiredFieldList() {
+        return StringUtils.isNotBlank(this.requiredFields) ? JSON.parseArray(this.requiredFields, EnumResult.class) : Collections.emptyList();
+    }
+
+    public void setRequiredFieldList(List<EnumResult> requiredFieldList) {
+        this.requiredFieldList = requiredFieldList;
+    }
+
+    public List<EnumResult> getExtendFieldList() {
+        return StringUtils.isNotBlank(this.extendFields) ? JSON.parseArray(this.extendFields, EnumResult.class) : Collections.emptyList();
+    }
+
+    public void setExtendFieldList(List<EnumResult> extendFieldList) {
+        this.extendFieldList = extendFieldList;
+    }
 }

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

@@ -10,7 +10,6 @@ import java.util.Objects;
 public enum DictionaryEnum {
     SEMESTER("学期"),
     COLLEGE("学生学院"),
-    MAJOR("专业"),
     CLAZZ("班级"),
     ALL_CLAZZ("教学班和基础班"),
     COURSE("课程"),

+ 4 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/RequiredFieldsEnum.java

@@ -16,18 +16,18 @@ public enum RequiredFieldsEnum {
     SITE_NUMBER("siteNumber", "座位号", true, false),
     COURSE_NAME("courseName","课程名称", true, true),
     COURSE_CODE("courseCode","课程代码", true, true),
-    PAPER_NUMBER("paperNumber","试卷编号", true, true),
+    PAPER_NUMBER("paperNumber","试卷编号", true, false),
     EXAM_DATE("examDate","考试日期", true, true),
     EXAM_TIME("examTime","考试时间", true, true),
     EXAM_PLACE("examPlace","校区(考点)", true, false),
     EXAM_ROOM("examRoom","考试教室(考场)", true, true),
     COLLEGE_NAME("collegeName","学院", true, true),
     MAJOR_NAME("majorName","专业", true, false),
-    TEACH_CLAZZ_NAME("teachClazzName","教学班", true, true),
-    CLAZZ_NAME("clazzName","行政班", true, false),
+    TEACH_CLAZZ_NAME("teachClassName","教学班", true, true),
+    CLAZZ_NAME("className","行政班", true, false),
     TEACHER_NAME("teacherName","任课老师", true, false),
     TEACHER_CODE("teacherCode","任课老师工号", true, false),
-    TEACHER_ROOM_NAME("teacherRoomName","开课学院", true, false);
+    TEACHING_ROOM_NAME("teachingRoomName","开课学院", true, true);
 
     private final String code;
     private final String name;

+ 2 - 14
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/BasicTeachClazzService.java

@@ -1,9 +1,8 @@
 package com.qmth.distributed.print.business.service;
 
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.distributed.print.business.bean.result.BasicTeachClazzResult;
 import com.qmth.teachcloud.common.entity.BasicTeachClazz;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.qmth.teachcloud.common.entity.SysUser;
 
 import java.util.List;
 
@@ -18,18 +17,7 @@ import java.util.List;
 public interface BasicTeachClazzService extends IService<BasicTeachClazz> {
 
     /**
-     * 查询或新增教学班
-     *
-     * @param requestUser    请求人
-     * @param examId         考试id
-     * @param teachClazzName 教学班名称
-     * @param courseId     课程编号
-     * @return 教学班
-     */
-    BasicTeachClazz findOrCreateBasicTeachClazz(SysUser requestUser, Long examId, Long courseId, String teachClazzName);
-
-    /**
-     * 查询所有加血版
+     * 查询所有教学班
      *
      * @param examId     考试id
      * @param courseCode 课程编号

+ 21 - 91
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java

@@ -236,50 +236,9 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
         Long schoolId = requestUser.getSchoolId();
         Long requestUserId = requestUser.getId();
 
-        Long id = basicExamStudentParam.getId();
-        Long semesterId = basicExamStudentParam.getSemesterId();
-        Long examId = basicExamStudentParam.getExamId();
-        Long courseId = basicExamStudentParam.getCourseId();
-        String studentName = basicExamStudentParam.getStudentName();
-        String studentCode = basicExamStudentParam.getStudentCode();
-        String college = basicExamStudentParam.getCollege();
-        String major = basicExamStudentParam.getMajor();
-        String teachClazz = basicExamStudentParam.getTeachClazz();
         String paperNumber = basicExamStudentParam.getPaperNumber();
         String teacherName = basicExamStudentParam.getTeacherName();
         String teacherCode = basicExamStudentParam.getTeacherCode();
-        Long examStartTime = basicExamStudentParam.getExamStartTime();
-        Long examEndTime = basicExamStudentParam.getExamEndTime();
-        String examPlace = basicExamStudentParam.getExamPlace();
-        String examRoom = basicExamStudentParam.getExamRoom();
-
-        // 校验1 学期、考试、课程为下拉框,姓名、学号、教学班为文本框,均必填;
-        if (!SystemConstant.longNotNull(semesterId)) {
-            errorMsgList.add("请选择学期");
-        }
-        if (!SystemConstant.longNotNull(examId)) {
-            errorMsgList.add("请选择考试");
-        }
-        if (courseId == null) {
-            errorMsgList.add("请选择课程");
-        }
-        BasicCourse basicCourse = basicCourseService.getById(courseId);
-        if (Objects.isNull(basicCourse)) {
-            errorMsgList.add("课程管理中不存在该课程");
-        }
-
-        if (!SystemConstant.strNotNull(studentName)) {
-            errorMsgList.add("姓名必填");
-        }
-        if (!SystemConstant.strNotNull(studentCode)) {
-            errorMsgList.add("学号必填");
-        }
-        if (!RegexUtil.validStudentCode(studentCode)) {
-            errorMsgList.add("学号只能由数字、字母组成");
-        }
-        if (!SystemConstant.strNotNull(teachClazz)) {
-            errorMsgList.add("教学班必填");
-        }
 
         Long teacherId = null;
         if (SystemConstant.strNotNull(teacherCode) && !SystemConstant.strNotNull(teacherName)) {
@@ -288,37 +247,25 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
         if (SystemConstant.strNotNull(teacherName) && !SystemConstant.strNotNull(teacherCode)) {
             errorMsgList.add("任课老师工号必填");
         }
-        if (SystemConstant.strNotNull(teacherName) && SystemConstant.strNotNull(teacherCode)) {
-            // 存在教师信息,根据工号查询,不存在报错(缺少机构信息没法直接创建教师)
-            SysUser teacher = sysUserService.getOne(
-                    new QueryWrapper<SysUser>().lambda().eq(SysUser::getSchoolId, schoolId)
-                            .eq(SysUser::getCode, teacherCode).eq(SysUser::getRealName, teacherName)
-                            .last(SystemConstant.LIMIT1));
-            if (Objects.isNull(teacher)) {
-                errorMsgList.add(String.format("任课老师工号[%s],任课老师[%s]在用户管理中不存在", teacherCode, teacherName));
+        if (StringUtils.isNotBlank(teacherCode) && StringUtils.isNotBlank(teacherName)) {
+            SysUser sysUser = sysUserService.getByLoginName(schoolId, teacherCode);
+            if (sysUser == null) {
+                errorMsgList.add("任课老师工号[" + teacherCode + "]不存在");
             } else {
-                teacherId = teacher.getId();
+                if (!sysUser.getEnable()) {
+                    errorMsgList.add("任课老师工号[" + teacherCode + "]已禁用");
+                } else if (!sysUser.getRealName().equals(teacherName)) {
+                    errorMsgList.add("任课老师[" + teacherName + "]与用户管理中姓名[" + sysUser.getRealName() + "]不一致");
+                } else {
+                    teacherId = sysUser.getId();
+                }
             }
         }
 
         // 校验2 试卷编号存在时,任课教师,考试时间,考点考场均必填;
         BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
         boolean needPaperNumber = (basicSchool.getHasPaperNumber() != null && basicSchool.getHasPaperNumber()) || ExamModelEnum.MODEL4.equals(basicExam.getExamModel());
-        if (SystemConstant.strNotNull(paperNumber)) {
-            String hasPaperNumberError = "试卷编号不为空时: ";
-            if (!SystemConstant.strNotNull(teacherCode) || !SystemConstant.strNotNull(teacherName)) {
-                errorMsgList.add(hasPaperNumberError + "任课老师、任课老师工号必填");
-            }
-            if (!SystemConstant.longNotNull(examStartTime) || !SystemConstant.longNotNull(examEndTime)) {
-                errorMsgList.add(hasPaperNumberError + "考试时间必填");
-            }
-            if (!SystemConstant.strNotNull(examPlace)) {
-                errorMsgList.add(hasPaperNumberError + "考点(校区)必填");
-            }
-            if (!SystemConstant.strNotNull(examRoom)) {
-                errorMsgList.add(hasPaperNumberError + "考场(考试教室)必填");
-            }
-        } else if (needPaperNumber) {
+        if (needPaperNumber) {
             errorMsgList.add("试卷编号必填");
         }
 
@@ -326,35 +273,20 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
             throw ExceptionResultEnum.ERROR.exception(String.join(";", errorMsgList));
         }
 
-        // 若教学班不存在则新建一个
-        BasicTeachClazz basicTeachClazz = basicTeachClazzService.findOrCreateBasicTeachClazz(requestUser, examId,
-                courseId, teachClazz);
 
         BasicExamStudent basicExamStudent = new BasicExamStudent();
+        BeanUtils.copyProperties(basicExamStudentParam, basicExamStudent);
         basicExamStudent.setSchoolId(schoolId);
-        basicExamStudent.setSemesterId(semesterId);
-        basicExamStudent.setExamId(examId);
-        basicExamStudent.setCourseId(courseId);
-        basicExamStudent.setClazzId(basicTeachClazz.getId());
-        basicExamStudent.setStudentName(studentName);
-        basicExamStudent.setStudentCode(studentCode);
-        basicExamStudent.setCollege(college);
-        basicExamStudent.setMajor(major);
-        basicExamStudent.setPaperNumber(paperNumber);
         basicExamStudent.setTeacherId(teacherId);
-        basicExamStudent.setExamStartTime(examStartTime);
-        basicExamStudent.setExamEndTime(examEndTime);
-        basicExamStudent.setExamPlace(examPlace);
-        basicExamStudent.setExamRoom(examRoom);
 
-        if (SystemConstant.longNotNull(id)) {
+        if (SystemConstant.longNotNull(basicExamStudent.getId())) {
             // 编辑 (学号不可更改)
-            BasicExamStudent dbBasicExamStudent = this.getById(id);
+            BasicExamStudent dbBasicExamStudent = this.getById(basicExamStudent.getId());
             if (Objects.isNull(dbBasicExamStudent)) {
                 throw ExceptionResultEnum.ERROR.exception("考生不存在");
             }
-            if (!studentCode.equals(dbBasicExamStudent.getStudentCode())) {
-                throw ExceptionResultEnum.ERROR.exception("编辑考生时,学号不可更改");
+            if (!basicExamStudent.getStudentCode().equals(dbBasicExamStudent.getStudentCode())) {
+                throw ExceptionResultEnum.ERROR.exception("学号不可更改");
             }
             MarkStudent markStudent = markStudentService.findByExamIdAndPaperNumberAndStudentCode(dbBasicExamStudent.getExamId(), dbBasicExamStudent.getPaperNumber(), dbBasicExamStudent.getStudentCode());
             if (markStudent != null && markStudent.getUpload() && StringUtils.isNotBlank(paperNumber) && !paperNumber.equals(dbBasicExamStudent.getPaperNumber())) {
@@ -363,15 +295,13 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
             if (ExamModelEnum.MODEL4.equals(basicExam.getExamModel()) && dbBasicExamStudent != null) {
                 oldPaperNumberList.add(dbBasicExamStudent.getPaperNumber());
             }
-
-            basicExamStudent.setId(id);
             basicExamStudent.updateInfo(requestUserId);
         } else {
             // 新增 (学号在考试课程下唯一)
-            if (this.count(new QueryWrapper<BasicExamStudent>().lambda().eq(BasicExamStudent::getSchoolId, schoolId)
-                    .eq(BasicExamStudent::getExamId, examId).eq(BasicExamStudent::getCourseId, courseId)
-                    .eq(BasicExamStudent::getStudentCode, studentCode)) > 0) {
-                throw ExceptionResultEnum.ERROR.exception(String.format("学号[%s]重复", studentCode));
+            if (this.count(new QueryWrapper<BasicExamStudent>().lambda()
+                    .eq(BasicExamStudent::getExamId, basicExamStudent.getExamId()).eq(BasicExamStudent::getCourseId, basicExamStudent.getCourseId())
+                    .eq(BasicExamStudent::getStudentCode, basicExamStudent.getStudentCode())) > 0) {
+                throw ExceptionResultEnum.ERROR.exception(String.format("学号[%s]重复", basicExamStudent.getStudentCode()));
             }
             basicExamStudent.insertInfo(requestUserId);
         }

+ 0 - 21
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicTeachClazzServiceImpl.java

@@ -31,27 +31,6 @@ public class BasicTeachClazzServiceImpl extends ServiceImpl<BasicTeachClazzMappe
     @Resource
     private BasicExamStudentService basicExamStudentService;
 
-    @Transactional
-    @Override
-    public BasicTeachClazz findOrCreateBasicTeachClazz(SysUser requestUser, Long examId, Long courseId, String teachClazzName) {
-        Long schoolId = requestUser.getSchoolId();
-        Long userId = requestUser.getId();
-        BasicTeachClazz basicTeachClazz = this.getOne(
-                new QueryWrapper<BasicTeachClazz>().lambda().eq(BasicTeachClazz::getSchoolId, schoolId)
-                        .eq(BasicTeachClazz::getExamId, examId).eq(BasicTeachClazz::getClazzName, teachClazzName).last(SystemConstant.LIMIT1));
-
-        if (Objects.isNull(basicTeachClazz)) {
-            basicTeachClazz = new BasicTeachClazz();
-            basicTeachClazz.setSchoolId(schoolId);
-            basicTeachClazz.setClazzName(teachClazzName);
-            basicTeachClazz.setCourseId(courseId);
-            basicTeachClazz.setExamId(examId);
-            basicTeachClazz.insertInfo(userId);
-            this.save(basicTeachClazz);
-        }
-        return basicTeachClazz;
-    }
-
     @Override
     public List<BasicTeachClazzResult> findAllTeachClazz(Long examId, String courseCode, String clazzName) {
         clazzName = SystemConstant.translateSpecificSign(clazzName);

+ 10 - 21
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -27,7 +27,10 @@ import com.qmth.distributed.print.business.templete.execute.AsyncExaminationImpo
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
 import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.*;
+import com.qmth.teachcloud.common.entity.BasicAttachment;
+import com.qmth.teachcloud.common.entity.SysOrg;
+import com.qmth.teachcloud.common.entity.SysUser;
+import com.qmth.teachcloud.common.entity.TBTask;
 import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.util.*;
@@ -96,18 +99,9 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
     @Resource
     private SysOrgService sysOrgService;
 
-    @Resource
-    private SysUserService sysUserService;
-
-    @Resource
-    TBTaskService tbTaskService;
-
     @Resource
     RedisCounterUtil redisCounterUtil;
 
-    @Resource
-    private ClientPrintDataService clientPrintDataService;
-
     @Resource
     ClientStatusService clientStatusService;
 
@@ -123,17 +117,12 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
     @Resource
     RedisUtil redisUtil;
 
-    @Resource
-    BasicClazzService basicClazzService;
-
     @Resource
     TeachClazzService teachClazzService;
 
     @Resource
     BasicRoleDataPermissionService basicRoleDataPermissionService;
 
-    @Resource
-    BasicPrintConfigService basicPrintConfigService;
     @Resource
     private ScanPaperService scanPaperService;
 
@@ -1193,12 +1182,12 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
      */
     private List<String> findClazzNamesByClazzIdSet(Set<Long> clazzIdSet) {
         Set<String> clazzNameSet = new HashSet<>();
-        if (clazzIdSet.size() > 0) {
-            Set<String> basicClazzSet = basicClazzService.list(new QueryWrapper<BasicClazz>().lambda().in(BasicClazz::getId, clazzIdSet)).stream().map(BasicClazz::getClazzName).collect(Collectors.toSet());
-            Set<String> teachClazzSet = teachClazzService.list(new QueryWrapper<TeachClazz>().lambda().in(TeachClazz::getId, clazzIdSet)).stream().map(TeachClazz::getClazzName).collect(Collectors.toSet());
-            clazzNameSet.addAll(basicClazzSet);
-            clazzNameSet.addAll(teachClazzSet);
-        }
+//        if (clazzIdSet.size() > 0) {
+//            Set<String> basicClazzSet = basicClazzService.list(new QueryWrapper<BasicClazz>().lambda().in(BasicClazz::getId, clazzIdSet)).stream().map(BasicClazz::getClazzName).collect(Collectors.toSet());
+//            Set<String> teachClazzSet = teachClazzService.list(new QueryWrapper<TeachClazz>().lambda().in(TeachClazz::getId, clazzIdSet)).stream().map(TeachClazz::getClazzName).collect(Collectors.toSet());
+//            clazzNameSet.addAll(basicClazzSet);
+//            clazzNameSet.addAll(teachClazzSet);
+//        }
         return new ArrayList<>(clazzNameSet);
     }
 

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

@@ -121,8 +121,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
     @Resource
     TaskService taskService;
     @Resource
-    BasicCardRuleService basicCardRuleService;
-    @Resource
     ExamPrintPlanService examPrintPlanService;
     @Resource
     RedisUtil redisUtil;
@@ -153,10 +151,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
     @Resource
     BasicSemesterService basicSemesterService;
     @Resource
-    BasicStudentService basicStudentService;
-    @Resource
-    BasicClazzService basicClazzService;
-    @Resource
     private BasicRoleDataPermissionService basicRoleDataPermissionService;
     @Resource
     private BasicOperationLogService basicOperationLogService;
@@ -2014,8 +2008,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                     examStudent.setStudentCode(basicExamStudent.getStudentCode());
                     examStudent.setStudentName(basicExamStudent.getStudentName());
                     examStudent.setSiteNumber(String.valueOf(atomicInteger.getAndIncrement()));
-                    examStudent.setCollegeName(basicExamStudent.getCollege());
-                    examStudent.setMajorName(basicExamStudent.getMajor());
+                    examStudent.setCollegeName(basicExamStudent.getCollegeName());
+                    examStudent.setMajorName(basicExamStudent.getMajorName());
                     examStudent.setTeacherId(basicExamStudent.getTeacherId());
                     BasicTeachClazz basicTeachClazz = basicTeachClazzService.getById(basicExamStudent.getClazzId());
                     examStudent.setTeachClazzId(basicExamStudent.getClazzId());

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

@@ -112,7 +112,7 @@ public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCS
 
                     ClazzContentDto clazzContent = new ClazzContentDto();
                     clazzContent.setClazzId(clazzId);
-                    clazzContent.setClazzName(examDetailService.findClazzNamesByClazzIds(String.valueOf(clazzId), ","));
+//                    clazzContent.setClazzName(examDetailService.findClazzNamesByClazzIds(String.valueOf(clazzId), ","));
 
                     // 匹配到以印刷的
                     List<ExamTaskPlanStatisticDto> printClazzList = matchClazzList.stream().filter(e -> ExamDetailStatusEnum.FINISH.equals(e.getExamDetailStatus())).collect(Collectors.toList());
@@ -190,7 +190,7 @@ public class TCStatisticsServiceImpl extends ServiceImpl<TCStatisticsMapper, TCS
                 tcStatistics.setCourseCode(tcStatisticsTemp.getCourseCode());
                 tcStatistics.setTeacherName(tcStatisticsTemp.getTeacherName());
                 tcStatistics.setClazzIds(clazzIds);
-                tcStatistics.setClazzName(examDetailService.findClazzNamesByClazzIds(clazzIds, ","));
+//                tcStatistics.setClazzName(examDetailService.findClazzNamesByClazzIds(clazzIds, ","));
                 tcStatistics.setClazzContent(JSON.toJSONString(clazzContentDtoList));
                 tcStatistics.setStatus(status);
                 tcStatistics.insertInfo(requestUserId);

+ 0 - 84
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncStudentDataImportService.java

@@ -1,84 +0,0 @@
-package com.qmth.distributed.print.business.templete.execute;
-
-import cn.hutool.core.date.DateUtil;
-import com.qmth.boot.api.exception.ApiException;
-import com.qmth.distributed.print.business.templete.importData.AsyncImportTaskTemplete;
-import com.qmth.distributed.print.business.templete.service.TaskLogicService;
-import com.qmth.teachcloud.common.bean.dto.excel.export.BasicStudentErrorExportDto;
-import com.qmth.teachcloud.common.contant.SpringContextHolder;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.TBTask;
-import com.qmth.teachcloud.common.enums.TaskResultEnum;
-import com.qmth.teachcloud.common.enums.TaskStatusEnum;
-import com.qmth.teachcloud.common.service.TBTaskService;
-import com.qmth.teachcloud.common.util.Result;
-import com.qmth.teachcloud.common.util.ResultUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
-
-import java.io.InputStream;
-import java.text.MessageFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.StringJoiner;
-
-/**
- * @Description: 异步-学生基础信息导入
- * @Author: CaoZixuan
- * @Date: 2021-04-07
- */
-@Service
-public class AsyncStudentDataImportService extends AsyncImportTaskTemplete {
-
-    private final static Logger log = LoggerFactory.getLogger(AsyncStudentDataImportService.class);
-
-    public static final String OBJ_TITLE = "学生基础数据";
-
-    @Override
-    public Result importTask(Map<String, Object> map) throws Exception {
-        TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
-        InputStream inputStream = super.getUploadFileInputStream(tbTask);
-        map.put("inputStream", inputStream);
-
-        StringJoiner stringJoinerSummary = new StringJoiner("\n")
-                .add(MessageFormat.format("{0}{1}{2}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), BEGIN_TITLE, OBJ_TITLE));
-        tbTask.setStatus(TaskStatusEnum.RUNNING);
-        TBTaskService tbTaskService = SpringContextHolder.getBean(TBTaskService.class);
-        tbTaskService.updateById(tbTask);
-        try {
-            TaskLogicService taskLogicService = SpringContextHolder.getBean(TaskLogicService.class);
-
-            // 执行导入基础学生数据
-            Map<String, Object> result = taskLogicService.executeImportBasicStudentLogic(map);
-
-            //错误数据,生成文件
-            if (result.containsKey(SystemConstant.ERROR_DATA_LIST)) {
-                tbTask.setResult(TaskResultEnum.ERROR);
-                List<BasicStudentErrorExportDto> errorDataList = (List<BasicStudentErrorExportDto>) result.get(SystemConstant.ERROR_DATA_LIST);
-                if (!CollectionUtils.isEmpty(errorDataList)) {
-                    super.createErrorFile(tbTask, BasicStudentErrorExportDto.class, errorDataList);
-                }
-            } else {
-                tbTask.setResult(TaskResultEnum.SUCCESS);
-            }
-            stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}{4}{5}{6}{7}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), FINISH_TITLE, Long.valueOf(String.valueOf(result.get(SystemConstant.DATA_COUNT))), FINISH_TOTAL_SIZE, Long.valueOf(String.valueOf(result.get(SystemConstant.SUCCESS_DATA_COUNT))), FINISH_SUCCESS_SIZE, Long.valueOf(String.valueOf(result.get(SystemConstant.ERROR_DATA_COUNT))), FINISH_ERROR_SIZE));
-        } catch (Exception e) {
-            log.error(SystemConstant.LOG_ERROR, e);
-            stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), EXCEPTION_TITLE, EXCEPTION_DATA, e.getMessage()));
-            tbTask.setResult(TaskResultEnum.ERROR);
-            if (e instanceof ApiException) {
-                ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
-            } else {
-                ResultUtil.error(e.getMessage());
-            }
-        } finally {//生成txt文件
-            tbTask.setSummary(stringJoinerSummary.toString());
-            tbTask.setStatus(TaskStatusEnum.FINISH);
-            tbTaskService.updateById(tbTask);
-        }
-        return ResultUtil.ok(map);
-    }
-}

+ 85 - 134
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/SyncBasicExamStudentImportService.java

@@ -2,11 +2,15 @@ package com.qmth.distributed.print.business.templete.execute;
 
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSON;
+import com.qmth.boot.tools.excel.ExcelWriter;
+import com.qmth.boot.tools.excel.enums.ExcelType;
 import com.qmth.distributed.print.business.bean.dto.BasicExamStudentDto;
+import com.qmth.distributed.print.business.bean.dto.importFile.BasicExamStudentImport;
+import com.qmth.distributed.print.business.bean.examRule.CodeNameEnableValue;
 import com.qmth.distributed.print.business.service.BasicExamService;
 import com.qmth.distributed.print.business.service.BasicExamStudentService;
 import com.qmth.distributed.print.business.templete.importData.SyncImportTaskTemplate;
-import com.qmth.distributed.print.business.templete.service.TaskLogicService;
+import com.qmth.distributed.print.business.templete.service.ImportLogicService;
 import com.qmth.teachcloud.common.annotation.ExcelNote;
 import com.qmth.teachcloud.common.bean.vo.FilePathVo;
 import com.qmth.teachcloud.common.contant.SpringContextHolder;
@@ -21,6 +25,7 @@ import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.mark.service.MarkPaperService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.usermodel.FillPatternType;
 import org.apache.poi.ss.usermodel.Font;
 import org.apache.poi.ss.usermodel.HorizontalAlignment;
@@ -32,6 +37,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import javax.servlet.ServletOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -52,7 +58,13 @@ public class SyncBasicExamStudentImportService extends SyncImportTaskTemplate {
 
     private final static Logger log = LoggerFactory.getLogger(SyncBasicExamStudentImportService.class);
 
-    public static final String OBJ_TITLE = "考生字典数据";
+    public static final String BEGIN_TITLE = "->开始处理导入文件";
+    public static final String EXCEPTION_TITLE = "->数据处理发生异常!";
+    public static final String EXCEPTION_DATA = "错误信息:";
+    public static final String FINISH_TITLE = "->数据处理结束,共处理了";
+    public static final String FINISH_TOTAL_SIZE = "条数据,成功";
+    public static final String FINISH_SUCCESS_SIZE = "条数据,失败";
+    public static final String FINISH_ERROR_SIZE = "条数据";
 
     @Resource
     private BasicExamService basicExamService;
@@ -69,37 +81,54 @@ public class SyncBasicExamStudentImportService extends SyncImportTaskTemplate {
         InputStream inputStream = super.getUploadFileInputStream(tbTask);
         map.put("inputStream", inputStream);
 
-        StringJoiner stringJoinerSummary = new StringJoiner("\n").add(
-                MessageFormat.format("{0}{1}{2}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN),
-                        BEGIN_TITLE, OBJ_TITLE));
+        StringJoiner stringJoinerSummary = new StringJoiner("\n");
+        SystemConstant.addSummary(stringJoinerSummary, BEGIN_TITLE);
         tbTask.setStatus(TaskStatusEnum.RUNNING);
         TBTaskService tbTaskService = SpringContextHolder.getBean(TBTaskService.class);
         tbTaskService.updateById(tbTask);
         int dataCount = 0;
         int successCount = 0;
         int errorCount = 0;
-        List<BasicExamStudentDto> errorDataList = new ArrayList<>();
+        boolean hasError;
+        List<BasicExamStudentImport> errorDataList;
 
         try {
-            TaskLogicService taskLogicService = SpringContextHolder.getBean(TaskLogicService.class);
+            ImportLogicService importLogicService = SpringContextHolder.getBean(ImportLogicService.class);
 
             // 执行导入考务数据
-            Map<String, Object> result = taskLogicService.executeImportBasicExamStudentLogic(map);
+            Map<String, Object> result = importLogicService.executeImportBasicExamStudentLogic(map, stringJoinerSummary);
             dataCount = Integer.parseInt(String.valueOf(result.get(SystemConstant.DATA_COUNT)));
             successCount = Integer.parseInt(String.valueOf(result.get(SystemConstant.SUCCESS_DATA_COUNT)));
             errorCount = Integer.parseInt(String.valueOf(result.get(SystemConstant.ERROR_DATA_COUNT)));
+            hasError = Boolean.parseBoolean(String.valueOf(result.get(SystemConstant.HAS_ERROR_DATA)));
 
-            // 无异常数据
-            if (result.containsKey(SystemConstant.DATASOURCE)) {
+            if (hasError) {
+                SystemConstant.addSummary(stringJoinerSummary, "有异常数据,开始生成错误文件");
+                tbTask.setResult(TaskResultEnum.ERROR);
+                // 有异常数据
+                errorDataList = JSON.parseArray(JSON.toJSONString(result.get(SystemConstant.ERROR_DATA_LIST)),
+                        BasicExamStudentImport.class);
+                try {
+                    String[] columnNames = (String[]) result.get(SystemConstant.COLUMN_NAMES);
+                    File excelFileTemp = SystemConstant.getFileTempVar(SystemConstant.EXCEL_PREFIX);
+                    this.createErrorExcelFile(columnNames, errorDataList, excelFileTemp);
+                    String fileName = SystemConstant.getNanoId() + SystemConstant.EXCEL_PREFIX;
+                    FilePathVo filePathVo = fileUploadService.uploadFile(excelFileTemp, UploadFileEnum.FILE, fileName);
+                    tbTask.setErrorFilePath(JSON.toJSONString(filePathVo));
+                    SystemConstant.addSummary(stringJoinerSummary, "错误文件生成生成,请到\"导入结果查询\"中,下载错误文件");
+                } catch (Exception e) {
+                    SystemConstant.addSummary(stringJoinerSummary, "错误文件生成失败," + e.getMessage());
+                }
+            } else {
                 List<BasicExamStudent> basicExamStudentList = JSON.parseArray(JSON.toJSONString(result.get(SystemConstant.DATASOURCE)), BasicExamStudent.class);
                 basicExamStudentService.saveOrUpdateBatch(basicExamStudentList);
                 // 模式4,直接进扫描阅卷库
                 BasicExam basicExam = basicExamService.getById(tbTask.getExamId());
                 if (ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
-                    taskLogicService.saveMarkStudent(tbTask.getExamId(), basicExamStudentList);
+                    importLogicService.saveMarkStudent(tbTask.getExamId(), basicExamStudentList);
 
                     // 重新统计试卷下考生数量
-                    basicExamStudentList.stream().map(BasicExamStudent::getPaperNumber).distinct().forEach(m-> markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(tbTask.getExamId(), m, SystemConstant.DEFAULT_PAPER_TYPE_A));
+                    basicExamStudentList.stream().map(BasicExamStudent::getPaperNumber).distinct().forEach(m -> markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(tbTask.getExamId(), m, SystemConstant.DEFAULT_PAPER_TYPE_A));
 
                     // 更改过试卷编号后,该试卷编号下没有考生则删除该试卷
                     List<String> oldPaperNumberList = JSON.parseArray(JSON.toJSONString(result.get("oldPaperNumberList")), String.class);
@@ -107,142 +136,64 @@ public class SyncBasicExamStudentImportService extends SyncImportTaskTemplate {
                         markPaperService.deleteByExamIdAndPaperNumber(tbTask.getExamId(), paperNumber, true);
                     }
                 }
-            } else if (result.containsKey(SystemConstant.ERROR_DATA_LIST)) {
-                // 有异常数据
-                errorDataList = JSON.parseArray(JSON.toJSONString(result.get(SystemConstant.ERROR_DATA_LIST)),
-                        BasicExamStudentDto.class);
-                throw ExceptionResultEnum.ERROR.exception("导入考生字典失败,请通过'导入结果查询'查看错误原因");
+                tbTask.setResult(TaskResultEnum.SUCCESS);
             }
         } catch (Exception e) {
-            log.error(SystemConstant.LOG_ERROR, e.getMessage());
-            throw ExceptionResultEnum.ERROR.exception(e.getMessage());
+            tbTask.setResult(TaskResultEnum.ERROR);
+            stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), EXCEPTION_TITLE, EXCEPTION_DATA, e.getMessage()));
         } finally {//生成文件
             stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}{4}{5}{6}{7}",
                     DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), FINISH_TITLE, dataCount,
                     FINISH_TOTAL_SIZE, successCount, FINISH_SUCCESS_SIZE, errorCount, FINISH_ERROR_SIZE));
-            if (CollectionUtils.isNotEmpty(errorDataList)) {
-                tbTask.setResult(TaskResultEnum.ERROR);
-                String createExcelError = "";
-                try {
-                    File excelFileTemp = SystemConstant.getFileTempVar(SystemConstant.EXCEL_PREFIX);
-                    this.createLocalErrorExcel(errorDataList, excelFileTemp);
-                    String fileName = SystemConstant.getNanoId() + SystemConstant.EXCEL_PREFIX;
-                    FilePathVo filePathVo = fileUploadService.uploadFile(excelFileTemp, UploadFileEnum.FILE, fileName);
-                    tbTask.setErrorFilePath(JSON.toJSONString(filePathVo));
-                } catch (Exception e) {
-                    createExcelError = e.getMessage();
-                    log.error("创建考生字典导入错误数据文件失败: " + e.getMessage());
-                } finally {
-                    tbTask.setSummary("创建考生字典导入错误数据文件失败" + stringJoinerSummary + createExcelError);
-                }
-            } else {
-                tbTask.setSummary(stringJoinerSummary.toString());
-                tbTask.setResult(TaskResultEnum.SUCCESS);
-            }
             tbTask.setStatus(TaskStatusEnum.FINISH);
+            tbTask.setSummary(stringJoinerSummary.toString());
             tbTaskService.updateById(tbTask);
         }
         return ResultUtil.ok();
     }
 
-    private void createLocalErrorExcel(List<BasicExamStudentDto> basicExamStudentDtoList, File excelFileTemp)
-            throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, IOException {
-
-        List<Field> fields = Arrays.asList(BasicExamStudentDto.class.getDeclaredFields());
-
-        log.debug("导出Excel开始...");
-        XSSFWorkbook wb = new XSSFWorkbook();
-        XSSFSheet sheet = wb.createSheet("考生字典导入");
-
-        Font defaultFont = wb.createFont();
-        defaultFont.setFontHeightInPoints((short) 12);
-        defaultFont.setFontName("宋体");
-
-        int cellCount = fields.size();
-        // 说明
-        XSSFCellStyle describeStyle = wb.createCellStyle();
-        XSSFDataFormat format = wb.createDataFormat();
-        describeStyle.setAlignment(HorizontalAlignment.LEFT);
-        Font describeFont = wb.createFont();
-        describeFont.setFontHeightInPoints((short) 12);
-        describeFont.setFontName("宋体");
-        describeFont.setColor(IndexedColors.RED.getIndex());
-        describeStyle.setFont(describeFont);
-        describeStyle.setDataFormat(format.getFormat("@"));
-        String describe = SystemConstant.BASIC_EXAM_STUDENT_DESCRIBE;
-        describe = describe.trim();
-        XSSFRow rowDescribe = sheet.createRow(0);
-        rowDescribe.setHeightInPoints(100); //行高设置成100px
-        for (int i = 0; i < cellCount; i++) {
-            XSSFCell cell = rowDescribe.createCell(i);
-            if (i == 0) {
-                cell.setCellValue(describe);
-                cell.setCellStyle(describeStyle);
-            }
-        }
-        CellRangeAddress region = new CellRangeAddress(0, 0, 0, cellCount - 1);
-        sheet.addMergedRegion(region);
-
-        // 表头行
-        XSSFCellStyle headerStyle = wb.createCellStyle();
-        headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
-        headerStyle.setAlignment(HorizontalAlignment.CENTER);
-        headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
-        headerStyle.setFont(defaultFont);
-        XSSFRow rowHead = sheet.createRow(1);
-        for (int i = 0; i < fields.size(); i++) {
-            XSSFCell cell = rowHead.createCell(i);
-            Field field = fields.get(i);
-            String title = "";
-            ExcelNote excelNote = field.getAnnotation(ExcelNote.class);
-
-            if (Objects.isNull(excelNote)) {
-                if (i == fields.size() - 1) {
-                    title = "异常信息";
-                } else {
-                    throw ExceptionResultEnum.ERROR.exception("未能获取dto属性注解");
-                }
-            } else {
-                title = excelNote.value();
-            }
-            cell.setCellValue(title);
-            cell.setCellStyle(headerStyle);
-        }
-        XSSFCell lastCell = rowHead.createCell(cellCount - 1);
-        lastCell.setCellValue("异常信息");
-        lastCell.setCellStyle(headerStyle);
-
-        // 内容行
-        XSSFCellStyle exampleStyle = wb.createCellStyle();
-        exampleStyle.setAlignment(HorizontalAlignment.LEFT);
-        exampleStyle.setFont(defaultFont);
-
-        for (int i = 0; i < basicExamStudentDtoList.size(); i++) {
-            BasicExamStudentDto basicExamStudentDto = basicExamStudentDtoList.get(i);
-            XSSFRow row = sheet.createRow(i + 2);
-            for (int j = 0; j < fields.size(); j++) {
-                XSSFCell cell = row.createCell(j);
-                Field head = fields.get(j);
-                String methodName = "get" + SystemConstant.initCap(head.getName());
-                Method getMethod = basicExamStudentDto.getClass().getDeclaredMethod(methodName);
-                String value = String.valueOf(getMethod.invoke(basicExamStudentDto));
-                if (SystemConstant.strNotNull(value)) {
-                    cell.setCellValue(value);
-                } else {
-                    cell.setCellValue("");
+    private void createErrorExcelFile(String[] columnName, List<BasicExamStudentImport> basicExamStudentDtoList, File excelFileTemp) {
+        try {
+            List<String> columnNameList = new ArrayList<>(Arrays.asList(columnName));
+            columnNameList.add("错误信息");
+            String[] columnNames = columnNameList.toArray(new String[0]);
+            List<String[]> columnValues = new ArrayList<>();
+            for (BasicExamStudentImport basicExamStudentImport : basicExamStudentDtoList) {
+                List<String> valueList = new ArrayList<>();
+                for (String title : columnNameList) {
+                    if (title.equals("错误信息")) {
+                        valueList.add(basicExamStudentImport.getErrorMsg());
+                        continue;
+                    }
+                    String value = "";
+                    for (CodeNameEnableValue codeNameEnableValue : basicExamStudentImport.getRequiredFieldList()) {
+                        if (codeNameEnableValue.getName().equals(title)) {
+                            value = codeNameEnableValue.getValue();
+                        }
+                    }
+                    if (StringUtils.isBlank(value)) {
+                        for (CodeNameEnableValue codeNameEnableValue : basicExamStudentImport.getExtendFieldList()) {
+                            if (codeNameEnableValue.getName().equals(title)) {
+                                value = codeNameEnableValue.getValue();
+                            }
+                        }
+                    }
+                    valueList.add(value);
                 }
-                cell.setCellStyle(exampleStyle);
+                // 错误信息
+                String[] columnValue = valueList.toArray(new String[valueList.size()]);
+                columnValues.add(columnValue);
             }
-        }
-        for (int i = 0; i < cellCount; i++) {
-            sheet.autoSizeColumn(i);
-            int width = sheet.getColumnWidth(i)  * 17 / 10;
-            sheet.setColumnWidth(i, Math.min(width, 255 * 256));
-        }
 
-        FileOutputStream outputStream = new FileOutputStream(excelFileTemp);
-        wb.write(outputStream);
-        outputStream.flush();
-        outputStream.close();
+            FileOutputStream outputStream = new FileOutputStream(excelFileTemp);
+            ExcelWriter writer = ExcelWriter.create(ExcelType.XLSX);
+            writer.writeDataArrays("考生数据", null, columnNames, columnValues.listIterator());
+            writer.output(outputStream);
+            outputStream.flush();
+            outputStream.close();
+        } catch (Exception e) {
+
+        }
     }
+
 }

+ 3 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/SyncObjectiveStructImportService.java

@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.templete.execute;
 
 import cn.hutool.core.date.DateUtil;
 import com.qmth.distributed.print.business.templete.importData.SyncImportTaskTemplate;
+import com.qmth.distributed.print.business.templete.service.ImportLogicService;
 import com.qmth.distributed.print.business.templete.service.TaskLogicService;
 import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SystemConstant;
@@ -41,9 +42,9 @@ public class SyncObjectiveStructImportService extends SyncImportTaskTemplate {
         tbTaskService.updateById(tbTask);
         try (InputStream inputStream = super.getUploadFileInputStream(tbTask)) {
             map.put("inputStream", inputStream);
-            TaskLogicService taskLogicService = SpringContextHolder.getBean(TaskLogicService.class);
+            ImportLogicService importLogicService = SpringContextHolder.getBean(ImportLogicService.class);
             // 执行导入考务数据
-            taskLogicService.executeImportObjectiveStructLogic(map);
+            importLogicService.executeImportObjectiveStructLogic(map);
             tbTask.setResult(TaskResultEnum.SUCCESS);
             stringJoinerSummary.add("导入客观题结构成功");
         } catch (Exception e) {

+ 3 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/SyncSubjectiveStructImportService.java

@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.templete.execute;
 
 import cn.hutool.core.date.DateUtil;
 import com.qmth.distributed.print.business.templete.importData.SyncImportTaskTemplate;
+import com.qmth.distributed.print.business.templete.service.ImportLogicService;
 import com.qmth.distributed.print.business.templete.service.TaskLogicService;
 import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SystemConstant;
@@ -41,9 +42,9 @@ public class SyncSubjectiveStructImportService extends SyncImportTaskTemplate {
         tbTaskService.updateById(tbTask);
         try (InputStream inputStream = super.getUploadFileInputStream(tbTask)) {
             map.put("inputStream", inputStream);
-            TaskLogicService taskLogicService = SpringContextHolder.getBean(TaskLogicService.class);
+            ImportLogicService importLogicService = SpringContextHolder.getBean(ImportLogicService.class);
             // 执行导入考务数据
-            taskLogicService.executeImportSubjectiveStructLogic(map);
+            importLogicService.executeImportSubjectiveStructLogic(map);
             tbTask.setResult(TaskResultEnum.SUCCESS);
             stringJoinerSummary.add("导入主观题结构成功");
         } catch (Exception e) {

+ 0 - 34
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/importData/AsyncImportTaskTemplete.java

@@ -76,40 +76,6 @@ public abstract class AsyncImportTaskTemplete {
         return inputStream;
     }
 
-    /**
-     * 创建txt文件
-     *
-     * @param tbTask
-     */
-    public void createTxt(TBTask tbTask) throws IOException {
-        try {
-            JSONObject json = SystemConstant.createTxt(tbTask.getSummary());
-            tbTask.setReportFilePath(json.toJSONString());
-        } catch (Exception e) {
-            log.error(SystemConstant.LOG_ERROR, e);
-            StringJoiner stringJoinerSummary = new StringJoiner("").add(tbTask.getSummary()).add("\n");
-            stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), EXCEPTION_CREATE_TXT_TITLE, EXCEPTION_DATA, e.getMessage()));
-
-            String summary = stringJoinerSummary.toString();
-            if (summary.length() >= 65535) {
-                summary = "Data too long : " + summary.substring(0, 100) + "......" + summary.substring(summary.length() - 100);
-            }
-
-            tbTask.setSummary(summary);
-            tbTask.setResult(TaskResultEnum.ERROR);
-            if (e instanceof ApiException) {
-                ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
-            } else {
-                ResultUtil.error(e.getMessage());
-            }
-        } finally {
-            TBTaskService tbTaskService = SpringContextHolder.getBean(TBTaskService.class);
-            tbTask.setStatus(TaskStatusEnum.FINISH);
-            tbTaskService.updateById(tbTask);
-        }
-    }
-
-
     /**
      * 创建txt文件
      *

+ 56 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/ImportLogicService.java

@@ -0,0 +1,56 @@
+package com.qmth.distributed.print.business.templete.service;
+
+import com.qmth.distributed.print.business.bean.dto.importFile.BasicExamStudentImport;
+import com.qmth.teachcloud.common.entity.BasicExamStudent;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+import java.util.StringJoiner;
+
+/**
+ * @Description: 任务处理逻辑
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/3/29
+ */
+public interface ImportLogicService {
+
+
+    /**
+     * 处理考生字典导入
+     *
+     * @param map 数据源
+     * @return 结果
+     * @throws Exception 异常
+     */
+    Map<String, Object> executeImportBasicExamStudentLogic(Map<String, Object> map, StringJoiner stringJoinerSummary);
+
+    /**
+     * 保存阅卷数据
+     *
+     * @param examId 考试id
+     */
+    void saveMarkStudent(Long examId, List<BasicExamStudent> basicExamStudentList);
+
+    /**
+     * 处理客观题结构导入
+     *
+     * @param map 数据源
+     * @return 结果
+     * @throws Exception 异常
+     */
+    Map<String, Object> executeImportObjectiveStructLogic(Map<String, Object> map) throws Exception;
+
+    /**
+     * 处理主观题结构导入
+     *
+     * @param map 数据源
+     * @return 结果
+     * @throws Exception 异常
+     */
+    Map<String, Object> executeImportSubjectiveStructLogic(Map<String, Object> map) throws Exception;
+
+}

+ 0 - 46
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/TaskLogicService.java

@@ -1,9 +1,6 @@
 package com.qmth.distributed.print.business.templete.service;
 
-import com.qmth.teachcloud.common.entity.BasicExamStudent;
-
 import java.io.IOException;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -41,15 +38,6 @@ public interface TaskLogicService {
      */
     Map<String, Object> executeExportPaperAndCardLogic(Map<String, Object> map) throws Exception;
 
-    /**
-     * 处理导入考生数据
-     *
-     * @param map 数据源
-     * @return 结果
-     * @throws Exception 异常
-     */
-    Map<String, Object> executeImportBasicStudentLogic(Map<String, Object> map) throws Exception;
-
     /**
      * 处理导入用户数据
      *
@@ -85,38 +73,4 @@ public interface TaskLogicService {
     Map<String, Object> executeDownloadScoreLogic(Map<String, Object> map) throws Exception;
 
     Map<String, Object> executeDownloadPaperFileBatch(Map<String, Object> map) throws Exception;
-
-    /**
-     * 处理考生字典导入
-     *
-     * @param map 数据源
-     * @return 结果
-     * @throws Exception 异常
-     */
-    Map<String, Object> executeImportBasicExamStudentLogic(Map<String, Object> map) throws Exception;
-
-    /**
-     * 保存阅卷数据
-     *
-     * @param examId 考试id
-     */
-    void saveMarkStudent(Long examId, List<BasicExamStudent> basicExamStudentList);
-
-    /**
-     * 处理客观题结构导入
-     *
-     * @param map 数据源
-     * @return 结果
-     * @throws Exception 异常
-     */
-    Map<String, Object> executeImportObjectiveStructLogic(Map<String, Object> map) throws Exception;
-
-    /**
-     * 处理主观题结构导入
-     *
-     * @param map 数据源
-     * @return 结果
-     * @throws Exception 异常
-     */
-    Map<String, Object> executeImportSubjectiveStructLogic(Map<String, Object> map) throws Exception;
 }

+ 763 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/ImportLogicServiceImpl.java

@@ -0,0 +1,763 @@
+package com.qmth.distributed.print.business.templete.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.qmth.boot.tools.excel.ExcelReader;
+import com.qmth.boot.tools.excel.enums.ExcelType;
+import com.qmth.boot.tools.excel.model.DataMap;
+import com.qmth.distributed.print.business.bean.dto.ObjectiveStructDto;
+import com.qmth.distributed.print.business.bean.dto.SubjectiveStructDto;
+import com.qmth.distributed.print.business.bean.dto.importFile.BasicExamStudentImport;
+import com.qmth.distributed.print.business.bean.dto.importFile.BasicExamStudentParseDto;
+import com.qmth.distributed.print.business.bean.examRule.CodeNameEnableValue;
+import com.qmth.distributed.print.business.entity.BasicExamRule;
+import com.qmth.distributed.print.business.enums.RequiredFieldsEnum;
+import com.qmth.distributed.print.business.service.BasicExamRuleService;
+import com.qmth.distributed.print.business.service.BasicExamService;
+import com.qmth.distributed.print.business.service.BasicExamStudentService;
+import com.qmth.distributed.print.business.templete.service.ImportLogicService;
+import com.qmth.teachcloud.common.base.BaseEntity;
+import com.qmth.teachcloud.common.bean.dto.mark.MarkUser;
+import com.qmth.teachcloud.common.bean.params.UserSaveParams;
+import com.qmth.teachcloud.common.bean.result.ExcelResult;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.*;
+import com.qmth.teachcloud.common.enums.*;
+import com.qmth.teachcloud.common.service.*;
+import com.qmth.teachcloud.common.util.ConvertUtil;
+import com.qmth.teachcloud.common.util.ServletUtil;
+import com.qmth.teachcloud.mark.dto.mark.setting.MarkGroupDto;
+import com.qmth.teachcloud.mark.dto.mark.setting.MarkGroupSingleDto;
+import com.qmth.teachcloud.mark.entity.MarkPaper;
+import com.qmth.teachcloud.mark.service.MarkGroupService;
+import com.qmth.teachcloud.mark.service.MarkPaperService;
+import com.qmth.teachcloud.mark.service.MarkQuestionService;
+import com.qmth.teachcloud.mark.service.MarkStudentService;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * @Description: 任务处理逻辑impl
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/3/29
+ */
+@Service
+public class ImportLogicServiceImpl implements ImportLogicService {
+    private final static Logger log = LoggerFactory.getLogger(ImportLogicServiceImpl.class);
+
+    @Resource
+    private BasicExamRuleService basicExamRuleService;
+    @Resource
+    BasicCourseService basicCourseService;
+    @Resource
+    BasicExamService basicExamService;
+    @Resource
+    SysUserService sysUserService;
+    @Resource
+    SysOrgService sysOrgService;
+    @Resource
+    BasicExamStudentService basicExamStudentService;
+    @Resource
+    MarkPaperService markPaperService;
+    @Resource
+    MarkStudentService markStudentService;
+    @Resource
+    MarkQuestionService markQuestionService;
+    @Resource
+    MarkGroupService markGroupService;
+    @Resource
+    SysRoleService sysRoleService;
+    @Resource
+    private CommonCacheService commonCacheService;
+
+
+    @Transactional
+    @Override
+    public Map<String, Object> executeImportBasicExamStudentLogic(Map<String, Object> map, StringJoiner stringJoinerSummary) {
+        SysUser requestUser = (SysUser) map.get(SystemConstant.USER);
+        InputStream inputStream = (InputStream) map.get("inputStream");
+        Long examId = SystemConstant.convertIdToLong(String.valueOf(map.get("examId")));
+        Long schoolId = requestUser.getSchoolId();
+        BasicExam basicExam = basicExamService.getById(examId);
+        if (Objects.isNull(basicExam)) {
+            throw ExceptionResultEnum.ERROR.exception("考试不存在");
+        }
+        Long semesterId = SystemConstant.convertIdToLong(basicExam.getSemesterId());
+
+        SystemConstant.addSummary(stringJoinerSummary, "开始解析文件内容");
+        BasicExamStudentParseDto basicExamStudentParseDto;
+        try {
+            basicExamStudentParseDto = this.parseBasicExamStudent(schoolId, inputStream);
+        } catch (Exception e) {
+            SystemConstant.addSummary(stringJoinerSummary, "解析文件内容结束,解析失败。" + e.getMessage());
+            throw ExceptionResultEnum.ERROR.exception(e.getMessage());
+        }
+        SystemConstant.addSummary(stringJoinerSummary, "解析文件内容结束,开始进行数据校验");
+
+        List<BasicExamStudentImport> basicExamStudentImportList = basicExamStudentParseDto.getBasicExamStudentImportList();
+        if (CollectionUtils.isEmpty(basicExamStudentImportList)) {
+            throw ExceptionResultEnum.ERROR.exception("没有可导入数据");
+        }
+
+        List<BasicExamStudent> basicExamStudentList = basicExamStudentService.list(new QueryWrapper<BasicExamStudent>().lambda()
+                .select(BasicExamStudent::getId, BasicExamStudent::getCourseId, BasicExamStudent::getStudentCode, BasicExamStudent::getPaperNumber)
+                .eq(BasicExamStudent::getSchoolId, schoolId).eq(BasicExamStudent::getExamId, examId));
+        Map<String, Long> courseIdStudentCodeMap = basicExamStudentList.stream().collect(Collectors.toMap(k -> k.getCourseId() + SystemConstant.HYPHEN + k.getStudentCode(), BaseEntity::getId));
+
+        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+        boolean needPaperNumber = (basicSchool.getHasPaperNumber() != null && basicSchool.getHasPaperNumber()) || ExamModelEnum.MODEL4.equals(basicExam.getExamModel());
+
+        Map<String, Long> basicCourseIdMap = new HashMap<>();
+        // 是否有错误提示
+        boolean hasError = false;
+
+        List<BasicExamStudent> basicExamStudents = new ArrayList<>();
+        for (BasicExamStudentImport basicExamStudentImport : basicExamStudentImportList) {
+            BasicExamStudent basicExamStudent = new BasicExamStudent();
+            BeanUtils.copyProperties(basicExamStudentImport, basicExamStudent);
+            basicExamStudent.setSchoolId(schoolId);
+            basicExamStudent.setSemesterId(semesterId);
+            basicExamStudent.setExamId(examId);
+            basicExamStudent.setExtendFields(CollectionUtils.isNotEmpty(basicExamStudentImport.getExtendFieldList()) ? JSON.toJSONString(basicExamStudentImport.getExtendFieldList()) : null);
+
+            StringJoiner stringJoiner = new StringJoiner(";");
+            // 校验excel内容
+            basicExamStudentImport.getRequiredFieldList().forEach(m -> {
+                if (m.getEnable() && StringUtils.isBlank(m.getValue())) {
+                    stringJoiner.add(m.getName() + "必填");
+                }
+                if (m.getCode().equals(RequiredFieldsEnum.PAPER_NUMBER.getCode()) && needPaperNumber) {
+                    if (StringUtils.isBlank(m.getValue())) {
+                        stringJoiner.add(m.getName() + "必填");
+                    }
+                }
+            });
+            if (StringUtils.isNotBlank(basicExamStudentImport.getTeacherCode()) && StringUtils.isBlank(basicExamStudentImport.getTeacherName())) {
+                stringJoiner.add(RequiredFieldsEnum.TEACHER_NAME.getName() + "必填");
+            }
+            if (StringUtils.isNotBlank(basicExamStudentImport.getTeacherName()) && StringUtils.isBlank(basicExamStudentImport.getTeacherCode())) {
+                stringJoiner.add(RequiredFieldsEnum.TEACHER_CODE.getName() + "必填");
+            }
+
+            try {
+                Map<String, Object> timeMap = ConvertUtil.analyzeStartAndEndTime(basicExamStudentImport.getExamDate(), basicExamStudentImport.getExamTime());
+                basicExamStudent.setExamStartTime(Long.valueOf(String.valueOf(timeMap.get("startTime"))));
+                basicExamStudent.setExamEndTime(Long.valueOf(String.valueOf(timeMap.get("endTime"))));
+            } catch (Exception e) {
+                stringJoiner.add("考试时间格式错误");
+            }
+
+            // 校验课程
+            String key = basicExamStudentImport.getCourseCode() + SystemConstant.HYPHEN + basicExamStudentImport.getTeachingRoomName();
+            if (!basicCourseIdMap.containsKey(key)) {
+                List<SysOrg> sysOrgList = sysOrgService.getSecondOrg(schoolId, basicExamStudentImport.getTeachingRoomName());
+                if (CollectionUtils.isEmpty(sysOrgList)) {
+                    stringJoiner.add("开课学院[" + basicExamStudentImport.getTeachingRoomName() + "]在学院层级不存在");
+                } else {
+                    SysOrg sysOrg = sysOrgList.get(0);
+                    // 校验课程代码和开课学院
+                    BasicCourse basicCourse = basicCourseService.getByTeachRoomIdAndCode(sysOrg.getId(), basicExamStudentImport.getCourseCode());
+                    if (Objects.isNull(basicCourse)) {
+                        stringJoiner.add("课程代码[" + basicExamStudentImport.getCourseCode() + "]在开课学院[" + basicExamStudentImport.getTeachingRoomName() + "]不存在");
+                    } else {
+                        basicExamStudent.setCourseId(basicCourse.getId());
+                        basicCourseIdMap.put(key, basicCourse.getId());
+                    }
+                }
+            } else {
+                basicExamStudent.setCourseId(basicCourseIdMap.get(key));
+            }
+
+            //校验任课老师
+            if (StringUtils.isNotBlank(basicExamStudentImport.getTeacherCode()) && StringUtils.isNotBlank(basicExamStudentImport.getTeacherName())) {
+                SysUser sysUser = sysUserService.getByLoginName(schoolId, basicExamStudentImport.getTeacherCode());
+                if (sysUser == null) {
+                    stringJoiner.add("任课老师工号[" + basicExamStudentImport.getTeacherCode() + "]不存在");
+                } else {
+                    if (!sysUser.getEnable()) {
+                        stringJoiner.add("任课老师工号[" + basicExamStudentImport.getTeacherCode() + "]已禁用");
+                    } else if (!sysUser.getRealName().equals(basicExamStudentImport.getTeacherName())) {
+                        stringJoiner.add("任课老师[" + basicExamStudentImport.getTeacherName() + "]与用户管理中姓名[" + sysUser.getRealName() + "]不一致");
+                    } else {
+                        basicExamStudent.setTeacherId(sysUser.getId());
+                    }
+                }
+            }
+
+            if (basicExamStudent.getCourseId() != null) {
+                if (courseIdStudentCodeMap.containsKey(basicExamStudent.getCourseId() + SystemConstant.HYPHEN + basicExamStudent.getStudentCode())) {
+                    basicExamStudent.setId(courseIdStudentCodeMap.get(basicExamStudent.getCourseId() + SystemConstant.HYPHEN + basicExamStudent.getStudentCode()));
+                }
+            }
+
+            if (stringJoiner.toString().length() > 0) {
+                basicExamStudentImport.setErrorMsg(stringJoiner.toString());
+            }
+
+            if (!hasError && stringJoiner.toString().length() > 0) {
+                hasError = true;
+            }
+
+            if (stringJoiner.toString().length() == 0) {
+                basicExamStudents.add(basicExamStudent);
+            }
+
+            map.put(SystemConstant.ERROR_DATA_LIST, basicExamStudentImportList);
+            map.put(SystemConstant.DATASOURCE, basicExamStudents);
+            map.put(SystemConstant.DATA_COUNT, basicExamStudentImportList.size());
+            map.put(SystemConstant.SUCCESS_DATA_COUNT, basicExamStudents.size());
+            map.put(SystemConstant.ERROR_DATA_COUNT, basicExamStudentImportList.size() - basicExamStudents.size());
+            map.put(SystemConstant.HAS_ERROR_DATA, hasError);
+            map.put(SystemConstant.COLUMN_NAMES, basicExamStudentParseDto.getColumnNames());
+        }
+
+        return map;
+    }
+
+    private BasicExamStudentParseDto parseBasicExamStudent(Long schoolId, InputStream inputStream) {
+        ExcelReader excelReader = ExcelReader.create(ExcelType.XLSX, inputStream, 1);
+        List<DataMap> dataMapList = null;
+        try {
+            dataMapList = excelReader.getDataMapList();
+        } catch (Exception e) {
+            throw ExceptionResultEnum.ERROR.exception("读取excel内容失败");
+        }
+        BasicExamStudentParseDto basicExamStudentParseDto = new BasicExamStudentParseDto();
+        List<BasicExamStudentImport> list = new ArrayList<>();
+        if (CollectionUtils.isNotEmpty(dataMapList)) {
+            String[] columnNames = excelReader.getColumnNames();
+
+            BasicExamRule basicExamRule = basicExamRuleService.getBySchoolId(schoolId);
+            if (basicExamRule == null) {
+                throw ExceptionResultEnum.ERROR.exception("通用规则未设置");
+            }
+
+            Map<String, EnumResult> requiredMap = basicExamRule.getRequiredFieldList().stream().filter(m -> m.getEnable()).collect(Collectors.toMap(EnumResult::getName, e -> e));
+            Map<String, EnumResult> extendMap = basicExamRule.getExtendFieldList().stream().filter(m -> m.getEnable()).collect(Collectors.toMap(EnumResult::getName, e -> e));
+
+            // 通用规则表头
+            List<String> actualTitleList = Stream.concat(requiredMap.keySet().stream(), extendMap.keySet().stream()).collect(Collectors.toList());
+            if (!CollectionUtils.isEqualCollection(Arrays.asList(columnNames), actualTitleList)) {
+                throw ExceptionResultEnum.ERROR.exception("表头有误,表头字段应为【" + String.join(",", actualTitleList) + "】");
+            }
+
+            basicExamStudentParseDto.setColumnNames(columnNames);
+
+            dataMapList.forEach(m -> {
+                BasicExamStudentImport basicExamStudentImport = new BasicExamStudentImport();
+                Class<BasicExamStudentImport> aClass = (Class<BasicExamStudentImport>) basicExamStudentImport.getClass();
+                for (Map.Entry<String, String> entry : m.entrySet()) {
+                    // 必填字段
+                    if (requiredMap.containsKey(entry.getKey())) {
+                        EnumResult enumResult = requiredMap.get(entry.getKey());
+                        try {
+                            Field declaredField = aClass.getDeclaredField(enumResult.getCode());
+                            declaredField.setAccessible(true);
+                            declaredField.set(basicExamStudentImport, entry.getValue());
+                        } catch (NoSuchFieldException e) {
+                            throw ExceptionResultEnum.ERROR.exception("未获取到表头为[" + entry.getKey() + "]的属性值");
+                        } catch (IllegalAccessException e) {
+                            throw ExceptionResultEnum.ERROR.exception("表头为[" + entry.getKey() + "]的值赋值失败");
+                        }
+                        basicExamStudentImport.getRequiredFieldList().add(new CodeNameEnableValue(enumResult.getCode(), enumResult.getName(), enumResult.getEnable(), entry.getValue()));
+                    }
+                    // 扩展字段
+                    if (extendMap.containsKey(entry.getKey())) {
+                        EnumResult enumResult = extendMap.get(entry.getKey());
+                        basicExamStudentImport.getExtendFieldList().add(new CodeNameEnableValue(enumResult.getCode(), enumResult.getName(), enumResult.getEnable(), entry.getValue()));
+                    }
+                }
+                list.add(basicExamStudentImport);
+            });
+        }
+        basicExamStudentParseDto.setBasicExamStudentImportList(list);
+        return basicExamStudentParseDto;
+    }
+
+    @Transactional
+    @Override
+    public void saveMarkStudent(Long examId, List<BasicExamStudent> basicExamStudentList) {
+        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
+        Long requestUserId = requestUser.getId();
+
+        Map<String, List<BasicExamStudent>> stringMap = basicExamStudentList.stream().collect(Collectors.groupingBy(BasicExamStudent::getPaperNumber));
+
+        for (Map.Entry<String, List<BasicExamStudent>> entry : stringMap.entrySet()) {
+            BasicExamStudent basicExamStudent = entry.getValue().get(0);
+            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, entry.getKey());
+            if (markPaper == null) {
+                BasicCourse basicCourse = basicCourseService.getByCode(basicExamStudent.getCourseCode());
+                markPaper = new MarkPaper(examId, basicExamStudent.getCourseId(), entry.getKey(), String.valueOf(System.currentTimeMillis()), requestUserId, SystemConstant.DEFAULT_PAPER_TYPE_A);
+                markPaperService.save(markPaper);
+            }
+            Set<String> secretNumberSet = new HashSet<>();
+            MarkPaper finalMarkPaper = markPaper;
+            entry.getValue().forEach(m -> markStudentService.updateByBasicExamStudent(m, finalMarkPaper, secretNumberSet));
+            markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examId, entry.getKey(), SystemConstant.DEFAULT_PAPER_TYPE_A);
+        }
+    }
+
+    @Transactional
+    @Override
+    public Map<String, Object> executeImportObjectiveStructLogic(Map<String, Object> map) throws Exception {
+        SysUser requestUser = (SysUser) map.get(SystemConstant.USER);
+        InputStream inputStream = (InputStream) map.get("inputStream");
+        Long examId = SystemConstant.convertIdToLong(String.valueOf(map.get("examId")));
+        Long schoolId = requestUser.getSchoolId();
+        BasicExam basicExam = basicExamService.getById(examId);
+        if (Objects.isNull(basicExam)) {
+            throw ExceptionResultEnum.ERROR.exception("考试不存在");
+        }
+        if (!ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
+            throw ExceptionResultEnum.ERROR.exception("仅针对模式4的考试可以导入");
+        }
+        // 课程编号名称校验
+        Map<String, String> courseCheckMap = basicCourseService.list(
+                        new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)).stream()
+                .collect(Collectors.toMap(BasicCourse::getCode, BasicCourse::getName));
+        List<MarkPaper> markPaperList = markPaperService.list(
+                new QueryWrapper<MarkPaper>().lambda().eq(MarkPaper::getExamId, examId));
+        // 题号重复校验
+        // 导入的客观题题号集合
+        Set<String> questionNumberCheckSet = new HashSet<>();
+        // 客观题选项个数在大题下一致性校验
+        Map<String, Integer> questionOptionCountMap = new HashMap<>();
+        // 该试卷已存在的主观题题号集合
+        Set<String> dbSubjectiveQuestionNumberSet = markQuestionService.list(
+                        new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
+                                .eq(MarkQuestion::getObjective, false)).stream()
+                .map(e -> e.getPaperNumber() + SystemConstant.HYPHEN + e.getMainNumber() + SystemConstant.HYPHEN + e.getSubNumber()).collect(Collectors.toSet());
+
+        ExcelResult<ObjectiveStructDto> excelResult = ConvertUtil.analyzeExcel(inputStream, ObjectiveStructDto.class,
+                true, 0);
+        List<ObjectiveStructDto> objectiveStructDtoList = excelResult.getDatasource();
+        List<MarkQuestion> markQuestionList = new ArrayList<>();
+        for (ObjectiveStructDto objectiveStructDto : objectiveStructDtoList) {
+            List<String> logicErrorList = new ArrayList<>();
+            // 公共异常提示
+            String logicErrorCommonNotice = "";
+
+            String courseCode = objectiveStructDto.getCourseCode();
+            String courseName = objectiveStructDto.getCourseName();
+            String paperNumber = objectiveStructDto.getPaperNumber();
+            String mainTitle = objectiveStructDto.getMainTitle();
+            Integer mainNumber = objectiveStructDto.getMainNumber();
+            Integer subNumber = objectiveStructDto.getSubNumber();
+            String answer = objectiveStructDto.getAnswer();
+            Integer optionCount = objectiveStructDto.getOptionCount();
+            Double totalScore = objectiveStructDto.getTotalScore();
+            Integer questionType = objectiveStructDto.getQuestionType();
+            String errorMsg = objectiveStructDto.getErrorMsg();
+
+            // 1.题号重复校验
+            if (SystemConstant.strNotNull(paperNumber) && mainNumber != null && subNumber != null) {
+                logicErrorCommonNotice = String.format("课程代码为[%s],试卷编号为[%s],大题号为[%s],小题号为[%s]的数据异常 : ", courseCode, paperNumber, mainNumber,
+                        subNumber);
+                String questionNumberKey = courseCode + SystemConstant.HYPHEN + paperNumber + SystemConstant.HYPHEN + mainNumber + SystemConstant.HYPHEN + subNumber;
+                if (questionNumberCheckSet.contains(questionNumberKey)) {
+                    logicErrorList.add("excel中题号重复");
+                } else {
+                    questionNumberCheckSet.add(questionNumberKey);
+                }
+                if (dbSubjectiveQuestionNumberSet.contains(questionNumberKey)) {
+                    logicErrorList.add("该题号已存在主观题中");
+                }
+                String mainQuestionKey = paperNumber + SystemConstant.HYPHEN + mainNumber;
+                if (questionOptionCountMap.containsKey(mainQuestionKey)) {
+                    if (!Objects.equals(questionOptionCountMap.get(mainQuestionKey), optionCount)) {
+                        logicErrorList.add("选项个数和该大题中的其他小题不一致");
+                    }
+                } else {
+                    questionOptionCountMap.put(mainQuestionKey, optionCount);
+                }
+            }
+
+            // 2.校验课程编号,课程名称,试卷在考试下是否存在
+            if (SystemConstant.strNotNull(courseCode) && SystemConstant.strNotNull(courseName) && SystemConstant.strNotNull(paperNumber)) {
+                if (!courseCheckMap.containsKey(courseCode)) {
+                    logicErrorList.add("课程编号不存在");
+                } else if (!courseCheckMap.get(courseCode).equals(courseName)) {
+                    logicErrorList.add("课程编号名称不匹配");
+                }
+                if (markPaperList.stream().noneMatch(m -> m.getPaperNumber().equals(paperNumber) && m.getCourseCode().equals(courseCode))) {
+                    logicErrorList.add("考试课程中不存在该试卷,请先创建试卷");
+                }
+            }
+            // 3.选项越界校验
+            List<String> optionScope = new ArrayList<>();
+            try {
+                for (int j = 1; j <= optionCount; j++) {
+                    String code = OptionsEnum.getCodeByIndex(j);
+                    optionScope.add(code);
+                }
+            } catch (Exception e) {
+                throw ExceptionResultEnum.ERROR.exception(e.getMessage());
+            }
+
+            // 答案选项越界校验
+            List<String> answerList = Arrays.asList(answer.split(""));
+            if (CollectionUtils.isNotEmpty(answerList)) {
+                for (String cell : answerList) {
+                    String outOfBoundsException = String.format("答案[%s]错误。答案只能从[%s]中选择", cell, String.join("", optionScope));
+                    try {
+                        OptionsEnum optionsEnum = OptionsEnum.getByCode(cell);
+                        int optionIndex = optionsEnum.getIndex();
+                        if (optionIndex > optionCount) {
+                            // 答案选项超出范围
+                            logicErrorList.add(outOfBoundsException);
+                        }
+                    } catch (Exception e) {
+                        logicErrorList.add(outOfBoundsException);
+                    }
+                }
+            } else {
+                logicErrorList.add("答案必填");
+            }
+
+            // 4.判断答案是否符合题型
+            if (questionType != null && SystemConstant.strNotNull(answer)) {
+                switch (questionType) {
+                    case 1:
+                        if (answer.length() > 1) {
+                            logicErrorList.add("单选题答案只能有一个");
+                        }
+                        break;
+                    case 2:
+                        break;
+                    case 3:
+                        if (optionCount != 2) {
+                            logicErrorList.add("判断题[选项个数]只能为2");
+                        }
+                        break;
+                    default:
+                        logicErrorList.add("[题型(1-单选,2-多选,3-判断)]必须从1、2、3中填写");
+                }
+            }
+
+            // 整理异常信息
+            if (CollectionUtils.isNotEmpty(logicErrorList)) {
+                if (SystemConstant.strNotNull(errorMsg)) {
+                    errorMsg = errorMsg + "、" + logicErrorCommonNotice + String.join("、", logicErrorList);
+                } else {
+                    errorMsg = logicErrorCommonNotice + String.join("、", logicErrorList);
+                }
+                objectiveStructDto.setErrorMsg(errorMsg);
+            } else {
+                MarkQuestion markQuestion = new MarkQuestion();
+                markQuestion.setExamId(examId);
+                markQuestion.setPaperNumber(paperNumber);
+                markQuestion.setPaperType(OptionsEnum.A.getCode());
+                markQuestion.setObjective(true);
+                markQuestion.setMainNumber(mainNumber);
+                markQuestion.setSubNumber(subNumber);
+                markQuestion.setMainTitle(mainTitle);
+                markQuestion.setAnswer(answer);
+                markQuestion.setOptionCount(optionCount);
+                markQuestion.setTotalScore(totalScore);
+                markQuestion.setObjectivePolicy(ObjectivePolicy.NONE);
+                markQuestion.setQuestionType(questionType);
+                markQuestionList.add(markQuestion);
+            }
+        }
+
+        if (objectiveStructDtoList.stream().anyMatch(e -> SystemConstant.strNotNull(e.getErrorMsg()))) {
+            // 抛出excel解析异常
+            throw ExceptionResultEnum.ERROR.exception(
+                    objectiveStructDtoList.stream().map(ObjectiveStructDto::getErrorMsg).filter(SystemConstant::strNotNull).collect(Collectors.joining(System.lineSeparator())));
+        } else {
+            // 保存客观题结构
+            Map<String, List<MarkQuestion>> markQuestionMap = markQuestionList.stream().collect(Collectors.groupingBy(MarkQuestion::getPaperNumber));
+            markQuestionMap.forEach((k, v) -> {
+                // 优先删除该试卷编号下的客观题
+                markQuestionService.remove(new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
+                        .eq(MarkQuestion::getPaperNumber, k).eq(MarkQuestion::getObjective, true));
+                // 保存客观题
+                markQuestionService.saveBatch(v);
+                markQuestionService.updateMarkPaperScore(examId, k, null);
+            });
+        }
+        return map;
+    }
+
+    @Transactional
+    @Override
+    public Map<String, Object> executeImportSubjectiveStructLogic(Map<String, Object> map) throws Exception {
+        SysUser requestUser = (SysUser) map.get(SystemConstant.USER);
+        InputStream inputStream = (InputStream) map.get("inputStream");
+        Long examId = SystemConstant.convertIdToLong(String.valueOf(map.get("examId")));
+        Long schoolId = requestUser.getSchoolId();
+        BasicExam basicExam = basicExamService.getById(examId);
+        if (Objects.isNull(basicExam)) {
+            throw ExceptionResultEnum.ERROR.exception("考试不存在");
+        }
+        if (!ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
+            throw ExceptionResultEnum.ERROR.exception("仅针对模式4的考试可以导入");
+        }
+        SysRole markerRole = sysRoleService.getOne(
+                new QueryWrapper<SysRole>().lambda().eq(SysRole::getType, RoleTypeEnum.MARKER));
+        if (Objects.isNull(markerRole)) {
+            throw ExceptionResultEnum.ERROR.exception("缺少评卷员角色");
+        }
+
+        // 课程编号名称校验
+        Map<String, String> courseCheckMap = basicCourseService.list(
+                        new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)).stream()
+                .collect(Collectors.toMap(BasicCourse::getCode, BasicCourse::getName));
+        List<MarkPaper> markPaperList = markPaperService.list(
+                new QueryWrapper<MarkPaper>().lambda().eq(MarkPaper::getExamId, examId));
+        // 题号重复校验
+        // 导入的客观题题号集合
+        Set<String> questionNumberCheckSet = new HashSet<>();
+        // 该试卷已存在的客观题题号集合
+        Set<String> dbObjectiveQuestionNumberSet = markQuestionService.list(
+                        new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
+                                .eq(MarkQuestion::getObjective, true)).stream()
+                .map(e -> e.getPaperNumber() + SystemConstant.HYPHEN + e.getMainNumber() + SystemConstant.HYPHEN + e.getSubNumber()).collect(Collectors.toSet());
+
+        ExcelResult<SubjectiveStructDto> excelResult = ConvertUtil.analyzeExcel(inputStream, SubjectiveStructDto.class,
+                true, 0);
+        List<SubjectiveStructDto> subjectiveStructDtoList = excelResult.getDatasource();
+        for (SubjectiveStructDto subjectiveStructDto : subjectiveStructDtoList) {
+            List<String> excelErrorList = new ArrayList<>();
+            // 公共异常提示
+            String excelErrorCommonNotice = "";
+
+            String courseCode = subjectiveStructDto.getCourseCode();
+            String courseName = subjectiveStructDto.getCourseName();
+            String paperNumber = subjectiveStructDto.getPaperNumber();
+            Integer mainNumber = subjectiveStructDto.getMainNumber();
+            Integer subNumber = subjectiveStructDto.getSubNumber();
+            Integer markerCount = subjectiveStructDto.getMarkerCount();
+            String markerCodes = subjectiveStructDto.getMarkerCodes();
+            String errorMsg = subjectiveStructDto.getErrorMsg();
+
+            // 1.题号重复校验
+            if (SystemConstant.strNotNull(paperNumber) && mainNumber != null && subNumber != null) {
+                excelErrorCommonNotice = String.format("课程代码为[%s],试卷编号为[%s],大题号为[%s],小题号为[%s]的数据异常 : ", courseCode, paperNumber, mainNumber,
+                        subNumber);
+                String questionNumberKey = courseCode + SystemConstant.HYPHEN + paperNumber + SystemConstant.HYPHEN + mainNumber + SystemConstant.HYPHEN + subNumber;
+                if (questionNumberCheckSet.contains(questionNumberKey)) {
+                    excelErrorList.add("excel中题号重复");
+                } else {
+                    questionNumberCheckSet.add(questionNumberKey);
+                }
+                if (dbObjectiveQuestionNumberSet.contains(questionNumberKey)) {
+                    excelErrorList.add("该题号已存在客观题中");
+                }
+            }
+
+            // 2.校验课程代码,课程名称,试卷在考试下是否存在
+            if (SystemConstant.strNotNull(courseCode) && SystemConstant.strNotNull(courseName) && SystemConstant.strNotNull(paperNumber)) {
+                if (!courseCheckMap.containsKey(courseCode)) {
+                    excelErrorList.add("课程代码不存在");
+                } else if (!courseCheckMap.get(courseCode).equals(courseName)) {
+                    excelErrorList.add("课程代码名称不匹配");
+                }
+                if (markPaperList.stream().noneMatch(m -> m.getPaperNumber().equals(paperNumber) && m.getCourseCode().equals(courseCode))) {
+                    excelErrorList.add("考试课程中不存在该试卷,请先创建试卷");
+                }
+            }
+
+            // 3.评卷员校验
+            if (Objects.isNull(markerCount) && Objects.isNull(markerCodes)) {
+                excelErrorList.add("[评卷员数量(系统生成)]和[绑定工号(英文逗号分隔)]不能同时为空");
+            }
+
+            // 整理异常信息
+            if (CollectionUtils.isNotEmpty(excelErrorList)) {
+                if (SystemConstant.strNotNull(errorMsg)) {
+                    errorMsg = errorMsg + "、" + excelErrorCommonNotice + String.join("、", excelErrorList);
+                } else {
+                    errorMsg = excelErrorCommonNotice + String.join("、", excelErrorList);
+                }
+                subjectiveStructDto.setErrorMsg(errorMsg);
+            }
+        }
+        if (subjectiveStructDtoList.stream().anyMatch(e -> SystemConstant.strNotNull(e.getErrorMsg()))) {
+            // 抛出excel解析异常
+            throw ExceptionResultEnum.ERROR.exception(
+                    subjectiveStructDtoList.stream().map(SubjectiveStructDto::getErrorMsg).filter(SystemConstant::strNotNull).collect(Collectors.joining(System.lineSeparator())));
+        } else {
+            List<String> paperErrorList = new ArrayList<>();
+            // 试卷编号-> 题目集合 Map
+            Map<String, List<SubjectiveStructDto>> paperQuestionsMap = subjectiveStructDtoList.stream().collect(Collectors.groupingBy(SubjectiveStructDto::getPaperNumber));
+            paperQuestionsMap.forEach((paperNumber, paperQuestionList) -> {
+                if (markGroupService.countByExamIdAndPaperNumber(examId, paperNumber) > 0) {
+                    paperErrorList.add(String.format("[试卷编号]%s,已存在分组,请先删除该试卷的所有分组再导入试题", paperNumber));
+                } else {
+                    // 优先删除该试卷的主观题
+                    markQuestionService.remove(
+                            new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
+                                    .eq(MarkQuestion::getPaperNumber, paperNumber).eq(MarkQuestion::getObjective, false));
+
+                    // 试卷下分组集合
+                    List<Integer> groupNumberList = paperQuestionList.stream().map(SubjectiveStructDto::getGroupNumber)
+                            .distinct().sorted().collect(Collectors.toList());
+
+                    // 评卷员序号
+                    AtomicInteger markerNumber = new AtomicInteger(0);
+                    for (Integer groupNumber : groupNumberList) {
+                        List<String> groupErrorList = new ArrayList<>();
+                        // 分组下题目集合
+                        List<SubjectiveStructDto> groupQuestionList = paperQuestionList.stream()
+                                .filter(e -> e.getGroupNumber().equals(groupNumber)).collect(Collectors.toList());
+
+                        String paperNumberGroupNumberNotice = String.format("[试卷编号]%s,[评卷分组(只能用小写数字)]%s,的", paperNumber,
+                                groupNumber);
+
+                        String orgName = null;
+                        Long orgId = null;
+                        BasicCourse basicCourse = basicCourseService.getOne(
+                                new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)
+                                        .eq(BasicCourse::getCode, groupQuestionList.get(0).getCourseCode()));
+                        if (Objects.isNull(basicCourse)) {
+                            groupErrorList.add("[课程代码]不存在");
+                        } else {
+                            Long teachingRoomId = basicCourse.getTeachingRoomId();
+                            SysOrg sysOrg = sysOrgService.getById(teachingRoomId);
+                            if (Objects.isNull(sysOrg)) {
+                                throw ExceptionResultEnum.ERROR.exception("无法找到机构");
+                            }
+                            orgName = sysOrg.getName();
+                            orgId = sysOrg.getId();
+                        }
+                        Integer markerCount = null;
+                        String markerCodes = null;
+                        List<Integer> markerCountList = groupQuestionList.stream().map(SubjectiveStructDto::getMarkerCount).distinct().collect(Collectors.toList());
+                        if (CollectionUtils.isNotEmpty(markerCountList)) {
+                            if (markerCountList.size() > 1) {
+                                groupErrorList.add("[评卷员数量(系统生成)]不一致");
+                            } else if (markerCountList.size() == 1) {
+                                markerCount = markerCountList.get(0);
+                            }
+                        }
+
+                        List<String> markerCodesList = groupQuestionList.stream().map(SubjectiveStructDto::getMarkerCodes).distinct().collect(Collectors.toList());
+                        if (CollectionUtils.isNotEmpty(markerCodesList)) {
+                            if (markerCodesList.size() > 1) {
+                                groupErrorList.add("[绑定工号(英文逗号分隔)]不一致");
+                            } else if (markerCodesList.size() == 1) {
+                                markerCodes = markerCodesList.get(0);
+                            }
+                        }
+
+                        // 组装评卷员信息
+                        List<MarkUser> markUsers = new ArrayList<>();
+                        if (SystemConstant.strNotNull(markerCodes)) {
+                            // 优先以绑定工号为准
+                            String[] markerCodeArray = markerCodes.split(SystemConstant.COMMA);
+                            for (String markerCode : markerCodeArray) {
+                                SysUser sysUser = sysUserService.getOne(
+                                        new QueryWrapper<SysUser>().lambda().eq(SysUser::getSchoolId, schoolId).eq(SysUser::getLoginName, markerCode).last(SystemConstant.LIMIT1));
+                                if (Objects.isNull(sysUser)) {
+                                    groupErrorList.add(paperNumberGroupNumberNotice + String.format(
+                                            "[绑定工号(英文逗号分隔)]中的%s,在系统中不存在请先创建用户", markerCode));
+                                } else {
+                                    // 添加评卷员信息
+                                    MarkUser markUser = new MarkUser();
+                                    markUser.setUserId(sysUser.getId());
+                                    markUser.setLoginName(sysUser.getLoginName());
+                                    markUser.setName(sysUser.getRealName());
+                                    markUser.setOrgName(orgName);
+                                    markUsers.add(markUser);
+                                }
+                            }
+                        } else if (Objects.nonNull(markerCount) && markerCount > 0) {
+                            // 没有绑定工号且评卷员生成数量大于0,生成评卷员(或使用之前工号相同的评卷员)
+                            for (int i = 0; i < markerCount; i++) {
+                                int num = markerNumber.incrementAndGet();
+                                if (num > 99) {
+                                    paperErrorList.add("[试卷编号]%s的[评卷员数量(系统生成)]总有效数量不能超过99");
+                                    break;
+                                }
+                                String markerCode = paperNumber + String.format("%02d", num);
+
+                                SysUser sysUser = sysUserService.getOne(
+                                        new QueryWrapper<SysUser>().lambda().eq(SysUser::getSchoolId, schoolId).eq(SysUser::getLoginName, markerCode).last(SystemConstant.LIMIT1));
+
+                                MarkUser markUser = new MarkUser();
+                                markUser.setLoginName(markerCode);
+                                markUser.setOrgName(orgName);
+                                markUsers.add(markUser);
+                                if (Objects.nonNull(sysUser)) {
+                                    markUser.setUserId(sysUser.getId());
+                                    markUser.setName(sysUser.getRealName());
+                                } else {
+                                    // 创建用户
+                                    UserSaveParams userSaveParams = new UserSaveParams();
+                                    userSaveParams.setSchoolId(schoolId);
+                                    userSaveParams.setLoginName(markerCode);
+                                    userSaveParams.setRealName(markerCode);
+                                    userSaveParams.setCode(markerCode);
+                                    userSaveParams.setPassword(SystemConstant.DEFAULT_PASSWORD);
+                                    userSaveParams.setOrgId(orgId);
+                                    userSaveParams.setEnable(true);
+                                    userSaveParams.setRoleIds(new Long[]{markerRole.getId()});
+                                    try {
+                                        markUser.setUserId(sysUserService.saveUser(userSaveParams));
+                                        markUser.setName(markerCode);
+                                    } catch (IllegalAccessException e) {
+                                        e.printStackTrace();
+                                    }
+                                }
+                            }
+                        }
+                        if (CollectionUtils.isEmpty(groupErrorList) && CollectionUtils.isEmpty(paperErrorList)) {
+                            // 创建评卷试题
+                            List<MarkQuestion> markQuestionList = paperQuestionList.stream().filter(e -> groupNumber.equals(e.getGroupNumber())).flatMap(e -> {
+                                MarkQuestion markQuestion = new MarkQuestion();
+                                markQuestion.setExamId(examId);
+                                markQuestion.setPaperNumber(paperNumber);
+                                markQuestion.setPaperType(OptionsEnum.A.getCode());
+                                markQuestion.setObjective(false);
+                                markQuestion.setMainNumber(e.getMainNumber());
+                                markQuestion.setSubNumber(e.getSubNumber());
+                                markQuestion.setMainTitle(e.getMainTitle());
+                                markQuestion.setTotalScore(e.getTotalScore());
+                                markQuestion.setIntervalScore(e.getIntervalScore());
+                                markQuestion.setQuestionType(QuestionType.QUESTION_ANSWER.getValue());
+                                return Stream.of(markQuestion);
+                            }).collect(Collectors.toList());
+                            markQuestionService.saveBatch(markQuestionList);
+
+                            MarkGroupDto markGroupDto = new MarkGroupDto();
+                            markGroupDto.setDoubleEnable(false);
+                            markGroupDto.setGroupNumber(groupNumber);
+                            markGroupDto.setMarkers(markUsers);
+                            markGroupDto.setQuestions(markQuestionList);
+                            markGroupDto.setPictureConfigs(new ArrayList<>());
+                            MarkGroupSingleDto markGroupSingleDto = new MarkGroupSingleDto();
+                            markGroupSingleDto.setExamId(examId);
+                            markGroupSingleDto.setPaperNumber(paperNumber);
+                            markGroupSingleDto.setGroupInfo(markGroupDto);
+                            markGroupService.saveGroup(markGroupSingleDto);
+                        }
+                        if (CollectionUtils.isNotEmpty(groupErrorList)) {
+                            String groupErrorMsg = paperNumberGroupNumberNotice + String.join(",", groupErrorList);
+                            paperErrorList.add(groupErrorMsg);
+                        }
+                    }
+                }
+            });
+            if (CollectionUtils.isNotEmpty(paperErrorList)) {
+                throw ExceptionResultEnum.ERROR.exception(String.join(System.lineSeparator(), paperErrorList));
+            }
+        }
+        return map;
+    }
+}

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

@@ -28,7 +28,6 @@ import com.qmth.teachcloud.common.entity.BasicExam;
 import com.qmth.teachcloud.common.entity.BasicSchool;
 import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.service.BasicAttachmentService;
-import com.qmth.teachcloud.common.service.BasicStudentService;
 import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.service.FileUploadService;
 import com.qmth.teachcloud.common.util.FileUtil;
@@ -81,8 +80,6 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
     BasicCardRuleService basicCardRuleService;
     @Autowired
     ExamDetailCourseService examDetailCourseService;
-    @Autowired
-    BasicStudentService basicStudentService;
     @Resource
     BasicExamService basicExamService;
     @Resource
@@ -126,8 +123,6 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
                     FileUtil.deleteFile(file);
                 }
             }
-            //
-
         }
     }
 

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

@@ -11,7 +11,6 @@ import com.qmth.boot.api.exception.ApiException;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.examRule.CodeNameEnableValue;
 import com.qmth.distributed.print.business.bean.examRule.FieldsDto;
-import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
 import com.qmth.distributed.print.business.bean.params.DownloadPaperFileParam;
 import com.qmth.distributed.print.business.bean.result.DictionaryResult;
 import com.qmth.distributed.print.business.bean.result.TSyncExamStudentScoreResult;
@@ -22,21 +21,15 @@ import com.qmth.distributed.print.business.enums.PaperFileDownloadExposureStatus
 import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.templete.service.TaskLogicService;
-import com.qmth.distributed.print.business.util.CreatePdfUtil;
 import com.qmth.distributed.print.business.util.pdf.CreatePdfNewUtil;
 import com.qmth.teachcloud.common.annotation.ExcelDBFieldDesc;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
-import com.qmth.teachcloud.common.bean.dto.excel.BasicStudentImportDto;
 import com.qmth.teachcloud.common.bean.dto.excel.DescribeImportDto;
 import com.qmth.teachcloud.common.bean.dto.excel.StatisticsImportDto;
 import com.qmth.teachcloud.common.bean.dto.excel.SysUserImportDto;
-import com.qmth.teachcloud.common.bean.dto.excel.export.BasicStudentErrorExportDto;
 import com.qmth.teachcloud.common.bean.dto.excel.export.SysUserErrorExportDto;
-import com.qmth.teachcloud.common.bean.dto.mark.MarkUser;
 import com.qmth.teachcloud.common.bean.params.ArraysParams;
-import com.qmth.teachcloud.common.bean.params.UserSaveParams;
-import com.qmth.teachcloud.common.bean.result.ExcelResult;
 import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
 import com.qmth.teachcloud.common.bean.vo.PrintPathVo;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
@@ -46,13 +39,6 @@ import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.util.*;
 import com.qmth.teachcloud.common.util.excel.ExcelError;
-import com.qmth.teachcloud.mark.dto.mark.setting.MarkGroupDto;
-import com.qmth.teachcloud.mark.dto.mark.setting.MarkGroupSingleDto;
-import com.qmth.teachcloud.mark.entity.MarkPaper;
-import com.qmth.teachcloud.mark.service.MarkGroupService;
-import com.qmth.teachcloud.mark.service.MarkPaperService;
-import com.qmth.teachcloud.mark.service.MarkQuestionService;
-import com.qmth.teachcloud.mark.service.MarkStudentService;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.io.FileUtils;
@@ -84,7 +70,6 @@ import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 /**
  * @Description: 任务处理逻辑impl
@@ -106,38 +91,22 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     @Resource
     ExamCardService examCardService;
     @Resource
-    ExamStudentService examStudentService;
-    @Resource
     BasicAttachmentService basicAttachmentService;
     @Resource
     ExamDetailService examDetailService;
     @Resource
-    CommonCacheService commonCacheService;
-    @Resource
     BasicCourseService basicCourseService;
     @Resource
-    CreatePdfUtil createPdfUtil;
-    @Resource
     CreatePdfNewUtil createPdfNewUtil;
     @Resource
     TBTaskPdfService tbTaskPdfService;
     @Resource
-    BasicCardRuleService basicCardRuleService;
-    @Resource
-    ExamDetailCourseService examDetailCourseService;
-    @Resource
-    BasicStudentService basicStudentService;
-    @Resource
     BasicRoleDataPermissionService basicRoleDataPermissionService;
     @Resource
-    BasicExamService basicExamService;
-    @Resource
     SysUserService sysUserService;
     @Resource
     FileStoreUtil fileStoreUtil;
     @Resource
-    BasicClazzService basicClazzService;
-    @Resource
     SysOrgService sysOrgService;
     @Resource
     TCStatisticsService tcStatisticsService;
@@ -155,21 +124,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     @Resource
     DictionaryConfig dictionaryConfig;
     @Resource
-    BasicPrintConfigService basicPrintConfigService;
-    @Resource
     FileUploadService fileUploadService;
-    @Resource
-    BasicExamStudentService basicExamStudentService;
-    @Resource
-    MarkPaperService markPaperService;
-    @Resource
-    MarkStudentService markStudentService;
-    @Resource
-    MarkQuestionService markQuestionService;
-    @Resource
-    MarkGroupService markGroupService;
-    @Resource
-    SysRoleService sysRoleService;
 
     @Transactional(rollbackFor = Exception.class)
     @Override
@@ -623,6 +578,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
         }
         return map;
     }
+
     @Override
     public Map<String, Object> executeExportPaperAndCardLogic(Map<String, Object> map) {
         String zipLocalRootPath = null;
@@ -730,79 +686,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
     }
 
 
-    @Transactional
-    @Override
-    public Map<String, Object> executeImportBasicStudentLogic(Map<String, Object> map) throws Exception {
-        InputStream inputStream = (InputStream) map.get("inputStream");
-        List<String> studentCodeList = new ArrayList<>();
-        List<BasicStudentErrorExportDto> errorDataList = new ArrayList<>();
-        AtomicInteger totalInteger = new AtomicInteger(0);
-        AtomicInteger successInteger = new AtomicInteger(0);
-        List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(BasicStudentImportDto.class, DescribeImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
-            Map<String, String> checkCodeMap = new HashMap<>();
-            for (int i = 0; i < finalExcelList.size(); i++) {
-                LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
-                List<Object> basicStudentImportDtoList = excelMap.get(i);
-                // 将要删除的异常数据
-                List<BasicStudentImportDto> willRemoveList = new ArrayList<>();
-                for (int y = 0; y < Objects.requireNonNull(basicStudentImportDtoList).size(); y++) {
-                    // 行索引
-                    Integer rowIndex = y + 1;
-                    BasicStudentImportDto basicStudentImportDto = (BasicStudentImportDto) basicStudentImportDtoList.get(y);
-                    basicStudentImportDto.setRowIndex(rowIndex);
-                    totalInteger.getAndIncrement();
-
-                    BasicStudentErrorExportDto basicStudentErrorExportDto = new BasicStudentErrorExportDto();
-                    BeanUtils.copyProperties(basicStudentImportDto, basicStudentErrorExportDto);
-
-
-                    String studentName = StringUtils.isNotBlank(basicStudentImportDto.getStudentName()) ? basicStudentImportDto.getStudentName().trim() : null;
-                    String studentCode = StringUtils.isNotBlank(basicStudentImportDto.getStudentCode()) ? basicStudentImportDto.getStudentCode().trim() : null;
-                    studentCodeList.add(studentCode);
-
-                    StringJoiner errorStringJoiner = new StringJoiner(";");
-                    // 必填字段校验
-                    String errorStringEmpty = ExcelUtil.checkExcelField(basicStudentImportDto);
-                    if (errorStringEmpty.length() > 0) {
-                        errorStringJoiner.add(errorStringEmpty);
-                    }
-
-                    // 检验学号
-                    if (SystemConstant.strNotNull(studentCode)) {
-                        if (checkCodeMap.containsKey(studentCode)) {
-                            errorStringJoiner.add("学号[" + studentCode + "]查询到多条数据");
-                        } else {
-                            checkCodeMap.put(studentCode, studentName);
-                        }
-                    }
-
-                    if (Objects.nonNull(studentCode) && !studentCode.matches(SystemConstant.REGULAR_EXPRESSION_OF_CODE1)) {
-                        errorStringJoiner.add("学号[" + studentCode + "]不符合规范");
-                    }
-                    String errorString = errorStringJoiner.toString();
-                    if (errorString.length() > 0) {
-                        basicStudentErrorExportDto.setErrorMsg(errorString);
-                        errorDataList.add(basicStudentErrorExportDto);
-                        willRemoveList.add(basicStudentImportDto);
-                    } else {
-                        // 校验通过的数据
-                        successInteger.getAndIncrement();
-                    }
-                }
-                basicStudentImportDtoList.removeAll(willRemoveList);
-            }
-            if (!errorDataList.isEmpty()) {
-                map.put(SystemConstant.ERROR_DATA_LIST, errorDataList);
-            }
-            map.put("studentCodeList", studentCodeList);
-            map.put(SystemConstant.DATA_COUNT, totalInteger.get());
-            map.put(SystemConstant.SUCCESS_DATA_COUNT, successInteger.get());
-            map.put(SystemConstant.ERROR_DATA_COUNT, errorDataList.size());
-            return finalExcelList;
-        }, 2);
-        return basicStudentService.executeBasicStudentImportLogic(finalList, map);
-    }
-
     @Transactional
     @Override
     public Map<String, Object> executeImportSysUserLogic(Map<String, Object> map) throws Exception {
@@ -1288,608 +1171,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
         return map;
     }
 
-    @Transactional
-    @Override
-    public Map<String, Object> executeImportBasicExamStudentLogic(Map<String, Object> map) throws Exception {
-        SysUser requestUser = (SysUser) map.get(SystemConstant.USER);
-        InputStream inputStream = (InputStream) map.get("inputStream");
-        Long examId = SystemConstant.convertIdToLong(String.valueOf(map.get("examId")));
-        Long schoolId = requestUser.getSchoolId();
-        BasicExam basicExam = basicExamService.getById(examId);
-        if (Objects.isNull(basicExam)) {
-            throw ExceptionResultEnum.ERROR.exception("考试不存在");
-        }
-        Long semesterId = SystemConstant.convertIdToLong(basicExam.getSemesterId());
-
-        List<BasicExamStudent> dbData = basicExamStudentService.list(new QueryWrapper<BasicExamStudent>().lambda()
-                .select(BasicExamStudent::getId, BasicExamStudent::getExamId, BasicExamStudent::getCourseCode,
-                        BasicExamStudent::getStudentCode, BasicExamStudent::getPaperNumber).eq(BasicExamStudent::getSchoolId, schoolId).eq(BasicExamStudent::getExamId, examId));
-
-        // 数据库中学生学号和id对应关系
-        Map<String, Long> studentCodeIdMap = dbData.stream().collect(Collectors.toMap(
-                k -> k.getExamId() + SystemConstant.HYPHEN + k.getCourseCode() + SystemConstant.HYPHEN + k.getStudentCode(),
-                BaseEntity::getId));
-        Map<String, String> paperNumberCourseCodeMap = dbData.stream().filter(e -> SystemConstant.strNotNull(e.getPaperNumber())).collect(
-                Collectors.toMap(BasicExamStudent::getPaperNumber, BasicExamStudent::getCourseCode, (o1, o2) -> o1));
-
-        // excel中学生学号和学生字典对象关系
-        Map<String, BasicExamStudent> studentCodeObjMap = new HashMap<>();
-        AtomicInteger successInteger = new AtomicInteger(0);
-        AtomicInteger exceptionInteger = new AtomicInteger(0);
-
-        ExcelResult<BasicExamStudentDto> excelResult = ConvertUtil.analyzeExcel(inputStream, BasicExamStudentDto.class,
-                true, 1);
-        List<BasicExamStudentDto> basicExamStudentDtoList = excelResult.getDatasource();
-        List<String> oldPaperNumberList = new ArrayList<>();
-        for (BasicExamStudentDto basicExamStudentDto : basicExamStudentDtoList) {
-            List<String> errorMsgList = new ArrayList<>();
-            // 行索引
-            String courseCode = basicExamStudentDto.getCourseCode();
-            String studentName = basicExamStudentDto.getStudentName();
-            String studentCode = basicExamStudentDto.getStudentCode();
-            String college = basicExamStudentDto.getCollege();
-            String major = basicExamStudentDto.getMajor();
-            String teachClazz = basicExamStudentDto.getTeachClazz();
-            String paperNumber = basicExamStudentDto.getPaperNumber();
-            String teacherName = basicExamStudentDto.getTeacherName();
-            String teacherCode = basicExamStudentDto.getTeacherCode();
-            String examDate = basicExamStudentDto.getExamDate();
-            String examTime = basicExamStudentDto.getExamTime();
-            String examPlace = basicExamStudentDto.getExamPlace();
-            String examRoom = basicExamStudentDto.getExamRoom();
-
-            Long examStartTime = null;
-            Long examEndTime = null;
-            try {
-                if (SystemConstant.strNotNull(examDate) && SystemConstant.strNotNull(examTime)) {
-                    Map<String, Object> timeMap = ConvertUtil.analyzeStartAndEndTime(examDate, examTime);
-                    examStartTime = SystemConstant.convertIdToLong(String.valueOf(timeMap.get("startTime")));
-                    examEndTime = SystemConstant.convertIdToLong(String.valueOf(timeMap.get("endTime")));
-                }
-            } catch (Exception e) {
-                errorMsgList.add(e.getMessage());
-            }
-
-            if (SystemConstant.strNotNull(paperNumber) && SystemConstant.strNotNull(courseCode)) {
-                if (paperNumberCourseCodeMap.containsKey(paperNumber)) {
-                    if (!Objects.equals(paperNumberCourseCodeMap.get(paperNumber), courseCode)) {
-                        errorMsgList.add(String.format("试卷编号和课程编号不匹配:试卷编号[%s]已经存在于课程[%s]下", paperNumber,
-                                paperNumberCourseCodeMap.get(paperNumber)));
-                    }
-                } else {
-                    paperNumberCourseCodeMap.put(paperNumber, courseCode);
-                }
-            }
-
-            String key = examId + SystemConstant.HYPHEN + courseCode + SystemConstant.HYPHEN + studentCode;
-            Long id = null;
-            if (studentCodeIdMap.containsKey(key)) {
-                id = studentCodeIdMap.get(key);
-            }
-            BasicExamStudentParam basicExamStudentParam = new BasicExamStudentParam();
-            basicExamStudentParam.setId(id);
-            basicExamStudentParam.setSemesterId(semesterId);
-            basicExamStudentParam.setExamId(examId);
-//            basicExamStudentParam.setCourseId(courseCode);
-            basicExamStudentParam.setStudentName(studentName);
-            basicExamStudentParam.setStudentCode(studentCode);
-            basicExamStudentParam.setCollege(college);
-            basicExamStudentParam.setMajor(major);
-            basicExamStudentParam.setTeachClazz(teachClazz);
-            basicExamStudentParam.setPaperNumber(paperNumber);
-            basicExamStudentParam.setTeacherName(teacherName);
-            basicExamStudentParam.setTeacherCode(teacherCode);
-            basicExamStudentParam.setExamStartTime(examStartTime);
-            basicExamStudentParam.setExamEndTime(examEndTime);
-            basicExamStudentParam.setExamPlace(examPlace);
-            basicExamStudentParam.setExamRoom(examRoom);
-            try {
-                BasicExamStudent basicExamStudent = basicExamStudentService.editEntityHelp(basicExamStudentParam,
-                        basicExam, oldPaperNumberList, requestUser);
-                // 考试课程下学号重复 后面的替换前面的
-                studentCodeObjMap.put(key, basicExamStudent);
-            } catch (Exception e) {
-                errorMsgList.add(e.getMessage());
-            }
-            String excelAnalyzeError = basicExamStudentDto.getErrorMsg();
-            if (SystemConstant.strNotNull(excelAnalyzeError)) {
-                exceptionInteger.getAndIncrement();
-                if (CollectionUtils.isNotEmpty(errorMsgList)) {
-                    basicExamStudentDto.setErrorMsg(excelAnalyzeError + ";" + String.join(";", errorMsgList));
-                }
-            } else if (CollectionUtils.isNotEmpty(errorMsgList)) {
-                exceptionInteger.getAndIncrement();
-                basicExamStudentDto.setErrorMsg(String.join(";", errorMsgList));
-            } else {
-                successInteger.getAndIncrement();
-            }
-        }
-
-        if (basicExamStudentDtoList.stream().anyMatch(e -> SystemConstant.strNotNull(e.getErrorMsg()))) {
-            map.put(SystemConstant.ERROR_DATA_LIST, basicExamStudentDtoList);
-        } else {
-            List<BasicExamStudent> basicExamStudentList = new ArrayList<>(studentCodeObjMap.values());
-            map.put(SystemConstant.DATASOURCE, basicExamStudentList);
-        }
-        map.put(SystemConstant.DATA_COUNT, basicExamStudentDtoList.size());
-        map.put(SystemConstant.SUCCESS_DATA_COUNT, successInteger.get());
-        map.put(SystemConstant.ERROR_DATA_COUNT, exceptionInteger.get());
-        map.put("oldPaperNumberList", oldPaperNumberList);
-        return map;
-    }
-
-    @Transactional
-    @Override
-    public void saveMarkStudent(Long examId, List<BasicExamStudent> basicExamStudentList) {
-        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
-        Long requestUserId = requestUser.getId();
-
-        Map<String, List<BasicExamStudent>> stringMap = basicExamStudentList.stream().collect(Collectors.groupingBy(BasicExamStudent::getPaperNumber));
-
-        for (Map.Entry<String, List<BasicExamStudent>> entry : stringMap.entrySet()) {
-            BasicExamStudent basicExamStudent = entry.getValue().get(0);
-            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, entry.getKey());
-            if (markPaper == null) {
-                BasicCourse basicCourse = basicCourseService.getByCode(basicExamStudent.getCourseCode());
-                markPaper = new MarkPaper(examId, basicExamStudent.getCourseId(), entry.getKey(), String.valueOf(System.currentTimeMillis()), requestUserId, SystemConstant.DEFAULT_PAPER_TYPE_A);
-                markPaperService.save(markPaper);
-            }
-            Set<String> secretNumberSet = new HashSet<>();
-            MarkPaper finalMarkPaper = markPaper;
-            entry.getValue().forEach(m -> markStudentService.updateByBasicExamStudent(m, finalMarkPaper, secretNumberSet));
-            markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examId, entry.getKey(), SystemConstant.DEFAULT_PAPER_TYPE_A);
-        }
-    }
-
-    @Transactional
-    @Override
-    public Map<String, Object> executeImportObjectiveStructLogic(Map<String, Object> map) throws Exception {
-        SysUser requestUser = (SysUser) map.get(SystemConstant.USER);
-        InputStream inputStream = (InputStream) map.get("inputStream");
-        Long examId = SystemConstant.convertIdToLong(String.valueOf(map.get("examId")));
-        Long schoolId = requestUser.getSchoolId();
-        BasicExam basicExam = basicExamService.getById(examId);
-        if (Objects.isNull(basicExam)) {
-            throw ExceptionResultEnum.ERROR.exception("考试不存在");
-        }
-        if (!ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
-            throw ExceptionResultEnum.ERROR.exception("仅针对模式4的考试可以导入");
-        }
-        // 课程编号名称校验
-        Map<String, String> courseCheckMap = basicCourseService.list(
-                        new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)).stream()
-                .collect(Collectors.toMap(BasicCourse::getCode, BasicCourse::getName));
-        List<MarkPaper> markPaperList = markPaperService.list(
-                new QueryWrapper<MarkPaper>().lambda().eq(MarkPaper::getExamId, examId));
-        // 题号重复校验
-        // 导入的客观题题号集合
-        Set<String> questionNumberCheckSet = new HashSet<>();
-        // 客观题选项个数在大题下一致性校验
-        Map<String, Integer> questionOptionCountMap = new HashMap<>();
-        // 该试卷已存在的主观题题号集合
-        Set<String> dbSubjectiveQuestionNumberSet = markQuestionService.list(
-                        new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
-                                .eq(MarkQuestion::getObjective, false)).stream()
-                .map(e -> e.getPaperNumber() + SystemConstant.HYPHEN + e.getMainNumber() + SystemConstant.HYPHEN + e.getSubNumber()).collect(Collectors.toSet());
-
-        ExcelResult<ObjectiveStructDto> excelResult = ConvertUtil.analyzeExcel(inputStream, ObjectiveStructDto.class,
-                true, 0);
-        List<ObjectiveStructDto> objectiveStructDtoList = excelResult.getDatasource();
-        List<MarkQuestion> markQuestionList = new ArrayList<>();
-        for (ObjectiveStructDto objectiveStructDto : objectiveStructDtoList) {
-            List<String> logicErrorList = new ArrayList<>();
-            // 公共异常提示
-            String logicErrorCommonNotice = "";
-
-            String courseCode = objectiveStructDto.getCourseCode();
-            String courseName = objectiveStructDto.getCourseName();
-            String paperNumber = objectiveStructDto.getPaperNumber();
-            String mainTitle = objectiveStructDto.getMainTitle();
-            Integer mainNumber = objectiveStructDto.getMainNumber();
-            Integer subNumber = objectiveStructDto.getSubNumber();
-            String answer = objectiveStructDto.getAnswer();
-            Integer optionCount = objectiveStructDto.getOptionCount();
-            Double totalScore = objectiveStructDto.getTotalScore();
-            Integer questionType = objectiveStructDto.getQuestionType();
-            String errorMsg = objectiveStructDto.getErrorMsg();
-
-            // 1.题号重复校验
-            if (SystemConstant.strNotNull(paperNumber) && mainNumber != null && subNumber != null) {
-                logicErrorCommonNotice = String.format("课程代码为[%s],试卷编号为[%s],大题号为[%s],小题号为[%s]的数据异常 : ", courseCode, paperNumber, mainNumber,
-                        subNumber);
-                String questionNumberKey = courseCode + SystemConstant.HYPHEN + paperNumber + SystemConstant.HYPHEN + mainNumber + SystemConstant.HYPHEN + subNumber;
-                if (questionNumberCheckSet.contains(questionNumberKey)) {
-                    logicErrorList.add("excel中题号重复");
-                } else {
-                    questionNumberCheckSet.add(questionNumberKey);
-                }
-                if (dbSubjectiveQuestionNumberSet.contains(questionNumberKey)) {
-                    logicErrorList.add("该题号已存在主观题中");
-                }
-                String mainQuestionKey = paperNumber + SystemConstant.HYPHEN + mainNumber;
-                if (questionOptionCountMap.containsKey(mainQuestionKey)) {
-                    if (!Objects.equals(questionOptionCountMap.get(mainQuestionKey), optionCount)) {
-                        logicErrorList.add("选项个数和该大题中的其他小题不一致");
-                    }
-                } else {
-                    questionOptionCountMap.put(mainQuestionKey, optionCount);
-                }
-            }
-
-            // 2.校验课程编号,课程名称,试卷在考试下是否存在
-            if (SystemConstant.strNotNull(courseCode) && SystemConstant.strNotNull(courseName) && SystemConstant.strNotNull(paperNumber)) {
-                if (!courseCheckMap.containsKey(courseCode)) {
-                    logicErrorList.add("课程编号不存在");
-                } else if (!courseCheckMap.get(courseCode).equals(courseName)) {
-                    logicErrorList.add("课程编号名称不匹配");
-                }
-                if (markPaperList.stream().noneMatch(m -> m.getPaperNumber().equals(paperNumber) && m.getCourseCode().equals(courseCode))) {
-                    logicErrorList.add("考试课程中不存在该试卷,请先创建试卷");
-                }
-            }
-            // 3.选项越界校验
-            List<String> optionScope = new ArrayList<>();
-            try {
-                for (int j = 1; j <= optionCount; j++) {
-                    String code = OptionsEnum.getCodeByIndex(j);
-                    optionScope.add(code);
-                }
-            } catch (Exception e) {
-                throw ExceptionResultEnum.ERROR.exception(e.getMessage());
-            }
-
-            // 答案选项越界校验
-            List<String> answerList = Arrays.asList(answer.split(""));
-            if (CollectionUtils.isNotEmpty(answerList)) {
-                for (String cell : answerList) {
-                    String outOfBoundsException = String.format("答案[%s]错误。答案只能从[%s]中选择", cell, String.join("", optionScope));
-                    try {
-                        OptionsEnum optionsEnum = OptionsEnum.getByCode(cell);
-                        int optionIndex = optionsEnum.getIndex();
-                        if (optionIndex > optionCount) {
-                            // 答案选项超出范围
-                            logicErrorList.add(outOfBoundsException);
-                        }
-                    } catch (Exception e) {
-                        logicErrorList.add(outOfBoundsException);
-                    }
-                }
-            } else {
-                logicErrorList.add("答案必填");
-            }
-
-            // 4.判断答案是否符合题型
-            if (questionType != null && SystemConstant.strNotNull(answer)) {
-                switch (questionType) {
-                    case 1:
-                        if (answer.length() > 1) {
-                            logicErrorList.add("单选题答案只能有一个");
-                        }
-                        break;
-                    case 2:
-                        break;
-                    case 3:
-                        if (optionCount != 2) {
-                            logicErrorList.add("判断题[选项个数]只能为2");
-                        }
-                        break;
-                    default:
-                        logicErrorList.add("[题型(1-单选,2-多选,3-判断)]必须从1、2、3中填写");
-                }
-            }
-
-            // 整理异常信息
-            if (CollectionUtils.isNotEmpty(logicErrorList)) {
-                if (SystemConstant.strNotNull(errorMsg)) {
-                    errorMsg = errorMsg + "、" + logicErrorCommonNotice + String.join("、", logicErrorList);
-                } else {
-                    errorMsg = logicErrorCommonNotice + String.join("、", logicErrorList);
-                }
-                objectiveStructDto.setErrorMsg(errorMsg);
-            } else {
-                MarkQuestion markQuestion = new MarkQuestion();
-                markQuestion.setExamId(examId);
-                markQuestion.setPaperNumber(paperNumber);
-                markQuestion.setPaperType(OptionsEnum.A.getCode());
-                markQuestion.setObjective(true);
-                markQuestion.setMainNumber(mainNumber);
-                markQuestion.setSubNumber(subNumber);
-                markQuestion.setMainTitle(mainTitle);
-                markQuestion.setAnswer(answer);
-                markQuestion.setOptionCount(optionCount);
-                markQuestion.setTotalScore(totalScore);
-                markQuestion.setObjectivePolicy(ObjectivePolicy.NONE);
-                markQuestion.setQuestionType(questionType);
-                markQuestionList.add(markQuestion);
-            }
-        }
-
-        if (objectiveStructDtoList.stream().anyMatch(e -> SystemConstant.strNotNull(e.getErrorMsg()))) {
-            // 抛出excel解析异常
-            throw ExceptionResultEnum.ERROR.exception(
-                    objectiveStructDtoList.stream().map(ObjectiveStructDto::getErrorMsg).filter(SystemConstant::strNotNull).collect(Collectors.joining(System.lineSeparator())));
-        } else {
-            // 保存客观题结构
-            Map<String, List<MarkQuestion>> markQuestionMap = markQuestionList.stream().collect(Collectors.groupingBy(MarkQuestion::getPaperNumber));
-            markQuestionMap.forEach((k, v) -> {
-                // 优先删除该试卷编号下的客观题
-                markQuestionService.remove(new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
-                        .eq(MarkQuestion::getPaperNumber, k).eq(MarkQuestion::getObjective, true));
-                // 保存客观题
-                markQuestionService.saveBatch(v);
-                markQuestionService.updateMarkPaperScore(examId, k, null);
-            });
-        }
-        return map;
-    }
-
-    @Transactional
-    @Override
-    public Map<String, Object> executeImportSubjectiveStructLogic(Map<String, Object> map) throws Exception {
-        SysUser requestUser = (SysUser) map.get(SystemConstant.USER);
-        InputStream inputStream = (InputStream) map.get("inputStream");
-        Long examId = SystemConstant.convertIdToLong(String.valueOf(map.get("examId")));
-        Long schoolId = requestUser.getSchoolId();
-        BasicExam basicExam = basicExamService.getById(examId);
-        if (Objects.isNull(basicExam)) {
-            throw ExceptionResultEnum.ERROR.exception("考试不存在");
-        }
-        if (!ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
-            throw ExceptionResultEnum.ERROR.exception("仅针对模式4的考试可以导入");
-        }
-        SysRole markerRole = sysRoleService.getOne(
-                new QueryWrapper<SysRole>().lambda().eq(SysRole::getType, RoleTypeEnum.MARKER));
-        if (Objects.isNull(markerRole)) {
-            throw ExceptionResultEnum.ERROR.exception("缺少评卷员角色");
-        }
-
-        // 课程编号名称校验
-        Map<String, String> courseCheckMap = basicCourseService.list(
-                        new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)).stream()
-                .collect(Collectors.toMap(BasicCourse::getCode, BasicCourse::getName));
-        List<MarkPaper> markPaperList = markPaperService.list(
-                new QueryWrapper<MarkPaper>().lambda().eq(MarkPaper::getExamId, examId));
-        // 题号重复校验
-        // 导入的客观题题号集合
-        Set<String> questionNumberCheckSet = new HashSet<>();
-        // 该试卷已存在的客观题题号集合
-        Set<String> dbObjectiveQuestionNumberSet = markQuestionService.list(
-                        new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
-                                .eq(MarkQuestion::getObjective, true)).stream()
-                .map(e -> e.getPaperNumber() + SystemConstant.HYPHEN + e.getMainNumber() + SystemConstant.HYPHEN + e.getSubNumber()).collect(Collectors.toSet());
-
-        ExcelResult<SubjectiveStructDto> excelResult = ConvertUtil.analyzeExcel(inputStream, SubjectiveStructDto.class,
-                true, 0);
-        List<SubjectiveStructDto> subjectiveStructDtoList = excelResult.getDatasource();
-        for (SubjectiveStructDto subjectiveStructDto : subjectiveStructDtoList) {
-            List<String> excelErrorList = new ArrayList<>();
-            // 公共异常提示
-            String excelErrorCommonNotice = "";
-
-            String courseCode = subjectiveStructDto.getCourseCode();
-            String courseName = subjectiveStructDto.getCourseName();
-            String paperNumber = subjectiveStructDto.getPaperNumber();
-            Integer mainNumber = subjectiveStructDto.getMainNumber();
-            Integer subNumber = subjectiveStructDto.getSubNumber();
-            Integer markerCount = subjectiveStructDto.getMarkerCount();
-            String markerCodes = subjectiveStructDto.getMarkerCodes();
-            String errorMsg = subjectiveStructDto.getErrorMsg();
-
-            // 1.题号重复校验
-            if (SystemConstant.strNotNull(paperNumber) && mainNumber != null && subNumber != null) {
-                excelErrorCommonNotice = String.format("课程代码为[%s],试卷编号为[%s],大题号为[%s],小题号为[%s]的数据异常 : ", courseCode, paperNumber, mainNumber,
-                        subNumber);
-                String questionNumberKey = courseCode + SystemConstant.HYPHEN + paperNumber + SystemConstant.HYPHEN + mainNumber + SystemConstant.HYPHEN + subNumber;
-                if (questionNumberCheckSet.contains(questionNumberKey)) {
-                    excelErrorList.add("excel中题号重复");
-                } else {
-                    questionNumberCheckSet.add(questionNumberKey);
-                }
-                if (dbObjectiveQuestionNumberSet.contains(questionNumberKey)) {
-                    excelErrorList.add("该题号已存在客观题中");
-                }
-            }
-
-            // 2.校验课程代码,课程名称,试卷在考试下是否存在
-            if (SystemConstant.strNotNull(courseCode) && SystemConstant.strNotNull(courseName) && SystemConstant.strNotNull(paperNumber)) {
-                if (!courseCheckMap.containsKey(courseCode)) {
-                    excelErrorList.add("课程代码不存在");
-                } else if (!courseCheckMap.get(courseCode).equals(courseName)) {
-                    excelErrorList.add("课程代码名称不匹配");
-                }
-                if (markPaperList.stream().noneMatch(m -> m.getPaperNumber().equals(paperNumber) && m.getCourseCode().equals(courseCode))) {
-                    excelErrorList.add("考试课程中不存在该试卷,请先创建试卷");
-                }
-            }
-
-            // 3.评卷员校验
-            if (Objects.isNull(markerCount) && Objects.isNull(markerCodes)) {
-                excelErrorList.add("[评卷员数量(系统生成)]和[绑定工号(英文逗号分隔)]不能同时为空");
-            }
-
-            // 整理异常信息
-            if (CollectionUtils.isNotEmpty(excelErrorList)) {
-                if (SystemConstant.strNotNull(errorMsg)) {
-                    errorMsg = errorMsg + "、" + excelErrorCommonNotice + String.join("、", excelErrorList);
-                } else {
-                    errorMsg = excelErrorCommonNotice + String.join("、", excelErrorList);
-                }
-                subjectiveStructDto.setErrorMsg(errorMsg);
-            }
-        }
-        if (subjectiveStructDtoList.stream().anyMatch(e -> SystemConstant.strNotNull(e.getErrorMsg()))) {
-            // 抛出excel解析异常
-            throw ExceptionResultEnum.ERROR.exception(
-                    subjectiveStructDtoList.stream().map(SubjectiveStructDto::getErrorMsg).filter(SystemConstant::strNotNull).collect(Collectors.joining(System.lineSeparator())));
-        } else {
-            List<String> paperErrorList = new ArrayList<>();
-            // 试卷编号-> 题目集合 Map
-            Map<String, List<SubjectiveStructDto>> paperQuestionsMap = subjectiveStructDtoList.stream().collect(Collectors.groupingBy(SubjectiveStructDto::getPaperNumber));
-            paperQuestionsMap.forEach((paperNumber, paperQuestionList) -> {
-                if (markGroupService.countByExamIdAndPaperNumber(examId, paperNumber) > 0) {
-                    paperErrorList.add(String.format("[试卷编号]%s,已存在分组,请先删除该试卷的所有分组再导入试题", paperNumber));
-                } else {
-                    // 优先删除该试卷的主观题
-                    markQuestionService.remove(
-                            new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
-                                    .eq(MarkQuestion::getPaperNumber, paperNumber).eq(MarkQuestion::getObjective, false));
-
-                    // 试卷下分组集合
-                    List<Integer> groupNumberList = paperQuestionList.stream().map(SubjectiveStructDto::getGroupNumber)
-                            .distinct().sorted().collect(Collectors.toList());
-
-                    // 评卷员序号
-                    AtomicInteger markerNumber = new AtomicInteger(0);
-                    for (Integer groupNumber : groupNumberList) {
-                        List<String> groupErrorList = new ArrayList<>();
-                        // 分组下题目集合
-                        List<SubjectiveStructDto> groupQuestionList = paperQuestionList.stream()
-                                .filter(e -> e.getGroupNumber().equals(groupNumber)).collect(Collectors.toList());
-
-                        String paperNumberGroupNumberNotice = String.format("[试卷编号]%s,[评卷分组(只能用小写数字)]%s,的", paperNumber,
-                                groupNumber);
-
-                        String orgName = null;
-                        Long orgId = null;
-                        BasicCourse basicCourse = basicCourseService.getOne(
-                                new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)
-                                        .eq(BasicCourse::getCode, groupQuestionList.get(0).getCourseCode()));
-                        if (Objects.isNull(basicCourse)) {
-                            groupErrorList.add("[课程代码]不存在");
-                        } else {
-                            Long teachingRoomId = basicCourse.getTeachingRoomId();
-                            SysOrg sysOrg = sysOrgService.getById(teachingRoomId);
-                            if (Objects.isNull(sysOrg)) {
-                                throw ExceptionResultEnum.ERROR.exception("无法找到机构");
-                            }
-                            orgName = sysOrg.getName();
-                            orgId = sysOrg.getId();
-                        }
-                        Integer markerCount = null;
-                        String markerCodes = null;
-                        List<Integer> markerCountList = groupQuestionList.stream().map(SubjectiveStructDto::getMarkerCount).distinct().collect(Collectors.toList());
-                        if (CollectionUtils.isNotEmpty(markerCountList)) {
-                            if (markerCountList.size() > 1) {
-                                groupErrorList.add("[评卷员数量(系统生成)]不一致");
-                            } else if (markerCountList.size() == 1) {
-                                markerCount = markerCountList.get(0);
-                            }
-                        }
-
-                        List<String> markerCodesList = groupQuestionList.stream().map(SubjectiveStructDto::getMarkerCodes).distinct().collect(Collectors.toList());
-                        if (CollectionUtils.isNotEmpty(markerCodesList)) {
-                            if (markerCodesList.size() > 1) {
-                                groupErrorList.add("[绑定工号(英文逗号分隔)]不一致");
-                            } else if (markerCodesList.size() == 1) {
-                                markerCodes = markerCodesList.get(0);
-                            }
-                        }
-
-                        // 组装评卷员信息
-                        List<MarkUser> markUsers = new ArrayList<>();
-                        if (SystemConstant.strNotNull(markerCodes)) {
-                            // 优先以绑定工号为准
-                            String[] markerCodeArray = markerCodes.split(SystemConstant.COMMA);
-                            for (String markerCode : markerCodeArray) {
-                                SysUser sysUser = sysUserService.getOne(
-                                        new QueryWrapper<SysUser>().lambda().eq(SysUser::getSchoolId, schoolId).eq(SysUser::getLoginName, markerCode).last(SystemConstant.LIMIT1));
-                                if (Objects.isNull(sysUser)) {
-                                    groupErrorList.add(paperNumberGroupNumberNotice + String.format(
-                                            "[绑定工号(英文逗号分隔)]中的%s,在系统中不存在请先创建用户", markerCode));
-                                } else {
-                                    // 添加评卷员信息
-                                    MarkUser markUser = new MarkUser();
-                                    markUser.setUserId(sysUser.getId());
-                                    markUser.setLoginName(sysUser.getLoginName());
-                                    markUser.setName(sysUser.getRealName());
-                                    markUser.setOrgName(orgName);
-                                    markUsers.add(markUser);
-                                }
-                            }
-                        } else if (Objects.nonNull(markerCount) && markerCount > 0) {
-                            // 没有绑定工号且评卷员生成数量大于0,生成评卷员(或使用之前工号相同的评卷员)
-                            for (int i = 0; i < markerCount; i++) {
-                                int num = markerNumber.incrementAndGet();
-                                if (num > 99) {
-                                    paperErrorList.add("[试卷编号]%s的[评卷员数量(系统生成)]总有效数量不能超过99");
-                                    break;
-                                }
-                                String markerCode = paperNumber + String.format("%02d", num);
-
-                                SysUser sysUser = sysUserService.getOne(
-                                        new QueryWrapper<SysUser>().lambda().eq(SysUser::getSchoolId, schoolId).eq(SysUser::getLoginName, markerCode).last(SystemConstant.LIMIT1));
-
-                                MarkUser markUser = new MarkUser();
-                                markUser.setLoginName(markerCode);
-                                markUser.setOrgName(orgName);
-                                markUsers.add(markUser);
-                                if (Objects.nonNull(sysUser)) {
-                                    markUser.setUserId(sysUser.getId());
-                                    markUser.setName(sysUser.getRealName());
-                                } else {
-                                    // 创建用户
-                                    UserSaveParams userSaveParams = new UserSaveParams();
-                                    userSaveParams.setSchoolId(schoolId);
-                                    userSaveParams.setLoginName(markerCode);
-                                    userSaveParams.setRealName(markerCode);
-                                    userSaveParams.setCode(markerCode);
-                                    userSaveParams.setPassword(SystemConstant.DEFAULT_PASSWORD);
-                                    userSaveParams.setOrgId(orgId);
-                                    userSaveParams.setEnable(true);
-                                    userSaveParams.setRoleIds(new Long[]{markerRole.getId()});
-                                    try {
-                                        markUser.setUserId(sysUserService.saveUser(userSaveParams));
-                                        markUser.setName(markerCode);
-                                    } catch (IllegalAccessException e) {
-                                        e.printStackTrace();
-                                    }
-                                }
-                            }
-                        }
-                        if (CollectionUtils.isEmpty(groupErrorList) && CollectionUtils.isEmpty(paperErrorList)) {
-                            // 创建评卷试题
-                            List<MarkQuestion> markQuestionList = paperQuestionList.stream().filter(e -> groupNumber.equals(e.getGroupNumber())).flatMap(e -> {
-                                MarkQuestion markQuestion = new MarkQuestion();
-                                markQuestion.setExamId(examId);
-                                markQuestion.setPaperNumber(paperNumber);
-                                markQuestion.setPaperType(OptionsEnum.A.getCode());
-                                markQuestion.setObjective(false);
-                                markQuestion.setMainNumber(e.getMainNumber());
-                                markQuestion.setSubNumber(e.getSubNumber());
-                                markQuestion.setMainTitle(e.getMainTitle());
-                                markQuestion.setTotalScore(e.getTotalScore());
-                                markQuestion.setIntervalScore(e.getIntervalScore());
-                                markQuestion.setQuestionType(QuestionType.QUESTION_ANSWER.getValue());
-                                return Stream.of(markQuestion);
-                            }).collect(Collectors.toList());
-                            markQuestionService.saveBatch(markQuestionList);
-
-                            MarkGroupDto markGroupDto = new MarkGroupDto();
-                            markGroupDto.setDoubleEnable(false);
-                            markGroupDto.setGroupNumber(groupNumber);
-                            markGroupDto.setMarkers(markUsers);
-                            markGroupDto.setQuestions(markQuestionList);
-                            markGroupDto.setPictureConfigs(new ArrayList<>());
-                            MarkGroupSingleDto markGroupSingleDto = new MarkGroupSingleDto();
-                            markGroupSingleDto.setExamId(examId);
-                            markGroupSingleDto.setPaperNumber(paperNumber);
-                            markGroupSingleDto.setGroupInfo(markGroupDto);
-                            markGroupService.saveGroup(markGroupSingleDto);
-                        }
-                        if (CollectionUtils.isNotEmpty(groupErrorList)) {
-                            String groupErrorMsg = paperNumberGroupNumberNotice + String.join(",", groupErrorList);
-                            paperErrorList.add(groupErrorMsg);
-                        }
-                    }
-                }
-            });
-            if (CollectionUtils.isNotEmpty(paperErrorList)) {
-                throw ExceptionResultEnum.ERROR.exception(String.join(System.lineSeparator(), paperErrorList));
-            }
-        }
-        return map;
-    }
-
     /**
      * 验证机构是否存在
      *
@@ -1993,16 +1274,16 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 clazz.setId(teachClazz.getId());
                 clazz.setName(teachClazz.getClazzName());
             } else {
-                QueryWrapper<BasicClazz> basicClazzQueryWrapper = new QueryWrapper<>();
-                basicClazzQueryWrapper.lambda().eq(BasicClazz::getSchoolId, schoolId)
-                        .eq(BasicClazz::getClazzName, key)
-                        .eq(BasicClazz::getEnable, true);
-                BasicClazz basicClazz = basicClazzService.getOne(basicClazzQueryWrapper);
-                if (Objects.nonNull(basicClazz)) {
-                    clazz = new DictionaryResult();
-                    clazz.setId(basicClazz.getId());
-                    clazz.setName(basicClazz.getClazzName());
-                }
+//                QueryWrapper<BasicClazz> basicClazzQueryWrapper = new QueryWrapper<>();
+//                basicClazzQueryWrapper.lambda().eq(BasicClazz::getSchoolId, schoolId)
+//                        .eq(BasicClazz::getClazzName, key)
+//                        .eq(BasicClazz::getEnable, true);
+//                BasicClazz basicClazz = basicClazzService.getOne(basicClazzQueryWrapper);
+//                if (Objects.nonNull(basicClazz)) {
+//                    clazz = new DictionaryResult();
+//                    clazz.setId(basicClazz.getId());
+//                    clazz.setName(basicClazz.getClazzName());
+//                }
             }
         } else {
             clazz = clazzMap.get(key);

+ 16 - 9
distributed-print-business/src/main/resources/mapper/BasicExamStudentMapper.xml

@@ -8,20 +8,25 @@
             bes.id,
             bes.semester_id AS semesterId,
             bes.exam_id AS examId,
+            bes.course_id courseId,
             bc.name AS courseName,
             bc.code AS courseCode,
+            so.name AS teachingRoomName,
             bes.student_name AS studentName,
             bes.student_code AS studentCode,
-            bes.college,
-            bes.major,
-            tbc.clazz_name AS teachClazz,
+            bes.site_number AS siteNumber,
+            bes.college_name AS collegeName,
+            bes.major_name AS majorName,
+            bes.teach_class_name AS teachClassName,
+            bes.class_name AS className,
             bes.paper_number AS paperNumber,
             teacher.real_name AS teacherName,
             teacher.code AS teacherCode,
             bes.exam_start_time AS examStartTime,
             bes.exam_end_time AS examEndTime,
             bes.exam_place AS examPlace,
-            bes.exam_room AS examRoom
+            bes.exam_room AS examRoom,
+            bes.extend_fields AS extendFields
         FROM
             basic_exam_student bes
                 LEFT JOIN
@@ -32,6 +37,8 @@
             sys_user teacher ON bes.teacher_id = teacher.id
                 LEFT JOIN
             sys_user su ON bes.create_id = su.id
+                LEFT JOIN
+            sys_org so ON bc.teaching_room_id = so.id
         <where>
             <if test="schoolId != null and schoolId != ''">
                 AND bes.school_id = #{schoolId}
@@ -49,10 +56,10 @@
                 AND (teacher.real_name LIKE CONCAT('%',#{teacher},'%') OR teacher.code LIKE CONCAT('%',#{teacher},'%'))
             </if>
             <if test="college != null and college != ''">
-                AND bes.college LIKE CONCAT('%',#{college},'%')
+                AND bes.college_name LIKE CONCAT('%',#{college},'%')
             </if>
             <if test="major != null and major != ''">
-                AND bes.major LIKE CONCAT('%',#{major},'%')
+                AND bes.major_name LIKE CONCAT('%',#{major},'%')
             </if>
             <if test="teachClazz != null and teachClazz != ''">
                 AND tbc.clazz_name LIKE CONCAT('%',#{teachClazz},'%')
@@ -81,8 +88,8 @@
             bes.course_code AS courseCode,
             bes.student_name AS studentName,
             bes.student_code AS studentCode,
-            bes.college,
-            bes.major,
+            bes.college_name AS collegeName,
+            bes.major_name AS majorName,
             tbc.clazz_name AS teachClazz,
             bes.paper_number AS paperNumber,
             teacher.real_name AS teacherName,
@@ -118,7 +125,7 @@
                 AND (teacher.real_name LIKE CONCAT('%',#{teacher},'%') OR teacher.code LIKE CONCAT('%',#{teacher},'%'))
             </if>
             <if test="college != null and college != ''">
-                AND bes.college LIKE CONCAT('%',#{college},'%')
+                AND bes.college_name LIKE CONCAT('%',#{college},'%')
             </if>
             <if test="major != null and major != ''">
                 AND bes.major LIKE CONCAT('%',#{major},'%')

+ 10 - 1
distributed-print/install/mysql/upgrade/3.4.0.sql

@@ -93,6 +93,12 @@ update mark_paper_package a left join basic_exam be on a.exam_id = be.id left jo
 ALTER TABLE `exam_print_plan` DROP COLUMN `third_relate_name`, DROP COLUMN `third_relate_id`;
 ALTER TABLE `exam_student` DROP COLUMN `can_delete`;
 ALTER TABLE `basic_exam_student` ADD COLUMN `teach_class_name` VARCHAR(100) NULL AFTER `major`, ADD COLUMN `class_name` VARCHAR(100) NULL AFTER `teach_class_name`;
+ALTER TABLE `basic_exam_student` ADD COLUMN `site_number` VARCHAR(10) NULL COMMENT '座位号' AFTER `student_code`, ADD COLUMN `extend_fields` MEDIUMTEXT NULL COMMENT '扩展字段' AFTER `exam_room`;
+ALTER TABLE `basic_exam_student`
+    CHANGE COLUMN `college` `college_name` VARCHAR(100) CHARACTER SET 'utf8mb4' NULL DEFAULT NULL COMMENT '学院' ,
+    CHANGE COLUMN `major` `major_name` VARCHAR(100) CHARACTER SET 'utf8mb4' NULL DEFAULT NULL COMMENT '专业' ;
+
+update basic_exam_student bes set bes.teach_class_name = (select btc.clazz_name from basic_teach_clazz btc where bes.clazz_id = btc.id) where bes.teach_class_name is null;
 
 -- drop table if exists exam_detail_course_paper_type;
 -- drop table if exists basic_template_org;
@@ -108,4 +114,7 @@ ALTER TABLE `basic_exam_student` ADD COLUMN `teach_class_name` VARCHAR(100) NULL
 -- drop table if exists basic_college;
 -- drop table if exists basic_campus;
 
--- delete脚本需要加上新增的表
+-- delete脚本需要加上新增的表
+
+-- 升级说明
+-- 1. 将通用规则中,教学班改为teachClassName,班级改为className

+ 0 - 76
distributed-print/src/main/java/com/qmth/distributed/print/api/BasicClazzController.java

@@ -1,76 +0,0 @@
-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.annotation.OperationLogDetail;
-import com.qmth.teachcloud.common.bean.params.BasicClazzParams;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.SysUser;
-import com.qmth.teachcloud.common.enums.log.OperationTypeEnum;
-import com.qmth.teachcloud.common.service.BasicClazzService;
-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.validation.annotation.Validated;
-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: 2021-08-28
- */
-@Api(tags = "班级管理controller")
-@RestController
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_BASIC + "/clazz")
-@Validated
-//@Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
-public class BasicClazzController {
-
-    @Resource
-    private BasicClazzService basicClazzService;
-
-    @ApiOperation(value = "班级基本信息管理-查询")
-    @RequestMapping(value = "/query", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
-    public Result findBasicClazzList(@ApiParam(value = "查询参数(班级号或班级名)") @RequestParam(required = false) String queryParams,
-                                     @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) {
-        return ResultUtil.ok(basicClazzService.basicClazzPage(queryParams, pageNumber, pageSize));
-    }
-
-    @ApiOperation(value = "班级基本信息管理-新增/编辑")
-    @RequestMapping(value = "/save", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "更新成功", response = EditResult.class)})
-    @OperationLogDetail(operationType = OperationTypeEnum.SAVE)
-    public Result saveBasicClazz(@Valid @RequestBody BasicClazzParams basicClazzParams, BindingResult bindingResult) throws IllegalAccessException {
-        if (bindingResult.hasErrors()) {
-            return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
-        }
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return ResultUtil.ok(basicClazzService.saveBasicClazz(basicClazzParams, sysUser));
-    }
-
-    @ApiOperation(value = "班级基本信息管理-批量删除")
-    @RequestMapping(value = "/delete_batch", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "删除成功", response = EditResult.class)})
-    @OperationLogDetail(operationType = OperationTypeEnum.DELETE)
-    public Result deleteBasicClazz(@ApiParam(value = "选择的要删除的班级id集合", required = true) @RequestParam List<String> idList) {
-        return ResultUtil.ok(basicClazzService.removeBasicClazzBatch(idList.stream().map(SystemConstant::convertIdToLong).collect(Collectors.toList())));
-    }
-
-    @ApiOperation(value = "班级数据源查询")
-    @RequestMapping(value = "/datasource", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
-    public Result findBasicClazzList(@ApiParam(value = "校区主键") @RequestParam(required = false) String campusId) {
-        return ResultUtil.ok(basicClazzService.findClazzDatasource(SystemConstant.convertIdToLong(campusId)));
-    }
-}

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

@@ -87,7 +87,7 @@ public class BasicExamStudentController {
         return ResultUtil.ok(basicExamStudentService.save(basicExamStudentParam, sysUser));
     }
 
-    @ApiOperation(value = "批量导入(同步)")
+    @ApiOperation(value = "导入")
     @RequestMapping(value = "/import", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Result.class)})
     @OperationLogDetail(operationType = OperationTypeEnum.IMPORT)

+ 0 - 75
distributed-print/src/main/java/com/qmth/distributed/print/api/BasicMajorController.java

@@ -1,75 +0,0 @@
-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.annotation.OperationLogDetail;
-import com.qmth.teachcloud.common.bean.params.BasicMajorParams;
-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.enums.log.OperationTypeEnum;
-import com.qmth.teachcloud.common.service.BasicMajorService;
-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;
-
-/**
- * <p>
- * 专业字典表 前端控制器
- * </p>
- *
- * @author wangliang
- * @since 2021-10-28
- */
-@Api(tags = "专业管理controller")
-@RestController
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_BASIC + "/major")
-public class BasicMajorController {
-    @Resource
-    private BasicMajorService basicMajorService;
-
-    @ApiOperation(value = "专业管理-查询")
-    @RequestMapping(value = "/query", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
-    public Result findBasicMajorList(@ApiParam(value = "专业名称") @RequestParam(required = false) String majorName,
-                                     @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(basicMajorService.basicMajorPage(schoolId, majorName, pageNumber, pageSize));
-    }
-
-    @ApiOperation(value = "专业管理-新增/编辑")
-    @RequestMapping(value = "/save", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "更新成功", response = EditResult.class)})
-    @OperationLogDetail(operationType = OperationTypeEnum.SAVE)
-    public Result saveBasicMajor(@Valid @RequestBody BasicMajorParams basicMajorParams, BindingResult bindingResult) throws IllegalAccessException {
-        if (bindingResult.hasErrors()) {
-            return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
-        }
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        return ResultUtil.ok(basicMajorService.saveBasicMajor(basicMajorParams, sysUser));
-    }
-
-    @ApiOperation(value = "专业管理-删除")
-    @RequestMapping(value = "/delete", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "删除成功", response = EditResult.class)})
-    @OperationLogDetail(operationType = OperationTypeEnum.DELETE)
-    public Result deleteBasicMajor(@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(basicMajorService.deleteBasicMajorByIdList(newIdList));
-    }
-}

+ 0 - 131
distributed-print/src/main/java/com/qmth/distributed/print/api/BasicStudentController.java

@@ -1,131 +0,0 @@
-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.annotation.OperationLogDetail;
-import com.qmth.teachcloud.common.bean.params.BasicStudentParams;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.common.enums.log.OperationTypeEnum;
-import com.qmth.teachcloud.common.service.BasicStudentService;
-import com.qmth.teachcloud.common.util.Result;
-import com.qmth.teachcloud.common.util.ResultUtil;
-import io.swagger.annotations.*;
-import org.springframework.validation.BindingResult;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 学校id 前端控制器
- * </p>
- *
- * @author wangliang
- * @since 2021-08-02
- */
-@Api(tags = "学生管理controller")
-@RestController
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_BASIC + "/student")
-@Validated
-public class BasicStudentController {
-    @Resource
-    private BasicStudentService basicStudentService;
-
-    @ApiOperation(value = "学生管理-查询")
-    @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) Long collegeId,
-                                       @ApiParam(value = "专业主键") @RequestParam(required = false) Long majorId,
-                                       @ApiParam(value = "班级主键") @RequestParam(required = false) Long clazzId,
-                                       @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) {
-        return ResultUtil.ok(basicStudentService.basicStudentPage(queryParams, collegeId, majorId, clazzId, pageNumber, pageSize));
-    }
-
-    @ApiOperation(value = "学生管理-新增/编辑")
-    @RequestMapping(value = "/save", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "更新成功", response = EditResult.class)})
-    @OperationLogDetail(operationType = OperationTypeEnum.SAVE)
-    public Result saveBasicStudent(@Valid @RequestBody BasicStudentParams basicStudentParams, BindingResult bindingResult) {
-        if (bindingResult.hasErrors()) {
-            return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
-        }
-        return ResultUtil.ok(basicStudentService.saveBasicStudent(basicStudentParams));
-    }
-
-    @ApiOperation(value = "学生管理-批量删除")
-    @RequestMapping(value = "/delete_batch", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "删除成功", response = EditResult.class)})
-    @OperationLogDetail(operationType = OperationTypeEnum.DELETE)
-    public Result deleteBasicStudent(@ApiParam(value = "选择的要删除的学生id集合", required = true) @RequestParam List<String> idList) {
-        return ResultUtil.ok(basicStudentService.removeBasicStudentBatch(idList.stream().map(SystemConstant::convertIdToLong).collect(Collectors.toList())));
-    }
-
-    @ApiOperation(value = "学生管理-根据条件删除")
-    @RequestMapping(value = "/delete_by_condition", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
-    @OperationLogDetail(operationType = OperationTypeEnum.DELETE)
-    public Result deleteBasicStudentByCondition(@ApiParam(value = "查询参数(学生学号或姓名)") @RequestParam(required = false) String queryParams,
-                                                @ApiParam(value = "学院主键") @RequestParam(required = false) String collegeId,
-                                                @ApiParam(value = "专业主键") @RequestParam(required = false) String majorId,
-                                                @ApiParam(value = "班级主键") @RequestParam(required = false) String clazzId) {
-        Set<Long> clazzIdSet = new HashSet<>();
-        if (SystemConstant.strNotNull(clazzId)) {
-            clazzIdSet.add(SystemConstant.convertIdToLong(clazzId));
-        } else {
-            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(collegeId), SystemConstant.convertIdToLong(majorId), clazzIdSet));
-    }
-
-    @ApiOperation(value = "学生管理-批量导入(异步)")
-    @RequestMapping(value = "/data_import", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = EditResult.class)})
-    @OperationLogDetail(operationType = OperationTypeEnum.IMPORT)
-    public Result basicStudentImportAysnc(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file) throws Exception {
-//        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-//        Map<String, Object> map = printCommonService.saveTask(file, TaskTypeEnum.STUDENT_IMPORT);
-//        map.put(SystemConstant.SYS_USER, sysUser);
-//
-//        asyncStudentDataImportService.importTask(map);
-//        TBTask tbTask = Objects.nonNull(map.get(SystemConstant.TASK)) ? (TBTask) map.get(SystemConstant.TASK) : null;
-//        return Objects.nonNull(tbTask) ? ResultUtil.ok(tbTask.getId()) : ResultUtil.error("创建任务失败");
-//        boolean success = basicStudentService.importBasicStudent(map, file);
-//        return ResultUtil.ok(success, "");
-        return null;
-    }
-
-    @ApiOperation(value = "学生管理-导出")
-    @RequestMapping(value = "/export", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = EditResult.class)})
-    @OperationLogDetail(operationType = OperationTypeEnum.EXPORT)
-    public void export(@ApiParam(value = "查询参数(学生学号或姓名)") @RequestParam(required = false) String queryParams,
-                       @ApiParam(value = "学院主键") @RequestParam(required = false) String collegeId,
-                       @ApiParam(value = "专业主键") @RequestParam(required = false) String majorId,
-                       @ApiParam(value = "班级主键") @RequestParam(required = false) String clazzId,
-                       HttpServletResponse response) throws Exception {
-        Set<Long> clazzIdSet = new HashSet<>();
-        if (SystemConstant.strNotNull(clazzId)) {
-            clazzIdSet.add(SystemConstant.convertIdToLong(clazzId));
-        } else {
-            clazzIdSet = null;
-        }
-        basicStudentService.exportData(response, queryParams, SystemConstant.convertIdToLong(collegeId), SystemConstant.convertIdToLong(majorId), clazzIdSet);
-    }
-}

+ 0 - 18
distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java

@@ -84,8 +84,6 @@ public class SysController {
     @Resource
     TeachcloudCommonService teachcloudCommonService;
     @Resource
-    BasicMajorService basicMajorService;
-    @Resource
     BasicCourseService basicCourseService;
     @Resource
     BasicSemesterService basicSemesterService;
@@ -727,22 +725,6 @@ public class SysController {
             //                    }).collect(Collectors.toList());
             //                }
             //                break;
-            case MAJOR:
-                QueryWrapper<BasicMajor> majorQueryWrapper = new QueryWrapper<>();
-                majorQueryWrapper.lambda().eq(BasicMajor::getSchoolId, schoolId).eq(BasicMajor::getEnable, true);
-
-                if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(collegeId))) {
-                    majorQueryWrapper.lambda().eq(BasicMajor::getBelongOrgId, collegeId);
-                }
-                List<BasicMajor> basicMajorList = basicMajorService.list(majorQueryWrapper);
-                dictionaryResultList = basicMajorList.stream().map(e -> {
-                    DictionaryResult dictionaryResult = new DictionaryResult();
-                    dictionaryResult.setId(e.getId());
-                    dictionaryResult.setCode(e.getCode());
-                    dictionaryResult.setName(e.getName());
-                    return dictionaryResult;
-                }).collect(Collectors.toList());
-                break;
             case CLAZZ:
                 QueryWrapper<BasicTeachClazz> clazzQueryWrapper = new QueryWrapper<>();
                 clazzQueryWrapper.lambda().eq(BasicTeachClazz::getSchoolId, schoolId).eq(BasicTeachClazz::getExamId, examId);

+ 0 - 281
distributed-print/src/test/java/com/qmth/distributed/print/BasicDataImportTest.java

@@ -1,281 +0,0 @@
-package com.qmth.distributed.print;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.qmth.distributed.print.business.util.PdfUtil;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.BasicCourse;
-import com.qmth.teachcloud.common.service.*;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-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;
-
-/**
- * @Description: 用户数据导入、课程导入、组织机构导入
- */
-@SpringBootTest
-@RunWith(SpringRunner.class)
-public class BasicDataImportTest {
-    @Autowired
-    private BasicCourseService basicCourseService;
-    @Autowired
-    private SysUserService sysUserService;
-    @Autowired
-    private SysOrgService sysOrgService;
-    @Autowired
-    private BasicUserCourseService basicUserCourseService;
-    @Autowired
-    private SysRoleService sysRoleService;
-    @Autowired
-    private SysUserRoleService sysUserRoleService;
-    @Autowired
-    private SysRolePrivilegeService sysRolePrivilegeService;
-    @Resource
-    private PdfUtil pdfUtil;
-
-    // 学校Id
-    private Long schoolId = 1l;
-
-    // 用户数据文件
-    String userFile = "D:\\20210508140918-1.xlsx";
-    // 课程数据文件
-    String courseFile = "D:\\20210508140918-2.xlsx";
-
-
-    @Test
-    public void importBasicCourse() throws Exception {
-        List<BasicCourse> courses = readCourseFile();
-        for (BasicCourse cours : courses) {
-            QueryWrapper<BasicCourse> queryWrapper = new QueryWrapper<>();
-            queryWrapper.lambda().eq(BasicCourse::getCode, cours.getCode());
-            BasicCourse basicCourse = basicCourseService.getOne(queryWrapper);
-            if (basicCourse != null) {
-                if (basicCourse.getName().equals(cours.getName())) {
-                    continue;
-                } else {
-                    throw new Exception(String.format("s%代码已存在,名称不一致,数据库:s%,文件中:s%", cours.getCode(), basicCourse.getName(), cours.getName()));
-                }
-            }
-
-            cours.setId(SystemConstant.getDbUuid());
-            cours.setSchoolId(schoolId);
-            basicCourseService.save(cours);
-        }
-    }
-
-//    @Test
-////    @Transactional
-//    public void importBasicUser() throws Exception {
-//        List<Map<String, String>> users = readUserFile();
-//        for (Map<String, String> userMap : users) {
-//            // sys_org
-//            String orgCode = userMap.get("orgCode");
-//            String orgName = userMap.get("orgName");
-//            QueryWrapper<SysOrg> orgQueryWrapper = new QueryWrapper<>();
-//            orgQueryWrapper.lambda().eq(SysOrg::getSchoolId, schoolId).eq(SysOrg::getCode, orgCode);
-//            SysOrg sysOrg = sysOrgService.getOne(orgQueryWrapper);
-//            if (sysOrg != null) {
-//                if (!sysOrg.getName().equals(orgName)) {
-//                    throw new Exception(String.format("s%代码已存在,名称不一致,数据库:s%,文件中:s%", orgCode, sysOrg.getName(), orgName));
-//                }
-//            } else {
-//                sysOrg = new SysOrg();
-//                sysOrg.setId(SystemConstant.getDbUuid());
-//                sysOrg.setSchoolId(schoolId);
-//                sysOrg.setCode(orgCode);
-//                sysOrg.setName(orgName);
-//                sysOrg.setParentId(100l);
-//                sysOrgService.save(sysOrg);
-//            }
-//
-//            // sys_user
-//            String loginName = userMap.get("loginName");
-//            String realName = userMap.get("realName");
-//            String mobileNumber = userMap.get("mobileNumber");
-//            String password = userMap.get("password");
-//            QueryWrapper<SysUser> userQueryWrapper = new QueryWrapper<>();
-//            userQueryWrapper.lambda().eq(SysUser::getSchoolId, schoolId).eq(SysUser::getLoginName, loginName);
-//            SysUser sysUser = sysUserService.getOne(userQueryWrapper);
-//            if (sysUser == null) {
-//                sysUser = new SysUser();
-//                sysUser.setId(SystemConstant.getDbUuid());
-//                sysUser.setSchoolId(schoolId);
-//                sysUser.setLoginName(loginName);
-//                sysUser.setRealName(realName);
-//                sysUser.setPassword(password);
-//                sysUser.setMobileNumber(mobileNumber);
-//                sysUser.setOrgId(sysOrg.getId());
-//                sysUserService.save(sysUser);
-//            }
-//
-//            // sys_user_role
-//            String roleType = userMap.get("roleType");
-//            QueryWrapper<SysRole> roleQueryWrapper = new QueryWrapper<>();
-//            roleQueryWrapper.lambda().eq(SysRole::getType, roleType);
-//            SysRole sysRole = sysRoleService.getOne(roleQueryWrapper);
-//            if (sysRole == null) {
-//                throw new Exception("角色不存在");
-//            }
-//            QueryWrapper<SysRolePrivilege> rolePrivilegeQueryWrapper = new QueryWrapper<>();
-//            rolePrivilegeQueryWrapper.lambda().eq(SysRolePrivilege::getRoleId, sysRole.getId()).eq(SysRolePrivilege::getEnable, true);
-//            List<SysRolePrivilege> rolePrivileges = sysRolePrivilegeService.list(rolePrivilegeQueryWrapper);
-//            List<SysUserRole> userRoles = new ArrayList<>();
-//            for (SysRolePrivilege rolePrivilege : rolePrivileges) {
-//                SysUserRole sysUserRole = new SysUserRole();
-//                sysUserRole.setId(SystemConstant.getDbUuid());
-//                sysUserRole.setUserId(sysUser.getId());
-//                sysUserRole.setRoleId(rolePrivilege.getRoleId());
-//                sysUserRole.setPrivilegeId(rolePrivilege.getPrivilegeId());
-//                sysUserRole.setEnable(true);
-//                userRoles.add(sysUserRole);
-//            }
-//            sysUserRoleService.saveBatch(userRoles);
-//
-//            // sys_user_course
-//            String courseCodeses = userMap.get("courseCode");
-//            if (roleType.equals(RoleTypeEnum.QUESTION_TEACHER.name())) {
-//                if (StringUtils.isBlank(courseCodeses)) {
-//                    throw new Exception("命题老师课程不能为空");
-//                }
-//
-//                List<BasicUserCourse> userCourses = new ArrayList<>();
-//                String[] courseCodes = courseCodeses.split(",");
-//                for (String courseCode : courseCodes) {
-//                    String[] coursees = courseCode.split(SystemConstant.ORG_SPLIT);
-//                    QueryWrapper<BasicCourse> basicCourseQueryWrapper = new QueryWrapper<>();
-//                    basicCourseQueryWrapper.lambda().eq(BasicCourse::getSchoolId, schoolId).eq(BasicCourse::getCode, coursees[0]);
-//                    BasicCourse basicCourse = basicCourseService.getOne(basicCourseQueryWrapper);
-//                    if (basicCourse == null) {
-//                        throw new Exception("命题老师对应课程不存在");
-//                    }
-//                    BasicUserCourse basicUserCourse = new BasicUserCourse();
-//                    basicUserCourse.setId(SystemConstant.getDbUuid());
-//                    basicUserCourse.setUserId(sysUser.getId());
-//                    basicUserCourse.setCourseId(basicCourse.getId());
-//                    userCourses.add(basicUserCourse);
-//                }
-//                basicUserCourseService.saveBatch(userCourses);
-//            }
-//        }
-//    }
-
-    /**
-     * 读取课程数据文件
-     *
-     * @return
-     * @throws Exception
-     */
-    private List<BasicCourse> readCourseFile() throws Exception {
-        File file = new File(courseFile);
-        if (!file.exists()) {
-            throw new Exception("课程数据文件不存在");
-        }
-        FileInputStream fileInputStream = new FileInputStream(file);
-        XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream);
-        XSSFSheet sheet = workbook.getSheetAt(0);
-
-        List<BasicCourse> courseList = new ArrayList<>();
-        for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
-            BasicCourse basicCourse = new BasicCourse();
-            Row row = sheet.getRow(i);
-            // 用户名
-            Cell cell0 = row.getCell(0);
-            basicCourse.setCode(cell0 == null ? null : cell0.getStringCellValue());
-            // 姓名
-            Cell cell1 = row.getCell(1);
-            basicCourse.setName(cell1 == null ? null : cell1.getStringCellValue());
-            courseList.add(basicCourse);
-        }
-        return courseList;
-    }
-
-    /**
-     * 读取用户数据文件
-     *
-     * @return
-     * @throws Exception
-     */
-    private List<Map<String, String>> readUserFile() throws Exception {
-        File file = new File(userFile);
-        if (!file.exists()) {
-            throw new Exception("用户数据文件不存在");
-        }
-        FileInputStream fileInputStream = new FileInputStream(file);
-        XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream);
-        XSSFSheet sheet = workbook.getSheetAt(0);
-
-        List<Map<String, String>> userList = new ArrayList<>();
-        for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
-            Map<String, String> map = new HashMap<>();
-            Row row = sheet.getRow(i);
-            // 用户名
-            Cell cell0 = row.getCell(0);
-            map.put("loginName", cell0 == null ? null : cell0.getStringCellValue());
-            // 姓名
-            Cell cell1 = row.getCell(1);
-            map.put("realName", cell1 == null ? null : cell1.getStringCellValue());
-            // 手机号
-            Cell cell2 = row.getCell(2);
-            map.put("mobileNumber", cell2 == null ? null : cell2.getStringCellValue());
-            // 密码
-            Cell cell4 = row.getCell(4);
-            map.put("password", cell4 == null ? null : cell4.getStringCellValue());
-            // 角色Code
-            Cell cell5 = row.getCell(5);
-            map.put("roleType", cell5 == null ? null : cell5.getStringCellValue());
-            // 机构code
-            Cell cell8 = row.getCell(8);
-            map.put("orgCode", cell8 == null ? null : cell8.getStringCellValue());
-            // 机构名称
-            Cell cell9 = row.getCell(9);
-            map.put("orgName", cell9 == null ? null : cell9.getStringCellValue());
-            // 命题老师可操作课程代码
-            Cell cell10 = row.getCell(10);
-            map.put("courseCode", cell10 == null ? null : cell10.getStringCellValue());
-            userList.add(map);
-        }
-
-        return userList;
-    }
-
-    @Test
-    public void createCourse() {
-        List<BasicCourse> courses = basicCourseService.list();
-        for (BasicCourse cours : courses) {
-            String a = "INSERT INTO `basic_course` VALUES (%s,1,'%s','%s',124882698949885952,1620464769921,NULL,1620464769921);";
-            System.out.println(String.format(a, SystemConstant.getDbUuid(), cours.getCode(), cours.getName()));
-        }
-    }
-
-    @Test
-    public void file(){
-        File file1 = new File("E:\\file\\基础和声1.pdf");
-        try {
-            PdfUtil.getPdfFormat(file1);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-        File file2 = new File("E:\\file\\1.pdf");
-        try {
-            PdfUtil.getPdfFormat(file2);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-}

+ 0 - 277
distributed-print/src/test/java/com/qmth/distributed/print/BasicUserImportTest.java

@@ -1,277 +0,0 @@
-package com.qmth.distributed.print;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.*;
-import com.qmth.teachcloud.common.enums.RoleTypeEnum;
-import com.qmth.teachcloud.common.service.*;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.junit.Test;
-import org.junit.platform.commons.util.StringUtils;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @Description: 用户数据导入、课程导入、组织机构导入
- */
-@SpringBootTest
-@RunWith(SpringRunner.class)
-public class BasicUserImportTest {
-    @Autowired
-    private BasicCourseService basicCourseService;
-    @Autowired
-    private SysUserService sysUserService;
-    @Autowired
-    private SysOrgService sysOrgService;
-    @Autowired
-    private BasicUserCourseService basicUserCourseService;
-    @Autowired
-    private SysRoleService sysRoleService;
-    @Autowired
-    private SysUserRoleService sysUserRoleService;
-    @Autowired
-    private SysRolePrivilegeService sysRolePrivilegeService;
-
-    // 学校Id
-    private Long schoolId = 5l;
-
-    // 用户数据文件
-    String userFile = "D:\\20210514_追加命题及课程数据-2.xlsx";
-    // 课程数据文件
-    String courseFile = "D:\\20210514_追加命题及课程数据-1.xlsx";
-
-
-    @Test
-    public void importBasicCourse() throws Exception {
-        List<BasicCourse> courses = readCourseFile();
-        for (BasicCourse cours : courses) {
-            QueryWrapper<BasicCourse> queryWrapper = new QueryWrapper<>();
-            queryWrapper.lambda().eq(BasicCourse::getCode, cours.getCode());
-            BasicCourse basicCourse = basicCourseService.getOne(queryWrapper);
-            if (basicCourse != null) {
-                if (basicCourse.getName().equals(cours.getName())) {
-                    continue;
-                } else {
-                    throw new Exception(String.format("s%代码已存在,名称不一致,数据库:s%,文件中:s%", cours.getCode(), basicCourse.getName(), cours.getName()));
-                }
-            }
-
-            cours.setId(SystemConstant.getDbUuid());
-            cours.setCreateId(124882698949885952l);
-            cours.setSchoolId(schoolId);
-            basicCourseService.save(cours);
-        }
-    }
-
-//    @Test
-////    @Transactional
-//    public void importBasicUser() throws Exception {
-//        List<Map<String, String>> users = readUserFile();
-//        for (Map<String, String> userMap : users) {
-//            // sys_org
-//            String orgCode = userMap.get("orgCode");
-//            String orgName = userMap.get("orgName");
-//            QueryWrapper<SysOrg> orgQueryWrapper = new QueryWrapper<>();
-//            orgQueryWrapper.lambda().eq(SysOrg::getSchoolId, schoolId).eq(SysOrg::getCode, orgCode);
-//            SysOrg sysOrg = sysOrgService.getOne(orgQueryWrapper);
-//            if (sysOrg != null) {
-//                if (!sysOrg.getName().equals(orgName)) {
-//                    throw new Exception(String.format("s%代码已存在,名称不一致,数据库:s%,文件中:s%", orgCode, sysOrg.getName(), orgName));
-//                }
-//            } else {
-//                sysOrg = new SysOrg();
-//                sysOrg.setId(SystemConstant.getDbUuid());
-//                sysOrg.setSchoolId(schoolId);
-//                sysOrg.setCode(orgCode);
-//                sysOrg.setName(orgName);
-//                sysOrg.setParentId(100l);
-//                sysOrgService.save(sysOrg);
-//            }
-//
-//            // sys_user
-//            String loginName = userMap.get("loginName");
-//            String realName = userMap.get("realName");
-//            String mobileNumber = userMap.get("mobileNumber");
-//            String password = userMap.get("password");
-//            QueryWrapper<SysUser> userQueryWrapper = new QueryWrapper<>();
-//            userQueryWrapper.lambda().eq(SysUser::getSchoolId, schoolId).eq(SysUser::getLoginName, loginName);
-//            SysUser sysUser = sysUserService.getOne(userQueryWrapper);
-//            if (sysUser == null) {
-//                sysUser = new SysUser();
-//                sysUser.setId(SystemConstant.getDbUuid());
-//                sysUser.setSchoolId(schoolId);
-//                sysUser.setLoginName(loginName);
-//                sysUser.setRealName(realName);
-//                sysUser.setPassword(password);
-//                sysUser.setMobileNumber(mobileNumber);
-//                sysUser.setOrgId(sysOrg.getId());
-//                sysUserService.save(sysUser);
-//            } else {
-//                sysUser.setEnable(true);
-//                sysUser.setMobileNumber(mobileNumber);
-//                sysUserService.updateById(sysUser);
-//
-//                String a = "update `sys_user` set mobile_number = %s, enable = true where id = %s;";
-//                System.out.println(String.format(a, mobileNumber, sysUser.getId()));
-//            }
-//
-//            // sys_user_role
-//            String roleType = userMap.get("roleType");
-//            QueryWrapper<SysRole> roleQueryWrapper = new QueryWrapper<>();
-//            roleQueryWrapper.lambda().eq(SysRole::getType, roleType);
-//            SysRole sysRole = sysRoleService.getOne(roleQueryWrapper);
-//            if (sysRole == null) {
-//                throw new Exception("角色不存在");
-//            }
-//
-//            UpdateWrapper<SysUserRole> sysUserRoleUpdateWrapper = new UpdateWrapper<>();
-//            sysUserRoleUpdateWrapper.lambda().eq(SysUserRole::getUserId, sysUser.getId());
-//            sysUserRoleService.remove(sysUserRoleUpdateWrapper);
-//
-//            QueryWrapper<SysRolePrivilege> rolePrivilegeQueryWrapper = new QueryWrapper<>();
-//            rolePrivilegeQueryWrapper.lambda().eq(SysRolePrivilege::getRoleId, sysRole.getId()).eq(SysRolePrivilege::getEnable, true);
-//            List<SysRolePrivilege> rolePrivileges = sysRolePrivilegeService.list(rolePrivilegeQueryWrapper);
-//            List<SysUserRole> userRoles = new ArrayList<>();
-//            for (SysRolePrivilege rolePrivilege : rolePrivileges) {
-//                SysUserRole sysUserRole = new SysUserRole();
-//                sysUserRole.setId(SystemConstant.getDbUuid());
-//                sysUserRole.setUserId(sysUser.getId());
-//                sysUserRole.setRoleId(rolePrivilege.getRoleId());
-//                sysUserRole.setPrivilegeId(rolePrivilege.getPrivilegeId());
-//                sysUserRole.setEnable(true);
-//                userRoles.add(sysUserRole);
-//            }
-//            sysUserRoleService.saveBatch(userRoles);
-//
-//            // sys_user_course
-//            String courseCodeses = userMap.get("courseCode");
-//            if (roleType.equals(RoleTypeEnum.QUESTION_TEACHER.name())) {
-//                if (StringUtils.isBlank(courseCodeses)) {
-//                    throw new Exception("命题老师课程不能为空");
-//                }
-//
-//                List<BasicUserCourse> userCourses = new ArrayList<>();
-//                String[] courseCodes = courseCodeses.split(",");
-//                for (String courseCode : courseCodes) {
-//                    String[] coursees = courseCode.split(SystemConstant.ORG_SPLIT);
-//                    QueryWrapper<BasicCourse> basicCourseQueryWrapper = new QueryWrapper<>();
-//                    basicCourseQueryWrapper.lambda().eq(BasicCourse::getSchoolId, schoolId).eq(BasicCourse::getCode, coursees[0]);
-//                    BasicCourse basicCourse = basicCourseService.getOne(basicCourseQueryWrapper);
-//                    if (basicCourse == null) {
-//                        throw new Exception("命题老师对应课程不存在," + coursees[0]);
-//                    }
-//                    BasicUserCourse basicUserCourse = new BasicUserCourse();
-//                    basicUserCourse.setId(SystemConstant.getDbUuid());
-//                    basicUserCourse.setUserId(sysUser.getId());
-//                    basicUserCourse.setCourseId(basicCourse.getId());
-//                    userCourses.add(basicUserCourse);
-//                }
-//                basicUserCourseService.saveBatch(userCourses);
-//            }
-//        }
-//    }
-
-    /**
-     * 读取课程数据文件
-     *
-     * @return
-     * @throws Exception
-     */
-    private List<BasicCourse> readCourseFile() throws Exception {
-        File file = new File(courseFile);
-        if (!file.exists()) {
-            throw new Exception("课程数据文件不存在");
-        }
-        FileInputStream fileInputStream = new FileInputStream(file);
-        XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream);
-        XSSFSheet sheet = workbook.getSheetAt(0);
-
-        List<BasicCourse> courseList = new ArrayList<>();
-        for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
-            BasicCourse basicCourse = new BasicCourse();
-            Row row = sheet.getRow(i);
-            // 用户名
-            Cell cell0 = row.getCell(0);
-            basicCourse.setCode(cell0 == null ? null : cell0.getStringCellValue());
-            // 姓名
-            Cell cell1 = row.getCell(1);
-            basicCourse.setName(cell1 == null ? null : cell1.getStringCellValue());
-            courseList.add(basicCourse);
-        }
-        return courseList;
-    }
-
-    /**
-     * 读取用户数据文件
-     *
-     * @return
-     * @throws Exception
-     */
-    private List<Map<String, String>> readUserFile() throws Exception {
-        File file = new File(userFile);
-        if (!file.exists()) {
-            throw new Exception("用户数据文件不存在");
-        }
-        FileInputStream fileInputStream = new FileInputStream(file);
-        XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream);
-        XSSFSheet sheet = workbook.getSheetAt(0);
-
-        List<Map<String, String>> userList = new ArrayList<>();
-        for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
-            Map<String, String> map = new HashMap<>();
-            Row row = sheet.getRow(i);
-            // 用户名
-            Cell cell0 = row.getCell(0);
-            map.put("loginName", cell0 == null ? null : cell0.getStringCellValue());
-            // 姓名
-            Cell cell1 = row.getCell(1);
-            map.put("realName", cell1 == null ? null : cell1.getStringCellValue());
-            // 手机号
-            Cell cell2 = row.getCell(2);
-            map.put("mobileNumber", cell2 == null ? null : cell2.getStringCellValue());
-            // 密码
-            Cell cell4 = row.getCell(4);
-            map.put("password", cell4 == null ? null : cell4.getStringCellValue());
-            // 角色Code
-            Cell cell5 = row.getCell(5);
-            map.put("roleType", cell5 == null ? null : cell5.getStringCellValue());
-            // 机构code
-            Cell cell8 = row.getCell(8);
-            map.put("orgCode", cell8 == null ? null : cell8.getStringCellValue());
-            // 机构名称
-            Cell cell9 = row.getCell(9);
-            map.put("orgName", cell9 == null ? null : cell9.getStringCellValue());
-            // 命题老师可操作课程代码
-            Cell cell10 = row.getCell(10);
-            map.put("courseCode", cell10 == null ? null : cell10.getStringCellValue());
-            userList.add(map);
-        }
-
-        return userList;
-    }
-
-    @Test
-    public void createCourse() {
-        QueryWrapper<BasicCourse> courseQueryWrapper = new QueryWrapper<>();
-        courseQueryWrapper.lambda().eq(BasicCourse::getSchoolId, schoolId);
-        List<BasicCourse> courses = basicCourseService.list(courseQueryWrapper);
-        for (BasicCourse cours : courses) {
-            String a = "INSERT INTO `basic_course` VALUES (%s,1,'%s','%s',124882698949885952,1620464769921,NULL,1620464769921);";
-            System.out.println(String.format(a, SystemConstant.getDbUuid(), cours.getCode(), cours.getName()));
-        }
-    }
-
-}

+ 26 - 0
distributed-print/src/test/java/com/qmth/distributed/print/ExcelReaderTest.java

@@ -0,0 +1,26 @@
+package com.qmth.distributed.print;
+
+import com.qmth.boot.tools.excel.ExcelReader;
+import com.qmth.boot.tools.excel.enums.ExcelType;
+import com.qmth.boot.tools.excel.model.DataMap;
+
+import java.io.FileInputStream;
+import java.util.List;
+
+public class ExcelReaderTest {
+
+    private final static String EXCEL_NAME = "/Users/xiaofei/Downloads/考生字典导入模板.xlsx";
+
+    public static void main(String[] args) {
+        try {
+            ExcelReader excelReader = ExcelReader.create(ExcelType.XLSX, new FileInputStream(EXCEL_NAME), 1);
+
+            List<String[]> dataArrayList = excelReader.getDataArrayList();
+//            List<DataMap> dataMapList = excelReader.getDataMapList();
+            String[] columnNames = excelReader.getColumnNames();
+            System.out.println(1);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

+ 10 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -1,5 +1,6 @@
 package com.qmth.teachcloud.common.contant;
 
+import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.aventrix.jnanoid.jnanoid.NanoIdUtils;
 import com.qmth.boot.core.uid.service.UidService;
@@ -29,6 +30,7 @@ import java.net.URLEncoder;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.text.DecimalFormat;
+import java.text.MessageFormat;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -319,6 +321,8 @@ public class SystemConstant {
     public static final String DATA_COUNT = "dataCount";
     public static final String SUCCESS_DATA_COUNT = "successDataCount";
     public static final String ERROR_DATA_COUNT = "errorDataCount";
+    public static final String HAS_ERROR_DATA = "hasErrorData";
+    public static final String COLUMN_NAMES = "columnNames";
     public static final List<Long> MENU_MANAGE = Arrays.asList(507L, 508L, 530L, 531L, 675L, 676L, 795L, 796L, 797L, 798L, 799L, 800L, 801L, 802L);
     public static final float PAPER_DEVIATION = 2;
     public static final String COMMA_OF_ENGLISH = ",";
@@ -1278,4 +1282,10 @@ public class SystemConstant {
         }
         return score;
     }
+
+
+    public static void addSummary(StringJoiner stringJoinerSummary, String message) {
+        // 时间:事件
+        stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), "->", message));
+    }
 }

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

@@ -1,106 +0,0 @@
-package com.qmth.teachcloud.common.entity;
-
-import com.baomidou.mybatisplus.annotation.FieldStrategy;
-import com.baomidou.mybatisplus.annotation.TableField;
-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: 2021-08-28
- */
-@ApiModel(value = "BasicClazz对象", description = "班级字典表")
-public class BasicClazz extends BaseEntity implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    @ApiModelProperty(value = "学校id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long schoolId;
-
-    @ApiModelProperty(value = "专业id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long majorId;
-
-    @ApiModelProperty(value = "简码")
-    private String shortCode;
-
-    @ApiModelProperty(value = "班级编号")
-    private String clazzCode;
-
-    @ApiModelProperty(value = "班级名称")
-    private String clazzName;
-
-    @ApiModelProperty(value = "是否可用")
-    private Boolean enable;
-
-    @ApiModelProperty(value = "权限机构id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField(value = "org_id", updateStrategy = FieldStrategy.IGNORED)
-    private Long orgId;
-
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public Long getSchoolId() {
-        return schoolId;
-    }
-
-    public void setSchoolId(Long schoolId) {
-        this.schoolId = schoolId;
-    }
-
-    public String getClazzCode() {
-        return clazzCode;
-    }
-
-    public void setClazzCode(String clazzCode) {
-        this.clazzCode = clazzCode;
-    }
-
-    public String getShortCode() {
-        return shortCode;
-    }
-
-    public void setShortCode(String shortCode) {
-        this.shortCode = shortCode;
-    }
-
-    public String getClazzName() {
-        return clazzName;
-    }
-
-    public void setClazzName(String clazzName) {
-        this.clazzName = clazzName;
-    }
-
-    public Boolean getEnable() {
-        return enable;
-    }
-
-    public void setEnable(Boolean enable) {
-        this.enable = enable;
-    }
-
-    public Long getOrgId() {
-        return orgId;
-    }
-
-    public void setOrgId(Long orgId) {
-        this.orgId = orgId;
-    }
-
-    public Long getMajorId() {
-        return majorId;
-    }
-
-    public void setMajorId(Long majorId) {
-        this.majorId = majorId;
-    }
-}

+ 32 - 10
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicExamStudent.java

@@ -57,11 +57,14 @@ public class BasicExamStudent extends BaseEntity {
     @ApiModelProperty(value = "学号")
     private String studentCode;
 
+    @ApiModelProperty(value = "座位号")
+    private String siteNumber;
+
     @ApiModelProperty(value = "学院")
-    private String college;
+    private String collegeName;
 
     @ApiModelProperty(value = "专业")
-    private String major;
+    private String majorName;
 
     @ApiModelProperty(value = "任课教师id")
     private Long teacherId;
@@ -78,6 +81,9 @@ public class BasicExamStudent extends BaseEntity {
     @ApiModelProperty("考场(考试教室)")
     private String examRoom;
 
+    @ApiModelProperty("扩展字段")
+    private String extendFields;
+
     public Long getSchoolId() {
         return schoolId;
     }
@@ -166,20 +172,28 @@ public class BasicExamStudent extends BaseEntity {
         this.studentCode = studentCode;
     }
 
-    public String getCollege() {
-        return college;
+    public String getSiteNumber() {
+        return siteNumber;
+    }
+
+    public void setSiteNumber(String siteNumber) {
+        this.siteNumber = siteNumber;
+    }
+
+    public String getCollegeName() {
+        return collegeName;
     }
 
-    public void setCollege(String college) {
-        this.college = college;
+    public void setCollegeName(String collegeName) {
+        this.collegeName = collegeName;
     }
 
-    public String getMajor() {
-        return major;
+    public String getMajorName() {
+        return majorName;
     }
 
-    public void setMajor(String major) {
-        this.major = major;
+    public void setMajorName(String majorName) {
+        this.majorName = majorName;
     }
 
     public Long getTeacherId() {
@@ -221,4 +235,12 @@ public class BasicExamStudent extends BaseEntity {
     public void setExamRoom(String examRoom) {
         this.examRoom = examRoom;
     }
+
+    public String getExtendFields() {
+        return extendFields;
+    }
+
+    public void setExtendFields(String extendFields) {
+        this.extendFields = extendFields;
+    }
 }

+ 0 - 96
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicMajor.java

@@ -1,96 +0,0 @@
-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;
-
-/**
- * <p>
- * 专业字典表
- * </p>
- *
- * @author wangliang
- * @since 2021-10-28
- */
-@ApiModel(value = "BasicMajor对象", description = "专业字典表")
-public class BasicMajor extends BaseEntity implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @ApiModelProperty(value = "学校id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long schoolId;
-
-    @ApiModelProperty(value = "机构id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long orgId;
-
-    @ApiModelProperty(value = "专业名称")
-    private String name;
-
-    @ApiModelProperty(value = "专业编码")
-    private String code;
-
-    @ApiModelProperty(value = "是否启用,0:停用,1:启用")
-    private Boolean enable;
-
-    @ApiModelProperty(value = "所属机构id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long belongOrgId;
-
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public Long getSchoolId() {
-        return schoolId;
-    }
-
-    public void setSchoolId(Long schoolId) {
-        this.schoolId = schoolId;
-    }
-
-    public Long getOrgId() {
-        return orgId;
-    }
-
-    public void setOrgId(Long orgId) {
-        this.orgId = orgId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getCode() {
-        return code;
-    }
-
-    public void setCode(String code) {
-        this.code = code;
-    }
-
-    public Boolean getEnable() {
-        return enable;
-    }
-
-    public void setEnable(Boolean enable) {
-        this.enable = enable;
-    }
-
-    public Long getBelongOrgId() {
-        return belongOrgId;
-    }
-
-    public void setBelongOrgId(Long belongOrgId) {
-        this.belongOrgId = belongOrgId;
-    }
-}

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

@@ -1,137 +0,0 @@
-package com.qmth.teachcloud.common.entity;
-
-import com.baomidou.mybatisplus.annotation.FieldStrategy;
-import com.baomidou.mybatisplus.annotation.TableField;
-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;
-
-/**
- * <p>
- * 学校id
- * </p>
- *
- * @author wangliang
- * @since 2021-08-02
- */
-@ApiModel(value = "BasicStudent对象", description = "学校id")
-public class BasicStudent extends BaseEntity implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @ApiModelProperty(value = "学校id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long schoolId;
-
-    @ApiModelProperty(value = "学生姓名")
-    private String studentName;
-
-    @ApiModelProperty(value = "学生编号")
-    private String studentCode;
-
-    @ApiModelProperty(value = "电话号码")
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
-    private String phoneNumber;
-
-    @ApiModelProperty(value = "班级id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
-    private Long clazzId;
-
-    @ApiModelProperty(value = "可用状态(1:可用,0:不可用)")
-    private Boolean enable;
-
-    @ApiModelProperty(value = "可操作人机构id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long orgId;
-
-    @ApiModelProperty(value = "所属机构id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
-    private Long belongOrgId;
-
-    @ApiModelProperty(value = "专业id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
-    private Long majorId;
-
-    public Long getBelongOrgId() {
-        return belongOrgId;
-    }
-
-    public void setBelongOrgId(Long belongOrgId) {
-        this.belongOrgId = belongOrgId;
-    }
-
-    public Long getMajorId() {
-        return majorId;
-    }
-
-    public void setMajorId(Long majorId) {
-        this.majorId = majorId;
-    }
-
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public Long getSchoolId() {
-        return schoolId;
-    }
-
-    public void setSchoolId(Long schoolId) {
-        this.schoolId = schoolId;
-    }
-
-    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 getPhoneNumber() {
-        return phoneNumber;
-    }
-
-    public void setPhoneNumber(String phoneNumber) {
-        this.phoneNumber = phoneNumber;
-    }
-
-    public Long getClazzId() {
-        return clazzId;
-    }
-
-    public void setClazzId(Long clazzId) {
-        this.clazzId = clazzId;
-    }
-
-    public Boolean getEnable() {
-        return enable;
-    }
-
-    public void setEnable(Boolean enable) {
-        this.enable = enable;
-    }
-
-    public Long getOrgId() {
-        return orgId;
-    }
-
-    public void setOrgId(Long orgId) {
-        this.orgId = orgId;
-    }
-}

+ 0 - 107
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicUserCourse.java

@@ -1,107 +0,0 @@
-package com.qmth.teachcloud.common.entity;
-
-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.teachcloud.common.base.BaseEntity;
-import io.swagger.annotations.ApiModelProperty;
-
-import java.io.Serializable;
-
-/**
- * <p>
- * 用户和课程关联表
- * </p>
- *
- * @author xf
- * @since 2021-03-23
- */
-@TableName("basic_user_course")
-public class BasicUserCourse extends BaseEntity implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @ApiModelProperty(value = "学校id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField("school_id")
-    private Long schoolId;
-
-    @ApiModelProperty(value = "机构id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField("org_id")
-    private Long orgId;
-
-    /**
-     * 用户ID
-     */
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField("user_id")
-    private Long userId;
-    /**
-     * 课程ID
-     */
-    @JsonSerialize(using = ToStringSerializer.class)
-    @TableField("course_id")
-    private Long courseId;
-
-    @ApiModelProperty(value = "授课班级")
-    @TableField("clazz_id")
-    private Long clazzId;
-
-    @ApiModelProperty(value = "是否启用?1-是 ;0-否")
-    @TableField("enable")
-    private Boolean enable;
-
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public Long getSchoolId() {
-        return schoolId;
-    }
-
-    public void setSchoolId(Long schoolId) {
-        this.schoolId = schoolId;
-    }
-
-    public Long getOrgId() {
-        return orgId;
-    }
-
-    public void setOrgId(Long orgId) {
-        this.orgId = orgId;
-    }
-
-    public Long getUserId() {
-        return userId;
-    }
-
-    public void setUserId(Long userId) {
-        this.userId = userId;
-    }
-
-    public Long getCourseId() {
-        return courseId;
-    }
-
-    public void setCourseId(Long courseId) {
-        this.courseId = courseId;
-    }
-
-    public Long getClazzId() {
-        return clazzId;
-    }
-
-    public void setClazzId(Long clazzId) {
-        this.clazzId = clazzId;
-    }
-
-    public Boolean getEnable() {
-        return enable;
-    }
-
-    public void setEnable(Boolean enable) {
-        this.enable = enable;
-    }
-}

+ 0 - 36
teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicClazzMapper.java

@@ -1,36 +0,0 @@
-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.dto.DataPermissionRule;
-import com.qmth.teachcloud.common.bean.result.BasicClazzResult;
-import com.qmth.teachcloud.common.entity.BasicClazz;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @Description: 基础课程管理mapper 接口
- * @Author: CaoZixuan
- * @Date: 2021-08-28
- */
-public interface BasicClazzMapper extends BaseMapper<BasicClazz> {
-
-    IPage<BasicClazzResult> findBasicClazzPage(@Param("iPage") Page<BasicClazzResult> iPage,
-                                               @Param("queryParams") String queryParams,
-                                               @Param("schoolId") Long schoolId,
-                                               @Param("dpr") DataPermissionRule dpr);
-
-    /**
-     * 根据班级idList和学校id查询新命题任务数据
-     *
-     * @param schoolId 学校id
-     * @param clazzIds 班级idSet
-     * @return 数据
-     */
-    @SuppressWarnings("MybatisXMapperMethodInspection")
-    List<Map<Object, Object>> findExamTaskPrintByClazzIdSet(@Param("schoolId") Long schoolId, @Param("clazzIds") List<Long> clazzIds);
-}

+ 0 - 35
teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicMajorMapper.java

@@ -1,35 +0,0 @@
-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.dto.DataPermissionRule;
-import com.qmth.teachcloud.common.bean.result.BasicMajorResult;
-import com.qmth.teachcloud.common.entity.BasicMajor;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.Set;
-
-/**
- * <p>
- * 专业字典表 Mapper 接口
- * </p>
- *
- * @author wangliang
- * @since 2021-10-28
- */
-public interface BasicMajorMapper extends BaseMapper<BasicMajor> {
-
-    /**
-     * 分页查询基础专业信息
-     * @param iPage 分页参数
-     * @param schoolId 学校id
-     * @param majorName 专业名称
-     * @param dpr 数据权限集合
-     * @return 基础专业分页参数
-     */
-    IPage<BasicMajorResult> findBasicMajorPage(@Param("iPage") Page<BasicMajorResult> iPage,
-                                               @Param("schoolId") Long schoolId,
-                                               @Param("majorName") String majorName,
-                                               @Param("dpr") DataPermissionRule dpr);
-}

+ 0 - 75
teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicStudentMapper.java

@@ -1,75 +0,0 @@
-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.dto.BasicStudentExportDto;
-import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
-import com.qmth.teachcloud.common.bean.dto.TaskPrintClassDto;
-import com.qmth.teachcloud.common.bean.result.BasicExamStudentResult;
-import com.qmth.teachcloud.common.entity.BasicStudent;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-import java.util.Set;
-
-/**
- * <p>
- * 学校id Mapper 接口
- * </p>
- *
- * @author wangliang
- * @since 2021-08-02
- */
-public interface BasicStudentMapper extends BaseMapper<BasicStudent> {
-
-    List<TaskPrintClassDto> listByClass(@Param("schoolId") Long schoolId, @Param("stringList") Set<String> stringList);
-
-    IPage<BasicExamStudentResult> findBasicStudentPage(@Param("iPage") Page<BasicExamStudentResult> iPage,
-                                                       @Param("queryParams") String queryParams,
-                                                       @Param("schoolId") Long schoolId,
-                                                       @Param("collegeId") Long collegeId,
-                                                       @Param("majorId") Long majorId,
-                                                       @Param("clazzId") Long clazzId,
-                                                       @Param("dpr") DataPermissionRule dpr);
-
-    /**
-     * 根据基础学生主键同步删除教学学生信息
-     *
-     * @param idSet 基础学生id集合
-     * @return 删除的行数
-     */
-    int deleteTeachStudentByBasicStudentIdSet(@Param("idSet") Set<Long> idSet);
-
-    /**
-     * 根据id查找学生信息
-     *
-     * @param id id
-     * @return 结果
-     */
-    BasicExamStudentResult findById(@Param("id") Long id);
-
-    /**
-     * 根据第三方字典id查找学生集合
-     *
-     * @param schoolId        学校id
-     * @param teacher
-     * @param className
-     * @param studentCodeList 学号集合
-     * @return 学生查询结果
-     */
-    List<BasicExamStudentResult> findBasicStudentList(@Param("schoolId") Long schoolId,
-                                                      @Param("examId") Long examId,
-                                                      @Param("courseId") Long courseId,
-                                                      @Param("teacher") String teacher,
-                                                      @Param("className") String className,
-                                                      @Param("studentCodeList") List<String> studentCodeList);
-
-    List<BasicStudentExportDto> listExportData(@Param("queryParams") String queryParams,
-                                               @Param("schoolId") Long schoolId,
-                                               @Param("collegeId") Long collegeId,
-                                               @Param("majorId") Long majorId,
-                                               @Param("clazzIdList") Set<Long> clazzIdList,
-                                               @Param("dpr") DataPermissionRule dpr);
-}

+ 0 - 20
teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicUserCourseMapper.java

@@ -1,20 +0,0 @@
-package com.qmth.teachcloud.common.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.qmth.teachcloud.common.entity.BasicUserCourse;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * <p>
- * 用户和课程关联表 Mapper 接口
- * </p>
- *
- * @author xf
- * @since 2021-03-23
- */
-public interface BasicUserCourseMapper extends BaseMapper<BasicUserCourse> {
-
-    List<BasicUserCourse> listBySchoolIdAndCourseCode(@Param("schoolId") Long schoolId, @Param("courseCode") String courseCode);
-}

+ 0 - 63
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicClazzService.java

@@ -1,63 +0,0 @@
-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.BasicClazzParams;
-import com.qmth.teachcloud.common.bean.result.BasicClazzResult;
-import com.qmth.teachcloud.common.bean.result.ClazzDatasourceResult;
-import com.qmth.teachcloud.common.entity.BasicClazz;
-import com.qmth.teachcloud.common.entity.SysUser;
-import org.springframework.util.LinkedMultiValueMap;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @Description: 基础班级service
- * @Author: CaoZixuan
- * @Date: 2021-08-28
- */
-public interface BasicClazzService extends IService<BasicClazz> {
-    /**
-     * 班级基础信息分页查询
-     *
-     * @param queryParams 查询参数(班级号或名称)
-     * @param pageNumber  分页页码
-     * @param pageSize    分页容量
-     * @return 分页结果
-     */
-    IPage<BasicClazzResult> basicClazzPage(String queryParams, int pageNumber, int pageSize);
-
-    /**
-     * 新增/编辑 学生基础信息
-     *
-     * @param basicClazzParams 基础学生信息参数
-     * @param sysUser          创建人信息
-     * @return 新增或编辑的班级id
-     */
-    Long saveBasicClazz(BasicClazzParams basicClazzParams, SysUser sysUser) throws IllegalAccessException;
-
-    /**
-     * 批量删除班级基本信息(逻辑)
-     *
-     * @param idList 要删除的班级主键集合
-     * @return 是否删除成功
-     */
-    Boolean removeBasicClazzBatch(List<Long> idList);
-
-    /**
-     * 执行批量导入班级逻辑
-     *
-     * @param finalList 基础班级数据集合
-     * @param map       参数
-     * @return 结果
-     */
-    Map<String, Object> executeBasicClazzImportLogic(List<LinkedMultiValueMap<Integer, Object>> finalList, Map<String, Object> map) throws IllegalAccessException;
-
-    /**
-     * 查询班级下拉数据源
-     *
-     * @return 班级数据源
-     */
-    List<ClazzDatasourceResult> findClazzDatasource(Long campusId);
-}

+ 0 - 46
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicMajorService.java

@@ -1,46 +0,0 @@
-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.BasicMajorParams;
-import com.qmth.teachcloud.common.bean.result.BasicMajorResult;
-import com.qmth.teachcloud.common.entity.BasicMajor;
-import com.qmth.teachcloud.common.entity.SysUser;
-
-import java.util.List;
-
-/**
- * <p>
- * 专业字典表 服务类
- * </p>
- *
- * @author wangliang
- * @since 2021-10-28
- */
-public interface BasicMajorService extends IService<BasicMajor> {
-
-    /**
-     * 基础专业分页查询
-     * @param schoolId 学校id
-     * @param majorName 专业名称模糊查询
-     * @param pageNumber 分页页数
-     * @param pageSize 分页容量
-     * @return 分页结果
-     */
-    IPage<BasicMajorResult> basicMajorPage(Long schoolId,String majorName, int pageNumber, int pageSize);
-
-    /**
-     * 基础专业编辑
-     * @param basicMajorParams 编辑参数
-     * @return 编辑后该专业id
-     */
-    Long saveBasicMajor(BasicMajorParams basicMajorParams, SysUser requestUser) throws IllegalAccessException;
-
-    /**
-     * 专业删除
-     * @param idList 专业主键id集合
-     * @return 是否删除成功
-     */
-    boolean deleteBasicMajorByIdList(List<Long> idList);
-}

+ 0 - 115
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicStudentService.java

@@ -1,115 +0,0 @@
-package com.qmth.teachcloud.common.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.qmth.teachcloud.common.bean.dto.TaskPrintClassDto;
-import com.qmth.teachcloud.common.bean.params.BasicStudentExtrasParam;
-import com.qmth.teachcloud.common.bean.params.BasicStudentParams;
-import com.qmth.teachcloud.common.bean.result.BasicExamStudentResult;
-import com.qmth.teachcloud.common.entity.BasicStudent;
-import com.qmth.teachcloud.common.entity.SysUser;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * <p>
- * 学校id 服务类
- * </p>
- *
- * @author wangliang
- * @since 2021-08-02
- */
-public interface BasicStudentService extends IService<BasicStudent> {
-
-    IPage<BasicStudent> listPage(Page<BasicStudent> page, String classId);
-
-    List<TaskPrintClassDto> listByClass(Long schoolId, Set<String> stringList);
-
-    /**
-     * 学生基础信息分页查询
-     *
-     * @param queryParams 查询参数(学生学号或姓名)
-     * @param collegeId   校区主键
-     * @param majorId     专业主键
-     * @param clazzId     班级ID
-     * @param pageNumber  分页页码
-     * @param pageSize    分页容量
-     * @return 分页结果
-     */
-    IPage<BasicExamStudentResult> basicStudentPage(String queryParams, Long collegeId, Long majorId, Long clazzId, int pageNumber, int pageSize);
-
-    /**
-     * 根据id查询基础学生数据
-     *
-     * @param id 学生id
-     * @return 学生信息
-     */
-    BasicExamStudentResult findById(Long id);
-
-    /**
-     * 学生基础信息查询
-     *
-     * @param schoolId        学校id
-     * @param examId
-     * @param teacher
-     * @param className
-     * @param studentCodeList 学号集合
-     * @return 学生查询结果
-     */
-    List<BasicExamStudentResult> basicStudentList(Long schoolId, Long examId, Long courseId, String teacher, String className, List<String> studentCodeList);
-
-    /**
-     * 新增/编辑 学生基础信息
-     *
-     * @param basicStudentParams 基础学生信息参数
-     * @return id
-     */
-    Long saveBasicStudent(BasicStudentParams basicStudentParams);
-
-    /**
-     * 保存 - 基础学生信息和学生附加信息(院、专、班)
-     *
-     * @param basicStudentExtrasParamList 参数集合
-     * @param requestUser                 请求人
-     * @param saveBasicStudent            是否保存基础学生数据
-     */
-    void saveBasicStudentWithExtrasList(List<BasicStudentExtrasParam> basicStudentExtrasParamList, SysUser requestUser, boolean saveBasicStudent, Map<String, Object> map) throws IllegalAccessException;
-
-    /**
-     * 批量删除学生基本信息(逻辑)
-     *
-     * @param idList 要删除的学生主键集合
-     * @return 是否删除成功
-     */
-    Boolean removeBasicStudentBatch(List<Long> idList);
-
-    /**
-     * 根据条件删除基础学生信息
-     *
-     * @param queryParams 学生参数(学号或姓名)
-     * @param collegeId   学院主键
-     * @param majorId     专业主键
-     * @param clazzIdList 班级主键集合
-     * @return 是否删除成功
-     */
-    Boolean removeBasicStudentByCondition(String queryParams, Long collegeId, Long majorId, Set<Long> clazzIdList);
-
-    /**
-     * 执行批量导入学生逻辑
-     *
-     * @param finalList 基础学生数据集合
-     * @param map       参数
-     * @return 结果
-     */
-    Map<String, Object> executeBasicStudentImportLogic(List<LinkedMultiValueMap<Integer, Object>> finalList, Map<String, Object> map) throws IllegalAccessException;
-
-    void exportData(HttpServletResponse response, String queryParams, Long collegeId, Long majorId, Set<Long> clazzIdList) throws Exception;
-
-    boolean importBasicStudent(Map<String, Object> map, MultipartFile file);
-}

+ 0 - 35
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicUserCourseService.java

@@ -1,35 +0,0 @@
-package com.qmth.teachcloud.common.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.qmth.teachcloud.common.entity.BasicUserCourse;
-import com.qmth.teachcloud.common.entity.SysUser;
-
-import java.util.List;
-import java.util.Set;
-
-/**
- * <p>
- * 用户和课程关联表 服务类
- * </p>
- *
- * @author xf
- * @since 2021-03-23
- */
-public interface BasicUserCourseService extends IService<BasicUserCourse> {
-
-    void removeByUserId(Long userId);
-
-    void saveBatch(SysUser sysUser);
-
-    /**
-     * 根据课程id和班级集合更新'basic_user_course'表
-     * 逻辑:课程id查询出所有该课程相关记录并删除,添加和班级对应关系
-     * @param courseId 课程id
-     * @param clazzIdSet 班级集合
-     * @param sysUser 执行人
-     * @param orgId 机构权限id
-     */
-    void updateByCourseIdAndClazzList(Long courseId, Set<Long> clazzIdSet, SysUser sysUser, Long orgId);
-
-    List<BasicUserCourse> listBySchoolIdAndCourseCode(Long schoolId, String courseCode);
-}

+ 1 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysUserService.java

@@ -245,5 +245,5 @@ public interface SysUserService extends IService<SysUser> {
 
 	void updateUiSetting(Long userId, String unescapeHtml);
 
-    SysUser getByLoginName(Long schoolId, String teacherName);
+    SysUser getByLoginName(Long schoolId, String loginName);
 }

+ 0 - 297
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicClazzServiceImpl.java

@@ -1,297 +0,0 @@
-package com.qmth.teachcloud.common.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-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.dto.DataPermissionRule;
-import com.qmth.teachcloud.common.bean.dto.excel.BasicClazzImportDto;
-import com.qmth.teachcloud.common.bean.dto.excel.DescribeImportDto;
-import com.qmth.teachcloud.common.bean.params.BasicClazzParams;
-import com.qmth.teachcloud.common.bean.result.BasicClazzResult;
-import com.qmth.teachcloud.common.bean.result.ClazzDatasourceResult;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.BasicClazz;
-import com.qmth.teachcloud.common.entity.BasicStudent;
-import com.qmth.teachcloud.common.entity.BasicUserCourse;
-import com.qmth.teachcloud.common.entity.SysUser;
-import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.common.mapper.BasicClazzMapper;
-import com.qmth.teachcloud.common.service.*;
-import com.qmth.teachcloud.common.util.ServletUtil;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.LinkedMultiValueMap;
-
-import javax.annotation.Resource;
-import java.util.*;
-import java.util.stream.Collectors;
-
-
-/**
- * @Description: 基础课程服务实现类
- * @Author: CaoZixuan
- * @Date: 2021-08-28
- */
-@Service
-public class BasicClazzServiceImpl extends ServiceImpl<BasicClazzMapper, BasicClazz> implements BasicClazzService {
-    @Resource
-    private BasicClazzMapper basicClazzMapper;
-    @Resource
-    private BasicStudentService basicStudentService;
-    @Resource
-    private BasicUserCourseService basicUserCourseService;
-    @Resource
-    private BasicMajorService basicMajorService;
-    @Resource
-    private BasicRoleDataPermissionService basicRoleDataPermissionService;
-
-
-    @Override
-    public IPage<BasicClazzResult> basicClazzPage(String queryParams, int pageNumber, int pageSize) {
-
-        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
-        Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
-        queryParams = SystemConstant.translateSpecificSign(queryParams);
-        DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(schoolId, requestUser.getId(), ServletUtil.getRequest().getServletPath());
-        return basicClazzMapper.findBasicClazzPage(new Page<>(pageNumber, pageSize), queryParams, schoolId, dpr);
-    }
-
-    @Transactional(propagation= Propagation.NESTED)
-    @Override
-    public Long saveBasicClazz(BasicClazzParams basicClazzParams, SysUser sysUser) throws IllegalAccessException {
-        List<BasicClazzParams> basicClazzParamsList = new ArrayList<>();
-        basicClazzParamsList.add(basicClazzParams);
-        BasicClazz basicClazz = this.editEntityHelp(basicClazzParamsList, sysUser).get(0);
-        this.saveOrUpdate(basicClazz);
-        return basicClazz.getId();
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    @Override
-    public Boolean removeBasicClazzBatch(List<Long> idList) {
-        Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
-        if (idList.size() == 0) {
-            throw ExceptionResultEnum.ERROR.exception("请选择要删除的班级");
-        }
-        // 业务处理 - 判断'exam_task_print'表中是否已经选中该班级
-        List<Map<Object, Object>> mapList = basicClazzMapper.findExamTaskPrintByClazzIdSet(schoolId, idList);
-        if (mapList.size() > 0) {
-            StringBuilder clazzNames = new StringBuilder();
-            for (Map<Object, Object> map : mapList) {
-                clazzNames.append(map.get("clazzName")).append(",");
-            }
-            throw ExceptionResultEnum.ERROR.exception("班级[" + clazzNames.substring(0, clazzNames.length() - 1) + "]生成了未结束的印刷任务,无法删除");
-        }
-
-        // 异常处理
-        String errorStudent = "";
-        String errorCourse = "";
-        List<BasicStudent> basicStudentCheck = basicStudentService.list(new QueryWrapper<BasicStudent>().lambda().in(BasicStudent::getClazzId, idList));
-        if (!CollectionUtils.isEmpty(basicStudentCheck)) {
-            Set<Long> ids = basicStudentCheck.stream().map(BasicStudent::getClazzId).collect(Collectors.toSet());
-            String studentClazzName = this.list(new QueryWrapper<BasicClazz>().lambda()
-                    .in(BasicClazz::getId, ids)).stream().map(BasicClazz::getClazzName).collect(Collectors.joining(","));
-            if (StringUtils.isNotBlank(studentClazzName)) {
-                throw ExceptionResultEnum.ERROR.exception("班级[" + studentClazzName + "]绑定了学生,无法删除");
-            }
-        }
-
-        List<BasicUserCourse> basicUserCourseCheck = basicUserCourseService.list(new QueryWrapper<BasicUserCourse>().lambda()
-                .in(BasicUserCourse::getClazzId, idList));
-        if (basicUserCourseCheck.size() > 0) {
-            Set<Long> ids = basicUserCourseCheck.stream().map(BasicUserCourse::getClazzId).collect(Collectors.toSet());
-            String exUserCourseClazz = this.list(new QueryWrapper<BasicClazz>().lambda().in(BasicClazz::getId, ids)).stream().map(BasicClazz::getClazzName).collect(Collectors.joining(","));
-            if (StringUtils.isNotBlank(exUserCourseClazz)) {
-                throw ExceptionResultEnum.ERROR.exception("班级[" + errorStudent + "]绑定了课程,无法删除");
-            }
-        }
-
-        // 物理删除
-        // 删除课程班级绑定关系
-        basicUserCourseService.remove(new QueryWrapper<BasicUserCourse>().lambda()
-                .in(BasicUserCourse::getClazzId, idList));
-        return this.removeByIds(idList);
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    @Override
-    @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);
-
-        List<BasicClazzParams> addBasicClazzParamsList = new ArrayList<>();
-        for (int i = 0; i < finalList.size(); i++) {
-            LinkedMultiValueMap<Integer, Object> excelMap = finalList.get(i);
-            List<Object> basicClazzImportDtoList = excelMap.get(i);
-
-            assert basicClazzImportDtoList != null;
-            if (basicClazzImportDtoList.get(0) instanceof DescribeImportDto) {
-                continue;
-            }
-            List<BasicClazzImportDto> datasource = basicClazzImportDtoList.stream().map(e -> {
-                BasicClazzImportDto basicClazzImportDto = new BasicClazzImportDto();
-                BeanUtils.copyProperties(e, basicClazzImportDto);
-                return basicClazzImportDto;
-            }).collect(Collectors.toList());
-            map.put("dataCount", datasource.size());
-
-            for (int y = 0; y < Objects.requireNonNull(basicClazzImportDtoList).size(); y++) {
-                BasicClazzImportDto basicClazzImportDto = (BasicClazzImportDto) basicClazzImportDtoList.get(y);
-
-                // 取值
-                String clazzName = basicClazzImportDto.getClazzName();
-
-                BasicClazzParams basicClazzParams = new BasicClazzParams();
-                basicClazzParams.setClazzName(clazzName);
-
-                BasicClazz tmp = this.getOne(new QueryWrapper<BasicClazz>().lambda()
-                        .eq(BasicClazz::getSchoolId, sysUser.getSchoolId())
-                        .eq(BasicClazz::getEnable, true)
-                        .eq(BasicClazz::getClazzName, clazzName));
-                if (Objects.nonNull(tmp)) {
-                    basicClazzParams.setId(tmp.getId());
-                }
-                addBasicClazzParamsList.add(basicClazzParams);
-            }
-
-            List<BasicClazz> basicClazzList = this.editEntityHelp(addBasicClazzParamsList, sysUser);
-            this.saveOrUpdateBatch(basicClazzList);
-        }
-        return map;
-    }
-
-    @Deprecated
-    @Override
-    public List<ClazzDatasourceResult> findClazzDatasource(Long campusId) {
-        // TODO: 2022/8/17 czx - 废弃方法
-        Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
-        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
-        DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(schoolId, requestUser.getId(), ServletUtil.getRequest().getServletPath());
-        QueryWrapper<BasicClazz> basicClazzQueryWrapper = new QueryWrapper<>();
-
-        basicClazzQueryWrapper.lambda().eq(BasicClazz::getEnable, true)
-                .eq(BasicClazz::getSchoolId, schoolId);
-        if (dpr.getOrgIdSet() != null && dpr.getOrgIdSet().size() > 0) {
-            basicClazzQueryWrapper.lambda().in(BasicClazz::getOrgId, dpr.getOrgIdSet());
-        }
-        if (SystemConstant.longNotNull(dpr.getRequestUserId())) {
-            basicClazzQueryWrapper.lambda().eq(BasicClazz::getCreateId, dpr.getRequestUserId());
-        }
-
-        return this.list(basicClazzQueryWrapper).stream()
-                .map(e -> {
-                    ClazzDatasourceResult clazzDatasourceResult = new ClazzDatasourceResult();
-                    clazzDatasourceResult.setId(e.getId());
-                    clazzDatasourceResult.setName(e.getClazzName());
-                    clazzDatasourceResult.setCode(e.getClazzCode());
-                    return clazzDatasourceResult;
-                }).collect(Collectors.toList());
-    }
-
-    /**
-     * 基础班级保存助手方法
-     *
-     * @param basicClazzParamsList 基础班级参数
-     * @param sysUser              操作人
-     * @return 结果
-     */
-    private List<BasicClazz> editEntityHelp(List<BasicClazzParams> basicClazzParamsList, SysUser sysUser) throws IllegalAccessException {
-        Long schoolId = sysUser.getSchoolId();
-        List<BasicClazz> editEntityList = new ArrayList<>();
-        for (BasicClazzParams basicClazzParams : basicClazzParamsList) {
-            SystemConstant.verifyDBFields(basicClazzParams, basicClazzParams.getClass());
-            // 普通参数
-            Long id = basicClazzParams.getId();
-            String clazzCode = basicClazzParams.getClazzCode();
-            String clazzName = basicClazzParams.getClazzName();
-            Long majorId = basicClazzParams.getMajorId();
-
-            // 校验专业不存在
-            if (Objects.isNull(basicMajorService.getById(majorId))) {
-                throw ExceptionResultEnum.ERROR.exception("专业不存在");
-            }
-
-            // 检验班级名称在学校的唯一性(字典班级在全校唯一)
-            BasicClazz checkName = this.getOne(new QueryWrapper<BasicClazz>().lambda()
-                    .eq(BasicClazz::getSchoolId, schoolId)
-                    .eq(BasicClazz::getMajorId, majorId)
-                    .eq(BasicClazz::getClazzName, clazzName));
-            if (Objects.nonNull(checkName)) {
-                if (!checkName.getId().equals(id)) {
-                    throw ExceptionResultEnum.ERROR.exception("班级名称[" + clazzName + "]重复");
-                }
-            }
-
-            // 组装基础参数
-            Long orgId;
-            BasicClazz basicClazz = new BasicClazz();
-            basicClazz.setSchoolId(schoolId);
-            basicClazz.setMajorId(majorId);
-            if (SystemConstant.strNotNull(clazzCode)) {
-                basicClazz.setClazzCode(clazzCode);
-            }
-            basicClazz.setClazzName(clazzName);
-
-            if (!SystemConstant.longNotNull(id)) {
-                // id为空 -> 新增
-                // 获取分布式id
-                orgId = sysUser.getOrgId();
-                id = SystemConstant.getDbUuid();
-                basicClazz.setId(id);
-                basicClazz.setEnable(true);
-                basicClazz.setCreateId(sysUser.getId());
-                String shortCode = createShortCode(schoolId);
-                basicClazz.setShortCode(shortCode);
-            } else {
-                // id不为空 -> 编辑
-                BasicClazz old = this.getById(id);
-                if (Objects.isNull(old) || old.getEnable().equals(false)) {
-                    throw ExceptionResultEnum.ERROR.exception("基础班级主键不存在或被禁用");
-                }
-                orgId = old.getOrgId();
-                basicClazz.setId(id);
-                basicClazz.setUpdateId(sysUser.getId());
-                // 如果更新了班级所属的专业则更新学生级联关系
-                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);
-                    });
-                    basicStudentService.updateBatchById(basicStudentList);
-                }
-            }
-            basicClazz.setOrgId(orgId);
-            editEntityList.add(basicClazz);
-        }
-        return editEntityList;
-    }
-
-    /**
-     * 生成考试简码
-     *
-     * @param schoolId 学校ID
-     */
-    private String createShortCode(Long schoolId) {
-        QueryWrapper<BasicClazz> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(BasicClazz::getSchoolId, schoolId);
-        List<BasicClazz> basicClazzes = this.baseMapper.selectList(queryWrapper);
-        if (basicClazzes.isEmpty()) {
-            return "001";
-        } else {
-            Optional<BasicClazz> max = basicClazzes.stream().filter(m -> StringUtils.isNotBlank(m.getShortCode())).max(Comparator.comparing(BasicClazz::getShortCode));
-            if (!max.isPresent()) {
-                return "001";
-            }
-            String maxShortCode = max.get().getShortCode();
-            int shortCode = StringUtils.isBlank(maxShortCode) ? 0 : Integer.parseInt(maxShortCode);
-            return String.format("%03d", shortCode + 1);
-        }
-    }
-}

+ 4 - 34
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicCourseServiceImpl.java

@@ -5,42 +5,35 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 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.google.common.collect.Lists;
-import com.qmth.boot.api.exception.ApiException;
 import com.qmth.boot.tools.excel.ExcelReader;
 import com.qmth.boot.tools.excel.enums.ExcelType;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import com.qmth.teachcloud.common.bean.dto.BasicCourseExportDto;
 import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
 import com.qmth.teachcloud.common.bean.dto.excel.BasicCourseImportDto;
-import com.qmth.teachcloud.common.bean.dto.excel.DescribeImportDto;
 import com.qmth.teachcloud.common.bean.params.BasicCourseParams;
 import com.qmth.teachcloud.common.bean.result.BasicCourseResult;
-import com.qmth.teachcloud.common.bean.result.ClazzDatasourceResult;
 import com.qmth.teachcloud.common.bean.result.SysUserResult;
 import com.qmth.teachcloud.common.bean.result.TeachCourseSelectResult;
 import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.*;
+import com.qmth.teachcloud.common.entity.BasicCourse;
+import com.qmth.teachcloud.common.entity.BasicTeachCourse;
+import com.qmth.teachcloud.common.entity.SysOrg;
+import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.mapper.BasicCourseMapper;
 import com.qmth.teachcloud.common.service.*;
 import com.qmth.teachcloud.common.util.ExcelUtil;
-import com.qmth.teachcloud.common.util.JdbcErrorUtil;
-import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.dao.DataIntegrityViolationException;
-import org.springframework.jdbc.BadSqlGrammarException;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 import java.io.InputStream;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -63,12 +56,6 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
     @Resource
     private SysOrgService sysOrgService;
 
-    @Resource
-    private BasicUserCourseService basicUserCourseService;
-
-    @Resource
-    private BasicClazzService basicClazzService;
-
     @Resource
     private BasicRoleDataPermissionService basicRoleDataPermissionService;
 
@@ -123,23 +110,6 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
         List<BasicCourseResult> list = iPage.getRecords();
         for (BasicCourseResult basicCourseResult : list) {
             Long courseId = basicCourseResult.getId();
-            List<BasicUserCourse> basicUserCourseList = basicUserCourseService.list(
-                    new QueryWrapper<BasicUserCourse>().lambda().eq(BasicUserCourse::getCourseId, courseId));
-            Set<Long> clazzIdSet = basicUserCourseList.stream().map(BasicUserCourse::getClazzId).collect(Collectors.toSet());
-            List<ClazzDatasourceResult> clazzDatasourceResultList = new ArrayList<>();
-            if (clazzIdSet.size() > 0) {
-                List<BasicClazz> clazzList = basicClazzService.list(
-                        new QueryWrapper<BasicClazz>().lambda().in(BasicClazz::getId, clazzIdSet).orderByAsc(BasicClazz::getCreateTime));
-                for (BasicClazz clazz : clazzList) {
-                    ClazzDatasourceResult clazzDatasourceResult = new ClazzDatasourceResult();
-                    clazzDatasourceResult.setId(clazz.getId());
-                    clazzDatasourceResult.setCode(clazz.getClazzCode());
-                    clazzDatasourceResult.setName(clazz.getClazzName());
-                    clazzDatasourceResultList.add(clazzDatasourceResult);
-                }
-                basicCourseResult.setClazzList(clazzDatasourceResultList);
-            }
-
             List<BasicTeachCourse> basicTeachCourseList = basicTeachCourseService.list(
                     new QueryWrapper<BasicTeachCourse>().lambda().eq(BasicTeachCourse::getCourseId, courseId));
             if (!CollectionUtils.isEmpty(basicTeachCourseList)) {

+ 0 - 139
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicMajorServiceImpl.java

@@ -1,139 +0,0 @@
-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.dto.DataPermissionRule;
-import com.qmth.teachcloud.common.bean.params.BasicMajorParams;
-import com.qmth.teachcloud.common.bean.result.BasicMajorResult;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.BasicClazz;
-import com.qmth.teachcloud.common.entity.BasicMajor;
-import com.qmth.teachcloud.common.entity.BasicStudent;
-import com.qmth.teachcloud.common.entity.SysUser;
-import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.common.mapper.BasicMajorMapper;
-import com.qmth.teachcloud.common.service.BasicClazzService;
-import com.qmth.teachcloud.common.service.BasicMajorService;
-import com.qmth.teachcloud.common.service.BasicRoleDataPermissionService;
-import com.qmth.teachcloud.common.service.BasicStudentService;
-import com.qmth.teachcloud.common.util.ServletUtil;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 专业字典表 服务实现类
- * </p>
- *
- * @author wangliang
- * @since 2021-10-28
- */
-@Service
-public class BasicMajorServiceImpl extends ServiceImpl<BasicMajorMapper, BasicMajor> implements BasicMajorService {
-    @Resource
-    private BasicClazzService basicClazzService;
-    @Resource
-    private BasicStudentService basicStudentService;
-    @Resource
-    private BasicRoleDataPermissionService basicRoleDataPermissionService;
-
-    @Override
-    public IPage<BasicMajorResult> basicMajorPage(Long schoolId, String majorName, int pageNumber, int pageSize) {
-        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
-        DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(schoolId, requestUser.getId(), ServletUtil.getRequest().getServletPath());
-
-        majorName = SystemConstant.translateSpecificSign(majorName);
-        return this.baseMapper.findBasicMajorPage(new Page<>(pageNumber, pageSize), schoolId, majorName, dpr);
-    }
-
-    @Transactional(propagation = Propagation.NESTED)
-    @Override
-    public Long saveBasicMajor(BasicMajorParams basicMajorParams, SysUser requestUser) throws IllegalAccessException {
-        SystemConstant.verifyDBFields(basicMajorParams, basicMajorParams.getClass());
-
-        Long id = basicMajorParams.getId();
-        Long schoolId = requestUser.getSchoolId();
-        String majorName = basicMajorParams.getMajorName();
-        Long collegeId = basicMajorParams.getCollegeId();
-
-        // 校验专业唯一性(名称在学院下)
-        BasicMajor checkName = this.getOne(new QueryWrapper<BasicMajor>().lambda()
-                .eq(BasicMajor::getSchoolId, schoolId)
-                .eq(BasicMajor::getBelongOrgId, collegeId)
-                .eq(BasicMajor::getName, majorName));
-        if (Objects.nonNull(checkName) && !checkName.getId().equals(id)) {
-            throw ExceptionResultEnum.ERROR.exception("专业名称[" + majorName + "]重复");
-        }
-        if (SystemConstant.longNotNull(id)) {
-            // 编辑
-            BasicMajor old = this.getById(id);
-            if (Objects.isNull(old)) {
-                throw ExceptionResultEnum.ERROR.exception("所选专业不存在");
-            }
-            this.update(new UpdateWrapper<BasicMajor>().lambda()
-                    .eq(BasicMajor::getId, id)
-                    .set(BasicMajor::getName, majorName)
-                    .set(BasicMajor::getBelongOrgId, collegeId)
-                    .set(BasicMajor::getEnable, true)
-                    .set(BasicMajor::getUpdateId, requestUser.getId()));
-
-            // 如果更新了专业所属学院则更新学生级联关系
-            if (!collegeId.equals(old.getBelongOrgId())) {
-                List<BasicStudent> basicStudentList = basicStudentService.list(new QueryWrapper<BasicStudent>().lambda().eq(BasicStudent::getMajorId, id));
-                basicStudentList.forEach(e -> e.setBelongOrgId(collegeId));
-                basicStudentService.updateBatchById(basicStudentList);
-            }
-
-        } else {
-            // 新增
-            id = SystemConstant.getDbUuid();
-            BasicMajor basicMajor = new BasicMajor();
-            basicMajor.setId(id);
-            basicMajor.setEnable(true);
-            basicMajor.setName(majorName);
-            basicMajor.setSchoolId(schoolId);
-            basicMajor.setCode(null);
-            basicMajor.setBelongOrgId(collegeId);
-            basicMajor.setOrgId(requestUser.getOrgId());
-            basicMajor.setCreateId(requestUser.getId());
-            this.save(basicMajor);
-        }
-        return id;
-    }
-
-    @Transactional
-    @Override
-    public boolean deleteBasicMajorByIdList(List<Long> idList) {
-        // 判断班级
-        List<BasicClazz> basicClazzList = basicClazzService.list(new QueryWrapper<BasicClazz>().lambda().in(BasicClazz::getMajorId, idList));
-        if (basicClazzList.size() > 0) {
-            List<Long> majorIdList = basicClazzList.stream().map(BasicClazz::getMajorId).distinct().collect(Collectors.toList());
-            String majorNames = this.list(new QueryWrapper<BasicMajor>().lambda().in(BasicMajor::getId, majorIdList))
-                    .stream()
-                    .map(BasicMajor::getName)
-                    .collect(Collectors.joining(","));
-            throw ExceptionResultEnum.ERROR.exception("专业[" + majorNames + "]绑定了班级,无法删除");
-        }
-        // 判断学生
-        List<BasicStudent> basicStudentList = basicStudentService.list(new QueryWrapper<BasicStudent>().lambda().in(BasicStudent::getMajorId, idList));
-        if (basicStudentList.size() > 0) {
-            List<Long> majorIdList = basicStudentList.stream().map(BasicStudent::getMajorId).distinct().collect(Collectors.toList());
-            String majorNames = this.list(new QueryWrapper<BasicMajor>().lambda().in(BasicMajor::getId, majorIdList))
-                    .stream()
-                    .map(BasicMajor::getName)
-                    .collect(Collectors.joining(","));
-            throw ExceptionResultEnum.ERROR.exception("专业[" + majorNames + "]绑定了学生,无法删除");
-        }
-        return this.removeByIds(idList);
-    }
-}

+ 0 - 653
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicStudentServiceImpl.java

@@ -1,653 +0,0 @@
-package com.qmth.teachcloud.common.service.impl;
-
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-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.google.common.collect.Lists;
-import com.qmth.boot.api.exception.ApiException;
-import com.qmth.teachcloud.common.base.BaseEntity;
-import com.qmth.teachcloud.common.bean.dto.BasicStudentExportDto;
-import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
-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.dto.excel.export.BasicStudentErrorExportDto;
-import com.qmth.teachcloud.common.bean.params.BasicClazzParams;
-import com.qmth.teachcloud.common.bean.params.BasicMajorParams;
-import com.qmth.teachcloud.common.bean.params.BasicStudentExtrasParam;
-import com.qmth.teachcloud.common.bean.params.BasicStudentParams;
-import com.qmth.teachcloud.common.bean.result.BasicExamStudentResult;
-import com.qmth.teachcloud.common.bean.vo.FilePathVo;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.*;
-import com.qmth.teachcloud.common.enums.*;
-import com.qmth.teachcloud.common.mapper.BasicStudentMapper;
-import com.qmth.teachcloud.common.service.*;
-import com.qmth.teachcloud.common.util.ExcelUtil;
-import com.qmth.teachcloud.common.util.JdbcErrorUtil;
-import com.qmth.teachcloud.common.util.ResultUtil;
-import com.qmth.teachcloud.common.util.ServletUtil;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.dao.DataIntegrityViolationException;
-import org.springframework.jdbc.BadSqlGrammarException;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * <p>
- * 学校id 服务实现类
- * </p>
- *
- * @author wangliang
- * @since 2021-08-02
- */
-@Service
-public class BasicStudentServiceImpl extends ServiceImpl<BasicStudentMapper, BasicStudent> implements BasicStudentService {
-    @Resource
-    private BasicStudentMapper basicStudentMapper;
-    @Resource
-    private BasicClazzService basicClazzService;
-    @Resource
-    private BasicMajorService basicMajorService;
-    @Resource
-    private SysOrgService sysOrgService;
-    @Resource
-    private BasicRoleDataPermissionService basicRoleDataPermissionService;
-    @Resource
-    private FileUploadService fileUploadService;
-    @Resource
-    private TBTaskService tbTaskService;
-
-
-    @Override
-    public IPage<BasicExamStudentResult> basicStudentPage(String queryParams, Long collegeId, Long majorId, Long clazzId, int pageNumber, int pageSize) {
-        Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
-        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
-        DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(schoolId, requestUser.getId(), ServletUtil.getRequest().getServletPath());
-        queryParams = SystemConstant.translateSpecificSign(queryParams);
-        return basicStudentMapper.findBasicStudentPage(new Page<>(pageNumber, pageSize), queryParams, schoolId, collegeId, majorId, clazzId, dpr);
-    }
-
-    @Override
-    public BasicExamStudentResult findById(Long id) {
-        BasicExamStudentResult basicStudentResult = null;
-        if (SystemConstant.longNotNull(id)) {
-            basicStudentResult = this.baseMapper.findById(id);
-        }
-        return basicStudentResult;
-    }
-
-    @Override
-    public List<BasicExamStudentResult> basicStudentList(Long schoolId, Long examId, Long courseId, String teacher, String className, List<String> studentCodeList) {
-        return this.baseMapper.findBasicStudentList(schoolId, examId, courseId, teacher, className, studentCodeList);
-    }
-
-    @Override
-    public IPage<BasicStudent> listPage(Page<BasicStudent> page, String classId) {
-        List<String> classIds = Arrays.asList(classId.split(","));
-        QueryWrapper<BasicStudent> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().in(BasicStudent::getClazzId, classIds)
-                .orderByAsc(BasicStudent::getClazzId)
-                .orderByAsc(BasicStudent::getStudentCode);
-        return this.baseMapper.selectPage(page, queryWrapper);
-    }
-
-    @Override
-    public List<TaskPrintClassDto> listByClass(Long schoolId, Set<String> stringList) {
-        return this.baseMapper.listByClass(schoolId, stringList).stream()
-                .peek(e -> e.setTeachBasicEnum(TeachBasicEnum.BASIC_CLAZZ))
-                .collect(Collectors.toList());
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    @Override
-    public Long saveBasicStudent(BasicStudentParams basicStudentParams) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        BasicStudent basicStudent = this.editEntityHelp(basicStudentParams, sysUser);
-        this.saveOrUpdate(basicStudent);
-        return basicStudent.getId();
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    @Override
-    public void saveBasicStudentWithExtrasList(List<BasicStudentExtrasParam> basicStudentExtrasParamList, SysUser requestUser, boolean saveBasicStudent, Map<String, Object> map) {
-        Long schoolId = requestUser.getSchoolId();
-        List<BasicStudentErrorExportDto> errorDataList = new ArrayList<>();
-        boolean throwException = true;
-        if (Objects.nonNull(map)) {
-            throwException = false;
-        }
-
-        // 查询所有学院map
-        List<SysOrg> sysOrgList = sysOrgService.findCollegeLevelOrgList(schoolId);
-        Map<String, Long> collegeMap = CollectionUtils.isEmpty(sysOrgList) ? new HashMap<>() : sysOrgList.stream().collect(Collectors.toMap(SysOrg::getName, SysOrg::getId));
-        // 查询所有专业map
-        List<BasicMajor> basicMajorList = basicMajorService.list(new QueryWrapper<BasicMajor>().lambda().eq(BasicMajor::getSchoolId, schoolId));
-        Map<String, Long> majorMap = CollectionUtils.isEmpty(basicMajorList) ? new HashMap<>() : basicMajorList.stream().collect(Collectors.toMap(k -> k.getBelongOrgId() + SystemConstant.HYPHEN + k.getName(), BaseEntity::getId));
-        // 查询所有班级map
-        List<BasicClazz> basicClazzList = basicClazzService.list(new QueryWrapper<BasicClazz>().lambda().eq(BasicClazz::getSchoolId, schoolId));
-        Map<String, Long> clazzMap = CollectionUtils.isEmpty(basicClazzList) ? new HashMap<>() : basicClazzList.stream().collect(Collectors.toMap(k -> k.getMajorId() + SystemConstant.HYPHEN + k.getClazzName(), BaseEntity::getId));
-
-        List<BasicStudent> editEntityList = new ArrayList<>();
-        for (BasicStudentExtrasParam basicStudentExtrasParam : basicStudentExtrasParamList) {
-            // 取值
-            String studentName = basicStudentExtrasParam.getStudentName();
-            String studentCode = basicStudentExtrasParam.getStudentCode();
-            String phoneNumber = basicStudentExtrasParam.getPhoneNumber();
-            String collegeName = basicStudentExtrasParam.getCollegeName();
-            String majorName = basicStudentExtrasParam.getMajorName();
-            String clazzName = basicStudentExtrasParam.getClazzName();
-
-            BasicStudentErrorExportDto basicStudentErrorExportDto = new BasicStudentErrorExportDto();
-            BeanUtils.copyProperties(basicStudentExtrasParam, basicStudentErrorExportDto);
-            // 学院
-            if (StringUtils.isBlank(collegeName)) {
-                basicStudentErrorExportDto.setErrorMsg("学号[" + studentCode + "]的数据,学院必填");
-                errorDataList.add(basicStudentErrorExportDto);
-                continue;
-            }
-            if (!collegeMap.containsKey(collegeName)) {
-                try {
-                    SysOrg sysOrg = new SysOrg();
-                    sysOrg.setSchoolId(schoolId);
-                    sysOrg.setName(collegeName);
-                    sysOrg.setParentId(sysOrgService.findRootOrg(schoolId).getId());
-                    sysOrgService.saveOrg(sysOrg, requestUser);
-                    collegeMap.put(collegeName, sysOrg.getId());
-                } catch (Exception e) {
-                    basicStudentErrorExportDto.setErrorMsg(e.getMessage());
-                    errorDataList.add(basicStudentErrorExportDto);
-                    continue;
-                }
-            }
-            Long collegeId = collegeMap.get(collegeName);
-            if (collegeId == null) {
-                basicStudentErrorExportDto.setErrorMsg("学号[" + studentCode + "]的数据,学院查询失败");
-                errorDataList.add(basicStudentErrorExportDto);
-                continue;
-            }
-
-            // 专业
-            if (StringUtils.isBlank(majorName)) {
-                basicStudentErrorExportDto.setErrorMsg("学号[" + studentCode + "]的数据,专业必填");
-                errorDataList.add(basicStudentErrorExportDto);
-                continue;
-            }
-            String majorKey = collegeId + SystemConstant.HYPHEN + majorName;
-            if (!majorMap.containsKey(majorKey)) {
-                // 新增一个major
-                try {
-                    BasicMajorParams basicMajorParams = new BasicMajorParams();
-                    basicMajorParams.setMajorName(majorName);
-                    basicMajorParams.setCollegeId(collegeId);
-                    Long majorId = basicMajorService.saveBasicMajor(basicMajorParams, requestUser);
-                    majorMap.put(majorKey, majorId);
-                } catch (Exception e) {
-                    basicStudentErrorExportDto.setErrorMsg(e.getMessage());
-                    errorDataList.add(basicStudentErrorExportDto);
-                    continue;
-                }
-
-            }
-            Long majorId = majorMap.get(majorKey);
-            if (majorId == null) {
-                basicStudentErrorExportDto.setErrorMsg("学号[" + studentCode + "]的数据,专业查询失败");
-                errorDataList.add(basicStudentErrorExportDto);
-                continue;
-            }
-
-            // 班级
-            if (StringUtils.isBlank(clazzName)) {
-                basicStudentErrorExportDto.setErrorMsg("学号[" + studentCode + "]的数据,班级必填");
-                errorDataList.add(basicStudentErrorExportDto);
-                continue;
-            }
-            String clazzKey = majorId + SystemConstant.HYPHEN + clazzName;
-            if (!clazzMap.containsKey(clazzKey)) {
-                // 新增一个clazz
-                try {
-                    BasicClazzParams basicClazzParams = new BasicClazzParams();
-                    basicClazzParams.setMajorId(majorId);
-                    basicClazzParams.setClazzName(clazzName);
-                    Long clazzId = basicClazzService.saveBasicClazz(basicClazzParams, requestUser);
-                    clazzMap.put(clazzKey, clazzId);
-                } catch (Exception e) {
-                    basicStudentErrorExportDto.setErrorMsg(e.getMessage());
-                    errorDataList.add(basicStudentErrorExportDto);
-                    continue;
-                }
-
-            }
-            Long clazzId = clazzMap.get(clazzKey);
-            if (clazzId == null) {
-                basicStudentErrorExportDto.setErrorMsg("学号[" + studentCode + "]的数据,班级查询失败");
-                errorDataList.add(basicStudentErrorExportDto);
-                continue;
-            }
-
-            if (saveBasicStudent) {
-                // 学生信息组装
-                BasicStudentParams basicStudentParams = new BasicStudentParams();
-                basicStudentParams.setStudentName(studentName);
-                basicStudentParams.setStudentCode(studentCode);
-                basicStudentParams.setPhoneNumber(phoneNumber);
-                basicStudentParams.setCollegeId(collegeId);
-                basicStudentParams.setMajorId(majorId);
-                basicStudentParams.setClazzId(clazzId);
-                try {
-                    BasicStudent basicStudent = this.editEntityHelp(basicStudentParams, requestUser);
-                    editEntityList.add(basicStudent);
-                } catch (Exception e) {
-                    basicStudentErrorExportDto.setErrorMsg(e.getMessage());
-                    errorDataList.add(basicStudentErrorExportDto);
-                }
-            }
-        }
-        // 抛出或者记录异常
-        if (throwException) {
-            String errorMsg = errorDataList.stream().map(BasicStudentErrorExportDto::getErrorMsg).collect(Collectors.joining("\n"));
-            throw ExceptionResultEnum.ERROR.exception(errorMsg);
-        } else {
-            if (map.containsKey(SystemConstant.ERROR_DATA_LIST)) {
-                errorDataList = JSON.parseArray(JSON.toJSONString(map.get(SystemConstant.ERROR_DATA_LIST)), BasicStudentErrorExportDto.class);
-                map.put(SystemConstant.ERROR_DATA_LIST, errorDataList);
-            }
-
-            int dataCount = (int) map.get(SystemConstant.DATA_COUNT);
-            map.put(SystemConstant.SUCCESS_DATA_COUNT, dataCount - errorDataList.size());
-            map.put(SystemConstant.ERROR_DATA_COUNT, errorDataList.size());
-        }
-
-
-        try {
-            this.saveOrUpdateBatch(editEntityList);
-        } catch (Exception e) {
-            if (e instanceof DataIntegrityViolationException || e instanceof BadSqlGrammarException) {
-                String content = JdbcErrorUtil.parseErrorMsg(e.getMessage().toString());
-                throw ExceptionResultEnum.SQL_ERROR.exception(content);
-            } else if (e instanceof ApiException) {
-                ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
-            } else {
-                ResultUtil.error(e.getMessage());
-            }
-        }
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    @Override
-    public Boolean removeBasicStudentBatch(List<Long> idList) {
-
-        if (idList.size() == 0) {
-            throw ExceptionResultEnum.ERROR.exception("请选择要删除的目标");
-        }
-        // 删除基础学生
-        this.remove(new QueryWrapper<BasicStudent>().lambda().in(BasicStudent::getId, idList));
-        // 同步删除教学学生
-        this.baseMapper.deleteTeachStudentByBasicStudentIdSet(new HashSet<>(idList));
-        return true;
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    @Override
-    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.longNotNull(collegeId)) {
-            basicStudentQueryWrapper.eq(BasicStudent::getBelongOrgId, collegeId);
-        }
-        if (SystemConstant.longNotNull(majorId)) {
-            basicStudentQueryWrapper.eq(BasicStudent::getMajorId, majorId);
-        }
-        if (clazzIdList != null && clazzIdList.size() > 0) {
-            basicStudentQueryWrapper.in(BasicStudent::getClazzId, clazzIdList);
-        }
-        List<BasicStudent> willDeleteStudent = this.list(basicStudentQueryWrapper);
-
-        // 删除基础学生
-        if (willDeleteStudent.size() > 0) {
-            Set<Long> idSet = willDeleteStudent.stream().map(BaseEntity::getId).collect(Collectors.toSet());
-            this.removeByIds(idSet);
-            // 同步删除教学学生
-            this.baseMapper.deleteTeachStudentByBasicStudentIdSet(idSet);
-        }
-        return true;
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    @Override
-    public Map<String, Object> executeBasicStudentImportLogic(List<LinkedMultiValueMap<Integer, Object>> finalList, Map<String, Object> map) {
-        SysUser sysUser = (SysUser) map.get(SystemConstant.SYS_USER);
-        for (int i = 0; i < finalList.size(); i++) {
-            LinkedMultiValueMap<Integer, Object> excelMap = finalList.get(i);
-            List<Object> basicStudentImportDtoList = excelMap.get(i);
-            if (CollectionUtils.isEmpty(basicStudentImportDtoList)) {
-                continue;
-            }
-            List<BasicStudentImportDto> datasource = basicStudentImportDtoList.stream().map(e -> {
-                BasicStudentImportDto basicStudentImportDto = new BasicStudentImportDto();
-                BeanUtils.copyProperties(e, basicStudentImportDto);
-                return basicStudentImportDto;
-            }).collect(Collectors.toList());
-
-            List<BasicStudentExtrasParam> basicStudentExtrasParamList = datasource.stream().flatMap(e -> {
-                BasicStudentExtrasParam basicStudentExtrasParam = new BasicStudentExtrasParam();
-                basicStudentExtrasParam.setStudentName(StringUtils.isNotBlank(e.getStudentName()) ? e.getStudentName().trim() : null);
-                basicStudentExtrasParam.setStudentCode(StringUtils.isNotBlank(e.getStudentCode()) ? e.getStudentCode().trim() : null);
-                basicStudentExtrasParam.setPhoneNumber(null);
-                basicStudentExtrasParam.setCollegeName(StringUtils.isNotBlank(e.getCollegeName()) ? e.getCollegeName().trim() : null);
-                basicStudentExtrasParam.setMajorName(StringUtils.isNotBlank(e.getMajorName()) ? e.getMajorName().trim() : null);
-                basicStudentExtrasParam.setClazzName(StringUtils.isNotBlank(e.getClazzName()) ? e.getClazzName().trim() : null);
-                basicStudentExtrasParam.setRowIndex(e.getRowIndex());
-                return Stream.of(basicStudentExtrasParam);
-            }).collect(Collectors.toList());
-            this.saveBasicStudentWithExtrasList(basicStudentExtrasParamList, sysUser, true, map);
-        }
-        return map;
-    }
-
-    @Override
-    public void exportData(HttpServletResponse response, String queryParams, Long collegeId, Long majorId, Set<Long> clazzIdList) throws Exception {
-        Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
-        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
-        DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(schoolId, requestUser.getId(), ServletUtil.getRequest().getServletPath());
-        queryParams = SystemConstant.translateSpecificSign(queryParams);
-        List<BasicStudentExportDto> studentExportDtos = basicStudentMapper.listExportData(queryParams, schoolId, collegeId, majorId, clazzIdList, dpr);
-        if (studentExportDtos.isEmpty()) {
-            throw ExceptionResultEnum.ERROR.exception("没有可导出数据");
-        }
-        ExcelUtil.excelExport("学生数据", BasicStudentExportDto.class, studentExportDtos, response);
-    }
-
-    @Override
-    public boolean importBasicStudent(Map<String, Object> map, MultipartFile file) {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-
-        TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
-        List<BasicStudent> basicStudentList = new ArrayList<>();
-        List<BasicStudentErrorExportDto> errorDataList = new ArrayList<>();
-        AtomicInteger totalInteger = new AtomicInteger(0);
-        try {
-            tbTask.setStatus(TaskStatusEnum.RUNNING);
-            tbTaskService.updateById(tbTask);
-            checkImportBasicStudent(file, basicStudentList, errorDataList, totalInteger, sysUser);
-
-            if (CollectionUtils.isNotEmpty(basicStudentList)) {
-                this.saveBatch(basicStudentList);
-            }
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        } finally {
-            if (CollectionUtils.isNotEmpty(errorDataList)) {
-                tbTask.setResult(TaskResultEnum.ERROR);
-                try {
-                    File excelFileTemp = SystemConstant.getFileTempVar(SystemConstant.EXCEL_PREFIX);
-                    ExcelUtil.excelExportLocal(excelFileTemp, BasicStudentErrorExportDto.class, errorDataList);
-                    String fileName = SystemConstant.getNanoId() + SystemConstant.EXCEL_PREFIX;
-                    FilePathVo filePathVo = fileUploadService.uploadFile(excelFileTemp, UploadFileEnum.FILE, fileName);
-                    tbTask.setErrorFilePath(JSON.toJSONString(filePathVo));
-                } catch (Exception e) {
-                    log.error("创建学生导入错误数据文件失败");
-                } finally {
-                    tbTask.setSummary(JSON.toJSONString(errorDataList));
-                }
-            } else {
-                tbTask.setResult(TaskResultEnum.SUCCESS);
-            }
-            tbTask.setStatus(TaskStatusEnum.FINISH);
-            tbTaskService.updateById(tbTask);
-        }
-        return true;
-    }
-
-    private void checkImportBasicStudent(MultipartFile file, List<BasicStudent> basicStudentList, List<BasicStudentErrorExportDto> errorDataList, AtomicInteger totalInteger, SysUser sysUser) throws IOException, NoSuchFieldException {
-        // 查询所有学院map
-        List<SysOrg> sysOrgList = sysOrgService.findCollegeLevelOrgList(sysUser.getSchoolId());
-        Map<String, Long> collegeMap = CollectionUtils.isEmpty(sysOrgList) ? new HashMap<>() : sysOrgList.stream().collect(Collectors.toMap(SysOrg::getName, SysOrg::getId));
-        // 查询所有专业map
-        List<BasicMajor> basicMajorList = basicMajorService.list(new QueryWrapper<BasicMajor>().lambda().eq(BasicMajor::getSchoolId, sysUser.getSchoolId()));
-        Map<String, Long> majorMap = CollectionUtils.isEmpty(basicMajorList) ? new HashMap<>() : basicMajorList.stream().collect(Collectors.toMap(k -> k.getBelongOrgId() + SystemConstant.HYPHEN + k.getName(), BaseEntity::getId));
-        // 查询所有班级map
-        List<BasicClazz> basicClazzList = basicClazzService.list(new QueryWrapper<BasicClazz>().lambda().eq(BasicClazz::getSchoolId, sysUser.getSchoolId()));
-        Map<String, Long> clazzMap = CollectionUtils.isEmpty(basicClazzList) ? new HashMap<>() : basicClazzList.stream().collect(Collectors.toMap(k -> k.getMajorId() + SystemConstant.HYPHEN + k.getClazzName(), BaseEntity::getId));
-
-        // 顶级机构(学校级)
-        Long rootSchoolOrgId = sysOrgService.findRootOrg(sysUser.getSchoolId()).getId();
-
-        ExcelUtil.excelReader(file.getInputStream(), Lists.newArrayList(BasicStudentImportDto.class, DescribeImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
-            Map<String, Integer> checkCodeMap = new HashMap<>();
-            for (int i = 0; i < finalExcelList.size(); i++) {
-                LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
-                List<Object> basicStudentImportDtoList = excelMap.get(i);
-                // 无数据,跳过
-                if (CollectionUtils.isEmpty(basicStudentImportDtoList)) {
-                    continue;
-                }
-                for (int y = 0; y < basicStudentImportDtoList.size(); y++) {
-                    // 计算总数量
-                    totalInteger.getAndIncrement();
-
-                    // 行索引
-                    Integer rowIndex = y + 1;
-                    BasicStudentImportDto basicStudentImportDto = (BasicStudentImportDto) basicStudentImportDtoList.get(y);
-                    String studentName = StringUtils.trimToNull(basicStudentImportDto.getStudentName());
-                    String studentCode = StringUtils.trimToNull(basicStudentImportDto.getStudentCode());
-                    String collegeName = StringUtils.trimToNull(basicStudentImportDto.getCollegeName());
-                    String majorName = StringUtils.trimToNull(basicStudentImportDto.getMajorName());
-                    String clazzName = StringUtils.trimToNull(basicStudentImportDto.getClazzName());
-
-                    // 本行全部列为空,跳过
-                    if (StringUtils.isAllBlank(studentName, studentCode, collegeName, majorName, clazzName)) {
-                        continue;
-                    }
-
-                    basicStudentImportDto.setRowIndex(rowIndex);
-                    BasicStudentErrorExportDto basicStudentErrorExportDto = new BasicStudentErrorExportDto();
-                    BeanUtils.copyProperties(basicStudentImportDto, basicStudentErrorExportDto);
-
-                    // excel内校验
-                    List<String> errorMsgList = new ArrayList<>();
-                    // 必填字段校验
-                    String errorStringEmpty = ExcelUtil.checkExcelField(basicStudentImportDto);
-                    if (errorStringEmpty.length() > 0) {
-                        errorMsgList.add(errorStringEmpty);
-                    }
-
-                    if (!studentCode.matches(SystemConstant.REGULAR_EXPRESSION_OF_CODE1)) {
-                        errorMsgList.add("学号[" + studentCode + "]只能是字母或数字");
-                    }
-
-                    // 检验学号
-                    if (checkCodeMap.containsKey(studentCode)) {
-                        Integer studentCodeCount = checkCodeMap.get(studentCode);
-                        errorMsgList.add(String.format("学号[%s]有[%d]行数据", studentCode, studentCodeCount));
-                        checkCodeMap.put(studentCode, studentCodeCount + 1);
-                    } else {
-                        checkCodeMap.put(studentCode, 1);
-                    }
-
-                    if (CollectionUtils.isNotEmpty(errorMsgList)) {
-                        continue;
-                    }
-
-                    // 院专班数据校验
-                    // 1.学院
-                    if (!collegeMap.containsKey(collegeName)) {
-                        try {
-                            SysOrg sysOrg = new SysOrg(sysUser.getSchoolId(), collegeName, rootSchoolOrgId);
-                            sysOrgService.saveOrg(sysOrg, sysUser);
-                            collegeMap.put(collegeName, sysOrg.getId());
-                        } catch (Exception e) {
-                            errorMsgList.add("创建学院[" + collegeName + "]失败");
-                            continue;
-                        }
-                    }
-                    Long collegeId = collegeMap.get(collegeName);
-                    if (collegeId == null) {
-                        errorMsgList.add("学号[" + studentCode + "]的考生,学院查询失败");
-                        errorDataList.add(basicStudentErrorExportDto);
-                        continue;
-                    }
-
-                    // 2.专业
-                    String majorKey = collegeId + SystemConstant.HYPHEN + majorName;
-                    if (!majorMap.containsKey(majorKey)) {
-                        // 新增一个major
-                        try {
-                            BasicMajorParams basicMajorParams = new BasicMajorParams();
-                            basicMajorParams.setMajorName(majorName);
-                            basicMajorParams.setCollegeId(collegeId);
-                            Long majorId = basicMajorService.saveBasicMajor(basicMajorParams, sysUser);
-                            majorMap.put(majorKey, majorId);
-                        } catch (Exception e) {
-                            errorMsgList.add("创建专业[" + majorName + "]失败");
-                            continue;
-                        }
-
-                    }
-                    Long majorId = majorMap.get(majorKey);
-                    if (majorId == null) {
-                        errorMsgList.add("学号[" + studentCode + "]的考生,专业查询失败");
-                        errorDataList.add(basicStudentErrorExportDto);
-                        continue;
-                    }
-
-                    // 3.班级
-                    String clazzKey = majorId + SystemConstant.HYPHEN + clazzName;
-                    if (!clazzMap.containsKey(clazzKey)) {
-                        // 新增一个clazz
-                        try {
-                            BasicClazzParams basicClazzParams = new BasicClazzParams();
-                            basicClazzParams.setMajorId(majorId);
-                            basicClazzParams.setClazzName(clazzName);
-                            Long clazzId = basicClazzService.saveBasicClazz(basicClazzParams, sysUser);
-                            clazzMap.put(clazzKey, clazzId);
-                        } catch (Exception e) {
-                            errorMsgList.add("创建班级[" + clazzName + "]失败");
-                            continue;
-                        }
-
-                    }
-                    Long clazzId = clazzMap.get(clazzKey);
-                    if (clazzId == null) {
-                        errorMsgList.add("学号[" + studentCode + "]的考生,班级查询失败");
-                        errorDataList.add(basicStudentErrorExportDto);
-                        continue;
-                    }
-
-                    // 学生信息组装
-                    BasicStudentParams basicStudentParams = new BasicStudentParams();
-                    basicStudentParams.setStudentName(studentName);
-                    basicStudentParams.setStudentCode(studentCode);
-                    basicStudentParams.setCollegeId(collegeId);
-                    basicStudentParams.setMajorId(majorId);
-                    basicStudentParams.setClazzId(clazzId);
-                    try {
-                        BasicStudent basicStudent = this.editEntityHelp(basicStudentParams, sysUser);
-                        basicStudentList.add(basicStudent);
-                    } catch (Exception e) {
-                        errorMsgList.add("学生保存失败");
-                    }
-
-                    // 错误
-                    if (CollectionUtils.isNotEmpty(errorMsgList)) {
-                        basicStudentErrorExportDto.setErrorMsg(JSON.toJSONString(errorMsgList));
-                        errorDataList.add(basicStudentErrorExportDto);
-                    }
-                }
-            }
-            return finalExcelList;
-        }, 2);
-    }
-
-    /**
-     * 学生保存助手方法(应对学生保存和导入批量保存)
-     *
-     * @param basicStudentParams 学生参数
-     * @param sysUser            操作人
-     * @return 结果
-     */
-    private BasicStudent editEntityHelp(BasicStudentParams basicStudentParams, SysUser sysUser) {
-        Long schoolId = sysUser.getSchoolId();
-        // 普通参数
-        String studentName = basicStudentParams.getStudentName();
-        String studentCode = basicStudentParams.getStudentCode();
-        String phoneNumber = basicStudentParams.getPhoneNumber();
-        Long clazzId = basicStudentParams.getClazzId();
-        Long majorId = basicStudentParams.getMajorId();
-        Long collegeId = basicStudentParams.getCollegeId();
-
-        // 检验有值的电话在学校的唯一性
-        if (SystemConstant.strNotNull(phoneNumber)) {
-            BasicStudent checkPhone = this.getOne(new QueryWrapper<BasicStudent>().lambda()
-                    .eq(BasicStudent::getSchoolId, schoolId)
-                    .eq(BasicStudent::getPhoneNumber, phoneNumber));
-            if (Objects.nonNull(checkPhone)) {
-                if ((basicStudentParams.getId() != null && !checkPhone.getId().equals(basicStudentParams.getId())) || basicStudentParams.getId() == null) {
-                    throw ExceptionResultEnum.ERROR.exception("电话[" + phoneNumber + "]已使用");
-                }
-            }
-        }
-
-        // 组装基础参数
-        BasicStudent basicStudent = new BasicStudent();
-        basicStudent.setStudentCode(studentCode);
-        basicStudent.setStudentName(studentName);
-        basicStudent.setPhoneNumber(phoneNumber);
-        basicStudent.setBelongOrgId(collegeId);
-        basicStudent.setMajorId(majorId);
-        basicStudent.setClazzId(clazzId);
-        basicStudent.setSchoolId(schoolId);
-        basicStudent.setOrgId(sysUser.getOrgId());
-
-        if (basicStudentParams.getId() != null) {
-            if (!studentCode.matches(SystemConstant.REGULAR_EXPRESSION_OF_CODE)) {
-                throw ExceptionResultEnum.ERROR.exception("学号[" + studentCode + "]不符合规范");
-            }
-            BasicStudent basicStudentOld = this.getById(basicStudentParams.getId());
-            if (!basicStudentOld.getStudentCode().equals(studentCode)) {
-                List<BasicStudent> checkCodeList = this.list(new QueryWrapper<BasicStudent>().lambda()
-                        .eq(BasicStudent::getSchoolId, schoolId)
-                        .eq(BasicStudent::getStudentCode, studentCode)
-                        .ne(BasicStudent::getId, basicStudentParams.getId()));
-                if (!CollectionUtils.isEmpty(checkCodeList)) {
-                    throw ExceptionResultEnum.ERROR.exception("学号[" + studentCode + "]已存在");
-                }
-            }
-
-            basicStudent.setId(basicStudentParams.getId());
-        } else {
-            BasicStudent checkCode = this.getOne(new QueryWrapper<BasicStudent>().lambda()
-                    .eq(BasicStudent::getSchoolId, schoolId)
-                    .eq(BasicStudent::getStudentCode, studentCode));
-            if (checkCode != null) {
-                basicStudent.setId(checkCode.getId());
-                // 禁用的学生,此时启用
-                basicStudent.setEnable(true);
-                basicStudent.updateInfo(sysUser.getId());
-            } else {
-                basicStudent.setId(SystemConstant.getDbUuid());
-                basicStudent.insertInfo(sysUser.getId());
-            }
-        }
-
-        return basicStudent;
-    }
-}

+ 0 - 85
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicUserCourseServiceImpl.java

@@ -1,85 +0,0 @@
-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.extension.service.impl.ServiceImpl;
-import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.BasicUserCourse;
-import com.qmth.teachcloud.common.entity.SysUser;
-import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
-import com.qmth.teachcloud.common.mapper.BasicUserCourseMapper;
-import com.qmth.teachcloud.common.service.BasicClazzService;
-import com.qmth.teachcloud.common.service.BasicUserCourseService;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.util.*;
-
-/**
- * <p>
- * 用户和课程关联表 服务实现类
- * </p>
- *
- * @author xf
- * @since 2021-03-23
- */
-@Service
-public class BasicUserCourseServiceImpl extends ServiceImpl<BasicUserCourseMapper, BasicUserCourse> implements BasicUserCourseService {
-    @Resource
-    private BasicClazzService basicClazzService;
-
-    @Override
-    public void removeByUserId(Long userId) {
-        UpdateWrapper<BasicUserCourse> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.lambda().eq(BasicUserCourse::getUserId, userId);
-        this.baseMapper.delete(updateWrapper);
-    }
-
-    @Override
-    public void saveBatch(SysUser sysUser) {
-        Long[] courseIds = sysUser.getCourseIds();
-        List<BasicUserCourse> list = new ArrayList<>();
-        for (Long courseId : courseIds) {
-            BasicUserCourse userCourse = new BasicUserCourse();
-            userCourse.setUserId(sysUser.getId());
-            userCourse.setCourseId(courseId);
-            userCourse.setCreateId(sysUser.getId());
-            userCourse.setCreateTime(System.currentTimeMillis());
-            list.add(userCourse);
-        }
-        this.saveBatch(list);
-    }
-
-    @Transactional
-    @Override
-    public void updateByCourseIdAndClazzList(Long courseId, Set<Long> clazzIdSet, SysUser sysUser, Long orgId) {
-        List<BasicUserCourse> willAddList = new ArrayList<>();
-
-        // 删除原有的全部
-        this.remove(new QueryWrapper<BasicUserCourse>().lambda().eq(BasicUserCourse::getCourseId,courseId).gt(BasicUserCourse::getId,0));
-
-        // 新增
-        if (clazzIdSet != null && clazzIdSet.size() > 0){
-            for (Long clazzId : clazzIdSet) {
-                if (Objects.isNull(basicClazzService.getById(clazzId))){
-                    throw ExceptionResultEnum.ERROR.exception("班级主键不存在");
-                }
-                BasicUserCourse basicUserCourse = new BasicUserCourse();
-                basicUserCourse.setId(SystemConstant.getDbUuid());
-                basicUserCourse.setSchoolId(sysUser.getSchoolId());
-                basicUserCourse.setOrgId(orgId);
-                basicUserCourse.setCourseId(courseId);
-                basicUserCourse.setClazzId(clazzId);
-                basicUserCourse.setUpdateId(sysUser.getId());
-                willAddList.add(basicUserCourse);
-            }
-        }
-        this.saveBatch(willAddList);
-    }
-
-    @Override
-    public List<BasicUserCourse> listBySchoolIdAndCourseCode(Long schoolId, String courseCode) {
-        return this.baseMapper.listBySchoolIdAndCourseCode(schoolId, courseCode);
-    }
-}

+ 2 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserServiceImpl.java

@@ -1151,10 +1151,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     }
 
     @Override
-    public SysUser getByLoginName(Long schoolId, String teacherName) {
+    public SysUser getByLoginName(Long schoolId, String loginName) {
         QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(SysUser::getSchoolId, schoolId)
-                .eq(SysUser::getLoginName, teacherName);
+                .eq(SysUser::getLoginName, loginName);
         return this.getOne(queryWrapper);
     }
 }

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

@@ -1,61 +0,0 @@
-<?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.BasicClazzMapper">
-
-    <select id="findBasicClazzPage"
-            resultType="com.qmth.teachcloud.common.bean.result.BasicClazzResult">
-        SELECT
-            clz.id,
-            clz.school_id AS schoolId,
-            clz.clazz_code AS clazzCode,
-            clz.clazz_name AS clazzName,
-            clz.enable,
-            clz.create_id AS createId,
-            clz.create_time AS createTime,
-            bm.id AS majorId,
-            bm.name AS majorName
-        FROM
-            basic_clazz clz
-                LEFT JOIN
-            basic_major bm ON bm.id = clz.major_id
-                AND bm.enable = TRUE
-        <where>
-            AND clz.enable = TRUE
-            <if test="schoolId != null and schoolId != ''">
-                AND clz.school_id = #{schoolId}
-            </if>
-            <if test="queryParams != null and queryParams != ''">
-                AND (clz.clazz_name LIKE CONCAT('%',#{queryParams},'%') OR clz.clazz_code LIKE CONCAT('%',#{queryParams},'%'))
-            </if>
-            <if test="dpr != null">
-                <if test="dpr.requestUserId != null">
-                    AND clz.create_id = #{dpr.requestUserId}
-                </if>
-                <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
-                    AND clz.org_id IN
-                    <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
-                        #{item}
-                    </foreach>
-                </if>
-            </if>
-        </where>
-        ORDER BY clz.create_time DESC
-    </select>
-    <select id="findExamTaskPrintByClazzIdSet" resultType="java.util.Map">
-        SELECT
-            etp.id, class_id AS clazzId, class_name AS clazzName
-        FROM
-            exam_task_print etp
-        LEFT JOIN
-            exam_print_plan epp ON etp.print_plan_id = epp.id
-        <where>
-            AND etp.school_id = #{schoolId}
-            <if test="clazzIds != null and clazzIds != '' and clazzIds.size > 0">
-                AND etp.class_id IN
-                <foreach collection="clazzIds" item="item" index="index" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-        </where>
-    </select>
-</mapper>

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

@@ -1,41 +0,0 @@
-<?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.BasicMajorMapper">
-
-    <select id="findBasicMajorPage"
-            resultType="com.qmth.teachcloud.common.bean.result.BasicMajorResult">
-        SELECT
-            bm.id,
-            bm.name AS majorName,
-            bm.code AS majorCode,
-            bm.create_id AS createId,
-            bm.create_time AS createTime,
-            bc.id AS collegeId,
-            bc.name AS collegeName
-        FROM
-            basic_major bm
-                LEFT JOIN
-            sys_org bc ON bm.belong_org_id = bc.id
-        <where>
-            AND bm.enable = true
-            <if test="schoolId != null and schoolId != ''">
-                AND bm.school_id = #{schoolId}
-            </if>
-            <if test="majorName != null and majorName != ''">
-                AND bm.name LIKE CONCAT('%',#{majorName},'%')
-            </if>
-            <if test="dpr != null">
-                <if test="dpr.requestUserId != null">
-                    AND bm.create_id = #{dpr.requestUserId}
-                </if>
-                <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
-                    AND bm.org_id IN
-                    <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
-                        #{item}
-                    </foreach>
-                </if>
-            </if>
-        </where>
-        ORDER BY bm.create_time DESC
-    </select>
-</mapper>

+ 0 - 210
teachcloud-common/src/main/resources/mapper/BasicStudentMapper.xml

@@ -1,210 +0,0 @@
-<?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.BasicStudentMapper">
-    <delete id="deleteTeachStudentByBasicStudentIdSet">
-        DELETE FROM teach_student WHERE
-            <if test="idSet != null and idSet != '' and idSet.size > 0">
-                student_id IN
-                <foreach collection="idSet" item="item" index="index" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-    </delete>
-
-    <select id="listByClass" resultType="com.qmth.teachcloud.common.bean.dto.TaskPrintClassDto">
-        SELECT
-            s.clazz_id classId,
-            clz.clazz_name className,
-            COUNT(1) studentCount
-        FROM
-            basic_student s
-                LEFT JOIN
-            basic_clazz clz ON s.clazz_id = clz.id and clz.enable = true
-        WHERE
-            s.school_id = #{schoolId}
-            <if test="stringList != null and stringList != '' and stringList.size > 0">
-                and s.clazz_id in
-                <foreach collection="stringList" item="cla" open="(" close=")" separator=",">
-                    #{cla}
-                </foreach>
-            </if>
-        GROUP BY s.clazz_id, clz.clazz_name
-    </select>
-
-    <select id="findBasicStudentPage"
-            resultType="com.qmth.teachcloud.common.bean.result.BasicExamStudentResult">
-        SELECT
-            stu.id,
-            student_name AS studentName,
-            student_code AS studentCode,
-            phone_number AS phoneNumber,
-            bc.id AS collegeId,
-            bc.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
-            sys_org bc ON stu.belong_org_id = bc.id
-        <where>
-            and stu.enable = true
-            <if test="queryParams != null and queryParams != ''">
-                and (student_name like concat('%',#{queryParams},'%') or student_code like concat('%',#{queryParams},'%'))
-            </if>
-            <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="dpr != null">
-                <if test="dpr.requestUserId != null">
-                    AND stu.create_id = #{dpr.requestUserId}
-                </if>
-                <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
-                    AND stu.org_id IN
-                    <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
-                        #{item}
-                    </foreach>
-                </if>
-            </if>
-        </where>
-        ORDER BY stu.create_time DESC
-    </select>
-    <select id="findById" resultType="com.qmth.teachcloud.common.bean.result.BasicExamStudentResult">
-        SELECT
-            stu.id,
-            stu.student_name AS studentName,
-            stu.student_code AS studentCode,
-            stu.college AS collegeName,
-            stu.major AS majorName,
-            stu.clazz_id AS clazzId,
-            clz.clazz_name AS clazz,
-            stu.create_id AS createId,
-            stu.create_time AS createTime
-        FROM
-            basic_exam_student stu
-                LEFT JOIN
-            basic_teach_clazz clz ON stu.clazz_id = clz.id
-        <where>
-            <if test="id != null">
-                AND stu.id = #{id}
-            </if>
-        </where>
-    </select>
-    <select id="findBasicStudentList" resultType="com.qmth.teachcloud.common.bean.result.BasicExamStudentResult">
-        SELECT
-            stu.id,
-            stu.student_name AS studentName,
-            stu.student_code AS studentCode,
-            stu.college AS collegeName,
-            stu.major AS majorName,
-            stu.clazz_id AS clazzId,
-            clz.clazz_name AS clazz,
-            stu.create_id AS createId,
-            stu.create_time AS createTime
-        FROM
-            basic_exam_student stu
-                LEFT JOIN
-            basic_teach_clazz clz ON stu.clazz_id = clz.id
-                LEFT JOIN
-            sys_user su ON stu.teacher_id = su.id
-        <where>
-            <if test="schoolId != null">
-                and stu.school_id = #{schoolId}
-            </if>
-            <if test="examId != null">
-                and stu.exam_id = #{examId}
-            </if>
-            <if test="courseId != null">
-                and stu.course_id = #{courseId}
-            </if>
-            <if test="teacher != null and teacher != ''">
-                and (su.login_name like concat('%', #{teacher}, '%') or su.real_name like concat('%', #{teacher}, '%'))
-            </if>
-            <if test="className != null and className != ''">
-                and clz.clazz_name like concat('%', #{className}, '%')
-            </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.student_code
-    </select>
-    <select id="listExportData" resultType="com.qmth.teachcloud.common.bean.dto.BasicStudentExportDto">
-        SELECT
-        stu.id,
-        student_name AS studentName,
-        student_code AS studentCode,
-        phone_number AS phoneNumber,
-        bc.id AS collegeId,
-        bc.name AS collegeName,
-        bm.id AS majorId,
-        bm.name AS majorName,
-        clazz_id AS clazzId,
-        clz.clazz_name AS clazzName,
-        stu.enable,
-        case stu.enable when true then '启用' else '禁用' end enableName,
-        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
-        sys_org bc ON stu.belong_org_id = bc.id
-        <where>
-            and stu.enable = true
-            <if test="queryParams != null and queryParams != ''">
-                and (student_name like concat('%',#{queryParams},'%') or student_code like concat('%',#{queryParams},'%'))
-            </if>
-            <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="clazzIdList != null and clazzIdList != '' and clazzIdList.size > 0">
-                AND stu.clazz_id IN
-                <foreach collection="clazzIdList" item="item" index="index" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="dpr != null">
-                <if test="dpr.requestUserId != null">
-                    AND stu.create_id = #{dpr.requestUserId}
-                </if>
-                <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
-                    AND stu.org_id IN
-                    <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
-                        #{item}
-                    </foreach>
-                </if>
-            </if>
-        </where>
-        ORDER BY stu.create_time DESC
-    </select>
-</mapper>

+ 0 - 35
teachcloud-common/src/main/resources/mapper/BasicUserCourseMapper.xml

@@ -1,35 +0,0 @@
-<?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.BasicUserCourseMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.qmth.teachcloud.common.entity.BasicUserCourse">
-    <result column="id" property="id" />
-        <result column="user_id" property="userId" />
-        <result column="course_id" property="courseId" />
-    </resultMap>
-
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-        id,
-        user_id, course_id
-    </sql>
-    <select id="listBySchoolIdAndCourseCode" resultType="com.qmth.teachcloud.common.entity.BasicUserCourse">
-        SELECT
-            a.id,
-            a.school_id schoolId,
-            a.org_id orgId,
-            a.user_id userId,
-            a.course_id courseId,
-            a.clazz_id clazzId,
-            a.create_id createId,
-            a.create_time createTime
-        FROM
-            basic_user_course a
-                LEFT JOIN
-            basic_course b ON a.course_id = b.id
-        WHERE
-            a.school_id = #{schoolId} AND b.code = #{courseCode}
-    </select>
-
-</mapper>

+ 3 - 3
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -1571,7 +1571,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         BasicTeachClazz basicTeachClazz = this.baseMapper.getBasicTeachClazzById(basicExamStudent.getClazzId());
         SysUser sysUser = sysUserService.getById(basicExamStudent.getTeacherId());
         if (markStudent == null) {
-            markStudent = new MarkStudent(basicExamStudent.getId(), basicExamStudent.getExamId(), basicExamStudent.getCourseId(), basicExamStudent.getPaperNumber(), markPaper.getCoursePaperId(), "A", basicExamStudent.getStudentCode(), basicExamStudent.getStudentName(), "", basicExamStudent.getExamPlace(), basicExamStudent.getExamRoom(), basicExamStudent.getCollege(), basicExamStudent.getMajor(), basicTeachClazz == null ? null : basicTeachClazz.getClazzName(), basicExamStudent.getTeacherId(), sysUser == null ? null : sysUser.getRealName(), basicExamStudent.getExamStartTime(), basicExamStudent.getExamEndTime(), markPaper.getUserId());
+            markStudent = new MarkStudent(basicExamStudent.getId(), basicExamStudent.getExamId(), basicExamStudent.getCourseId(), basicExamStudent.getPaperNumber(), markPaper.getCoursePaperId(), "A", basicExamStudent.getStudentCode(), basicExamStudent.getStudentName(), "", basicExamStudent.getExamPlace(), basicExamStudent.getExamRoom(), basicExamStudent.getCollegeName(), basicExamStudent.getMajorName(), basicExamStudent.getTeachClassName(), basicExamStudent.getTeacherId(), sysUser == null ? null : sysUser.getRealName(), basicExamStudent.getExamStartTime(), basicExamStudent.getExamEndTime(), markPaper.getUserId());
             if (markStudent.getSecretNumber() == null) {
                 markStudent.randomSecretNumber();
                 while (secretNumberSet.contains(markStudent.getSecretNumber())
@@ -1581,8 +1581,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
             }
         } else {
             markStudent.setStudentName(basicExamStudent.getStudentName());
-            markStudent.setCollege(basicExamStudent.getCollege());
-            markStudent.setMajorName(basicExamStudent.getMajor());
+            markStudent.setCollege(basicExamStudent.getCollegeName());
+            markStudent.setMajorName(basicExamStudent.getMajorName());
             markStudent.setClassName(basicTeachClazz == null ? null : basicTeachClazz.getClazzName());
             markStudent.setExamPlace(basicExamStudent.getExamPlace());
             markStudent.setExamRoom(basicExamStudent.getExamRoom());

+ 1 - 1
teachcloud-mark/src/main/resources/mapper/MarkPaperMapper.xml

@@ -170,7 +170,7 @@
                 </foreach>
             </if>
         </if>
-        group by t.id,t.exam_id,t.course_id, t.paper_number
+        group by t.id,t.exam_id,bc.code,bc.name, t.paper_number
         ORDER BY t.id desc
     </select>
     <select id="getCourseCount" resultType="java.lang.Integer">