|
@@ -157,10 +157,10 @@ public class PaperApi {
|
|
Specification<Paper> specification = (root, query, builder) -> {
|
|
Specification<Paper> specification = (root, query, builder) -> {
|
|
List<Predicate> predicates = new ArrayList<>();
|
|
List<Predicate> predicates = new ArrayList<>();
|
|
predicates.add(builder.equal(root.get("workId"), workId));
|
|
predicates.add(builder.equal(root.get("workId"), workId));
|
|
- if(areaCode != null && areaCode != "") {
|
|
|
|
|
|
+ if (areaCode != null && areaCode != "") {
|
|
predicates.add(builder.equal(root.get("areaCode"), areaCode));
|
|
predicates.add(builder.equal(root.get("areaCode"), areaCode));
|
|
}
|
|
}
|
|
- if(subject != null) {
|
|
|
|
|
|
+ if (subject != null) {
|
|
predicates.add(builder.equal(root.get("subject"), subject));
|
|
predicates.add(builder.equal(root.get("subject"), subject));
|
|
}
|
|
}
|
|
if (startNumber != null && endNumber != null) {
|
|
if (startNumber != null && endNumber != null) {
|
|
@@ -208,18 +208,31 @@ public class PaperApi {
|
|
@RequestParam(required = false) Boolean markedLogic,
|
|
@RequestParam(required = false) Boolean markedLogic,
|
|
@RequestParam(required = false) Boolean arbi,
|
|
@RequestParam(required = false) Boolean arbi,
|
|
@RequestParam(required = false) Boolean reject,
|
|
@RequestParam(required = false) Boolean reject,
|
|
|
|
+ @RequestParam(defaultValue = "false") Boolean isScore,//打分阶段该档位已打分数
|
|
Pageable pageable) {
|
|
Pageable pageable) {
|
|
//查询最大批次号
|
|
//查询最大批次号
|
|
// Long batchNo = paperRepo.findByQuestionId(questionId);
|
|
// Long batchNo = paperRepo.findByQuestionId(questionId);
|
|
Specification<Paper> specification = (root, query, builder) -> {
|
|
Specification<Paper> specification = (root, query, builder) -> {
|
|
List<Predicate> predicates = new ArrayList<>();
|
|
List<Predicate> predicates = new ArrayList<>();
|
|
predicates.add(builder.equal(root.get("questionId"), questionId));
|
|
predicates.add(builder.equal(root.get("questionId"), questionId));
|
|
- if (Objects.isNull(level)) {
|
|
|
|
- predicates.add(builder.isNull(root.get("level")));
|
|
|
|
- //查询当前批次号数据
|
|
|
|
-// predicates.add(builder.equal(root.get("batchNo"), batchNo));
|
|
|
|
|
|
+ //isScore为true时,为科组长打分详情页面数据查询条件
|
|
|
|
+ if(isScore) {
|
|
|
|
+ //level为null时,查询待评数量
|
|
|
|
+ if (Objects.isNull(level)) {
|
|
|
|
+ predicates.add(builder.isNotNull(root.get("level")));
|
|
|
|
+ predicates.add(builder.isNull(root.get("score")));
|
|
|
|
+ } else {
|
|
|
|
+ predicates.add(builder.equal(root.get("level"), level));
|
|
|
|
+ predicates.add(builder.isNotNull(root.get("score")));
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- predicates.add(builder.equal(root.get("level"), level));
|
|
|
|
|
|
+ if (Objects.isNull(level)) {
|
|
|
|
+ predicates.add(builder.isNull(root.get("level")));
|
|
|
|
+ //查询当前批次号数据
|
|
|
|
+// predicates.add(builder.equal(root.get("batchNo"), batchNo));
|
|
|
|
+ } else {
|
|
|
|
+ predicates.add(builder.equal(root.get("level"), level));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (arbi != null) {
|
|
if (arbi != null) {
|
|
predicates.add(builder.equal(root.get("isArbitrated"), arbi));
|
|
predicates.add(builder.equal(root.get("isArbitrated"), arbi));
|
|
@@ -243,6 +256,7 @@ public class PaperApi {
|
|
papers.forEach(p -> {
|
|
papers.forEach(p -> {
|
|
paperDTOs.add(paperAssembler.toDTO(p));
|
|
paperDTOs.add(paperAssembler.toDTO(p));
|
|
});
|
|
});
|
|
|
|
+ paperDTOs.sort(Comparator.comparingInt(PaperDTO::getSortSum));
|
|
return new PageableDTO(paperDTOs, papers.getTotalElements(), papers.getTotalPages(), pageable.getPageNumber());
|
|
return new PageableDTO(paperDTOs, papers.getTotalElements(), papers.getTotalPages(), pageable.getPageNumber());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -278,6 +292,48 @@ public class PaperApi {
|
|
return new ResponseEntity(paperAssembler.toDTO(paper), HttpStatus.OK);
|
|
return new ResponseEntity(paperAssembler.toDTO(paper), HttpStatus.OK);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 批量试卷处理。提交评卷
|
|
|
|
+ *
|
|
|
|
+ * @param body 试卷信息
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping(value = "batch", method = RequestMethod.PATCH)
|
|
|
|
+ @Transactional
|
|
|
|
+ public ResponseEntity marking(@RequestBody HashMap<String, String> body) {
|
|
|
|
+ String action = body.get("action");
|
|
|
|
+ String level = body.get("level");
|
|
|
|
+ String tagged = body.get("tagged");
|
|
|
|
+ String paperIds = body.get("paperIds");
|
|
|
|
+ if (paperIds.length() > 0) {
|
|
|
|
+ List<PaperDTO> list = new ArrayList<>();
|
|
|
|
+ String[] ids = paperIds.split(",");
|
|
|
|
+ for (String id : ids) {
|
|
|
|
+ Paper paper = paperRepo.findOne(Long.valueOf(id));
|
|
|
|
+ //需要打回的评卷员
|
|
|
|
+ String ranges = body.get("range");
|
|
|
|
+ if (action != null && level != null) {
|
|
|
|
+ if (action.equals("leveling")) {
|
|
|
|
+ markingService.levelMarkPaper(paper, level, false);
|
|
|
|
+ } else if (action.equals("sampling")) {
|
|
|
|
+ markingService.levelMarkPaper(paper, level, true);
|
|
|
|
+ } else if (action.equals("reject")) {
|
|
|
|
+ markingService.reject(paper, level, ranges);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (tagged != null) {
|
|
|
|
+ boolean isTagged = paper.isTagged();
|
|
|
|
+ paper.setTagged(!isTagged);
|
|
|
|
+ paperRepo.save(paper);
|
|
|
|
+ }
|
|
|
|
+ PaperDTO paperDTO = paperAssembler.toDTO(paper);
|
|
|
|
+ list.add(paperDTO);
|
|
|
|
+ }
|
|
|
|
+ return new ResponseEntity(list, HttpStatus.OK);
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 标记试卷
|
|
* 标记试卷
|
|
*
|
|
*
|
|
@@ -451,7 +507,7 @@ public class PaperApi {
|
|
}
|
|
}
|
|
InputStream inputStream = file.getInputStream();
|
|
InputStream inputStream = file.getInputStream();
|
|
//保存
|
|
//保存
|
|
- String savePath = systemConfig.getLocalhostPath() + File.separator + "files"+ File.separator + workId + File.separator + questionId + File.separator + subject.name();
|
|
|
|
|
|
+ String savePath = systemConfig.getLocalhostPath() + File.separator + "files" + File.separator + workId + File.separator + questionId + File.separator + subject.name();
|
|
File fileSave = new File(savePath);
|
|
File fileSave = new File(savePath);
|
|
if (!fileSave.exists()) {
|
|
if (!fileSave.exists()) {
|
|
fileSave.mkdirs();
|
|
fileSave.mkdirs();
|
|
@@ -460,7 +516,7 @@ public class PaperApi {
|
|
File[] oldFiles = fileSave.listFiles();
|
|
File[] oldFiles = fileSave.listFiles();
|
|
if (oldFiles.length > 0) {
|
|
if (oldFiles.length > 0) {
|
|
for (File oldFile : oldFiles) {
|
|
for (File oldFile : oldFiles) {
|
|
- if(oldFile.exists()) {
|
|
|
|
|
|
+ if (oldFile.exists()) {
|
|
oldFile.delete();
|
|
oldFile.delete();
|
|
}
|
|
}
|
|
}
|
|
}
|