diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/ExOpenUserService.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExOpenUserService.java
new file mode 100644
index 0000000..7949c1b
--- /dev/null
+++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExOpenUserService.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ccic.safeliab.service;
+
+import com.ccic.safeliab.entity.ExOpenUser;
+import com.ccic.safeliab.support.BaseService;
+
+
+/**
+ * 服务类
+ *
+ * @author edwong
+ */
+public interface ExOpenUserService extends BaseService<ExOpenUser> {
+
+}
diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/ExOpenUserServiceImpl.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExOpenUserServiceImpl.java
new file mode 100644
index 0000000..ec37f73
--- /dev/null
+++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExOpenUserServiceImpl.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.ccic.safeliab.service;
+
+import com.ccic.safeliab.dao.OpenUserMapper;
+import com.ccic.safeliab.entity.ExOpenUser;
+import com.ccic.safeliab.support.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * 服务实现类
+ *
+ * @author edwong
+ */
+@Service
+public class ExOpenUserServiceImpl extends BaseServiceImpl<OpenUserMapper, ExOpenUser> implements ExOpenUserService {
+
+
+}
diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamService.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamService.java
index e3f7c0d..e38f3d2 100644
--- a/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamService.java
+++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamService.java
@@ -29,6 +29,6 @@ public interface ExamService {
 
     R saveUserAnswers(UserAnswersVO userAnswersVO);
 
-    boolean checkExamCaptcha(Long examId, String captcha);
+    R examRegist(Long examId, String captcha, String name, String phoneNumber);
 
 }
diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamServiceImpl.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamServiceImpl.java
index 3ac9a0b..94c1d22 100644
--- a/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamServiceImpl.java
+++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamServiceImpl.java
@@ -16,14 +16,8 @@
 package com.ccic.safeliab.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.ccic.safeliab.dao.AnswersMapper;
-import com.ccic.safeliab.dao.ExamInfoMapper;
-import com.ccic.safeliab.dao.ExamScouresMapper;
-import com.ccic.safeliab.dao.QuestionMapper;
-import com.ccic.safeliab.entity.ExAnswers;
-import com.ccic.safeliab.entity.ExExamInfo;
-import com.ccic.safeliab.entity.ExExamScoures;
-import com.ccic.safeliab.entity.ExamPapers;
+import com.ccic.safeliab.dao.*;
+import com.ccic.safeliab.entity.*;
 import com.ccic.safeliab.vo.ExamPageDataVO;
 import com.ccic.safeliab.vo.PageQuestionCategoriesVO;
 import com.ccic.safeliab.vo.UserAnswersVO;
@@ -33,6 +27,8 @@ import org.springframework.stereotype.Service;
 
 import java.util.List;
 import com.ccic.safeliab.util.R;
+import org.springframework.ui.Model;
+import org.springframework.ui.ModelMap;
 
 
 /**
@@ -62,6 +58,9 @@ public class ExamServiceImpl implements ExamService {
     @Autowired
     private ExamPaperService paperService;
 
+    @Autowired
+    private ExOpenUserService exOpenUserService;
+
     @Override
     public R findExamPageData(Long examId) {
         QueryWrapper<ExExamInfo> examScouresWrapper = new QueryWrapper<>();
@@ -91,7 +90,11 @@ public class ExamServiceImpl implements ExamService {
         examPageDataVO.setPaperId(examInfo.getPaperId());
         examPageDataVO.setPaperName(examPapers.getPaperName());
         examPageDataVO.setTotalScore(examPapers.getTotalScore());
-        examPageDataVO.setExamDuration(examPapers.getExamDuration());
+        if (examPapers.getDurationType() == 1) {
+            examPageDataVO.setExamDuration(examPapers.getExamDuration() * 60 );
+        } else {
+            examPageDataVO.setExamDuration(examPapers.getExamDuration() * 60 * 60 );
+        }
         examPageDataVO.setPaperContent(examPapers.getPaperContent());
         examPageDataVO.setQuestionCount(examPapers.getQuestionCount());
         examPageDataVO.setQuestionCategoriesList(pageQuestionCategoriesList);
@@ -100,7 +103,6 @@ public class ExamServiceImpl implements ExamService {
 
     @Override
     public R saveUserAnswers(UserAnswersVO userAnswersVO) {
-        userAnswersVO.setUserId(Long.parseLong("1"));
         QueryWrapper<ExAnswers> answersQueryWrapper = new QueryWrapper<>();
         answersQueryWrapper.lambda().eq(ExAnswers::getUserId, userAnswersVO.getUserId());
         answersQueryWrapper.lambda().eq(ExAnswers::getExamId, userAnswersVO.getExamId());
@@ -120,7 +122,7 @@ public class ExamServiceImpl implements ExamService {
                 exAnswers.setPaperId(userAnswersVO.getPaperId());
             }
         }
-        answersService.saveBatch(answersList);
+        answersService.saveBatchByExam(answersList, userAnswersVO.getUserId());
         QueryWrapper<ExExamScoures> examScouresQueryWrapper = new QueryWrapper<>();
         examScouresQueryWrapper.lambda().eq(ExExamScoures::getUserId, userAnswersVO.getUserId());
         examScouresQueryWrapper.lambda().eq(ExExamScoures::getExamId, userAnswersVO.getExamId());
@@ -134,21 +136,47 @@ public class ExamServiceImpl implements ExamService {
         examScoures.setPaperId(userAnswersVO.getPaperId());
         examScoures.setExamId(userAnswersVO.getExamId());
         examScoures.setTotalScore(totalScore);
-        examScoures.setExamTimeSpent(userAnswersVO.getExamTimeSpent());
-        examScouresService.save(examScoures);
+        int examTimeSpentInMinutes = (int) Math.ceil((double) userAnswersVO.getExamTimeSpent() / 60);
+        examScoures.setExamTimeSpent(examTimeSpentInMinutes);
+        examScouresService.saveByExam(examScoures, userAnswersVO.getUserId());
         Integer leadValue = examScouresMapper.getLeadValue(userAnswersVO.getExamId(), userAnswersVO.getPaperId(), totalScore);
         return R.ok().data(leadValue);
     }
 
     @Override
-    public boolean checkExamCaptcha(Long examId, String captcha) {
+    public R examRegist(Long examId, String captcha, String name, String phoneNumber) {
         ExExamInfo examInfo = examInfoMapper.selectById(examId);
-        if (examInfo != null) {
+        ModelMap map = new ModelMap();
+        if (examInfo != null && examInfo.getPublishStatus() == 1) {
             if (captcha.equals(examInfo.getCaptcha())) {
-                return true;
+                QueryWrapper<ExOpenUser> qw = new QueryWrapper<>();
+                qw.lambda().eq(ExOpenUser::getPhoneNumber, phoneNumber);
+                qw.lambda().eq(ExOpenUser::getNickname, name);
+                ExOpenUser openUser = exOpenUserService.getOne(qw);
+                Long openUserId = null;
+                if (openUser == null) {
+                    ExOpenUser newOpenUser = new ExOpenUser();
+                    newOpenUser.setPhoneNumber(phoneNumber);
+                    newOpenUser.setNickname(name);
+                    exOpenUserService.save(newOpenUser);
+                    openUserId = newOpenUser.getId();
+                } else {
+                    openUserId = openUser.getId();
+                }
+                map.put("status", 200);
+                map.put("msg", "进入考试");
+                map.put("examOpenUserId", openUserId.toString());
+                return R.ok().data(map);
+            } else {
+                map.put("status", 999);
+                map.put("msg", "考试码错误");
+                return R.ok().data(map);
             }
         }
-        return false;
+        map.put("status", 999);
+        map.put("msg", "获取考试信息失败");
+        return R.ok().data(map);
+
     }
 
 }
diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseService.java b/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseService.java
index 193f28a..ebb0312 100644
--- a/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseService.java
+++ b/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseService.java
@@ -8,4 +8,8 @@ public interface BaseService<T> extends IService<T> {
     boolean deleteLogic(List<Long> ids);
 
     boolean saveBatch(List<T> list);
+
+    boolean saveByExam(T entity, Long examUserId);
+
+    boolean saveBatchByExam(List<T> list, Long examUserId);
 }
diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseServiceImpl.java b/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseServiceImpl.java
index 3f66ea5..011ba1b 100644
--- a/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseServiceImpl.java
+++ b/ccic-exam/src/main/java/com/ccic/safeliab/support/BaseServiceImpl.java
@@ -77,5 +77,39 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> exte
         return super.saveBatch(list);
     }
 
+    public boolean saveByExam(T entity, Long examUserId) {
+
+        entity.setCreatedBy(examUserId);
+        entity.setUpdatedBy(examUserId);
+        Date now = new Date();
+        entity.setCreatedAt(now);
+        entity.setUpdatedAt(now);
+        if (entity.getStatus() == null) {
+            entity.setStatus(1);
+        }
+        entity.setIsDeleted(0);
+        return super.save(entity);
+    }
+
+    public boolean saveBatchByExam(List<T> list, Long examUserId) {
+        if (list == null || list.isEmpty()) {
+            return false;
+        }
+        Date now = new Date();
+        for (T entity : list) {
+            if (entity != null) {
+                entity.setCreatedBy(examUserId);
+                entity.setUpdatedBy(examUserId);
+                entity.setCreatedAt(now);
+                entity.setUpdatedAt(now);
+                if (entity.getStatus() == null) {
+                    entity.setStatus(1);
+                }
+                entity.setIsDeleted(0);
+            }
+        }
+        return super.saveBatch(list);
+    }
+
 
 }
diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/web/ExamController.java b/ccic-exam/src/main/java/com/ccic/safeliab/web/ExamController.java
index 0ad6876..b4194e1 100644
--- a/ccic-exam/src/main/java/com/ccic/safeliab/web/ExamController.java
+++ b/ccic-exam/src/main/java/com/ccic/safeliab/web/ExamController.java
@@ -63,14 +63,14 @@ public class ExamController {
 	}
 
 	/**
-	 * 验证考试码
+	 * 考试报名
 	 * @param examId
 	 * @param captcha
 	 * @return
 	 */
-	@GetMapping("/checkExamCaptcha")
-	public R checkExamCaptcha(Long examId, String captcha) {
-		return R.ok().data(examService.checkExamCaptcha(examId, captcha));
+	@GetMapping("/examRegist")
+	public R examRegist(Long examId, String captcha, String name, String phoneNumber) {
+		return examService.examRegist(examId, captcha, name, phoneNumber);
 	}
 
 
diff --git a/ccic-exam/src/main/resources/mappers/ExamScheduleMapper.xml b/ccic-exam/src/main/resources/mappers/ExamScheduleMapper.xml
index 4d347a1..884865f 100644
--- a/ccic-exam/src/main/resources/mappers/ExamScheduleMapper.xml
+++ b/ccic-exam/src/main/resources/mappers/ExamScheduleMapper.xml
@@ -66,58 +66,51 @@
     </select>
     <select id="getExamParticipation" resultType="java.util.Map">
         SELECT
-            openuser.id as key,
-            openuser.nickname as name,
-            openuser.phone_number as phoneNumber ,
-            sc.total_score as score,
-            STRING_AGG ( questions.question_number, '、'  ORDER BY TO_NUMBER(questions.question_number) ASC) as wrongQuestionIds
+          usr.ID AS KEY,
+          usr.nickname AS name,
+          usr.phone_number AS phoneNumber,
+          sco.total_score AS score,
+          STRING_AGG (pq.question_number, '、' ORDER BY TO_NUMBER(pq.question_number) ASC) AS wrongQuestionIds
         FROM
-            ex_exam_info info
-                LEFT JOIN ex_exam_scores sc ON info.paper_id = sc.paper_id
-                AND info.ID = sc.exam_id
-                LEFT JOIN ex_answers ans ON info.paper_id = ans.paper_id
-                AND sc.user_id = ans.user_id
-                AND ans.exam_id = info.ID
-                AND ans.is_correct = 0
-                LEFT JOIN ex_open_user openuser ON openuser.ID = sc.user_id
-                LEFT JOIN ex_paper_questions questions ON questions.question_id = ans.question_id
-                AND info.paper_id = ans.paper_id
+          ex_exam_info info
+        LEFT JOIN ex_exam_papers paper ON info.paper_id = paper.id and paper.is_deleted = 0
+        LEFT JOIN ex_paper_questions pq ON paper.id = pq.paper_id and pq.is_deleted = 0
+        LEFT JOIN ex_answers ans ON ans.question_id = pq.question_id and ans.is_deleted = 0
+        LEFT JOIN ex_open_user usr ON usr.id = ans.user_id and usr.is_deleted = 0
+        LEFT JOIN ex_exam_scores sco ON usr.id = sco.user_id and sco.is_deleted = 0
         WHERE
-            info.is_deleted = 0
-          AND info.ID = #{exam_id}
+            info.ID = #{exam_id}
+          and ans.is_correct = 0
+          and info.is_deleted = 0
         GROUP BY
-            openuser.id,
-            openuser.nickname,
-            openuser.phone_number,
-            sc.total_score
+          usr.ID,
+          usr.nickname,
+          usr.phone_number,
+          sco.total_score
         ORDER BY
-            openuser.nickname,
-            openuser.phone_number
+          usr.nickname,
+          usr.phone_number
     </select>
     <select id="getExamAnswerDetails" resultType="java.util.Map">
         SELECT
-            questions.question_number as key,
-            questions.question_number as questionNumber,
-            SUM ( CASE WHEN ans.is_correct = 0 THEN 1 ELSE 0 END ) AS wrongPeopleCount,
-            STRING (
-                    ROUND( SUM ( CASE WHEN ans.is_correct = 0 THEN 1 ELSE 0 END ) / COUNT ( 0 ) * 100, 0 )
-            ) AS wrongPeopleRatio
+          pq.question_number AS key,
+          pq.question_number AS questionNumber,
+          SUM(CASE WHEN ans.is_correct = 0 THEN 1 ELSE 0 END) AS wrongPeopleCount,
+          STRING (
+          ROUND(SUM(CASE WHEN ans.is_correct = 0 THEN 1 ELSE 0 END) / COUNT(0) * 100, 0)) AS wrongPeopleRatio
         FROM
-            ex_exam_info info
-            LEFT JOIN ex_exam_scores sc ON info.paper_id = sc.paper_id
-            AND info.ID = sc.exam_id
-            LEFT JOIN ex_answers ans ON info.paper_id = ans.paper_id
-            AND sc.user_id = ans.user_id
-            AND info.ID = ans.exam_id
-            LEFT JOIN ex_open_user openuser ON openuser.ID = ans.user_id
-            LEFT JOIN ex_paper_questions questions ON questions.question_id = ans.question_id
-            AND info.paper_id = ans.paper_id
+          ex_paper_questions pq
+          LEFT JOIN ex_exam_papers paper ON pq.paper_id = paper.ID
+          AND paper.is_deleted = 0
+          LEFT JOIN ex_exam_info info ON paper.ID = info.paper_id
+          AND info.is_deleted = 0
+          LEFT JOIN ex_answers ans ON ans.question_id = pq.question_id and ans.is_deleted = 0
         WHERE
-            info.is_deleted = 0
-          AND info.ID = #{exam_id}
+          info.ID = #{exam_id}
+          AND pq.is_deleted = 0
         GROUP BY
-            questions.question_number
+          pq.question_number
         ORDER BY
-            questions.question_number
+          pq.question_number
     </select>
 </mapper>
\ No newline at end of file