|
@@ -18,13 +18,14 @@ import com.alibaba.fastjson.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
-import java.util.function.Function;
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -219,13 +220,13 @@ public class MarkSubjectApi {
|
|
LevelStatDTO manualScoreDTO = new LevelStatDTO();
|
|
LevelStatDTO manualScoreDTO = new LevelStatDTO();
|
|
manualScoreDTO.setId("manualScore");
|
|
manualScoreDTO.setId("manualScore");
|
|
List<String> markTaskPaperIds = markTaskRepo.findByWorkIdAndSubjectAndStageAndManualScore(markSubject.getWorkId(), markSubject.getSubject().name(), MarkStage.SCORE.ordinal());
|
|
List<String> markTaskPaperIds = markTaskRepo.findByWorkIdAndSubjectAndStageAndManualScore(markSubject.getWorkId(), markSubject.getSubject().name(), MarkStage.SCORE.ordinal());
|
|
- List<Long> paperIds = markTaskPaperIds.stream().map(m-> Long.parseLong(m)).collect(Collectors.toList());
|
|
|
|
|
|
+ List<Long> paperIds = markTaskPaperIds.stream().map(m -> Long.parseLong(m)).collect(Collectors.toList());
|
|
List<MarkTask> markTaskList = markTaskRepo.findByPaperIdInAndStage(paperIds, MarkStage.SCORE);
|
|
List<MarkTask> markTaskList = markTaskRepo.findByPaperIdInAndStage(paperIds, MarkStage.SCORE);
|
|
- Map<Long, List<MarkTask>> markTaskMap = markTaskList.stream().collect(Collectors.groupingBy(m->m.getPaper().getId()));
|
|
|
|
|
|
+ Map<Long, List<MarkTask>> markTaskMap = markTaskList.stream().collect(Collectors.groupingBy(m -> m.getPaper().getId()));
|
|
Set<Long> paperIdSet = new HashSet();
|
|
Set<Long> paperIdSet = new HashSet();
|
|
for (Map.Entry<Long, List<MarkTask>> entry : markTaskMap.entrySet()) {
|
|
for (Map.Entry<Long, List<MarkTask>> entry : markTaskMap.entrySet()) {
|
|
- long count = entry.getValue().stream().filter(m->Objects.isNull(m.getResult())).count();
|
|
|
|
- if(count == 0){
|
|
|
|
|
|
+ long count = entry.getValue().stream().filter(m -> Objects.isNull(m.getResult())).count();
|
|
|
|
+ if (count == 0) {
|
|
paperIdSet.add(entry.getKey());
|
|
paperIdSet.add(entry.getKey());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -261,7 +262,7 @@ public class MarkSubjectApi {
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "{markSubject}/markergroups", method = RequestMethod.POST)
|
|
@RequestMapping(value = "{markSubject}/markergroups", method = RequestMethod.POST)
|
|
public MarkerGroup createMarkerGroup(@PathVariable MarkSubject markSubject, @RequestBody MarkerGroup markerGroup) {
|
|
public MarkerGroup createMarkerGroup(@PathVariable MarkSubject markSubject, @RequestBody MarkerGroup markerGroup) {
|
|
- if(MarkStage.SCORE == markSubject.getStage() && ParamCache.paramMap.get(markSubject.getWorkId()).getIsLevelToScore() == 1){
|
|
|
|
|
|
+ if (MarkStage.SCORE == markSubject.getStage() && ParamCache.paramMap.get(markSubject.getWorkId()).getIsLevelToScore() == 1) {
|
|
throw new RuntimeException("当前为谁分档谁打分,不能编辑分组");
|
|
throw new RuntimeException("当前为谁分档谁打分,不能编辑分组");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -270,7 +271,7 @@ public class MarkSubjectApi {
|
|
}
|
|
}
|
|
if (MarkStage.LEVEL == markSubject.getStage() || MarkStage.SCORE == markSubject.getStage()) {
|
|
if (MarkStage.LEVEL == markSubject.getStage() || MarkStage.SCORE == markSubject.getStage()) {
|
|
int count = markTaskRepo.countByWorkIdAndSubjectAndStage(markSubject.getWorkId(), markSubject.getSubject(), markSubject.getStage());
|
|
int count = markTaskRepo.countByWorkIdAndSubjectAndStage(markSubject.getWorkId(), markSubject.getSubject(), markSubject.getStage());
|
|
- if(count > 0){
|
|
|
|
|
|
+ if (count > 0) {
|
|
throw new RuntimeException("当前阶段已发布任务,不能编辑分组");
|
|
throw new RuntimeException("当前阶段已发布任务,不能编辑分组");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -302,13 +303,13 @@ public class MarkSubjectApi {
|
|
@RequestMapping(value = "{markSubject}/markergroups/{domain}", method = RequestMethod.DELETE)
|
|
@RequestMapping(value = "{markSubject}/markergroups/{domain}", method = RequestMethod.DELETE)
|
|
public void removeMarkerGroup(@PathVariable MarkSubject markSubject, @PathVariable MarkerGroup domain) {
|
|
public void removeMarkerGroup(@PathVariable MarkSubject markSubject, @PathVariable MarkerGroup domain) {
|
|
|
|
|
|
- if(MarkStage.SCORE == markSubject.getStage() && ParamCache.paramMap.get(markSubject.getWorkId()).getIsLevelToScore() == 1){
|
|
|
|
|
|
+ if (MarkStage.SCORE == markSubject.getStage() && ParamCache.paramMap.get(markSubject.getWorkId()).getIsLevelToScore() == 1) {
|
|
throw new RuntimeException("当前为谁分档谁打分,不能删除分组");
|
|
throw new RuntimeException("当前为谁分档谁打分,不能删除分组");
|
|
}
|
|
}
|
|
|
|
|
|
if (MarkStage.LEVEL == markSubject.getStage() || MarkStage.SCORE == markSubject.getStage()) {
|
|
if (MarkStage.LEVEL == markSubject.getStage() || MarkStage.SCORE == markSubject.getStage()) {
|
|
int count = markTaskRepo.countByWorkIdAndSubjectAndStage(markSubject.getWorkId(), markSubject.getSubject(), markSubject.getStage());
|
|
int count = markTaskRepo.countByWorkIdAndSubjectAndStage(markSubject.getWorkId(), markSubject.getSubject(), markSubject.getStage());
|
|
- if(count > 0){
|
|
|
|
|
|
+ if (count > 0) {
|
|
throw new RuntimeException("当前阶段已发布任务,不能删除分组");
|
|
throw new RuntimeException("当前阶段已发布任务,不能删除分组");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -389,8 +390,9 @@ public class MarkSubjectApi {
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "{markSubject}/canLevel", method = RequestMethod.GET)
|
|
@RequestMapping(value = "{markSubject}/canLevel", method = RequestMethod.GET)
|
|
public Boolean canLevel(@PathVariable MarkSubject markSubject) {
|
|
public Boolean canLevel(@PathVariable MarkSubject markSubject) {
|
|
|
|
+ boolean allowTaskOverlay = ParamCache.paramMap.get(markSubject.getWorkId()).getAllowTaskOverlay() == 1;
|
|
int count = paperRepo.countByWorkIdAndSubjectAndLevelIsNullAndIsMissingFalseAndActiveTrueAndBatchNoNotNullAndTest(markSubject.getWorkId(), markSubject.getSubject(), 0);
|
|
int count = paperRepo.countByWorkIdAndSubjectAndLevelIsNullAndIsMissingFalseAndActiveTrueAndBatchNoNotNullAndTest(markSubject.getWorkId(), markSubject.getSubject(), 0);
|
|
- return count > 0 ? false : true;
|
|
|
|
|
|
+ return allowTaskOverlay || count <= 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -422,7 +424,7 @@ public class MarkSubjectApi {
|
|
* @param markSubject 评卷科目id
|
|
* @param markSubject 评卷科目id
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "{markSubject}/scoreProgress", method = RequestMethod.GET)
|
|
@RequestMapping(value = "{markSubject}/scoreProgress", method = RequestMethod.GET)
|
|
- public List scoreProgress(@PathVariable MarkSubject markSubject,@RequestParam(defaultValue = "") Long questionId) {
|
|
|
|
|
|
+ public List scoreProgress(@PathVariable MarkSubject markSubject, @RequestParam(defaultValue = "") Long questionId) {
|
|
return stageControlService.scoreProgress(markSubject, questionId);
|
|
return stageControlService.scoreProgress(markSubject, questionId);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -464,6 +466,32 @@ public class MarkSubjectApi {
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 锁定科目评卷任务
|
|
|
|
+ *
|
|
|
|
+ * @param markSubject 评卷科目id
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping(value = "{markSubject}/updateLocking", method = RequestMethod.POST)
|
|
|
|
+ @Transactional
|
|
|
|
+ public ResponseEntity updateLocking(@PathVariable MarkSubject markSubject) {
|
|
|
|
+ markSubject.setLocking(!markSubject.isLocking());
|
|
|
|
+ markSubjectRepo.saveAndFlush(markSubject);
|
|
|
|
+
|
|
|
|
+ // 禁用账号
|
|
|
|
+ List<MarkUser> markUsers = markUserRepo.findByWorkIdAndSubject(markSubject.getWorkId(), markSubject.getSubject());
|
|
|
|
+ for (MarkUser markUser : markUsers) {
|
|
|
|
+ if (Role.MARKER.equals(markUser.getRole()) || Role.MARK_LEADER.equals(markUser.getRole())) {
|
|
|
|
+ markUser.setEnabled(!markSubject.isLocking());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ markUserRepo.save(markUsers);
|
|
|
|
+
|
|
|
|
+ // 所有用户强制退出
|
|
|
|
+ stageControlService.logoutAndBackupDb(markSubject);
|
|
|
|
+
|
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 更新科目名称
|
|
* 更新科目名称
|
|
*
|
|
*
|