|
@@ -46,7 +46,7 @@ import cn.com.qmth.stmms.biz.file.enums.FormatType;
|
|
|
import cn.com.qmth.stmms.biz.file.service.FileService;
|
|
|
import cn.com.qmth.stmms.biz.lock.LockService;
|
|
|
import cn.com.qmth.stmms.biz.mark.service.MarkService;
|
|
|
-import cn.com.qmth.stmms.biz.report.service.*;
|
|
|
+import cn.com.qmth.stmms.biz.report.service.ReportService;
|
|
|
import cn.com.qmth.stmms.common.annotation.Logging;
|
|
|
import cn.com.qmth.stmms.common.annotation.RoleRequire;
|
|
|
import cn.com.qmth.stmms.common.domain.WebUser;
|
|
@@ -101,7 +101,6 @@ public class PaperController extends BaseExamController {
|
|
|
@Autowired
|
|
|
private MarkService markService;
|
|
|
|
|
|
-
|
|
|
@Autowired
|
|
|
private MarkerService markerService;
|
|
|
|
|
@@ -531,7 +530,7 @@ public class PaperController extends BaseExamController {
|
|
|
@RequestMapping(value = "/question-edit/{questionId}", method = RequestMethod.GET)
|
|
|
@RoleRequire(Role.SCHOOL_ADMIN)
|
|
|
public String edit(Model model, @PathVariable Integer questionId, ExamSubjectSearchQuery query,
|
|
|
- @RequestParam(required = false) Boolean upload,@RequestParam Boolean enableUpdate) {
|
|
|
+ @RequestParam(required = false) Boolean upload, @RequestParam Boolean enableUpdate) {
|
|
|
ExamQuestion examQuestion = questionService.findById(questionId);
|
|
|
model.addAttribute("examQuestion", examQuestion);
|
|
|
model.addAttribute("objectivePolicyList", ObjectivePolicy.values());
|
|
@@ -554,12 +553,12 @@ public class PaperController extends BaseExamController {
|
|
|
String t = query.getTotalScoreNotEqual() == null ? "" : query.getTotalScoreNotEqual().toString();
|
|
|
ExamQuestion newQ = questionService.findByExamAndSubjectAndObjectiveAndMainNumberAndSubNumber(examId,
|
|
|
question.getSubjectCode(), question.isObjective(), question.getMainNumber(), question.getSubNumber());
|
|
|
- if(!old.isObjective()&&!enableUpdate) {//只能修改大题名称的主观题
|
|
|
- questionService.updateMainTitle(id, question.getMainTitle(), question.getName());
|
|
|
- return "redirect:/admin/exam/paper/detail?subjectCode=" + question.getSubjectCode() + "&pageNumber="
|
|
|
+ if (!old.isObjective() && !enableUpdate) {// 只能修改大题名称的主观题
|
|
|
+ questionService.updateMainTitle(id, question.getMainTitle(), question.getName());
|
|
|
+ return "redirect:/admin/exam/paper/detail?subjectCode=" + question.getSubjectCode() + "&pageNumber="
|
|
|
+ query.getPageNumber() + "&code=" + query.getCode() + "&category=" + query.getCategory()
|
|
|
+ "&level=" + query.getLevel() + "&upload=" + u + "&totalScoreNotEqual=" + t;
|
|
|
- }
|
|
|
+ }
|
|
|
if (old == null || ((old.getMainNumber() != question.getMainNumber()
|
|
|
|| !old.getSubNumber().equals(question.getSubNumber())) && newQ != null)) {
|
|
|
addMessage(redirectAttributes, "编辑失败,编辑题目不存在或编辑后的题号已存在");
|
|
@@ -852,8 +851,7 @@ public class PaperController extends BaseExamController {
|
|
|
}
|
|
|
|
|
|
private boolean validate(ExamQuestion question, List<String> error, Map<Integer, String> titleMap) {
|
|
|
- int score = (int) (question.getTotalScore() * 100);
|
|
|
- if ((question.getTotalScore() * 100) - score > 0) {
|
|
|
+ if (countDecimalPlaces(question.getTotalScore()) > 2) {
|
|
|
error.add("有满分为小数超2位的记录");
|
|
|
return false;
|
|
|
}
|
|
@@ -885,6 +883,15 @@ public class PaperController extends BaseExamController {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ public int countDecimalPlaces(double number) {
|
|
|
+ String num = Double.toString(number);
|
|
|
+ int decimalPointIndex = num.indexOf('.');
|
|
|
+ if (decimalPointIndex == -1) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return num.length() - decimalPointIndex - 1;
|
|
|
+ }
|
|
|
+
|
|
|
@Logging(menu = "导入数据包", type = LogType.IMPORT_FILE)
|
|
|
@RequestMapping(value = "/importData", method = RequestMethod.POST)
|
|
|
@RoleRequire(Role.SCHOOL_ADMIN)
|