| | |
| | | * @history 2018-03-11 create kevin |
| | | * |
| | | */ |
| | | @Api(tags = "考试管理接口") |
| | | @Api(tags = "考试管理接口") |
| | | @Controller |
| | | @CrossOrigin(origins="*",maxAge=3600) |
| | | @RequestMapping(value = "/exam/exam") |
| | | public class ExamController { |
| | | private final Logger log = LogManager.getLogger(ExamController.class); |
| | | |
| | | // 分页查询中,默认记录条数和页数 |
| | | // 分页查询中,默认记录条数和页数 |
| | | private static final int DEFAULT_PAGE_SIZE = 10; |
| | | private static final int DEFAULT_PAGE_NUM = 1; |
| | | |
| | | //生成密码长度 |
| | | //生成密码长度 |
| | | private static final int EXAM_CERT_PWD_LENGTH = 8; |
| | | |
| | | @Autowired |
| | |
| | | IClassService classService; |
| | | |
| | | /** |
| | | * 考试列表 |
| | | * 考试列表 |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | @RequestMapping(value = "list", method = RequestMethod.GET) |
| | | public @ResponseBody Result list(String keyword,String classId,String subjectId,Short status,Integer pageSize,Integer pageNum) { |
| | | pageSize = pageSize != null && pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE; |
| | | pageNum = pageNum != null && pageNum > 0 ? pageNum : DEFAULT_PAGE_NUM; |
| | | //总考试数量 |
| | | //总考试数量 |
| | | int totalCount = examService.listCount(keyword == null ? "" : keyword.trim(),classId,subjectId,status); |
| | | Pager pager = new Pager(pageSize,pageNum); |
| | | pager.setTotalCount(totalCount); |
| | |
| | | |
| | | |
| | | if(listResult!=null && listResult.size()>0){ |
| | | //查询待批阅,已批阅,未提交数量 |
| | | //查询待批阅,已批阅,未提交数量 |
| | | Map<String,Integer> countMap = examService.queryExamResultStatusCount(QBeanUtils.listPropertyVal(list, "examId")); |
| | | countMap = countMap==null?new HashMap<String,Integer>(1):countMap; |
| | | Integer tempCount = null; |
| | |
| | | private String getExamProgressStatus(List<ExamBatchInfo> lstBatchInfos){ |
| | | |
| | | if(lstBatchInfos == null ||lstBatchInfos.size()==0){ |
| | | return "已结束"; |
| | | return "已结束"; |
| | | } |
| | | |
| | | String progressStatus="待开始"; |
| | | String progressStatus="待开始"; |
| | | Date now = new Date(); |
| | | |
| | | //根据开始时间倒序 |
| | | //根据开始时间倒序 |
| | | lstBatchInfos.sort(new Comparator<ExamBatchInfo>(){ |
| | | @Override |
| | | public int compare(ExamBatchInfo o1, ExamBatchInfo o2) { |
| | |
| | | } |
| | | }); |
| | | |
| | | //如果所有批次都小于当前时间,则已结束,如果有一个批次正在进行中,则进行中 |
| | | //如果所有批次都小于当前时间,则已结束,如果有一个批次正在进行中,则进行中 |
| | | if(lstBatchInfos.get(0).getEndTime().getTime()<now.getTime()){ |
| | | progressStatus="已结束"; |
| | | progressStatus="已结束"; |
| | | }else{ |
| | | for(ExamBatchInfo f : lstBatchInfos){ |
| | | if(f.getStartTime().getTime()<=now.getTime() && f.getEndTime().getTime()>=now.getTime()){ |
| | | progressStatus = "进行中"; |
| | | progressStatus = "进行中"; |
| | | break; |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 教师查看考试成绩列表 |
| | | * 教师查看考试成绩列表 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "老师查看学生考试结果列表") |
| | | @ApiOperation(value = "老师查看学生考试结果列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="examId", dataType="String", paramType="query", value="考试id", required=true), |
| | | @ApiImplicitParam(name="examBatchId", dataType="String", paramType="query", value="批次id", required=true), |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id", required=true), |
| | | @ApiImplicitParam(name="examId", dataType="String", paramType="query", value="考试id", required=true), |
| | | @ApiImplicitParam(name="examBatchId", dataType="String", paramType="query", value="批次id", required=true), |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id", required=true), |
| | | }) |
| | | @RequestMapping(value = "teacher/examresultlist", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryStudentExamResultList(String examId, String examBatchId, String classId,String keyword, Integer pageSize, Integer pageNum) { |
| | | pageSize = pageSize != null && pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE; |
| | | pageNum = pageNum != null && pageNum > 0 ? pageNum : DEFAULT_PAGE_NUM; |
| | | |
| | | //总考试数量 |
| | | //总考试数量 |
| | | int totalCount = examService.listResultCount(examId, |
| | | StringUtils.isEmpty(examBatchId)?null:new String[]{examBatchId}, classId, keyword == null ? "" : keyword.trim()); |
| | | |
| | |
| | | for(Map<String, Object> map:listResult){ |
| | | map.put("rank", rank); |
| | | map.put("isPass", (map.get("studentScore")==null ? BigDecimal.ZERO :(BigDecimal)map.get("studentScore")) |
| | | .compareTo((BigDecimal)map.get("passingScore")) == -1 ? "否" : "是"); |
| | | .compareTo((BigDecimal)map.get("passingScore")) == -1 ? "否" : "是"); |
| | | rank++; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 详情页面数据 |
| | | * 详情页面数据 |
| | | * |
| | | * @param examId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "详情页面数据") |
| | | @ApiOperation(value = "详情页面数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="examId", dataType="String", paramType="query", value="考试id", required=true), |
| | | @ApiImplicitParam(name="examId", dataType="String", paramType="query", value="考试id", required=true), |
| | | }) |
| | | @RequestMapping(value = "/detail", method = RequestMethod.GET) |
| | | public @ResponseBody Result detail(String examId) { |
| | | return new Result(true,"",CollectionUtils.newObjectMap("detail",examService.queryExamDetail(examId))); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取补考考试,根据maxLateMin标记") |
| | | @ApiOperation(value = "获取补考考试,根据maxLateMin标记") |
| | | @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name="examId", dataType="String", paramType="query", value="考试id", required=true), |
| | | // @ApiImplicitParam(name="examId", dataType="String", paramType="query", value="考试id", required=true), |
| | | }) |
| | | @RequestMapping(value = "/getReExam", method = RequestMethod.GET) |
| | | public @ResponseBody Result getReExam() { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 保存 |
| | | * 保存 |
| | | * |
| | | * @param examInfo |
| | | * @return |
| | |
| | | } |
| | | |
| | | /** |
| | | * 保存 |
| | | * 保存 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/saveRemedy", method = RequestMethod.POST) |
| | | public @ResponseBody Result saveRemedy(@RequestBody ExamBatchInfo examBatchInfo) { |
| | | Result result = null; |
| | | //获取考试ID |
| | | //获取考试ID |
| | | String examId = examBatchInfo.getExamId(); |
| | | //获取开始时间 |
| | | //获取开始时间 |
| | | Date startTime = examBatchInfo.getStartTime(); |
| | | //获取结束时间 |
| | | //获取结束时间 |
| | | Date endTime = examBatchInfo.getEndTime(); |
| | | //生成补考考试 |
| | | //生成补考考试 |
| | | examService.addRemedy(examId,startTime,endTime); |
| | | result = new Result(true,"",CollectionUtils.newObjectMap("examId", examId)); |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | * 删除 |
| | | * |
| | | * @param examIds |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "删除考试", notes = "根据传入的考试ID字符串参数进行删除(多个ID以逗号分割, 如:examId1,examId2)", httpMethod = "GET") |
| | | @ApiImplicitParam(name = "examIds", value = "考试ID字符串", required = true, dataType = "String", paramType = "body") |
| | | @ApiOperation(value = "删除考试", notes = "根据传入的考试ID字符串参数进行删除(多个ID以逗号分割, 如:examId1,examId2)", httpMethod = "GET") |
| | | @ApiImplicitParam(name = "examIds", value = "考试ID字符串", required = true, dataType = "String", paramType = "body") |
| | | @RequestMapping(value = "delete", method = RequestMethod.GET) |
| | | public @ResponseBody Result delete(String examIds) { |
| | | Result result = new Result(true); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设置考试题目 |
| | | * 设置考试题目 |
| | | * |
| | | * @param examInfo |
| | | * @return |
| | |
| | | } |
| | | |
| | | /** |
| | | * 发布考试 |
| | | * 发布考试 |
| | | * |
| | | * @param |
| | | * @return |
| | |
| | | @RequestMapping(value = "/publish", method = RequestMethod.GET) |
| | | public @ResponseBody Result publishExam(String examIds) { |
| | | if (StringUtils.isEmpty(examIds)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | return this.examService.doPublishExam(examIds.split(",")); |
| | | } |
| | | |
| | | /** |
| | | * 撤回考试 |
| | | * 撤回考试 |
| | | * |
| | | * @param |
| | | * @return |
| | |
| | | @RequestMapping(value = "/revoke", method = RequestMethod.GET) |
| | | public @ResponseBody Result revokeExam(String examIds) { |
| | | if (StringUtils.isEmpty(examIds)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | return this.examService.doRevokeExam(examIds.split(",")); |
| | | } |
| | | |
| | | /** |
| | | * 学生考试信息列表 |
| | | * 学生考试信息列表 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "学生考试信息列表") |
| | | @ApiOperation(value = "学生考试信息列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="keyword", dataType="String", paramType="query", value="关键字考试名称模糊查询"), |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id"), |
| | | @ApiImplicitParam(name="subjectId", dataType="String", paramType="query", value="课程id", required=false), |
| | | @ApiImplicitParam(name="status", dataType="String", paramType="query", value="状态(默认全部,1未开始,2未交卷,3已交卷,4逾期未交,5已批阅)", required=false), |
| | | @ApiImplicitParam(name="keyword", dataType="String", paramType="query", value="关键字考试名称模糊查询"), |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id"), |
| | | @ApiImplicitParam(name="subjectId", dataType="String", paramType="query", value="课程id", required=false), |
| | | @ApiImplicitParam(name="status", dataType="String", paramType="query", value="状态(默认全部,1未开始,2未交卷,3已交卷,4逾期未交,5已批阅)", required=false), |
| | | }) |
| | | @RequestMapping(value = "/student/list", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryStudentExamList(String keyword, String classId, String subjectId, Integer status, Integer pageSize, Integer pageNum) { |
| | | pageSize = pageSize != null && pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE; |
| | | pageNum = pageNum != null && pageNum > 0 ? pageNum : DEFAULT_PAGE_NUM; |
| | | classId=ClientUtils.getClassId(); |
| | | if(classId==null){ |
| | | classId=ClientUtils.getClassId(); |
| | | } |
| | | System.out.println("avcd"+ClientUtils.getUserId()); |
| | | // System.out.println(ClientUtils.getUserId()+"--cla"+classId+"--sub"+subjectId+"--sta"+status+"--key"+keyword+"--pag"+pageNum+"---siz"+pageSize); |
| | | String [] classIds= null; |
| | |
| | | return new Result(true,"",CollectionUtils.newObjectMap("stuExams",listResult,"examCount",totalCount)); |
| | | } |
| | | /** |
| | | * 学生考试信息列表 |
| | | * 学生考试信息列表 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "学生考试信息列表") |
| | | @ApiOperation(value = "学生考试信息列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id"), |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id"), |
| | | }) |
| | | @RequestMapping(value = "/student/nowExam", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryStudentExam(String classId) { |
| | | //获取当前考试列表以结束时间排序最新的在最前面 |
| | | //获取当前考试列表以结束时间排序最新的在最前面 |
| | | String [] classIds= null; |
| | | if(!StringUtils.isEmpty(classId)){ |
| | | classIds = new String[]{classId}; |
| | |
| | | return new Result(true,"",CollectionUtils.newObjectMap("stuExams",listResult!=null && listResult.size()>0?listResult.get(0):null)); |
| | | } |
| | | |
| | | @ApiOperation(value = "学生考试信息列表") |
| | | @ApiOperation(value = "学生考试信息列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="examBatchId", dataType="String", paramType="query", value="班级id"), |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id") |
| | | @ApiImplicitParam(name="examBatchId", dataType="String", paramType="query", value="班级id"), |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id") |
| | | }) |
| | | @RequestMapping(value = "/student/record", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryStudentRecord(String examBatchId, String classId) { |
| | | // 查询是否有进行中的考试 |
| | | // 查询是否有进行中的考试 |
| | | ExerciseRecord record = commonDAO.findUnique( |
| | | "from ExerciseRecord where examBatchId=? and classId=? and userId = ? and deleteFlag is false ", |
| | | CollectionUtils.newList(examBatchId,classId,ClientUtils.getUserId()), |
| | |
| | | } |
| | | |
| | | /** |
| | | * 学生考试信息列表 |
| | | * 学生考试信息列表 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "学生考试信息列表") |
| | | @ApiOperation(value = "学生考试信息列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id"), |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id"), |
| | | }) |
| | | @RequestMapping(value = "/student/stuMessage", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryStudent() { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据考试批次ID获取考试题目信息 |
| | | * 根据考试批次ID获取考试题目信息 |
| | | * |
| | | * @param examBatchId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "学生开始考试接口") |
| | | @ApiOperation(value = "学生开始考试接口") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="examBatchId", dataType="String", paramType="query", value="考试批次id", required=true), |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id", required=false) |
| | | @ApiImplicitParam(name="examBatchId", dataType="String", paramType="query", value="考试批次id", required=true), |
| | | @ApiImplicitParam(name="classId", dataType="String", paramType="query", value="班级id", required=false) |
| | | }) |
| | | @RequestMapping(value = "/student/startexam", method = RequestMethod.GET) |
| | | public @ResponseBody Result doStartExam(String examBatchId, String classId,String studentUserId) { |
| | | |
| | | if (StringUtils.isEmpty(examBatchId) || StringUtils.isEmpty(classId)) { |
| | | return new Result(false, "参数错误,班级,考试批次不能为空"); |
| | | return new Result(false, "参数错误,班级,考试批次不能为空"); |
| | | } |
| | | |
| | | Result result = this.examService.doStartExam(examBatchId,classId,StringUtils.isNotEmpty(studentUserId)?studentUserId:ClientUtils.getUserId()); |
| | |
| | | |
| | | return result; |
| | | } |
| | | @ApiOperation(value = "学生开始补考接口") |
| | | @ApiOperation(value = "学生开始补考接口") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="examId", dataType="String", paramType="query", value="考试批次id", required=true), |
| | | @ApiImplicitParam(name="examId", dataType="String", paramType="query", value="考试批次id", required=true), |
| | | }) |
| | | @RequestMapping(value = "/student/startReExam", method = RequestMethod.GET) |
| | | public @ResponseBody Result doStartReExam(String examId) { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | @ApiOperation(value = "学生补考记录") |
| | | @ApiOperation(value = "学生补考记录") |
| | | @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name="examId", dataType="String", paramType="query", value="考试批次id", required=true), |
| | | // @ApiImplicitParam(name="examId", dataType="String", paramType="query", value="考试批次id", required=true), |
| | | }) |
| | | @RequestMapping(value = "/student/getReExamRecordList", method = RequestMethod.GET) |
| | | public @ResponseBody Result getReExamRecordList() { |
| | |
| | | }); |
| | | return reExamRecordList; |
| | | } |
| | | return new Result(false,"没有设置补考"); |
| | | return new Result(false,"没有设置补考"); |
| | | } |
| | | |
| | | @ApiOperation(value = "学生考试详情") |
| | | @ApiImplicitParams({@ApiImplicitParam(name="examBatchId", dataType="String", paramType="query", value="考试批次id", required=true)}) |
| | | @ApiOperation(value = "学生考试详情") |
| | | @ApiImplicitParams({@ApiImplicitParam(name="examBatchId", dataType="String", paramType="query", value="考试批次id", required=true)}) |
| | | @RequestMapping(value = "/student/examdetail", method = RequestMethod.GET) |
| | | public @ResponseBody Result viewExamDetail(String examBatchId) { |
| | | ExamBatchInfo batchInfo = this.commonService.read(ExamBatchInfo.class, examBatchId); |
| | | //考试信息 |
| | | //考试信息 |
| | | ExamInfo examInfo =this.examService.queryExamDetail(batchInfo.getExamId()); |
| | | examInfo.setExamStartTime(batchInfo.getStartTime()); |
| | | examInfo.setExamEndTime(batchInfo.getEndTime()); |
| | | |
| | | // 获取考卷信息 |
| | | // 获取考卷信息 |
| | | Map<String, ExamPaperInfo> paperStatistic =null; |
| | | if(examInfo.getExamType()!=ExamInfo.EXAM_TYPE_RANDOM && examInfo.getExamType()!=ExamInfo.EXAM_TYPE_RANDOM_BY_GROUP){ |
| | | paperStatistic = examPaperService.queryExamPaperItemsStatistic( |
| | |
| | | return new Result(true,"",CollectionUtils.newObjectMap("examInfo",examInfo,"paperStatistic",paperStatistic)); |
| | | } |
| | | |
| | | @ApiOperation(value = "提交考试答案") |
| | | @ApiImplicitParams({@ApiImplicitParam(name="answers", dataType="String", paramType="query", value="提交答案", required=true)}) |
| | | @ApiOperation(value = "提交考试答案") |
| | | @ApiImplicitParams({@ApiImplicitParam(name="answers", dataType="String", paramType="query", value="提交答案", required=true)}) |
| | | @RequestMapping(value = "/student/submitExam", method = RequestMethod.POST) |
| | | public @ResponseBody Object doSubmitExamAnswer(@RequestParam(value = "answers") String answers) throws IOException { |
| | | Result result = new Result(true); |
| | | // 用户本次做题提交的数据 |
| | | // 用户本次做题提交的数据 |
| | | String recordId =null; |
| | | // try { |
| | | ExerciseSubmitAnswerData answerData = new ObjectMapper().readValue(answers, ExerciseSubmitAnswerData.class); |
| | | recordId = answerData.getExerciseRecordId(); |
| | | // 提交试卷答案 |
| | | result = new Result(true, "答案提交成功",exerciseVerService.doOperExerciseAnswerData(answerData)); |
| | | // 记录提交的数据日志 |
| | | // 提交试卷答案 |
| | | result = new Result(true, "答案提交成功",exerciseVerService.doOperExerciseAnswerData(answerData)); |
| | | // 记录提交的数据日志 |
| | | exerciseVerService.doSaveExerciseDataSubmitLog(answers, recordId,ExerciseDataSubmitLog.TYPE_SUBMIT_ANSWER, ExerciseDataSubmitLog.STATUS_SUCCESS,"/exercise/Exercise/exerAnswers"); |
| | | // } catch (Exception e) { |
| | | // log.error("考试保存错误", e); |
| | | // result = new Result(false, "提交考试答案请求异常"); |
| | | // log.error("考试保存错误", e); |
| | | // result = new Result(false, "提交考试答案请求异常"); |
| | | // exerciseVerService.doSaveExerciseDataSubmitLog(answers, recordId,ExerciseDataSubmitLog.TYPE_SUBMIT_ANSWER, ExerciseDataSubmitLog.STATUS_FAILED,"/exercise/Exercise/exerAnswers"); |
| | | // } |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation(value = "老师阅卷") |
| | | @ApiImplicitParams({@ApiImplicitParam(name="answerData", dataType="object", paramType="query", value="提交答案", required=true)}) |
| | | @ApiOperation(value = "老师阅卷") |
| | | @ApiImplicitParams({@ApiImplicitParam(name="answerData", dataType="object", paramType="query", value="提交答案", required=true)}) |
| | | @RequestMapping(value = "/teacher/checkExam", method = RequestMethod.POST) |
| | | public @ResponseBody Object doCheckExam(@RequestBody ExerciseSubmitAnswerData answerData) { |
| | | Result result = new Result(true); |
| | | String recordId = null; |
| | | try { |
| | | // 提交记录id |
| | | // 提交记录id |
| | | recordId = answerData.getExerciseRecordId(); |
| | | // 提交试卷答案 |
| | | result = new Result(true, "答案提交成功",exerciseVerService.doOperExerciseAnswerData(answerData)); |
| | | // 记录提交的数据日志 |
| | | // 提交试卷答案 |
| | | result = new Result(true, "答案提交成功",exerciseVerService.doOperExerciseAnswerData(answerData)); |
| | | // 记录提交的数据日志 |
| | | exerciseVerService.doSaveExerciseDataSubmitLog(JSON.toJSONString(answerData),recordId,ExerciseDataSubmitLog.TYPE_SUBMIT_ANSWER, ExerciseDataSubmitLog.STATUS_SUCCESS,"/exam/exam/teacher/checkExam"); |
| | | } catch (Exception e) { |
| | | log.error("考试保存错误", e); |
| | | result = new Result(false, "提交练习答案请求异常"); |
| | | log.error("考试保存错误", e); |
| | | result = new Result(false, "提交练习答案请求异常"); |
| | | exerciseVerService.doSaveExerciseDataSubmitLog(JSON.toJSONString(answerData),recordId,ExerciseDataSubmitLog.TYPE_SUBMIT_ANSWER, ExerciseDataSubmitLog.STATUS_FAILED,"/exam/exam/teacher/checkExam"); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 查询考试凭证信息列表 |
| | | * 查询考试凭证信息列表 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "查询学生考试凭证") |
| | | @ApiOperation(value = "查询学生考试凭证") |
| | | @RequestMapping(value = "/teacher/examacertificatelist", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryStudentExamCertificateList(String examId, String classId, String examBatchId, |
| | | String keyword, Integer pageSize, Integer pageNum) { |
| | |
| | | StringBuffer hql = new StringBuffer(500); |
| | | hql.append("select r.classId from ExamBatchInfo f,ExamBatchClassRe r where f.examBatchId = r.examBatchId and f.deleteFlag is false and r.deleteFlag is false "); |
| | | |
| | | // 如果examBatchId为空,则获取考试对应的所有批次 |
| | | // 如果examBatchId为空,则获取考试对应的所有批次 |
| | | if (StringUtils.isNotEmpty(examBatchId)) { |
| | | hql.append(" and f.examBatchId=:examBatchId"); |
| | | queryParams.put("examBatchId", examBatchId); |
| | |
| | | } |
| | | |
| | | List<String> classLst =this.commonDAO.findByComplexHql(hql.toString(), queryParams, String.class); |
| | | //如果不存在关联的班级信息,则直接返回 |
| | | //如果不存在关联的班级信息,则直接返回 |
| | | if (classLst == null || classLst.size() == 0) { |
| | | return new Result(false,"无班级考生信息",CollectionUtils.newObjectMap("list",null)); |
| | | return new Result(false,"无班级考生信息",CollectionUtils.newObjectMap("list",null)); |
| | | } |
| | | |
| | | // 查询记录数 |
| | | // 查询记录数 |
| | | int totalCount = commonDAO.findCountByComplexHql("from StuStudent t WHERE t.classId in(:classIds) and t.deleteFlag is false", |
| | | CollectionUtils.newObjectMap("classIds",classLst.toArray(new String[]{}))); |
| | | |
| | | // page赋值 |
| | | // page赋值 |
| | | Pager page = new Pager(); |
| | | page.setTotalCount(totalCount); |
| | | page.setPageSize(pageSize != null && pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 学生考试信息列表 |
| | | * 学生考试信息列表 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "生成学生考试凭证") |
| | | @ApiOperation(value = "生成学生考试凭证") |
| | | @RequestMapping(value = "/teacher/genstudentacertificate", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryStudentExamCertificateList(String examId, String examBatchId) { |
| | | Map<String, Object> queryParams = new HashMap<String, Object>(1); |
| | | |
| | | // 如果examBatchId为空,则获取考试对应的所有批次 |
| | | // 如果examBatchId为空,则获取考试对应的所有批次 |
| | | String hql ="select distinct r.classId from ExamBatchInfo f,ExamBatchClassRe r where f.examBatchId = r.examBatchId and f.deleteFlag is false and r.deleteFlag is false"; |
| | | |
| | | if (StringUtils.isNotEmpty(examBatchId)) { |
| | |
| | | |
| | | List<String> classLst =this.commonDAO.findByComplexHql(hql, queryParams, String.class); |
| | | |
| | | //如果不存在关联的班级信息,则直接返回 |
| | | //如果不存在关联的班级信息,则直接返回 |
| | | if (classLst == null || classLst.size() == 0) { |
| | | return new Result(false, "无班级考生信息",CollectionUtils.newObjectMap("list", null)); |
| | | return new Result(false, "无班级考生信息",CollectionUtils.newObjectMap("list", null)); |
| | | } |
| | | |
| | | //查询所有学生用户信息 |
| | | //查询所有学生用户信息 |
| | | List<User> lstUser = this.commonDAO.findByComplexHql( |
| | | "select distinct u from StuStudent t,User u WHERE t.userId=u.userId AND t.classId in(:classIds) and t.deleteFlag is false and u.deleteFlag is false", |
| | | CollectionUtils.newObjectMap("classIds",classLst.toArray(new String[]{})),User.class); |
| | |
| | | } |
| | | |
| | | if(!this.userService.doBatchUpdateUser(lstUser)){ |
| | | return new Result(false,"更新学生考试凭证密码失败!"); |
| | | return new Result(false,"更新学生考试凭证密码失败!"); |
| | | } |
| | | |
| | | return new Result(true); |