|
@@ -1,8 +1,27 @@
|
|
|
package cn.com.qmth.stmms.api.controller;
|
|
|
|
|
|
-import cn.com.qmth.stmms.api.exception.ApiException;
|
|
|
+import java.text.DecimalFormat;
|
|
|
+import java.util.LinkedList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
+import net.sf.json.JSONArray;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
+
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
import cn.com.qmth.stmms.api.utils.AESUtil;
|
|
|
-import cn.com.qmth.stmms.api.utils.MenualAbsentDTO;
|
|
|
import cn.com.qmth.stmms.biz.exam.model.Exam;
|
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
|
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
@@ -15,26 +34,12 @@ import cn.com.qmth.stmms.biz.mark.service.MarkLibraryService;
|
|
|
import cn.com.qmth.stmms.biz.user.model.User;
|
|
|
import cn.com.qmth.stmms.biz.user.service.UserService;
|
|
|
import cn.com.qmth.stmms.biz.utils.ScoreItem;
|
|
|
-import cn.com.qmth.stmms.common.annotation.Logging;
|
|
|
import cn.com.qmth.stmms.common.annotation.RoleRequire;
|
|
|
import cn.com.qmth.stmms.common.domain.ApiUser;
|
|
|
-import cn.com.qmth.stmms.common.enums.LogType;
|
|
|
import cn.com.qmth.stmms.common.enums.Role;
|
|
|
import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
|
-import com.google.common.base.Strings;
|
|
|
-import net.sf.json.JSONArray;
|
|
|
-import net.sf.json.JSONObject;
|
|
|
-import org.apache.commons.lang.StringUtils;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.text.DecimalFormat;
|
|
|
-import java.util.LinkedList;
|
|
|
-import java.util.List;
|
|
|
+import com.google.common.base.Strings;
|
|
|
|
|
|
@Controller("examStudentApiController")
|
|
|
@RequestMapping("/api")
|
|
@@ -63,11 +68,12 @@ public class ExamStudentController extends BaseApiController {
|
|
|
public JSONObject checkStudent(HttpServletRequest request, @RequestBody ExamStudent examStudent) {
|
|
|
JSONObject obj = new JSONObject();
|
|
|
Exam exam = examService.findById(examStudent.getExamId());
|
|
|
- ExamStudent student = studentService
|
|
|
- .findByExamIdAndExamNumber(examStudent.getExamId(), examStudent.getExamNumber());
|
|
|
+ ExamStudent student = studentService.findByExamIdAndExamNumber(examStudent.getExamId(),
|
|
|
+ examStudent.getExamNumber());
|
|
|
if (student != null) {
|
|
|
obj.accumulate("examId", examStudent.getExamId());
|
|
|
- obj.accumulate("campusName", student.getCampusName());
|
|
|
+ obj.accumulate("campusCode", "0");
|
|
|
+ obj.accumulate("campusName", StringUtils.trimToEmpty(student.getCampusName()));
|
|
|
obj.accumulate("examNumber", student.getExamNumber());
|
|
|
obj.accumulate("name", student.getName());
|
|
|
obj.accumulate("studentId", String.valueOf(student.getId()));
|
|
@@ -124,7 +130,8 @@ public class ExamStudentController extends BaseApiController {
|
|
|
obj.accumulate("id", student.getId());
|
|
|
obj.accumulate("schoolId", student.getSchoolId());
|
|
|
obj.accumulate("examNumber", student.getExamNumber());
|
|
|
- obj.accumulate("campusName", student.getCampusName());
|
|
|
+ obj.accumulate("campusCode", "0");
|
|
|
+ obj.accumulate("campusName", StringUtils.trimToEmpty(student.getCampusName()));
|
|
|
obj.accumulate("subjectCode", student.getSubjectCode());
|
|
|
obj.accumulate("subjectName", student.getSubjectName());
|
|
|
obj.accumulate("name", student.getName());
|
|
@@ -153,9 +160,8 @@ public class ExamStudentController extends BaseApiController {
|
|
|
// 构造客观题得分明细
|
|
|
JSONArray objective = new JSONArray();
|
|
|
List<ScoreItem> scoreList = student.getScoreList(true);
|
|
|
- List<ExamQuestion> questionList = questionService
|
|
|
- .findByExamAndSubjectAndObjectiveAndPaperType(student.getExamId(),
|
|
|
- student.getSubjectCode(), true, student.getPaperType());
|
|
|
+ List<ExamQuestion> questionList = questionService.findByExamAndSubjectAndObjectiveAndPaperType(
|
|
|
+ student.getExamId(), student.getSubjectCode(), true, student.getPaperType());
|
|
|
int i = 0;
|
|
|
for (ScoreItem item : scoreList) {
|
|
|
i++;
|
|
@@ -178,8 +184,8 @@ public class ExamStudentController extends BaseApiController {
|
|
|
// 构造主观题得分明细
|
|
|
JSONArray subjective = new JSONArray();
|
|
|
scoreList = student.getScoreList(false);
|
|
|
- questionList = questionService
|
|
|
- .findByExamAndSubjectAndObjective(student.getExamId(), student.getSubjectCode(), false);
|
|
|
+ questionList = questionService.findByExamAndSubjectAndObjective(student.getExamId(),
|
|
|
+ student.getSubjectCode(), false);
|
|
|
i = 0;
|
|
|
for (ScoreItem item : scoreList) {
|
|
|
i++;
|
|
@@ -254,9 +260,8 @@ public class ExamStudentController extends BaseApiController {
|
|
|
if (Strings.isNullOrEmpty(examSeqCode)) {
|
|
|
student = studentService.findBySchoolIdAndSubjectCodeAndStudentCode(schoolId, subjectCode, studentCode);
|
|
|
} else {
|
|
|
- student = studentService
|
|
|
- .findBySchoolIdAndSubjectCodeAndStudentCodeAndRemark(schoolId, subjectCode, studentCode,
|
|
|
- examSeqCode);
|
|
|
+ student = studentService.findBySchoolIdAndSubjectCodeAndStudentCodeAndRemark(schoolId, subjectCode,
|
|
|
+ studentCode, examSeqCode);
|
|
|
}
|
|
|
if (student != null) {
|
|
|
DecimalFormat df = new DecimalFormat("####.###");
|