ソースを参照

3.2.7 评卷参数管理优化

xiaofei 2 年 前
コミット
f34fae4bd3
29 ファイル変更554 行追加175 行削除
  1. 0 19
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamPaperStructurePageDto.java
  2. 12 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/marking/BasicPaperInfo.java
  3. 77 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/marking/ClassMarker.java
  4. 11 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/marking/EvaluationParameters.java
  5. 64 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamPaperClassMarker.java
  6. 39 15
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamPaperStructure.java
  7. 53 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/ExamPaperStructureStatusTypeEnum.java
  8. 10 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamPaperClassMarkerMapper.java
  9. 4 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamStudentMapper.java
  10. 19 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPaperClassMarkerService.java
  11. 4 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPaperGroupService.java
  12. 2 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPaperStructureService.java
  13. 2 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamStudentService.java
  14. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/CloudUserPushServiceImpl.java
  15. 63 50
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncServiceImpl.java
  16. 0 42
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java
  17. 66 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperClassMarkerServiceImpl.java
  18. 15 7
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperGroupServiceImpl.java
  19. 27 8
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperStructureServiceImpl.java
  20. 5 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamStudentServiceImpl.java
  21. 22 0
      distributed-print-business/src/main/resources/db/log/脚本-xiaof.sql
  22. 21 0
      distributed-print-business/src/main/resources/db/upgrade/3.2.7.sql
  23. 3 7
      distributed-print-business/src/main/resources/mapper/ExamDetailMapper.xml
  24. 1 0
      distributed-print-business/src/main/resources/mapper/ExamPaperStructureMapper.xml
  25. 10 0
      distributed-print-business/src/main/resources/mapper/ExamStudentMapper.xml
  26. 13 2
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamPaperStructureController.java
  27. 0 2
      distributed-print/src/main/java/com/qmth/distributed/print/api/WorkController.java
  28. 6 15
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/sync/CloudMarkingTaskUtils.java
  29. 4 0
      teachcloud-report-business/src/main/resources/mapper/ExamPaperClassMarkerMapper.xml

+ 0 - 19
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamPaperStructurePageDto.java

@@ -1,13 +1,6 @@
 package com.qmth.distributed.print.business.bean.dto;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.distributed.print.business.entity.ExamPaperStructure;
-import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusEnum;
-import com.qmth.teachcloud.common.base.BaseEntity;
-import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
 
@@ -22,8 +15,6 @@ public class ExamPaperStructurePageDto extends ExamPaperStructure implements Ser
 
     private static final long serialVersionUID = 1L;
 
-    private String statusStr;
-
     private String taskStatus;
 
     private String transferId;
@@ -36,16 +27,6 @@ public class ExamPaperStructurePageDto extends ExamPaperStructure implements Ser
 
     private String realName;
 
-    @Override
-    public String getStatusStr() {
-        return statusStr;
-    }
-
-    @Override
-    public void setStatusStr(String statusStr) {
-        this.statusStr = statusStr;
-    }
-
     @Override
     public String getTaskStatus() {
         return taskStatus;

+ 12 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/marking/BasicPaperInfo.java

@@ -1,5 +1,6 @@
 package com.qmth.distributed.print.business.bean.marking;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusEnum;
@@ -50,6 +51,9 @@ public class BasicPaperInfo {
     @ApiModelProperty(value = "课程创建的任务序号")
     private String sequence;
 
+    @ApiModelProperty(value = "是否开启分班阅(1:开启,0:关闭)(默认0)")
+    private Boolean openClassReading;
+
     public Long getExamPaperStructureId() {
         return examPaperStructureId;
     }
@@ -129,4 +133,12 @@ public class BasicPaperInfo {
     public void setSequence(String sequence) {
         this.sequence = sequence;
     }
+
+    public Boolean getOpenClassReading() {
+        return openClassReading;
+    }
+
+    public void setOpenClassReading(Boolean openClassReading) {
+        this.openClassReading = openClassReading;
+    }
 }

+ 77 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/marking/ClassMarker.java

@@ -0,0 +1,77 @@
+package com.qmth.distributed.print.business.bean.marking;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 班级评卷员信息
+ */
+public class ClassMarker {
+    @ApiModelProperty(value = "评卷员id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private String id;
+
+    @ApiModelProperty("姓名")
+    private String name;
+
+    @ApiModelProperty("账号")
+    private String loginName;
+
+    @ApiModelProperty("显示名称")
+    private String label;
+
+    @ApiModelProperty("所属机构")
+    private String orgName;
+
+    @ApiModelProperty("班级")
+    private String className;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getLoginName() {
+        return loginName;
+    }
+
+    public void setLoginName(String loginName) {
+        this.loginName = loginName;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public String getOrgName() {
+        return orgName;
+    }
+
+    public void setOrgName(String orgName) {
+        this.orgName = orgName;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+}

+ 11 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/marking/EvaluationParameters.java

@@ -12,17 +12,17 @@ import java.util.List;
  */
 public class EvaluationParameters {
     @ApiModelProperty(value = "基础试卷信息")
-    @NotNull(message = "缺少基础试卷信息")
     private BasicPaperInfo basicPaperInfo;
 
     @ApiModelProperty(value = "试卷结构信息")
-    @NotNull(message = "缺少试卷结构信息")
     private PaperStructureInfo paperStructureInfo;
 
     @ApiModelProperty(value = "分组信息")
-    @NotNull(message = "缺少分组信息")
     private List<GroupInfo> groupInfo;
 
+    @ApiModelProperty(value = "分班阅信息")
+    private List<ClassMarker> classInfo;
+
     public BasicPaperInfo getBasicPaperInfo() {
         return basicPaperInfo;
     }
@@ -46,4 +46,12 @@ public class EvaluationParameters {
     public void setGroupInfo(List<GroupInfo> groupInfo) {
         this.groupInfo = groupInfo;
     }
+
+    public List<ClassMarker> getClassInfo() {
+        return classInfo;
+    }
+
+    public void setClassInfo(List<ClassMarker> classInfo) {
+        this.classInfo = classInfo;
+    }
 }

+ 64 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamPaperClassMarker.java

@@ -0,0 +1,64 @@
+package com.qmth.distributed.print.business.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;
+import java.util.Objects;
+
+/**
+ * @Description: 班级评卷员绑定关系
+ */
+@ApiModel(value = "ExamPaperClassMarker对象", description = "班级评卷员绑定关系表")
+public class ExamPaperClassMarker extends BaseEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "试卷结构id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long examPaperStructureId;
+
+    @ApiModelProperty(value = "评卷员id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long markerId;
+
+    @ApiModelProperty(value = "评卷员登录名")
+    private String loginName;
+
+    @ApiModelProperty(value = "班级")
+    private String className;
+
+    public Long getExamPaperStructureId() {
+        return examPaperStructureId;
+    }
+
+    public void setExamPaperStructureId(Long examPaperStructureId) {
+        this.examPaperStructureId = examPaperStructureId;
+    }
+
+    public Long getMarkerId() {
+        return markerId;
+    }
+
+    public void setMarkerId(Long markerId) {
+        this.markerId = markerId;
+    }
+
+    public String getLoginName() {
+        return loginName;
+    }
+
+    public void setLoginName(String loginName) {
+        this.loginName = loginName;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+}

+ 39 - 15
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/ExamPaperStructure.java

@@ -1,5 +1,7 @@
 package com.qmth.distributed.print.business.entity;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -9,8 +11,12 @@ import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusEnum;
 import com.qmth.teachcloud.common.base.BaseEntity;
 
 import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.StringUtils;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
 
 /**
  * <p>
@@ -85,10 +91,7 @@ public class ExamPaperStructure extends BaseEntity implements Serializable {
     /**
      * 状态
      */
-    private ExamPaperStructureStatusEnum status;
-
-    @TableField(exist = false)
-    private String statusStr;
+    private String status;
     /**
      * 试卷原卷和标答附件ID
      */
@@ -131,10 +134,14 @@ public class ExamPaperStructure extends BaseEntity implements Serializable {
     private Boolean structureChange;
 
 
-    @ApiModelProperty(value = "客观题答案有提交,需要重新统分(1:有变动,需要统分,0:不统分)(默认0)")
+    @ApiModelProperty(value = "客观题答案有提交,需要重新统分(1:有变动,需要统分,0:不统分)(默认0)")
     @TableField("object_answer_change")
     private Boolean objectAnswerChange;
 
+    @ApiModelProperty(value = "是否开启分班阅(1:开启,0:关闭)(默认0)")
+    @TableField("open_class_reading")
+    private Boolean openClassReading;
+
     @TableField(exist = false)
     private String taskStatus;
 
@@ -221,22 +228,14 @@ public class ExamPaperStructure extends BaseEntity implements Serializable {
         this.paperType = paperType;
     }
 
-    public ExamPaperStructureStatusEnum getStatus() {
+    public String getStatus() {
         return status;
     }
 
-    public void setStatus(ExamPaperStructureStatusEnum status) {
+    public void setStatus(String status) {
         this.status = status;
     }
 
-    public String getStatusStr() {
-        return statusStr;
-    }
-
-    public void setStatusStr(String statusStr) {
-        this.statusStr = statusStr;
-    }
-
     public String getPaperAnswer() {
         return paperAnswer;
     }
@@ -340,4 +339,29 @@ public class ExamPaperStructure extends BaseEntity implements Serializable {
     public void setObjectAnswerChange(Boolean objectAnswerChange) {
         this.objectAnswerChange = objectAnswerChange;
     }
+
+    public Boolean getOpenClassReading() {
+        return openClassReading;
+    }
+
+    public void setOpenClassReading(Boolean openClassReading) {
+        this.openClassReading = openClassReading;
+    }
+
+    /**
+     * 状态处理
+     *
+     * @param status   状态
+     * @param type     大类,取ExamPaperStructureStatusTypeEnum
+     * @param category 类别,save或者sync
+     * @param value    值,true或者false
+     * @return
+     */
+    public static String parseStatus(String status, String type, String category, Boolean value) {
+        JSONObject jsonObject = StringUtils.isNotBlank(status) ? JSON.parseObject(status, JSONObject.class) : new JSONObject();
+        JSONObject object = jsonObject.containsKey(type) ? jsonObject.getJSONObject(type) : new JSONObject();
+        object.put(category, value);
+        jsonObject.put(type, object);
+        return JSON.toJSONString(jsonObject);
+    }
 }

+ 53 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/ExamPaperStructureStatusTypeEnum.java

@@ -0,0 +1,53 @@
+package com.qmth.distributed.print.business.enums;
+
+import com.qmth.teachcloud.common.enums.EnumResult;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 考试试卷结构同步状态
+ */
+public enum ExamPaperStructureStatusTypeEnum {
+
+    STRUCTURE("structure","未开始"),
+    GROUP("group","主观题结构同步成功"),
+    CLASS("class","分组同步成功"),
+    OBJECTIVE("objective","绑定评卷员同步成功,结束"),
+    MARKER_LEADER("markerLeader","绑定评卷员同步成功,结束"),
+    MARKER("marker","绑定评卷员同步成功,结束"),
+    ANSWER_FILE("answerFile","绑定评卷员同步成功,结束");
+
+    ExamPaperStructureStatusTypeEnum(String type, String desc) {
+        this.type = type;
+        this.desc = desc;
+    }
+
+    private String type;
+    private String desc;
+
+    public String getType() {
+        return type;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    /**
+     * @return
+     */
+    public static List<EnumResult> listTypes() {
+        List<EnumResult> list = new ArrayList<EnumResult>();
+        for (ExamPaperStructureStatusTypeEnum value : ExamPaperStructureStatusTypeEnum.values()) {
+            EnumResult result = new EnumResult();
+            result.setName(value.name());
+            result.setOrdinal(value.ordinal());
+            result.setCode(null);
+            result.setDesc(value.getDesc());
+            list.add(result);
+        }
+        return list;
+    }
+
+}

+ 10 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamPaperClassMarkerMapper.java

@@ -0,0 +1,10 @@
+package com.qmth.distributed.print.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.distributed.print.business.entity.ExamPaperClassMarker;
+
+/**
+ * @Description: 班级和评卷员关系mapper
+ */
+public interface ExamPaperClassMarkerMapper extends BaseMapper<ExamPaperClassMarker> {
+}

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

@@ -38,8 +38,9 @@ public interface ExamStudentMapper extends BaseMapper<ExamStudent> {
 
     /**
      * 根据班级id查询考生,班级可以是教学班或行政班(两表查)
+     *
      * @param schoolId 学校id
-     * @param classId 班级id
+     * @param classId  班级id
      * @return 考生查询结果
      */
     List<ExamStudent> listExamStudentBySchoolIdAndClazzId(@Param("schoolId") Long schoolId, @Param("classId") String classId);
@@ -56,4 +57,6 @@ public interface ExamStudentMapper extends BaseMapper<ExamStudent> {
     List<SyncExamStudentDto> listStudentByExamDetailCourseId(@Param("examDetailCourseId") Long examDetailCourseId, @Param("paperType") String paperType);
 
     List<String> listTicketNumberByExamId(@Param("examId") Long examId);
+
+    List<String> listUserClass(@Param("schoolId") Long schoolId, @Param("examId") Long examId, @Param("paperNumber") String paperNumber);
 }

+ 19 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPaperClassMarkerService.java

@@ -0,0 +1,19 @@
+package com.qmth.distributed.print.business.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.distributed.print.business.bean.marking.ClassMarker;
+import com.qmth.distributed.print.business.entity.ExamPaperClassMarker;
+import com.qmth.distributed.print.business.entity.ExamPaperStructure;
+
+import java.util.List;
+
+/**
+ * @Description: 班级和评卷员关系实现类
+ */
+public interface ExamPaperClassMarkerService extends IService<ExamPaperClassMarker> {
+    void saveExamPaperClassInfo(ExamPaperStructure examPaperStructure, Boolean openClassReading, List<ClassMarker> classInfo);
+
+    void deleteExamPaperClassInfo(Long paperStructureId);
+
+    List<ExamPaperClassMarker> listByExamPaperStructureId(Long id);
+}

+ 4 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPaperGroupService.java

@@ -5,6 +5,7 @@ import com.qmth.distributed.print.business.bean.marking.CardJpgResult;
 import com.qmth.distributed.print.business.bean.marking.GroupInfo;
 import com.qmth.distributed.print.business.bean.marking.Marker;
 import com.qmth.distributed.print.business.entity.ExamPaperGroup;
+import com.qmth.distributed.print.business.entity.ExamPaperStructure;
 
 import java.util.List;
 
@@ -18,10 +19,10 @@ public interface ExamPaperGroupService extends IService<ExamPaperGroup> {
     /**
      * 保存考试试卷分组信息
      *
-     * @param examPaperStructureId 试卷结构id
-     * @param groupInfo            分组信息
+     * @param examPaperStructure 试卷结构对象
+     * @param groupInfo          分组信息
      */
-    void saveExamPaperGroupInfo(Long examPaperStructureId, List<GroupInfo> groupInfo);
+    void saveExamPaperGroupInfo(ExamPaperStructure examPaperStructure, List<GroupInfo> groupInfo);
 
     /**
      * 删除考试试卷分组信息

+ 2 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPaperStructureService.java

@@ -95,4 +95,6 @@ public interface ExamPaperStructureService extends IService<ExamPaperStructure>
      * 自动统分
      */
     void subjectCalculate();
+
+    List<String> listUserClass(Long examId, String paperNumber);
 }

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

@@ -49,4 +49,6 @@ public interface ExamStudentService extends IService<ExamStudent> {
     List<String> listTicketNumberByExamId(Long examId);
 
     void removeByExamDetailCourseId(Long id);
+
+    List<String> listUserClass(Long schoolId, Long examId, String paperNumber);
 }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/CloudUserPushServiceImpl.java

@@ -102,7 +102,7 @@ public class CloudUserPushServiceImpl implements CloudUserPushService {
                     Long schoolId = userPushParam.getSchoolId();
                     String orgCode = userPushParam.getOrgCode();
 
-                    PushResult pushResult = stmmsUtils.syncUser(account, name, password, roleValue, enable, schoolId, orgCode);
+                    PushResult pushResult = stmmsUtils.syncUser(account, name, roleValue, enable, schoolId, orgCode);
                     boolean syncResult = pushResult.getSuccess();
                     String syncExceptionCell = null;
 

+ 63 - 50
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncServiceImpl.java

@@ -10,7 +10,7 @@ import com.qmth.distributed.print.business.bean.dto.SyncExamTaskDto;
 import com.qmth.distributed.print.business.bean.marking.GroupInfo;
 import com.qmth.distributed.print.business.bean.marking.Marker;
 import com.qmth.distributed.print.business.entity.*;
-import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusEnum;
+import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusTypeEnum;
 import com.qmth.distributed.print.business.enums.ExamTaskSyncStatusEnum;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.teachcloud.common.bean.dto.stmms.GroupDetailDTO;
@@ -18,12 +18,17 @@ import com.qmth.teachcloud.common.bean.dto.stmms.PicConfig;
 import com.qmth.teachcloud.common.bean.dto.stmms.QuestionBaseDTO;
 import com.qmth.teachcloud.common.bean.dto.stmms.QuestionDTO;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
-import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.*;
+import com.qmth.teachcloud.common.entity.BasicAttachment;
+import com.qmth.teachcloud.common.entity.BasicCollege;
+import com.qmth.teachcloud.common.entity.SysOrg;
+import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.enums.userPush.SpecialPrivilegeEnum;
-import com.qmth.teachcloud.common.service.*;
+import com.qmth.teachcloud.common.service.BasicAttachmentService;
+import com.qmth.teachcloud.common.service.SysOrgService;
+import com.qmth.teachcloud.common.service.SysUserService;
+import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.sync.CloudMarkingTaskUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -84,6 +89,9 @@ public class DataSyncServiceImpl implements DataSyncService {
     @Resource
     private ExamPaperGroupMarkerService examPaperGroupMarkerService;
 
+    @Resource
+    private ExamPaperClassMarkerService examPaperClassMarkerService;
+
     @Resource
     ExamTaskService examTaskService;
 
@@ -212,27 +220,21 @@ public class DataSyncServiceImpl implements DataSyncService {
     @Async
     @Override
     public void syncPaperStructureAndGroup(ExamPaperStructure examPaperStructure, TBSyncTask tbSyncTask) {
-        // 开始同步
-        ExamPaperStructureStatusEnum structureStatus = ExamPaperStructureStatusEnum.INIT;
         // 同步初始参数
         TaskResultEnum result = null;
         String mainProgress = "<b>步骤:删除分组->主观题结构->主观题分组->绑定评卷员</b><br>";
         String errorMessage = "";
-        try {
-            String paperTypes = examPaperStructure.getPaperType();
-            if (StringUtils.isBlank(paperTypes)) {
-                throw ExceptionResultEnum.ERROR.exception("没有可同步的试卷类型");
-            }
 
-            Long schoolId = examPaperStructure.getSchoolId();
-            // 云阅卷考试ID
-            String examId = String.valueOf(examPaperStructure.getThirdRelateId());
-            // 科目代码(课程代码+卷型+课程序号)
-            String subjectCode = examPaperStructure.getCourseCode().concat(examPaperStructure.getPaperType()).concat(examPaperStructure.getSequence());
+        Long schoolId = examPaperStructure.getSchoolId();
+        // 云阅卷考试ID
+        String examId = String.valueOf(examPaperStructure.getThirdRelateId());
+        // 科目代码(课程代码+卷型+课程序号)
+        String subjectCode = examPaperStructure.getCourseCode().concat(examPaperStructure.getPaperType()).concat(examPaperStructure.getSequence());
 
-            // 同步中
-            tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.RUNNING, null, null);
+        // 同步中
+        tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.RUNNING, null, null);
 
+        try {
             // 同步分组(检查,若存在,先删除)
             errorMessage = "[删除分组]";
             int i = 0;
@@ -253,7 +255,8 @@ public class DataSyncServiceImpl implements DataSyncService {
                 }).collect(Collectors.toList());
 
                 // 主观题不传试卷类型 update by 20220711
-                cloudMarkingTaskUtils.syncPaperStructure(schoolId, examId, subjectCode, false, null, syncSubjectiveStructureDatas);
+                boolean syncPaperStructure = cloudMarkingTaskUtils.syncPaperStructure(schoolId, examId, subjectCode, false, null, syncSubjectiveStructureDatas);
+                examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.STRUCTURE.getType(), "sync", syncPaperStructure));
             }
 
             // 清掉云阅卷主观题答案
@@ -267,8 +270,6 @@ public class DataSyncServiceImpl implements DataSyncService {
                 }
             }
 
-            structureStatus = ExamPaperStructureStatusEnum.SUBJECTIVE_FINISH;
-
             errorMessage = "[主观题分组]";
             List<ExamPaperGroup> examPaperGroups = examPaperGroupService.listByExamPaperStructureId(examPaperStructure.getId());
             if (!CollectionUtils.isEmpty(examPaperGroups)) {
@@ -297,34 +298,49 @@ public class DataSyncServiceImpl implements DataSyncService {
                     }
                     groupDetailDTOS.add(groupDetailDTO);
                 }
-                cloudMarkingTaskUtils.saveMarkerGroup(schoolId, examId, subjectCode, 0, groupDetailDTOS);
+                boolean saveMarkerGroup = cloudMarkingTaskUtils.saveMarkerGroup(schoolId, examId, subjectCode, 0, groupDetailDTOS);
+                examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.GROUP.getType(), "sync", saveMarkerGroup));
             }
-            structureStatus = ExamPaperStructureStatusEnum.GROUP_FINISH;
 
             // 同步绑定评卷员
-            errorMessage = "[绑定评卷员]";
-            String orgCode = cloudMarkingTaskUtils.isCollegeMode(schoolId) ? sysOrgService.findCollegeByCourseCode(schoolId, examPaperStructure.getCourseCode()).getCode() : null;
-            SysConfigService sysConfigService = SpringContextHolder.getBean(SysConfigService.class);
-            SysConfig sysConfig = sysConfigService.getByKey("sys.user.initPassword");
-            for (ExamPaperGroup examPaperGroup : examPaperGroups) {
-                List<ExamPaperGroupMarker> examPaperGroupMarkers = examPaperGroupMarkerService.listByGroupId(examPaperGroup.getId());
-                for (ExamPaperGroupMarker examPaperGroupMarker : examPaperGroupMarkers) {
-                    // 推送用户
-                    SysUser markerUser = sysUserService.getById(examPaperGroupMarker.getMarkerId());
-                    cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.MARKER.getPrefix() + markerUser.getLoginName(), markerUser.getRealName(), sysConfig.getConfigValue(), SpecialPrivilegeEnum.MARKER.getValue(), markerUser.getEnable(), schoolId, orgCode);
-                    // 绑定评卷员
-                    cloudMarkingTaskUtils.saveMarker(schoolId, examId, subjectCode, examPaperGroup.getGroupNumber(), examPaperGroupMarker.getLoginName());
+            try {
+                errorMessage = "[绑定评卷员]";
+                String orgCode = cloudMarkingTaskUtils.isCollegeMode(schoolId) ? sysOrgService.findCollegeByCourseCode(schoolId, examPaperStructure.getCourseCode()).getCode() : null;
+                for (ExamPaperGroup examPaperGroup : examPaperGroups) {
+                    List<ExamPaperGroupMarker> examPaperGroupMarkers = examPaperGroupMarkerService.listByGroupId(examPaperGroup.getId());
+                    for (ExamPaperGroupMarker examPaperGroupMarker : examPaperGroupMarkers) {
+                        // 推送用户
+                        SysUser markerUser = sysUserService.getById(examPaperGroupMarker.getMarkerId());
+                        cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.MARKER.getPrefix() + markerUser.getLoginName(), markerUser.getRealName(), SpecialPrivilegeEnum.MARKER.getValue(), markerUser.getEnable(), schoolId, orgCode);
+                        // 绑定评卷员
+                        cloudMarkingTaskUtils.saveMarker(schoolId, examId, subjectCode, examPaperGroup.getGroupNumber(), examPaperGroupMarker.getLoginName());
+                    }
+                }
+                examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.MARKER.getType(), "sync", true));
+            } catch (IllegalAccessException e) {
+                examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.MARKER.getType(), "sync", false));
+            }
+
+            errorMessage = "[分班阅]";
+            List<ExamPaperClassMarker> examPaperClassMarkers = examPaperClassMarkerService.listByExamPaperStructureId(examPaperStructure.getId());
+            if (!CollectionUtils.isEmpty(examPaperClassMarkers)) {
+                try {
+                    for (ExamPaperClassMarker examPaperClassMarker : examPaperClassMarkers) {
+                        String className = examPaperClassMarker.getClassName();
+                        List<String> classNames = Arrays.asList(className.split(","));
+                        cloudMarkingTaskUtils.saveUserClass(schoolId, examId, examPaperClassMarker.getLoginName(), classNames);
+                    }
+                    examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.CLASS.getType(), "sync", true));
+                } catch (Exception e) {
+                    examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.CLASS.getType(), "sync", false));
                 }
             }
-            structureStatus = ExamPaperStructureStatusEnum.FINISH;
             result = TaskResultEnum.SUCCESS;
         } catch (Exception e) {
             result = TaskResultEnum.ERROR;
             errorMessage = errorMessage + e.getMessage();
         } finally {
-            examPaperStructure.setStatus(structureStatus);
             examPaperStructureService.updateById(examPaperStructure);
-
             tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.FINISH, result, mainProgress + errorMessage);
         }
     }
@@ -418,19 +434,18 @@ public class DataSyncServiceImpl implements DataSyncService {
                     }
                 }
                 String paperAnswerUrl = JSONObject.toJSONString(paperAnswerJsons);
-
                 // 更新url
-                UpdateWrapper<ExamPaperStructure> updateWrapper = new UpdateWrapper<>();
-                updateWrapper.lambda().set(ExamPaperStructure::getPaperAnswer, paperAnswerUrl).eq(ExamPaperStructure::getId, examPaperStructure.getId());
-                examPaperStructureService.update(updateWrapper);
+                examPaperStructure.setPaperAnswer(paperAnswerUrl);
+                examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.ANSWER_FILE.getType(), "sync", true));
             }
-
             result = TaskResultEnum.SUCCESS;
         } catch (ApiException e) {
+            examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.ANSWER_FILE.getType(), "sync", false));
             result = TaskResultEnum.ERROR;
             errorMessage = e.getMessage();
         } finally {
             tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.FINISH, result, errorMessage);
+            examPaperStructureService.updateById(examPaperStructure);
             if (paperFile != null) {
                 paperFile.delete();
             }
@@ -506,19 +521,19 @@ public class DataSyncServiceImpl implements DataSyncService {
                     // 推送用户
                     String orgCode = cloudMarkingTaskUtils.isCollegeMode(schoolId) ? sysOrgService.findCollegeByCourseCode(schoolId, examPaperStructure.getCourseCode()).getCode() : null;
                     SysUser markerUser = sysUserService.getById(object.getLong("id"));
-                    SysConfigService sysConfigService = SpringContextHolder.getBean(SysConfigService.class);
-                    SysConfig sysConfig = sysConfigService.getByKey("sys.user.initPassword");
-                    cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.SUBJECT_HEADER.getPrefix() + markerUser.getLoginName(), markerUser.getRealName(), sysConfig.getConfigValue(), SpecialPrivilegeEnum.SUBJECT_HEADER.getValue(), markerUser.getEnable(), schoolId, orgCode);
-
+                    cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.SUBJECT_HEADER.getPrefix() + markerUser.getLoginName(), markerUser.getRealName(), SpecialPrivilegeEnum.SUBJECT_HEADER.getValue(), markerUser.getEnable(), schoolId, orgCode);
                     cloudMarkingTaskUtils.saveMarkLeader(schoolId, subjectCode, object.getString("loginName"), orgCode);
                 }
             }
+            examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.MARKER_LEADER.getType(), "sync", true));
             result = TaskResultEnum.SUCCESS;
         } catch (Exception e) {
+            examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.MARKER_LEADER.getType(), "sync", false));
             result = TaskResultEnum.ERROR;
             errorMessage = e.getMessage();
         } finally {
             tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.FINISH, result, errorMessage);
+            examPaperStructureService.updateById(examPaperStructure);
         }
     }
 
@@ -537,11 +552,9 @@ public class DataSyncServiceImpl implements DataSyncService {
             List<Marker> markerList = groupInfo.getMarkerList();
 
             String orgCode = cloudMarkingTaskUtils.isCollegeMode(schoolId) ? sysOrgService.findCollegeByCourseCode(schoolId, examPaperStructure.getCourseCode()).getCode() : null;
-            SysConfigService sysConfigService = SpringContextHolder.getBean(SysConfigService.class);
-            SysConfig sysConfig = sysConfigService.getByKey("sys.user.initPassword");
             for (Marker marker : markerList) {
                 // 推送用户
-                cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.MARKER.getPrefix() + marker.getLoginName(), marker.getName(), sysConfig.getConfigValue(), SpecialPrivilegeEnum.MARKER.getValue(), true, schoolId, orgCode);
+                cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.MARKER.getPrefix() + marker.getLoginName(), marker.getName(), SpecialPrivilegeEnum.MARKER.getValue(), true, schoolId, orgCode);
                 // 绑定评卷员
                 cloudMarkingTaskUtils.saveMarker(schoolId, String.valueOf(examPaperStructure.getThirdRelateId()), subjectCode, groupInfo.getGroupNumber(), marker.getLoginName());
             }

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

@@ -373,48 +373,6 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
         IPage<ExaminationResult> page = examDetailMapper.findBriefPage(new Page<>(pageNumber, pageSize), schoolId, semesterId, examId, printPlanIdList, courseCode, paperNumber, examPlace, examRoom, packageCode, startDate, endDate, dpr);
         List<ExaminationResult> list = page.getRecords();
         for (ExaminationResult examinationResult : list) {
-            String examDetailCourseIds = examinationResult.getExamDetailCourseIds();
-            if (examDetailCourseIds == null || examDetailCourseIds.length() == 0) {
-                throw ExceptionResultEnum.ERROR.exception("考务数据缺失课程信息");
-            }
-            // 处理课程和科目
-            String[] arr = examDetailCourseIds.split(",");
-
-            String courseNameCodeStr = "";
-            String paperNumberStr = "";
-            Set<String> cardTypeSet = new HashSet<>();
-            for (String examDetailCourseId : arr) {
-                ExamDetailCourse examDetailCourse = examDetailCourseService.getById(examDetailCourseId);
-                String code = examDetailCourse.getCourseCode();
-                String name = examDetailCourse.getCourseName();
-                String number = examDetailCourse.getPaperNumber();
-                courseNameCodeStr = courseNameCodeStr + name + "(" + code + ")" + SystemConstant.PAUSE_SIGN;
-                paperNumberStr = paperNumberStr + number + SystemConstant.PAUSE_SIGN;
-
-                if (StringUtils.isNotBlank(examDetailCourse.getPaperType())) {
-                    List<String> paperTypes = Arrays.asList(examDetailCourse.getPaperType().split(","));
-                    ExamTaskDetail examTaskDetail = examTaskDetailService.findByExamIdAndCourseCodeAndPaperNumber(schoolId, examinationResult.getExamId(), code, number);
-                    List<JSONObject> paperAttachments = JSON.parseArray(examTaskDetail.getPaperAttachmentIds(), JSONObject.class).stream().filter(m -> paperTypes.contains(m.getString("name"))).collect(Collectors.toList());
-                    for (JSONObject jsonObject : paperAttachments) {
-                        String cardTypeString = jsonObject.getString("cardType");
-                        String createMethod = jsonObject.getString("createMethod");
-                        if (cardTypeString.equals(CardTypeEnum.GENERIC.name()) && StringUtils.isNotBlank(createMethod) && createMethod.equals(CardCreateMethodEnum.UPLOAD.name())) {
-                            cardTypeSet.add(SyncCardTypeEnum.GENERIC.getDesc());
-                        } else {
-                            cardTypeSet.add(SyncCardTypeEnum.CUSTOM.getDesc());
-                        }
-                    }
-                }
-            }
-            courseNameCodeStr = courseNameCodeStr.substring(0, courseNameCodeStr.length() - SystemConstant.PAUSE_SIGN.length());
-            paperNumberStr = paperNumberStr.substring(0, paperNumberStr.length() - SystemConstant.PAUSE_SIGN.length());
-            examinationResult.setCourseNameCode(courseNameCodeStr);
-            examinationResult.setPaperNumber(paperNumberStr);
-
-            if (cardTypeSet.size() > 0) {
-                examinationResult.setCardType(String.join(SystemConstant.PAUSE_SIGN, cardTypeSet));
-            }
-
             // 处理时间
             Long startTime = examinationResult.getExamStartTime();
             Long endTime = examinationResult.getExamEndTime();

+ 66 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperClassMarkerServiceImpl.java

@@ -0,0 +1,66 @@
+package com.qmth.distributed.print.business.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.distributed.print.business.bean.marking.ClassMarker;
+import com.qmth.distributed.print.business.entity.ExamPaperClassMarker;
+import com.qmth.distributed.print.business.entity.ExamPaperStructure;
+import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusTypeEnum;
+import com.qmth.distributed.print.business.mapper.ExamPaperClassMarkerMapper;
+import com.qmth.distributed.print.business.service.ExamPaperClassMarkerService;
+import com.qmth.distributed.print.business.service.ExamPaperStructureService;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description: 班级和评卷员关系服务实现类
+ */
+@Service
+public class ExamPaperClassMarkerServiceImpl extends ServiceImpl<ExamPaperClassMarkerMapper, ExamPaperClassMarker> implements ExamPaperClassMarkerService {
+
+    @Resource
+    ExamPaperStructureService examPaperStructureService;
+
+    @Transactional
+    @Override
+    public void saveExamPaperClassInfo(ExamPaperStructure examPaperStructure, Boolean openClassReading, List<ClassMarker> classInfo) {
+        // 1.删除原有数据
+        this.deleteExamPaperClassInfo(examPaperStructure.getId());
+        if (openClassReading && !CollectionUtils.isEmpty(classInfo)) {
+            List<ExamPaperClassMarker> list = new ArrayList<>();
+            for (ClassMarker classMarker : classInfo) {
+                ExamPaperClassMarker examPaperClassMarker = new ExamPaperClassMarker();
+                examPaperClassMarker.setId(SystemConstant.getDbUuid());
+                examPaperClassMarker.setExamPaperStructureId(examPaperStructure.getId());
+                examPaperClassMarker.setMarkerId(Long.valueOf(classMarker.getId()));
+                examPaperClassMarker.setLoginName(classMarker.getLoginName());
+                examPaperClassMarker.setClassName(classMarker.getClassName());
+                list.add(examPaperClassMarker);
+            }
+            this.saveBatch(list);
+            examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.CLASS.getType(), "save", true));
+            examPaperStructureService.updateById(examPaperStructure);
+        }
+    }
+
+    @Override
+    public void deleteExamPaperClassInfo(Long paperStructureId) {
+        UpdateWrapper<ExamPaperClassMarker> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda().eq(ExamPaperClassMarker::getExamPaperStructureId, paperStructureId);
+        this.remove(updateWrapper);
+    }
+
+    @Override
+    public List<ExamPaperClassMarker> listByExamPaperStructureId(Long id) {
+        QueryWrapper<ExamPaperClassMarker> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamPaperClassMarker::getExamPaperStructureId, id);
+        return this.list(queryWrapper);
+    }
+}

+ 15 - 7
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperGroupServiceImpl.java

@@ -3,14 +3,14 @@ package com.qmth.distributed.print.business.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.qmth.distributed.print.business.bean.marking.GroupInfo;
-import com.qmth.distributed.print.business.bean.marking.Marker;
-import com.qmth.distributed.print.business.bean.marking.PictureConfig;
-import com.qmth.distributed.print.business.bean.marking.Question;
+import com.qmth.distributed.print.business.bean.marking.*;
 import com.qmth.distributed.print.business.entity.ExamPaperGroup;
+import com.qmth.distributed.print.business.entity.ExamPaperStructure;
+import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusTypeEnum;
 import com.qmth.distributed.print.business.mapper.ExamPaperGroupMapper;
 import com.qmth.distributed.print.business.service.ExamPaperGroupMarkerService;
 import com.qmth.distributed.print.business.service.ExamPaperGroupService;
+import com.qmth.distributed.print.business.service.ExamPaperStructureService;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.paperGroup.ScorePolicyEnum;
@@ -34,11 +34,14 @@ public class ExamPaperGroupServiceImpl extends ServiceImpl<ExamPaperGroupMapper,
     @Resource
     private ExamPaperGroupMarkerService examPaperGroupMarkerService;
 
+    @Resource
+    private ExamPaperStructureService examPaperStructureService;
+
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public void saveExamPaperGroupInfo(Long examPaperStructureId, List<GroupInfo> groupInfo) {
+    public void saveExamPaperGroupInfo(ExamPaperStructure examPaperStructure, List<GroupInfo> groupInfo) {
         // 1.删除原有分组
-        this.deleteExamPaperGroupInfo(examPaperStructureId);
+        this.deleteExamPaperGroupInfo(examPaperStructure.getId());
         // 2.新增新的试卷结构分组
         for (int i = 0; i < groupInfo.size(); i++) {
             GroupInfo group = groupInfo.get(i);
@@ -54,7 +57,7 @@ public class ExamPaperGroupServiceImpl extends ServiceImpl<ExamPaperGroupMapper,
             List<PictureConfig> pictureConfigList = group.getPictureConfigList();
 
             ExamPaperGroup examPaperGroup = new ExamPaperGroup();
-            examPaperGroup.setExamPaperStructureId(examPaperStructureId);
+            examPaperGroup.setExamPaperStructureId(examPaperStructure.getId());
             examPaperGroup.setGroupNumber(i + 1);
             examPaperGroup.setDoubleRate(doubleRate);
             examPaperGroup.setArbitrateThreshold(arbitrateThreshold);
@@ -68,6 +71,11 @@ public class ExamPaperGroupServiceImpl extends ServiceImpl<ExamPaperGroupMapper,
             Long groupId = examPaperGroup.getId();
             examPaperGroupMarkerService.saveExamPaperGroupMarkerByGroupId(groupId, markerList);
         }
+        // 先保存分组
+        examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.GROUP.getType(), "save", true));
+        // 再保存评卷员
+        examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.MARKER.getType(), "save", true));
+        examPaperStructureService.updateById(examPaperStructure);
     }
 
     @Transactional(rollbackFor = Exception.class)

+ 27 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperStructureServiceImpl.java

@@ -17,6 +17,7 @@ import com.qmth.distributed.print.business.bean.dto.ExamPaperSubjectiveStructure
 import com.qmth.distributed.print.business.bean.marking.*;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusEnum;
+import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusTypeEnum;
 import com.qmth.distributed.print.business.enums.ExamTaskSyncStatusEnum;
 import com.qmth.distributed.print.business.mapper.ExamPaperStructureMapper;
 import com.qmth.distributed.print.business.service.*;
@@ -101,6 +102,12 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
     @Resource
     private BasicRoleDataPermissionService basicRoleDataPermissionService;
 
+    @Resource
+    ExamStudentService examStudentService;
+
+    @Resource
+    ExamPaperClassMarkerService examPaperClassMarkerService;
+
     @Override
     public IPage<ExamPaperStructurePageDto> listByPropositionTeacherId(Long semesterId, Long examId, Integer pageNumber, Integer pageSize, String[] structureStatusEnums, Boolean ready) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
@@ -109,8 +116,6 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
         Page<ExamPaperStructure> page = new Page<>(pageNumber, pageSize);
         IPage<ExamPaperStructurePageDto> examPaperStructureIPage = this.baseMapper.listByPropositionTeacherId(page, schoolId, semesterId, examId, ExamTaskSyncStatusEnum.FINISH.name(), structureStatusEnums, ready, dpr);
         examPaperStructureIPage.getRecords().forEach(m -> {
-            m.setStatusStr(ExamPaperStructureStatusEnum.INIT.equals(m.getStatus()) ? "未提交" : "已提交");
-
             // 试卷结构同步任务状态
             if (m.getId() != null) {
                 QueryWrapper<TBSyncTask> queryWrapper = new QueryWrapper<>();
@@ -272,6 +277,7 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
 
         // 保存
         examPaperStructure.setPaperAnswer(JSONObject.toJSONString(paperAnswerList));
+        examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.ANSWER_FILE.getType(), "save", true));
         this.updateById(examPaperStructure);
 
         return examPaperStructure;
@@ -356,7 +362,9 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
         // 2.保存试卷结构
         ExamPaperStructure examPaperStructure = this.saveExamPaperStructure(evaluationParameterStr, requestUser);
         // 3.保存分组和分组关系信息
-        examPaperGroupService.saveExamPaperGroupInfo(examPaperStructure.getId(), evaluationParameters.getGroupInfo());
+        examPaperGroupService.saveExamPaperGroupInfo(examPaperStructure, evaluationParameters.getGroupInfo());
+        // 4.保存分班阅信息
+        examPaperClassMarkerService.saveExamPaperClassInfo(examPaperStructure, examPaperStructure.getOpenClassReading(), evaluationParameters.getClassInfo());
         // 返回试卷结构信息
         return examPaperStructure;
     }
@@ -387,7 +395,7 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
             }
         }
         examPaperStructure.setObjectiveStructure(objectiveStructure);
-
+        examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.OBJECTIVE.getType(), "save", true));
         this.updateById(examPaperStructure);
         return examPaperStructure;
     }
@@ -451,6 +459,7 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
         }
 
         examPaperStructure.setMarkLeader(markLeader);
+        examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.MARKER_LEADER.getType(), "save", true));
         this.updateById(examPaperStructure);
         return examPaperStructure;
     }
@@ -472,6 +481,7 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
         }
         UpdateWrapper<ExamPaperStructure> updateWrapper = new UpdateWrapper<>();
         updateWrapper.lambda().set(ExamPaperStructure::getPaperInfoJson, JSON.toJSONString(evaluationParameters))
+                .set(ExamPaperStructure::getStatus, ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.MARKER.getType(), "save", true))
                 .eq(ExamPaperStructure::getId, examPaperStructureId);
         this.update(updateWrapper);
         return examPaperStructure;
@@ -513,6 +523,12 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
         }
     }
 
+    @Override
+    public List<String> listUserClass(Long examId, String paperNumber) {
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        return examStudentService.listUserClass(schoolId, examId, paperNumber);
+    }
+
     /**
      * 保存试卷结构
      *
@@ -537,7 +553,6 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
         if (!SystemConstant.strNotNull(paperType)) {
             throw ExceptionResultEnum.ERROR.exception("试卷类型不存在");
         }
-        ExamPaperStructureStatusEnum status = basicPaperInfo.getStatus();
         String objectiveStructure = JSON.toJSONString(paperStructureInfo.getObjectiveQuestionList());
         String subjectiveStructure = JSON.toJSONString(paperStructureInfo.getSubjectiveQuestionList());
         Long propositionTeacherId = requestUser.getId();
@@ -556,11 +571,11 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
         examPaperStructure.setCourseName(courseName);
         examPaperStructure.setSequence(sequence);
         examPaperStructure.setPaperType(paperType);
-        examPaperStructure.setStatus(status);
         examPaperStructure.setObjectiveStructure(objectiveStructure);
         examPaperStructure.setSubjectiveStructure(subjectiveStructure);
         examPaperStructure.setPaperInfoJson(evaluationParameterStr);
         examPaperStructure.setPropositionTeacherId(propositionTeacherId);
+        examPaperStructure.setOpenClassReading(basicPaperInfo.getOpenClassReading());
         examPaperStructure.setEnable(true);
         if (SystemConstant.longNotNull(examPaperStructureId)) {
             // 如果是编辑试卷机构,当客观题信息(大题名称、大题号、小题号、分数)全都没变的情况下不更新客观题机构(因为答案可能已经上传)
@@ -574,6 +589,10 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
                 // 如果本次编辑试卷结构 客观题结构和之前数据库中存储的确实一致,则不更新客观题结构(把原数据库的客观题结构作为更新的)
                 examPaperStructure.setObjectiveStructure(oldObjectiveQuestion);
             }
+            examPaperStructure.setStatus(ExamPaperStructure.parseStatus(old.getStatus(), ExamPaperStructureStatusTypeEnum.STRUCTURE.getType(), "save", true));
+
+        } else {
+            examPaperStructure.setStatus(ExamPaperStructure.parseStatus(null, ExamPaperStructureStatusTypeEnum.STRUCTURE.getType(), "save", true));
         }
         this.saveOrUpdate(examPaperStructure);
         return examPaperStructure;
@@ -640,7 +659,7 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
                 throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(errors));
             }
             return finalExcelList;
-        },2);
+        }, 2);
         List<Object> list = new ArrayList<>();
         for (LinkedMultiValueMap<Integer, Object> map : finalList) {
             for (Map.Entry<Integer, List<Object>> entry : map.entrySet()) {
@@ -699,7 +718,7 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
                 throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(errors));
             }
             return finalExcelList;
-        },2);
+        }, 2);
         List<Object> list = new ArrayList<>();
         for (LinkedMultiValueMap<Integer, Object> map : finalList) {
             for (Map.Entry<Integer, List<Object>> entry : map.entrySet()) {

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

@@ -130,4 +130,9 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
         updateWrapper.lambda().eq(ExamStudent::getExamDetailCourseId, id);
         this.remove(updateWrapper);
     }
+
+    @Override
+    public List<String> listUserClass(Long schoolId, Long examId, String paperNumber) {
+        return this.baseMapper.listUserClass(schoolId, examId, paperNumber);
+    }
 }

+ 22 - 0
distributed-print-business/src/main/resources/db/log/脚本-xiaof.sql

@@ -261,3 +261,25 @@ CREATE TABLE `sys_role_privilege_custom` (
 
 ALTER TABLE `sys_role_privilege`
     ADD COLUMN `school_id` BIGINT(20) NULL COMMENT '内置角色,按学校自定义的权限' AFTER `enable`;
+
+
+CREATE TABLE `exam_paper_class_marker` (
+     `id` BIGINT(20) NOT NULL,
+     `exam_paper_structure_id` BIGINT(20) NULL COMMENT '评卷参数id',
+     `marker_id` BIGINT(20) NULL COMMENT '评卷员id',
+     `login_name` VARCHAR(100) NULL COMMENT '评卷员登录名',
+     `class_name` MEDIUMTEXT NULL COMMENT '班级',
+     `create_id` BIGINT(20) NULL,
+     `create_time` BIGINT(20) NULL,
+     `update_id` BIGINT(20) NULL,
+     `update_time` BIGINT(20) NULL,
+     PRIMARY KEY (`id`));
+
+ALTER TABLE `exam_paper_structure`
+    ADD COLUMN `open_class_reading` TINYINT(1) NULL DEFAULT 0 COMMENT '是否开启分班阅' AFTER `object_answer_change`;
+
+ALTER TABLE `exam_paper_structure`
+    CHANGE COLUMN `status` `status` VARCHAR(200) NULL DEFAULT NULL COMMENT '{\n    \"structure\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"group\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"class\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"objective\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"markerLeader\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"marker\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"answerFile\":\n    {\n        \"save\": false,\n        \"sync\": false\n    }\n}' ;
+
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('882', '查询分班阅班级', '/api/admin/exam/structure/list_user_class', 'URL', '488', '13', 'AUTH', '1', '1', '1');
+UPDATE `sys_privilege` SET `related` = '671,672,882' WHERE (`id` = '670');

+ 21 - 0
distributed-print-business/src/main/resources/db/upgrade/3.2.7.sql

@@ -168,3 +168,24 @@ VALUES(880, '重启流程', '/api/admin/exam/task/restart', 'URL', 42, 9, 'AUTH'
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
 VALUES(881, '打回', 'Restart', 'LINK', 42, 6, 'AUTH', '880', 1, 0, 1);
+
+CREATE TABLE `exam_paper_class_marker` (
+                                           `id` BIGINT(20) NOT NULL,
+                                           `exam_paper_structure_id` BIGINT(20) NULL COMMENT '评卷参数id',
+                                           `marker_id` BIGINT(20) NULL COMMENT '评卷员id',
+                                           `login_name` VARCHAR(100) NULL COMMENT '评卷员登录名',
+                                           `class_name` MEDIUMTEXT NULL COMMENT '班级',
+                                           `create_id` BIGINT(20) NULL,
+                                           `create_time` BIGINT(20) NULL,
+                                           `update_id` BIGINT(20) NULL,
+                                           `update_time` BIGINT(20) NULL,
+                                           PRIMARY KEY (`id`));
+
+ALTER TABLE `exam_paper_structure`
+    ADD COLUMN `open_class_reading` TINYINT(1) NULL DEFAULT 0 COMMENT '是否开启分班阅' AFTER `object_answer_change`;
+
+ALTER TABLE `exam_paper_structure`
+    CHANGE COLUMN `status` `status` VARCHAR(200) NULL DEFAULT NULL COMMENT '{\n    \"structure\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"group\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"class\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"objective\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"markerLeader\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"marker\":\n    {\n        \"save\": false,\n        \"sync\": false\n    },\n    \"answerFile\":\n    {\n        \"save\": false,\n        \"sync\": false\n    }\n}' ;
+
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('882', '查询分班阅班级', '/api/admin/exam/structure/list_user_class', 'URL', '488', '13', 'AUTH', '1', '1', '1');
+UPDATE `sys_privilege` SET `related` = '671,672,882' WHERE (`id` = '670');

+ 3 - 7
distributed-print-business/src/main/resources/mapper/ExamDetailMapper.xml

@@ -157,18 +157,14 @@
         MAX(det.create_id) AS createId,
         MAX(det.create_time) AS createTime,
         GROUP_CONCAT(cou.id) AS examDetailCourseIds,
-        GROUP_CONCAT(cou.course_code) AS courseCodes,
-        GROUP_CONCAT(cou.paper_number) AS paperNumbers
+        GROUP_CONCAT(CONCAT(cou.course_name, '(', cou.course_code, ')')) AS courseNameCode,
+        GROUP_CONCAT(cou.paper_number) AS paperNumber
         FROM
         exam_detail det
         INNER JOIN
         exam_detail_course cou ON det.id = cou.exam_detail_id
         LEFT JOIN
-        sys_user b on det.create_id = b.id
-        LEFT JOIN
-        exam_print_plan epp on epp.id = det.print_plan_id
-        LEFT JOIN
-        basic_exam be on be.id = epp.exam_id
+        basic_exam be on be.id = det.exam_id
         LEFT JOIN
         basic_semester bs on bs.id = be.semester_id
         <where>

+ 1 - 0
distributed-print-business/src/main/resources/mapper/ExamPaperStructureMapper.xml

@@ -10,6 +10,7 @@
             eps.paper_info_json paperInfoJson,
             eps.paper_answer paperAnswer,
             eps.mark_leader markLeader,
+            eps.open_class_reading openClassReading,
             su.login_name loginName,
             su.real_name realName
             from

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

@@ -305,4 +305,14 @@
                         es.exam_detail_course_id = edc.id
                         AND ed.exam_id = #{examId})
     </select>
+    <select id="listUserClass" resultType="java.lang.String">
+        SELECT DISTINCT
+            clazz_name
+        FROM
+            exam_student
+        WHERE
+            school_id = #{schoolId} AND exam_id = #{examId}
+          AND paper_number = #{paperNumber}
+          AND clazz_name IS NOT NULL
+    </select>
 </mapper>

+ 13 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamPaperStructureController.java

@@ -82,7 +82,7 @@ public class ExamPaperStructureController {
         return ResultUtil.ok(String.valueOf(examPaper.getId()), null);
     }
 
-    @ApiOperation(value = "评卷参数-提交")
+    @ApiOperation(value = "设置评卷参数-提交")
     @RequestMapping(value = "/submit", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "更新成功", response = EditResult.class)})
     @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UN_KNOW)
@@ -200,7 +200,7 @@ public class ExamPaperStructureController {
     }
 
     /**
-     * 查询教学秘书
+     * 转办/打回
      */
     @ApiOperation(value = "转办/打回")
     @RequestMapping(value = "/transfer", method = RequestMethod.POST)
@@ -211,5 +211,16 @@ public class ExamPaperStructureController {
                            @ApiParam(value = "用户ID", required = false) @RequestParam(required = false) Long transferId) {
         return ResultUtil.ok(examPaperStructureService.transfer(examId, courseCode, paperNumber, transferId));
     }
+
+    /**
+     * 查询绑定班级
+     */
+    @ApiOperation(value = "查询绑定班级")
+    @RequestMapping(value = "/list_user_class", method = RequestMethod.POST)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
+    public Result transfer(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
+                           @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) {
+        return ResultUtil.ok(examPaperStructureService.listUserClass(examId, paperNumber));
+    }
 }
 

+ 0 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/WorkController.java

@@ -7,11 +7,9 @@ import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusEnum;
 import com.qmth.distributed.print.business.service.ExamPaperStructureService;
 import com.qmth.distributed.print.business.service.ExamTaskService;
 import com.qmth.distributed.print.business.service.GradeInitializeService;
-import com.qmth.teachcloud.common.annotation.OperationLogDetail;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.GradeAnalyzePaperStatusEnum;
-import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;

+ 6 - 15
teachcloud-common/src/main/java/com/qmth/teachcloud/common/sync/CloudMarkingTaskUtils.java

@@ -15,6 +15,7 @@ import com.qmth.teachcloud.common.enums.SyncFileTypeEnum;
 import com.qmth.teachcloud.common.enums.SyncModeEnum;
 import com.qmth.teachcloud.common.enums.userPush.SpecialPrivilegeEnum;
 import com.qmth.teachcloud.common.service.CommonCacheService;
+import com.qmth.teachcloud.common.util.Base64Util;
 import com.qmth.teachcloud.common.util.HttpKit;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.collections4.CollectionUtils;
@@ -55,19 +56,6 @@ public class CloudMarkingTaskUtils {
     @Resource
     private DictionaryConfig dictionaryConfig;
 
-    /**
-     * 获取同步规则
-     *
-     * @param schoolId 学校ID
-     */
-    public SyncModeEnum getSyncMode(Long schoolId) {
-        SysConfig sysConfig = commonCacheService.addSysConfigCache(schoolId, SystemConstant.CLOUDMARK_SYNC_MODE);
-        if (sysConfig == null || StringUtils.isBlank(sysConfig.getConfigValue())) {
-            return SyncModeEnum.BY_SCHOOL;
-        }
-        return SyncModeEnum.valueOf(sysConfig.getConfigValue());
-    }
-
     /**
      * 同步规则是否为按学院同步
      *
@@ -202,12 +190,15 @@ public class CloudMarkingTaskUtils {
         return JSONObject.parseArray(JSONObject.toJSON(examObject).toString(), JSONObject.class);
     }
 
-    public PushResult syncUser(String account, String name, String password, int roleValue, Boolean enable, Long schoolId, String orgCode) throws IllegalAccessException {
+    public PushResult syncUser(String account, String name, int roleValue, Boolean enable, Long schoolId, String orgCode) throws IllegalAccessException {
         SysConfig sysConfig = commonCacheService.addSysConfigCache(schoolId, SystemConstant.CLOUDMARK_HOST_URL);
         Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置云阅卷地址"));
         String hostUrl = sysConfig.getConfigValue();
         String userSaveUrl = SystemConstant.CLOUD_MARK_USER_EXTERNAL_SAVE_API;
         String postUrl = hostUrl.concat(userSaveUrl);
+
+        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+        String password = basicSchool != null && StringUtils.isNotBlank(basicSchool.getInitPassword()) ? new String(Base64Util.decode(basicSchool.getInitPassword())) : "123456";
         // 参数
         Map<String, Object> map = new HashMap<>();
         map.put("account", validParam(account, null, true, "关联名称(唯一标识)"));
@@ -771,7 +762,7 @@ public class CloudMarkingTaskUtils {
      * @param name         参数名称
      */
     private List<String> validParam(List<String> value, List<String> defaultValue, boolean require, String name) {
-        if (require && (CollectionUtils.isEmpty(value) || CollectionUtils.isEmpty(defaultValue))) {
+        if (require && CollectionUtils.isEmpty(value) && CollectionUtils.isEmpty(defaultValue)) {
             throw ExceptionResultEnum.ERROR.exception((StringUtils.isBlank(name) ? "" : name) + "值必填");
         }
         return CollectionUtils.isEmpty(value) ? defaultValue : value;

+ 4 - 0
teachcloud-report-business/src/main/resources/mapper/ExamPaperClassMarkerMapper.xml

@@ -0,0 +1,4 @@
+<?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.distributed.print.business.mapper.ExamPaperClassMarkerMapper">
+</mapper>