|
@@ -28,6 +28,7 @@ import cn.com.qmth.stmms.biz.exam.model.ExamPackage;
|
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
|
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
|
+import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
|
|
|
import cn.com.qmth.stmms.biz.exam.query.ExamStudentSearchQuery;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.CheckStudentService;
|
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamPackageService;
|
|
@@ -204,7 +205,7 @@ public class ScoreController extends BaseExamController {
|
|
|
if (lockService.trylock(LockType.EXAM, examId)) {
|
|
|
ScoreCalculateThread thread = new ScoreCalculateThread(examId, lockService, studentService,
|
|
|
questionService, markService, checkStudentService,
|
|
|
- reportService,examService);
|
|
|
+ reportService,examService,subjectService);
|
|
|
taskExecutor.submit(thread);
|
|
|
}
|
|
|
return new ModelAndView("redirect:/admin/exam/score");
|
|
@@ -216,6 +217,9 @@ public class ScoreController extends BaseExamController {
|
|
|
WebUser wu = RequestUtils.getWebUser(request);
|
|
|
int examId = getSessionExamId(request);
|
|
|
String exporMmessage = enableExport(examId);
|
|
|
+ if(exporMmessage ==null && StringUtils.isNotBlank(query.getStudentCode())){
|
|
|
+ exporMmessage = enableExport(examId, query.getStudentCode());
|
|
|
+ }
|
|
|
if (exporMmessage != null) {
|
|
|
addMessage(redirectAttributes, "评卷未结束不能导出成绩 " + exporMmessage);
|
|
|
return "redirect:/admin/exam/score";
|
|
@@ -257,6 +261,20 @@ public class ScoreController extends BaseExamController {
|
|
|
return "redirect:/admin/exam/score";
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @RequestMapping("/enableExport")
|
|
|
+ @ResponseBody
|
|
|
+ public JSONObject query(HttpServletRequest request, @RequestParam(required = false) String subjectCode) {
|
|
|
+ int examId = getSessionExamId(request);
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ String exporMmessage = isChecked(examId);
|
|
|
+ if(exporMmessage ==null && StringUtils.isNotBlank(subjectCode)){
|
|
|
+ exporMmessage = enableExport(examId, subjectCode);
|
|
|
+ }
|
|
|
+ obj.accumulate("enableExport", exporMmessage==null);
|
|
|
+ obj.accumulate("exporMmessage", exporMmessage);
|
|
|
+ return obj;
|
|
|
+ }
|
|
|
|
|
|
private List<ScoreItem> buildScoreList(ExamStudent student) {
|
|
|
List<ScoreItem> scoreList = new LinkedList<ScoreItem>();
|
|
@@ -323,19 +341,42 @@ public class ScoreController extends BaseExamController {
|
|
|
}
|
|
|
|
|
|
private String enableExport(int examId) {
|
|
|
+ String message = isChecked(examId);
|
|
|
+ if(message==null){
|
|
|
+ List<ExamSubject> subjects = subjectService.list(examId);
|
|
|
+ for (ExamSubject subject : subjects) {
|
|
|
+ message = enableExport(examId,subject.getCode());
|
|
|
+ if(message!=null){
|
|
|
+ return message;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return message;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String isChecked(int examId) {
|
|
|
String message = null;
|
|
|
Exam exam = examService.findById(examId);
|
|
|
- long totalCount = studentService.countByExamId(examId);
|
|
|
- long uploadCount = studentService.countByExamIdAndUpload(examId, true);
|
|
|
- long manualAbsentCount = studentService.countByExamIdAndManualAbsent(examId, true);
|
|
|
+ ExamStudentSearchQuery query = new ExamStudentSearchQuery();
|
|
|
+ query.setExamId(examId);
|
|
|
+ query.setUpload(false);
|
|
|
+ query.setManualAbsent(false);
|
|
|
+ long unUploadManualAbsentCount = studentService.countByQuery(query);
|
|
|
if (exam.isNeedCalculate()) {
|
|
|
message = "该考试需要统分";
|
|
|
- } else if (uploadCount + manualAbsentCount != totalCount) {
|
|
|
- message = "已上传和人工指定缺考总数不等于总人数";
|
|
|
- } else if (groupService.countByExamAndStatus(examId, MarkStatus.TRIAL, MarkStatus.FORMAL) != 0) {
|
|
|
- message = "有科目未评卷完成";
|
|
|
+ } else if (unUploadManualAbsentCount > 0) {
|
|
|
+ message = "未上传考生必须人工指定缺考";
|
|
|
} else if (checkStudentService.countByExamIdAndChecked(examId, false) != 0) {
|
|
|
message = "人工确认未完成";
|
|
|
+ }
|
|
|
+ return message;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String enableExport(int examId,String subjectCode) {
|
|
|
+ String message = null;
|
|
|
+ List<MarkGroup> groups = groupService.findByExamAndSubjectAndStatus(examId, subjectCode, MarkStatus.FORMAL,MarkStatus.TRIAL);
|
|
|
+ if(groups!=null){
|
|
|
+ message = subjectCode+" 科目未评卷完成";
|
|
|
}
|
|
|
return message;
|
|
|
}
|