|
@@ -2,8 +2,10 @@ package cn.com.qmth.stmms.admin.exam;
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.HashSet;
|
|
import java.util.LinkedList;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Set;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
@@ -355,31 +357,28 @@ public class MarkGroupController extends BaseExamController {
|
|
int examId = getSessionExamId(request);
|
|
int examId = getSessionExamId(request);
|
|
MarkGroup group = groupService.findOne(examId, subjectCode, number);
|
|
MarkGroup group = groupService.findOne(examId, subjectCode, number);
|
|
if (group != null) {
|
|
if (group != null) {
|
|
- // quick update
|
|
|
|
- picList = StringEscapeUtils.unescapeHtml(picList);
|
|
|
|
- JSONArray array = JSONArray.fromObject(picList);
|
|
|
|
- List<PictureConfigItem> list = JSONArray.toList(array, new PictureConfigItem(), new JsonConfig());
|
|
|
|
- if (list != null && !list.isEmpty()) {
|
|
|
|
- groupService.updatePicList(examId, subjectCode, number, list);
|
|
|
|
- }
|
|
|
|
- if (doubleRate != null) {
|
|
|
|
- groupService.updateDoubleRate(examId, subjectCode, number, doubleRate);
|
|
|
|
- }
|
|
|
|
- if (arbitrateThreshold != null) {
|
|
|
|
- groupService.updateArbitrateThreshold(examId, subjectCode, number, arbitrateThreshold);
|
|
|
|
- }
|
|
|
|
- groupService.updateMarkMode(examId, subjectCode, number, markMode);
|
|
|
|
- if (trialCount != null && trialCount > 0 && group.getStatus() == MarkStatus.TRIAL) {
|
|
|
|
- groupService.updateTrialCount(examId, subjectCode, number, trialCount);
|
|
|
|
- }
|
|
|
|
- groupService.updateSheetView(examId, subjectCode, number, sheetView);
|
|
|
|
if (questionDetail != null && reset.booleanValue()) {
|
|
if (questionDetail != null && reset.booleanValue()) {
|
|
// advance update
|
|
// advance update
|
|
questionDetail = StringEscapeUtils.unescapeHtml(questionDetail);
|
|
questionDetail = StringEscapeUtils.unescapeHtml(questionDetail);
|
|
- array = JSONArray.fromObject(questionDetail);
|
|
|
|
|
|
+ JSONArray array = JSONArray.fromObject(questionDetail);
|
|
List<ExamQuestionDTO> detailList = JSONArray.toList(array, new ExamQuestionDTO(), new JsonConfig());
|
|
List<ExamQuestionDTO> detailList = JSONArray.toList(array, new ExamQuestionDTO(), new JsonConfig());
|
|
|
|
+ List<ExamQuestion> all = questionService.findByExamAndSubjectAndObjective(examId, subjectCode,false);
|
|
|
|
+ List<ExamQuestion> old = questionService.findByExamAndSubjectAndObjectiveAndGroupNumber(examId, subjectCode,false,number);
|
|
|
|
+ Set<Integer> mainNumbers = new HashSet<Integer>();
|
|
|
|
+ for (ExamQuestion examQuestion : all) {
|
|
|
|
+ mainNumbers.add(examQuestion.getMainNumber());
|
|
|
|
+ }
|
|
|
|
+ for (ExamQuestion examQuestion : old) {
|
|
|
|
+ mainNumbers.remove(examQuestion.getMainNumber());
|
|
|
|
+ }
|
|
for (int i = 0; i < detailList.size(); i++) {
|
|
for (int i = 0; i < detailList.size(); i++) {
|
|
ExamQuestionDTO dto = detailList.get(i);
|
|
ExamQuestionDTO dto = detailList.get(i);
|
|
|
|
+ if (mainNumbers.contains(dto.getMainNumber())) {
|
|
|
|
+ addMessage(redirectAttributes, "大题号不能重复");
|
|
|
|
+ redirectAttributes.addAttribute("subjectCode", subjectCode);
|
|
|
|
+ redirectAttributes.addAttribute("number", number);
|
|
|
|
+ return "redirect:/admin/exam/group/edit-full";
|
|
|
|
+ }
|
|
Object scoreListArray[] = array.getJSONObject(i).getJSONArray("scoreList").toArray();
|
|
Object scoreListArray[] = array.getJSONObject(i).getJSONArray("scoreList").toArray();
|
|
List<Double> scoreList = new ArrayList<Double>();
|
|
List<Double> scoreList = new ArrayList<Double>();
|
|
for (int j = 0; j < scoreListArray.length; j++) {
|
|
for (int j = 0; j < scoreListArray.length; j++) {
|
|
@@ -412,6 +411,24 @@ public class MarkGroupController extends BaseExamController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // quick update
|
|
|
|
+ picList = StringEscapeUtils.unescapeHtml(picList);
|
|
|
|
+ JSONArray array = JSONArray.fromObject(picList);
|
|
|
|
+ List<PictureConfigItem> list = JSONArray.toList(array, new PictureConfigItem(), new JsonConfig());
|
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
|
+ groupService.updatePicList(examId, subjectCode, number, list);
|
|
|
|
+ }
|
|
|
|
+ if (doubleRate != null) {
|
|
|
|
+ groupService.updateDoubleRate(examId, subjectCode, number, doubleRate);
|
|
|
|
+ }
|
|
|
|
+ if (arbitrateThreshold != null) {
|
|
|
|
+ groupService.updateArbitrateThreshold(examId, subjectCode, number, arbitrateThreshold);
|
|
|
|
+ }
|
|
|
|
+ groupService.updateMarkMode(examId, subjectCode, number, markMode);
|
|
|
|
+ if (trialCount != null && trialCount > 0 && group.getStatus() == MarkStatus.TRIAL) {
|
|
|
|
+ groupService.updateTrialCount(examId, subjectCode, number, trialCount);
|
|
|
|
+ }
|
|
|
|
+ groupService.updateSheetView(examId, subjectCode, number, sheetView);
|
|
redirectAttributes.addAttribute("subjectCode", subjectCode);
|
|
redirectAttributes.addAttribute("subjectCode", subjectCode);
|
|
redirectAttributes.addAttribute("number", number);
|
|
redirectAttributes.addAttribute("number", number);
|
|
return "redirect:/admin/exam/group";
|
|
return "redirect:/admin/exam/group";
|