Browse Source

add: 联调改动(后端记录 试卷双评默认设置)

caozixuan 9 months ago
parent
commit
9665cc2ba5

+ 1 - 0
install/mysql/init/paper_struct_db.sql

@@ -76,6 +76,7 @@ CREATE TABLE `mps_paper` (
   `school_id` bigint NOT NULL,
   `school_id` bigint NOT NULL,
   `subjective_score` double NOT NULL,
   `subjective_score` double NOT NULL,
   `total_score` double NOT NULL,
   `total_score` double NOT NULL,
+  `default_double_set` mediumtext COLLATE utf8_bin COMMENT '默认双评设置',
   PRIMARY KEY (`id`),
   PRIMARY KEY (`id`),
   UNIQUE KEY `IDX_PAPER_01` (`school_id`,`exam_id`,`course_id`)
   UNIQUE KEY `IDX_PAPER_01` (`school_id`,`exam_id`,`course_id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

+ 4 - 1
install/mysql/upgrade/1.0.2.sql

@@ -7,4 +7,7 @@ ALTER TABLE mps_paper_group
     ADD COLUMN arbitrate_method VARCHAR(32) NULL COMMENT '仲裁方式(小题仲裁、分组仲裁)' AFTER arbitrate_threshold;
     ADD COLUMN arbitrate_method VARCHAR(32) NULL COMMENT '仲裁方式(小题仲裁、分组仲裁)' AFTER arbitrate_threshold;
 
 
 ALTER TABLE mps_paper_group_unit
 ALTER TABLE mps_paper_group_unit
-    ADD COLUMN arbitrate_threshold DOUBLE NULL COMMENT '仲裁阈值' AFTER detail_unit_number;
+    ADD COLUMN arbitrate_threshold DOUBLE NULL COMMENT '仲裁阈值' AFTER detail_unit_number;
+
+ALTER TABLE mps_paper
+    ADD COLUMN default_double_set MEDIUMTEXT NULL COMMENT '默认双评设置' AFTER total_score;

+ 45 - 0
src/main/java/cn/com/qmth/mps/bean/DefaultDoubleSet.java

@@ -0,0 +1,45 @@
+package cn.com.qmth.mps.bean;
+
+import cn.com.qmth.mps.enums.ArbitrateMethod;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 默认双评设置
+ * @Author: CaoZixuan
+ * @Date: 2024-08-30
+ */
+public class DefaultDoubleSet {
+
+    @ApiModelProperty(value = "仲裁方式")
+    private ArbitrateMethod arbitrateMethod;
+
+    @ApiModelProperty(value = "是否开启双评")
+    private Boolean doubleEnable;
+
+    @ApiModelProperty(value = "双评比例")
+    private Double doubleRate;
+
+    public ArbitrateMethod getArbitrateMethod() {
+        return arbitrateMethod;
+    }
+
+    public void setArbitrateMethod(ArbitrateMethod arbitrateMethod) {
+        this.arbitrateMethod = arbitrateMethod;
+    }
+
+    public Boolean getDoubleEnable() {
+        return doubleEnable;
+    }
+
+    public void setDoubleEnable(Boolean doubleEnable) {
+        this.doubleEnable = doubleEnable;
+    }
+
+    public Double getDoubleRate() {
+        return doubleRate;
+    }
+
+    public void setDoubleRate(Double doubleRate) {
+        this.doubleRate = doubleRate;
+    }
+}

+ 22 - 8
src/main/java/cn/com/qmth/mps/entity/PaperEntity.java

@@ -1,28 +1,38 @@
 package cn.com.qmth.mps.entity;
 package cn.com.qmth.mps.entity;
 
 
-import com.baomidou.mybatisplus.annotation.TableName;
-
 import cn.com.qmth.mps.entity.base.AuditingEntity;
 import cn.com.qmth.mps.entity.base.AuditingEntity;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
 
 
 @TableName(value="mps_paper",autoResultMap = true)
 @TableName(value="mps_paper",autoResultMap = true)
 public class PaperEntity extends AuditingEntity {
 public class PaperEntity extends AuditingEntity {
+
 	/**
 	/**
-	 * 
+	 *
 	 */
 	 */
 	private static final long serialVersionUID = -8681575737341326402L;
 	private static final long serialVersionUID = -8681575737341326402L;
+
 	private Long schoolId;
 	private Long schoolId;
+
 	private Long examId;
 	private Long examId;
+
 	private Long courseId;
 	private Long courseId;
+
 	private Double totalScore;
 	private Double totalScore;
+
 	private Double objectiveScore;
 	private Double objectiveScore;
 
 
 	private Double subjectiveScore;
 	private Double subjectiveScore;
-	
+
 	private String paperType;
 	private String paperType;
-	
+
 	private Boolean structFinish;
 	private Boolean structFinish;
+
 	private Boolean groupFinish;
 	private Boolean groupFinish;
 
 
+	@ApiModelProperty("默认双评设置")
+	private String defaultDoubleSet;
+
 	public Long getSchoolId() {
 	public Long getSchoolId() {
 		return schoolId;
 		return schoolId;
 	}
 	}
@@ -71,7 +81,6 @@ public class PaperEntity extends AuditingEntity {
 		this.subjectiveScore = subjectiveScore;
 		this.subjectiveScore = subjectiveScore;
 	}
 	}
 
 
-
 	public String getPaperType() {
 	public String getPaperType() {
 		return paperType;
 		return paperType;
 	}
 	}
@@ -96,6 +105,11 @@ public class PaperEntity extends AuditingEntity {
 		this.structFinish = structFinish;
 		this.structFinish = structFinish;
 	}
 	}
 
 
-	
-	
+	public String getDefaultDoubleSet() {
+		return defaultDoubleSet;
+	}
+
+	public void setDefaultDoubleSet(String defaultDoubleSet) {
+		this.defaultDoubleSet = defaultDoubleSet;
+	}
 }
 }

+ 19 - 10
src/main/java/cn/com/qmth/mps/service/impl/PaperGroupServiceImpl.java

@@ -2,7 +2,9 @@ package cn.com.qmth.mps.service.impl;
 
 
 import java.util.*;
 import java.util.*;
 
 
+import cn.com.qmth.mps.bean.*;
 import cn.com.qmth.mps.enums.ArbitrateMethod;
 import cn.com.qmth.mps.enums.ArbitrateMethod;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -14,11 +16,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.boot.core.exception.StatusException;
 import com.qmth.boot.core.exception.StatusException;
 
 
-import cn.com.qmth.mps.bean.PaperDetail;
-import cn.com.qmth.mps.bean.PaperDetailUnit;
-import cn.com.qmth.mps.bean.PaperGroup;
-import cn.com.qmth.mps.bean.PaperGroupUnit;
-import cn.com.qmth.mps.bean.User;
 import cn.com.qmth.mps.dao.PaperGroupDao;
 import cn.com.qmth.mps.dao.PaperGroupDao;
 import cn.com.qmth.mps.entity.PaperDetailEntity;
 import cn.com.qmth.mps.entity.PaperDetailEntity;
 import cn.com.qmth.mps.entity.PaperEntity;
 import cn.com.qmth.mps.entity.PaperEntity;
@@ -224,7 +221,8 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
 			if (Objects.isNull(arbitrateMethod)) {
 			if (Objects.isNull(arbitrateMethod)) {
 				throw new StatusException("仲裁方式未设置");
 				throw new StatusException("仲裁方式未设置");
 			}
 			}
-			if (ArbitrateMethod.GROUP_ARBITRATE.equals(arbitrateMethod) && (Objects.isNull(arbitrateThreshold) || (arbitrateThreshold < 0))) {
+			if (ArbitrateMethod.GROUP_ARBITRATE.equals(arbitrateMethod) && (Objects.isNull(arbitrateThreshold) || (
+					arbitrateThreshold < 0))) {
 				throw new StatusException("仲裁阈值未正确设置");
 				throw new StatusException("仲裁阈值未正确设置");
 			}
 			}
 		}
 		}
@@ -240,7 +238,7 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
 					throw new StatusException("仲裁阈值未正确设置");
 					throw new StatusException("仲裁阈值未正确设置");
 				}
 				}
 			}
 			}
-			if (!doubleEnable || ArbitrateMethod.GROUP_ARBITRATE.equals(arbitrateMethod)){
+			if (!doubleEnable || ArbitrateMethod.GROUP_ARBITRATE.equals(arbitrateMethod)) {
 				u.setArbitrateThreshold(null);
 				u.setArbitrateThreshold(null);
 			}
 			}
 		}
 		}
@@ -298,6 +296,11 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
 		paperGroupUnitService.saveUnit(groupId, paperId, domain.getGroupUnits());
 		paperGroupUnitService.saveUnit(groupId, paperId, domain.getGroupUnits());
 		paper.setGroupFinish(
 		paper.setGroupFinish(
 				paperGroupUnitService.countByPaperId(paperId).equals(paperDetailUnitService.countByPaperId(paperId)));
 				paperGroupUnitService.countByPaperId(paperId).equals(paperDetailUnitService.countByPaperId(paperId)));
+
+		DefaultDoubleSet defaultDoubleSet = domain.getDefaultDoubleSet();
+		if (Objects.nonNull(defaultDoubleSet)) {
+			paper.setDefaultDoubleSet(JSON.toJSONString(defaultDoubleSet));
+		}
 		paperService.updateById(paper);
 		paperService.updateById(paper);
 	}
 	}
 
 
@@ -324,7 +327,7 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
 	@Transactional
 	@Transactional
 	@Override
 	@Override
 	public void groupDelete(Long groupId, User user) {
 	public void groupDelete(Long groupId, User user) {
-		PaperGroupEntity group=this.getById(groupId);
+		PaperGroupEntity group = this.getById(groupId);
 		if (group == null) {
 		if (group == null) {
 			throw new StatusException("未找到分组信息");
 			throw new StatusException("未找到分组信息");
 		}
 		}
@@ -338,8 +341,14 @@ public class PaperGroupServiceImpl extends ServiceImpl<PaperGroupDao, PaperGroup
 		}
 		}
 		this.removeById(groupId);
 		this.removeById(groupId);
 		paperGroupUnitService.removeByGroupId(groupId);
 		paperGroupUnitService.removeByGroupId(groupId);
-		paper.setGroupFinish(false);
-		paperService.updateById(paper);
+
+		UpdateWrapper<PaperEntity> paperEntityUpdateWrapper = new UpdateWrapper<>();
+		paperEntityUpdateWrapper.lambda().set(PaperEntity::getGroupFinish, false).eq(PaperEntity::getId, paper.getId());
+		if (this.count(new QueryWrapper<PaperGroupEntity>().lambda().eq(PaperGroupEntity::getPaperId, paper.getId()))
+				== 0) {
+			paperEntityUpdateWrapper.lambda().set(PaperEntity::getDefaultDoubleSet, null);
+		}
+		paperService.update(paperEntityUpdateWrapper);
 	}
 	}
 
 
 	@Override
 	@Override

+ 6 - 0
src/main/java/cn/com/qmth/mps/service/impl/PaperServiceImpl.java

@@ -7,6 +7,7 @@ import java.util.stream.Collectors;
 
 
 import cn.com.qmth.mps.bean.*;
 import cn.com.qmth.mps.bean.*;
 import cn.com.qmth.mps.enums.ArbitrateMethod;
 import cn.com.qmth.mps.enums.ArbitrateMethod;
+import com.alibaba.fastjson.JSON;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
@@ -298,6 +299,11 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
 		vo.setCourseName(course.getName());
 		vo.setCourseName(course.getName());
 		vo.setStructInfo(paperDetailService.getStructInfo(vo.getId()));
 		vo.setStructInfo(paperDetailService.getStructInfo(vo.getId()));
 		vo.setGroupInfo(paperGroupService.getGroupInfo(vo.getId()));
 		vo.setGroupInfo(paperGroupService.getGroupInfo(vo.getId()));
+
+		String defaultDoubleSetStr = paper.getDefaultDoubleSet();
+		if (!StringUtils.isBlank(defaultDoubleSetStr)) {
+			vo.setDefaultDoubleSet(JSON.parseObject(defaultDoubleSetStr, DefaultDoubleSet.class));
+		}
 		return vo;
 		return vo;
 	}
 	}
 
 

+ 12 - 0
src/main/java/cn/com/qmth/mps/vo/paper/PaperGroupDomain.java

@@ -2,6 +2,7 @@ package cn.com.qmth.mps.vo.paper;
 
 
 import java.util.List;
 import java.util.List;
 
 
+import cn.com.qmth.mps.bean.DefaultDoubleSet;
 import cn.com.qmth.mps.bean.PaperGroupUnit;
 import cn.com.qmth.mps.bean.PaperGroupUnit;
 import cn.com.qmth.mps.enums.ArbitrateMethod;
 import cn.com.qmth.mps.enums.ArbitrateMethod;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
@@ -32,6 +33,9 @@ public class PaperGroupDomain {
 	@ApiModelProperty("分组信息")
 	@ApiModelProperty("分组信息")
 	private List<PaperGroupUnit> groupUnits;
 	private List<PaperGroupUnit> groupUnits;
 
 
+	@ApiModelProperty("默认双评设置")
+	private DefaultDoubleSet defaultDoubleSet;
+
 	public Long getGroupId() {
 	public Long getGroupId() {
 		return groupId;
 		return groupId;
 	}
 	}
@@ -95,4 +99,12 @@ public class PaperGroupDomain {
 	public void setGroupUnits(List<PaperGroupUnit> groupUnits) {
 	public void setGroupUnits(List<PaperGroupUnit> groupUnits) {
 		this.groupUnits = groupUnits;
 		this.groupUnits = groupUnits;
 	}
 	}
+
+	public DefaultDoubleSet getDefaultDoubleSet() {
+		return defaultDoubleSet;
+	}
+
+	public void setDefaultDoubleSet(DefaultDoubleSet defaultDoubleSet) {
+		this.defaultDoubleSet = defaultDoubleSet;
+	}
 }
 }

+ 48 - 6
src/main/java/cn/com/qmth/mps/vo/paper/PaperInfoVo.java

@@ -2,106 +2,148 @@ package cn.com.qmth.mps.vo.paper;
 
 
 import java.util.List;
 import java.util.List;
 
 
+import cn.com.qmth.mps.bean.DefaultDoubleSet;
 import cn.com.qmth.mps.bean.PaperDetail;
 import cn.com.qmth.mps.bean.PaperDetail;
 import cn.com.qmth.mps.bean.PaperGroup;
 import cn.com.qmth.mps.bean.PaperGroup;
 import cn.com.qmth.mps.entity.base.BaseEntity;
 import cn.com.qmth.mps.entity.base.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 
-public class PaperInfoVo extends BaseEntity{
+public class PaperInfoVo extends BaseEntity {
+
 	/**
 	/**
-	 * 
+	 *
 	 */
 	 */
 	private static final long serialVersionUID = -2271590671135347709L;
 	private static final long serialVersionUID = -2271590671135347709L;
+
 	@ApiModelProperty("试卷结构id")
 	@ApiModelProperty("试卷结构id")
 	private Long id;
 	private Long id;
+
 	@ApiModelProperty("学校id")
 	@ApiModelProperty("学校id")
 	private Long schoolId;
 	private Long schoolId;
+
 	@ApiModelProperty("考试id")
 	@ApiModelProperty("考试id")
 	private Long examId;
 	private Long examId;
+
 	@ApiModelProperty("科目id")
 	@ApiModelProperty("科目id")
 	private Long courseId;
 	private Long courseId;
+
 	@ApiModelProperty("科目代码")
 	@ApiModelProperty("科目代码")
 	private String courseCode;
 	private String courseCode;
+
 	@ApiModelProperty("科目名称")
 	@ApiModelProperty("科目名称")
-    private String courseName;
+	private String courseName;
+
 	@ApiModelProperty("试卷总分")
 	@ApiModelProperty("试卷总分")
 	private Double totalScore;
 	private Double totalScore;
+
 	@ApiModelProperty("主观总分")
 	@ApiModelProperty("主观总分")
 	private Double subjectiveScore;
 	private Double subjectiveScore;
+
 	@ApiModelProperty("试卷结构信息")
 	@ApiModelProperty("试卷结构信息")
 	private List<PaperDetail> structInfo;
 	private List<PaperDetail> structInfo;
+
 	@ApiModelProperty("分组信息")
 	@ApiModelProperty("分组信息")
 	private List<PaperGroup> groupInfo;
 	private List<PaperGroup> groupInfo;
+
 	@ApiModelProperty("分组是否完成")
 	@ApiModelProperty("分组是否完成")
 	private Boolean groupFinish;
 	private Boolean groupFinish;
+
+	@ApiModelProperty("默认双评设置")
+	private DefaultDoubleSet defaultDoubleSet;
+
 	public Long getId() {
 	public Long getId() {
 		return id;
 		return id;
 	}
 	}
+
 	public void setId(Long id) {
 	public void setId(Long id) {
 		this.id = id;
 		this.id = id;
 	}
 	}
+
 	public Long getSchoolId() {
 	public Long getSchoolId() {
 		return schoolId;
 		return schoolId;
 	}
 	}
+
 	public void setSchoolId(Long schoolId) {
 	public void setSchoolId(Long schoolId) {
 		this.schoolId = schoolId;
 		this.schoolId = schoolId;
 	}
 	}
+
 	public Long getExamId() {
 	public Long getExamId() {
 		return examId;
 		return examId;
 	}
 	}
+
 	public void setExamId(Long examId) {
 	public void setExamId(Long examId) {
 		this.examId = examId;
 		this.examId = examId;
 	}
 	}
+
 	public Long getCourseId() {
 	public Long getCourseId() {
 		return courseId;
 		return courseId;
 	}
 	}
+
 	public void setCourseId(Long courseId) {
 	public void setCourseId(Long courseId) {
 		this.courseId = courseId;
 		this.courseId = courseId;
 	}
 	}
+
 	public String getCourseCode() {
 	public String getCourseCode() {
 		return courseCode;
 		return courseCode;
 	}
 	}
+
 	public void setCourseCode(String courseCode) {
 	public void setCourseCode(String courseCode) {
 		this.courseCode = courseCode;
 		this.courseCode = courseCode;
 	}
 	}
+
 	public String getCourseName() {
 	public String getCourseName() {
 		return courseName;
 		return courseName;
 	}
 	}
+
 	public void setCourseName(String courseName) {
 	public void setCourseName(String courseName) {
 		this.courseName = courseName;
 		this.courseName = courseName;
 	}
 	}
+
 	public Double getTotalScore() {
 	public Double getTotalScore() {
 		return totalScore;
 		return totalScore;
 	}
 	}
+
 	public void setTotalScore(Double totalScore) {
 	public void setTotalScore(Double totalScore) {
 		this.totalScore = totalScore;
 		this.totalScore = totalScore;
 	}
 	}
+
 	public Double getSubjectiveScore() {
 	public Double getSubjectiveScore() {
 		return subjectiveScore;
 		return subjectiveScore;
 	}
 	}
+
 	public void setSubjectiveScore(Double subjectiveScore) {
 	public void setSubjectiveScore(Double subjectiveScore) {
 		this.subjectiveScore = subjectiveScore;
 		this.subjectiveScore = subjectiveScore;
 	}
 	}
-	
+
 	public List<PaperDetail> getStructInfo() {
 	public List<PaperDetail> getStructInfo() {
 		return structInfo;
 		return structInfo;
 	}
 	}
+
 	public void setStructInfo(List<PaperDetail> structInfo) {
 	public void setStructInfo(List<PaperDetail> structInfo) {
 		this.structInfo = structInfo;
 		this.structInfo = structInfo;
 	}
 	}
+
 	public List<PaperGroup> getGroupInfo() {
 	public List<PaperGroup> getGroupInfo() {
 		return groupInfo;
 		return groupInfo;
 	}
 	}
+
 	public void setGroupInfo(List<PaperGroup> groupInfo) {
 	public void setGroupInfo(List<PaperGroup> groupInfo) {
 		this.groupInfo = groupInfo;
 		this.groupInfo = groupInfo;
 	}
 	}
+
 	public Boolean getGroupFinish() {
 	public Boolean getGroupFinish() {
 		return groupFinish;
 		return groupFinish;
 	}
 	}
+
 	public void setGroupFinish(Boolean groupFinish) {
 	public void setGroupFinish(Boolean groupFinish) {
 		this.groupFinish = groupFinish;
 		this.groupFinish = groupFinish;
 	}
 	}
 
 
-	
-	
+	public DefaultDoubleSet getDefaultDoubleSet() {
+		return defaultDoubleSet;
+	}
+
+	public void setDefaultDoubleSet(DefaultDoubleSet defaultDoubleSet) {
+		this.defaultDoubleSet = defaultDoubleSet;
+	}
 }
 }