ting.yin 4 jaren geleden
bovenliggende
commit
4f375a0140

+ 2 - 2
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/file/service/impl/FileServiceImpl.java

@@ -177,12 +177,12 @@ public class FileServiceImpl implements FileService, InitializingBean {
 
     @Override
     public String getCardUri(int examId, String subjectCode, FormatType type) {
-        return FileType.ANSWER.getPath(examId, subjectCode, type.getExtName());
+        return FileType.CARD.getPath(examId, subjectCode, type.getExtName());
     }
 
     @Override
     public String getCardUri(int examId, FormatType type) {
-        return FileType.ANSWER.getPath(examId, COMMON_PLACEHOLDER, type.getExtName());
+        return FileType.CARD.getPath(examId, COMMON_PLACEHOLDER, type.getExtName());
     }
 
     @Override

+ 11 - 6
stmms-web/src/main/java/cn/com/qmth/stmms/api/controller/CoreController.java

@@ -10,12 +10,14 @@ import cn.com.qmth.stmms.common.annotation.RoleRequire;
 import cn.com.qmth.stmms.common.domain.ApiUser;
 import cn.com.qmth.stmms.common.enums.ExamStatus;
 import cn.com.qmth.stmms.common.enums.ExamType;
+import cn.com.qmth.stmms.common.enums.ObjectiveStatus;
 import cn.com.qmth.stmms.common.enums.Role;
 import cn.com.qmth.stmms.common.enums.SubjectiveStatus;
 import cn.com.qmth.stmms.common.utils.DateUtils;
 import cn.com.qmth.stmms.common.utils.RequestUtils;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
+
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
+
 import java.text.DecimalFormat;
 import java.util.Date;
 
@@ -48,25 +51,25 @@ public class CoreController extends BaseApiController {
             @RequestParam(required = false) String examTime) {
         ApiUser user = RequestUtils.getApiUser(request);
         JSONObject result = new JSONObject();
-        //输入字段预处理并初步校验
+        // 输入字段预处理并初步校验
         code = validate("code", code, false, 32);
         name = validate("name", name, true, 32);
         Date time = DateUtils.parseDate(examTime);
         Exam current = null;
         if (id != null) {
-            //根据id查找考试并校验
+            // 根据id查找考试并校验
             current = examService.findById(id);
             if (current == null) {
                 throw ApiException.QUERY_PARAM_ERROR.replaceMessage("id invalid");
             }
         } else if (code != null) {
-            //根据code查找考试并校验
+            // 根据code查找考试并校验
             current = examService.findBySchoolAndCode(user.getSchoolId(), code);
         } else {
             throw ApiException.QUERY_PARAM_ERROR.replaceMessage("id/code both unexists");
         }
         if (current == null) {
-            //新建考试并校验考试时间
+            // 新建考试并校验考试时间
             if (time == null) {
                 throw ApiException.QUERY_PARAM_ERROR.replaceMessage("examTime invalid");
             }
@@ -75,6 +78,8 @@ public class CoreController extends BaseApiController {
             current.setSchoolId(user.getSchoolId());
             current.setType(ExamType.SCAN_IMAGE);
             current.setStatus(ExamStatus.START);
+            current.setForbiddenInfo(false);
+            current.setObjectiveStatus(ObjectiveStatus.WAITING);
             current.setCreateTime(new Date());
         } else if (!current.getSchoolId().equals(user.getSchoolId()) || current.getStatus() != ExamStatus.START) {
             throw ApiException.EXAM_NOT_ACCESSIBLED;
@@ -106,7 +111,7 @@ public class CoreController extends BaseApiController {
         examNumber = validate("examNumber", examNumber, true, 64);
         ExamStudent student = studentService.findByExamIdAndExamNumber(examId, examNumber);
         if (student == null) {
-            //新建考生
+            // 新建考生
             student = new ExamStudent();
             student.setExamId(examId);
             student.setSchoolId(exam.getSchoolId());
@@ -133,7 +138,7 @@ public class CoreController extends BaseApiController {
             student.setSubjectiveScore(0d);
             student.setSubjectiveStatus(SubjectiveStatus.UNMARK);
         } else {
-            //更新现有考生
+            // 更新现有考生
             name = validate(name, true, 32);
             if (name != null) {
                 student.setName(name);