|
@@ -464,14 +464,15 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
|
|
|
|
Long paperId = imp.getPaperId();
|
|
|
Integer groupNumber = imp.getGroupNumber();
|
|
|
- if (Objects.nonNull(paperId) && Objects.nonNull(groupNumber)){
|
|
|
+ Double questionScore = imp.getScore();
|
|
|
+ if (Objects.nonNull(paperId) && Objects.nonNull(groupNumber) && Objects.nonNull(questionScore)) {
|
|
|
// 有分组信息才解析双评信息
|
|
|
String groupKey = paperId + "-" + groupNumber;
|
|
|
ArbitrateMethod arbitrateMethod = null;
|
|
|
Double doubleRate = null;
|
|
|
Double arbitrateThreshold = null;
|
|
|
|
|
|
- if (doubleMarkSettingMap.containsKey(groupKey)){
|
|
|
+ if (doubleMarkSettingMap.containsKey(groupKey)) {
|
|
|
DoubleMarkImportParam doubleMarkImportParam = doubleMarkSettingMap.get(groupKey);
|
|
|
arbitrateMethod = doubleMarkImportParam.getArbitrateMethod();
|
|
|
doubleRate = doubleMarkImportParam.getDoubleRate();
|
|
@@ -487,10 +488,10 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
|
try {
|
|
|
double n = Double.parseDouble(doubleRateStr);
|
|
|
|
|
|
- if (n < 0 || n > 1){
|
|
|
+ if (n < 0 || n > 1) {
|
|
|
msg.append(" 双评比例只能在(0~1)");
|
|
|
} else {
|
|
|
- if (Objects.nonNull(doubleRate) && !doubleRate.equals(n)){
|
|
|
+ if (Objects.nonNull(doubleRate) && !doubleRate.equals(n)) {
|
|
|
msg.append(" 同分组的双评比例必须相同");
|
|
|
} else {
|
|
|
doubleRate = n;
|
|
@@ -502,18 +503,19 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (Objects.nonNull(doubleRate) && doubleRate > 0){
|
|
|
+ if (Objects.nonNull(doubleRate) && doubleRate > 0) {
|
|
|
// 开启双评才继续解析 仲裁方式和仲裁值
|
|
|
// 仲裁方式(0-分组,1-小题)
|
|
|
if (StringUtils.isNotBlank(arbitrateMethodStr)) {
|
|
|
try {
|
|
|
int n = Integer.parseInt(arbitrateMethodStr);
|
|
|
- List<ArbitrateMethod> arbitrateMethodList = Arrays.stream(ArbitrateMethod.values()).filter(e -> e.getValue().equals(n)).collect(
|
|
|
- Collectors.toList());
|
|
|
- if (arbitrateMethodList.size() != 1){
|
|
|
+ List<ArbitrateMethod> arbitrateMethodList = Arrays.stream(ArbitrateMethod.values())
|
|
|
+ .filter(e -> e.getValue().equals(n)).collect(Collectors.toList());
|
|
|
+ if (arbitrateMethodList.size() != 1) {
|
|
|
msg.append(" 仲裁方式只能选择0或1");
|
|
|
} else {
|
|
|
- if (Objects.nonNull(arbitrateMethod) && !arbitrateMethod.equals(arbitrateMethodList.get(0))){
|
|
|
+ if (Objects.nonNull(arbitrateMethod) && !arbitrateMethod.equals(
|
|
|
+ arbitrateMethodList.get(0))) {
|
|
|
msg.append(" 同分组的仲裁方式必须相同");
|
|
|
} else {
|
|
|
arbitrateMethod = arbitrateMethodList.get(0);
|
|
@@ -527,18 +529,17 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
|
msg.append(" 仲裁方式不能为空");
|
|
|
}
|
|
|
|
|
|
- if (Objects.nonNull(arbitrateMethod)){
|
|
|
+ if (Objects.nonNull(arbitrateMethod)) {
|
|
|
// 仲裁方式不为空才解析
|
|
|
// 仲裁阀值
|
|
|
if (StringUtils.isNotBlank(arbitrateThresholdStr)) {
|
|
|
try {
|
|
|
double n = Double.parseDouble(arbitrateThresholdStr);
|
|
|
- if (n < 0){
|
|
|
+ if (n < 0) {
|
|
|
msg.append(" 仲裁阀值不能小于0");
|
|
|
}
|
|
|
- if (ArbitrateMethod.QUESTION_ARBITRATE.equals(arbitrateMethod)){
|
|
|
- Double questionScore = imp.getScore();
|
|
|
- if (Objects.nonNull(questionScore) && n > questionScore){
|
|
|
+ if (ArbitrateMethod.QUESTION_ARBITRATE.equals(arbitrateMethod)) {
|
|
|
+ if (n > questionScore) {
|
|
|
msg.append(" 仲裁阀值不能超过小题满分");
|
|
|
}
|
|
|
} else if (ArbitrateMethod.GROUP_ARBITRATE.equals(arbitrateMethod)) {
|
|
@@ -556,8 +557,16 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (!doubleMarkSettingMap.containsKey(groupKey)){
|
|
|
- doubleMarkSettingMap.put(groupKey, new DoubleMarkImportParam(arbitrateMethod, doubleRate, arbitrateThreshold));
|
|
|
+ if (!doubleMarkSettingMap.containsKey(groupKey)) {
|
|
|
+ List<Integer> indexList = new ArrayList<>();
|
|
|
+ indexList.add(i + 3);
|
|
|
+ doubleMarkSettingMap.put(groupKey,
|
|
|
+ new DoubleMarkImportParam(arbitrateMethod, doubleRate, arbitrateThreshold, indexList,
|
|
|
+ questionScore));
|
|
|
+ } else {
|
|
|
+ DoubleMarkImportParam cellMap = doubleMarkSettingMap.get(groupKey);
|
|
|
+ cellMap.getIndexes().add(i + 3);
|
|
|
+ cellMap.setTotalScore(cellMap.getTotalScore() + questionScore);
|
|
|
}
|
|
|
}
|
|
|
if (msg.length() > 0) {
|
|
@@ -566,6 +575,14 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
|
ret.add(imp);
|
|
|
}
|
|
|
}
|
|
|
+ // 检测分组仲裁的分组 分组阈值设置是否超过整组分数
|
|
|
+ doubleMarkSettingMap.forEach((k, v) -> {
|
|
|
+ if (v.getArbitrateMethod() != null && v.getArbitrateMethod().equals(ArbitrateMethod.GROUP_ARBITRATE)) {
|
|
|
+ if (v.getArbitrateThreshold() > v.getTotalScore()) {
|
|
|
+ failRecords.add(newError(v.getIndexes().get(0), " 分组仲裁阀值不能超过分组满分"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
if (CollectionUtils.isNotEmpty(failRecords)) {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return failRecords;
|