|
|
@@ -90,7 +90,7 @@ public class ExamService {
|
|
|
if(UserTypeEnum.isCard(user.getUserType()) && !UserRegStatus.Student.equals(user.getRegStatus())) {
|
|
|
throw new RuntimeException("VIP功能不可用");
|
|
|
}
|
|
|
- return openExaminee(relatedId, SecurityUtils.getUserId(), getDirectedKey(directed));
|
|
|
+ return openExaminee(relatedId, SecurityUtils.getUserId(), directed);
|
|
|
} else if(PaperType.Simulated.equals(paperType)) {
|
|
|
SysUser exist = sysUserService.selectUserById(SecurityUtils.getUserId());
|
|
|
LearnStudent ls = learnStudentMapper.selectLearnStudentByStudentId(exist.getUserId());
|
|
|
@@ -102,14 +102,6 @@ public class ExamService {
|
|
|
throw new RuntimeException("错误类型: " + paperType);
|
|
|
}
|
|
|
|
|
|
- private String getDirectedKey(boolean directed) {
|
|
|
- if(!directed) {
|
|
|
- return "";
|
|
|
- }
|
|
|
- LearnStudent ls = learnStudentMapper.selectLearnStudentByStudentId(SecurityUtils.getUserId());
|
|
|
- return StringUtils.trimToEmpty(ls.getDirectKey());
|
|
|
- }
|
|
|
-
|
|
|
public AnswerSheet loadExaminee(Long examineeId, Boolean examContinue) {
|
|
|
LearnExaminee examinee = examineeMapper.selectLearnExamineeByExamineeId(examineeId);
|
|
|
if(examContinue) {
|
|
|
@@ -431,14 +423,26 @@ public class ExamService {
|
|
|
* 根据知识点生成一次性练习卷并开始做题
|
|
|
* @return
|
|
|
*/
|
|
|
- private AnswerSheet openExaminee(Long knowledgeId, Long studentId, String directKey) {
|
|
|
+ private AnswerSheet openExaminee(Long knowledgeId, Long studentId, Boolean directed) {
|
|
|
+ String directKey;
|
|
|
+ AMarjorPlan plan = null;
|
|
|
+ LearnStudent ls = null;
|
|
|
+ if(!directed) {
|
|
|
+ directKey = "";
|
|
|
+ } else {
|
|
|
+ ls = learnStudentMapper.selectLearnStudentByStudentId(SecurityUtils.getUserId());
|
|
|
+ if(null == (plan = marjorPlanService.selectAMarjorPlanById(ls.getMajorPlanId()))) {
|
|
|
+ throw new ValidationException("专业id无效");
|
|
|
+ }
|
|
|
+ directKey = StringUtils.trimToEmpty(ls.getDirectKey());
|
|
|
+ }
|
|
|
LearnKnowledgeTree knowledgeTree = knowledgeTreeMapper.selectLearnKnowledgeTreeById(knowledgeId);
|
|
|
LearnPaper paper = new LearnPaper();
|
|
|
paper.setPaperType(PaperType.Practice.name());
|
|
|
paper.setRelateId(knowledgeId);
|
|
|
paper.setYear(Calendar.getInstance().get(Calendar.YEAR));
|
|
|
paper.setStatus(PaperStatus.TmpValid.getVal());
|
|
|
- paper.setDirectKey(studentId + "_" + StringUtils.trimToEmpty(directKey));
|
|
|
+ paper.setDirectKey(studentId + "_" + directKey);
|
|
|
List<LearnPaper> paperList = paperMapper.selectLearnPaperList(paper);
|
|
|
if (CollectionUtils.isNotEmpty(paperList)) { // 有未做完的
|
|
|
LearnPaper existPaper = paperList.get(0);
|
|
|
@@ -491,6 +495,14 @@ public class ExamService {
|
|
|
learnExaminee.setState(ExamineeStatus.Exam.getVal());
|
|
|
learnExaminee.setBeginTime(new Date());
|
|
|
learnExaminee.setDuration(0L);
|
|
|
+ if(directed && null != ls.getMajorPlanId()) {
|
|
|
+ JSONObject info = new JSONObject();
|
|
|
+ info.put("universityId", ls.getUniversityId());
|
|
|
+ info.put("universityName", plan.getUniversityName());
|
|
|
+ info.put("planId", ls.getMajorPlanId());
|
|
|
+ info.put("majorName", plan.getMajorName());
|
|
|
+ learnExaminee.setPaperInfo(info.toJSONString());
|
|
|
+ }
|
|
|
examineeMapper.insertLearnExaminee(learnExaminee);
|
|
|
|
|
|
AnswerSheet answerSheet = buildAnswerSheet(paper, learnExaminee);
|