| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.utils.TimeSwitchUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.modules.apply.entity.Apply; |
| | | import org.springblade.modules.exam.entity.*; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | |
| | | //模拟考试 |
| | | if (examPaperVO1.getExamType()==2) { |
| | | examPaperVO1.setNum(baseMapper.getTrainNumber(examPaperVO1)); |
| | | examPaperVO1.setExamNum(baseMapper.getExamNumber(examPaperVO1)); |
| | | //计算截止时间 |
| | | long nowTime = System.currentTimeMillis(); |
| | | long examStartTime = examPaperVO1.getStartTime().getTime(); |
| | | long examEndTime = examPaperVO1.getEndTime().getTime(); |
| | | //判断时间 |
| | | if (nowTime-examEndTime>0){ |
| | | //剩余时间大于1天 |
| | | examPaperVO1.setDeadline("考试已结束"); |
| | | }else if(nowTime-examStartTime>=0 && nowTime-examEndTime<=0){ |
| | | //已到考试时间 |
| | | examPaperVO1.setDeadline("已到考试时间"); |
| | | }else { |
| | | long time = examStartTime - nowTime; |
| | | examPaperVO1.setDeadline(TimeSwitchUtil.secondToTime(time)); |
| | | } |
| | | } |
| | | }); |
| | | return examPaperVOIPage; |
| | |
| | | if (null!=paper.getScoreId()){ |
| | | //随机分类信息 |
| | | List<ExamSubjectChoicesVO> examSubjectChoicesVOS = baseMapper.queryRandomSubject(paper); |
| | | // long before = System.currentTimeMillis(); |
| | | List<ExamExaminationSubject> list = new ArrayList<>(); |
| | | examSubjectChoicesVOS.forEach(examSubjectChoicesVO -> { |
| | | //新增个人对应每场考试成绩试卷 |
| | | ExamExaminationSubject ksxtSginup = new ExamExaminationSubject(); |
| | |
| | | ksxtSginup.setCategoryId(examSubjectChoicesVO.getChoicesType()); |
| | | ksxtSginup.setSubjectId(examSubjectChoicesVO.getId()); |
| | | //新增 |
| | | examExaminationSubjectService.save(ksxtSginup); |
| | | // examExaminationSubjectService.save(ksxtSginup); |
| | | list.add(ksxtSginup); |
| | | //将题目答案设置为空字符串,不让前端看到 |
| | | examSubjectChoicesVO.setAnswer(""); |
| | | }); |
| | | //批量新增 |
| | | baseMapper.insertBatch(list); |
| | | // long after = System.currentTimeMillis(); |
| | | // System.out.println("时间差"+(after-before)); |
| | | //新增试卷关联信息 |
| | | return examSubjectChoicesVOS; |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ExamPaper getExamInfoByExamName(String examName) { |
| | | public List<ExamPaper> getExamInfoByExamName(String examName) { |
| | | return baseMapper.getExamInfoByExamName(examName); |
| | | } |
| | | |