| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * 作业管理 |
| | | * 作业管理 |
| | | * |
| | | * @author kevin |
| | | * |
| | | */ |
| | | @Api(tags = "作业管理接口") |
| | | @Api(tags = "作业管理接口") |
| | | @Controller |
| | | @CrossOrigin(origins="*",maxAge=3600) |
| | | @RequestMapping(value = "/exercise/info") |
| | |
| | | @Autowired |
| | | private IExerciseCompleteService exerciseCompleteService; |
| | | |
| | | /** 练习V2.0版本接口service */ |
| | | /** 练习V2.0版本接口service */ |
| | | @Autowired |
| | | private IExerciseVerService exerciseVerService; |
| | | |
| | | //------------------------------------------------app接口------------------------------------------- |
| | | //------------------------------------------------app接口------------------------------------------- |
| | | /** |
| | | * 获取作业详情 |
| | | * 获取作业详情 |
| | | * |
| | | * @param examId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "获取作业详情", notes = "") |
| | | @ApiOperation(value = "获取作业详情", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "exerciseInfoId", value = "作业id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "exerciseInfoId", value = "作业id", required = true, paramType="query", dataType = "String"), |
| | | }) |
| | | @RequestMapping(value = "/app/detail", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryDetail(String exerciseInfoId) { |
| | | if (StringUtils.isEmpty(exerciseInfoId)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | |
| | | ExerciseInfo exerciseInfo = this.commonDAO.read(ExerciseInfo.class, exerciseInfoId); |
| | |
| | | } |
| | | |
| | | |
| | | //-------------------------------------------------后台端接口----------------------------------------- |
| | | //-------------------------------------------------后台端接口----------------------------------------- |
| | | |
| | | /** |
| | | * 考试列表 |
| | | * 作业列表 |
| | | * |
| | | * @return |
| | | */ |
| | |
| | | pageSize = pageSize != null && pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE; |
| | | pageNum = pageNum != null && pageNum > 0 ? pageNum : DEFAULT_PAGE_NUM; |
| | | |
| | | //作业数量 |
| | | //作业数量 |
| | | int totalCount = exerciseInfoService.listCount(keyword == null ? "" : keyword.trim(),classId,status); |
| | | Pager pager = new Pager(pageSize,pageNum); |
| | | pager.setTotalCount(totalCount); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 保存作业基础信息 |
| | | * 保存作业基础信息 |
| | | * |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 删除作业 |
| | | * 删除作业 |
| | | * |
| | | * @param examId |
| | | * @return |
| | |
| | | @RequestMapping(value = "/delete", method = RequestMethod.GET) |
| | | public @ResponseBody Result deleteExercise(String exerciseInfoId) { |
| | | if (StringUtils.isEmpty(exerciseInfoId)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | return this.exerciseInfoService.deleteExerciseInfo(exerciseInfoId); |
| | | } |
| | | |
| | | /** |
| | | * 发布作业 |
| | | * 发布作业 |
| | | * |
| | | * @param exerciseIds |
| | | * @return |
| | |
| | | @RequestMapping(value = "/publish", method = RequestMethod.GET) |
| | | public @ResponseBody Result publishExerciseInfo(String exerciseIds) { |
| | | if (StringUtils.isEmpty(exerciseIds)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | return this.exerciseInfoService.doPublishExercise(exerciseIds.split(",")); |
| | | } |
| | | |
| | | /** |
| | | * 撤回作业 |
| | | * 撤回作业 |
| | | * |
| | | * @param exerciseIds |
| | | * @return |
| | |
| | | @RequestMapping(value = "/revoke", method = RequestMethod.GET) |
| | | public @ResponseBody Result revokeExerciseInfo(String exerciseIds) { |
| | | if (StringUtils.isEmpty(exerciseIds)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | |
| | | return this.exerciseInfoService.doRevokeExercise(exerciseIds.split(",")); |
| | | } |
| | | |
| | | /** |
| | | * 撤回作业校验 |
| | | * 撤回作业校验 |
| | | * |
| | | * @param exerciseIds |
| | | * @return |
| | |
| | | int count= this.commonDAO.findCountByComplexHql("from ExerciseInfo f where f.startTime<=:startTime and f.exerciseInfoId in (:exerciseIds)", |
| | | CollectionUtils.newObjectMap("startTime",new Date(),"exerciseIds",exerciseIds)); |
| | | |
| | | return count>0?new Result(false,"已开始的作业不能撤回"):new Result(true); |
| | | return count>0?new Result(false,"已开始的作业不能撤回"):new Result(true); |
| | | } |
| | | |
| | | /** |
| | | * 获取作业详情 |
| | | * 获取作业详情 |
| | | * |
| | | * @param examId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "获取作业详情", notes = "") |
| | | @ApiOperation(value = "获取作业详情", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "exerciseInfoId", value = "作业id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "exerciseInfoId", value = "作业id", required = true, paramType="query", dataType = "String"), |
| | | }) |
| | | @RequestMapping(value = "/detail", method = RequestMethod.GET) |
| | | public @ResponseBody Result initExerciseInfo(String exerciseInfoId) { |
| | | Result result = new Result(true); |
| | | if (StringUtils.isEmpty(exerciseInfoId)) { |
| | | new Result(false, "参数错误"); |
| | | new Result(false, "参数错误"); |
| | | } |
| | | ExerciseInfo exerciseInfo = this.commonDAO.read(ExerciseInfo.class, exerciseInfoId); |
| | | exerciseInfo.setSubjectName(exerciseInfo.getSubject().getName()); |
| | | |
| | | // 获取关联班机信息 |
| | | // 获取关联班机信息 |
| | | if (exerciseInfo.getReClasses() != null) { |
| | | List<ExerciseExamReClass> reClasses = new ArrayList<ExerciseExamReClass>( |
| | | exerciseInfo.getReClasses().size()); |
| | |
| | | exerciseInfo.setReClasses(reClasses); |
| | | } |
| | | |
| | | //答题作业取题目信息 |
| | | //答题作业取题目信息 |
| | | if(exerciseInfo.getType()== ExerciseInfo.EXERCISE_TYPE_ANSWER){ |
| | | String groupId = exerciseInfoService.queryExerciseInfoRelatedGroupId(exerciseInfoId); |
| | | @SuppressWarnings("deprecation") |
| | | List<ExerciseItem> lstItem = exerciseVerService.queryExerciseItemList(groupId); |
| | | |
| | | // 3.组装返回参数 |
| | | // 3.组装返回参数 |
| | | ExerItemResponseData responseData = new ExerItemResponseData(); |
| | | responseData.setExerciseGroupId(groupId); |
| | | responseData.setItems(lstItem); |
| | |
| | | |
| | | |
| | | /** |
| | | * 作业题型配置 |
| | | * 作业题型配置 |
| | | * |
| | | * @param examId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "作业题型配置查询") |
| | | @ApiOperation(value = "作业题型配置查询") |
| | | @RequestMapping(value = "/itemset/list", method = RequestMethod.GET) |
| | | public @ResponseBody List<Map<String, Object>> examItemTypeList(String exerciseInfoId) { |
| | | return this.commonDAO.findListWithMapByHql("select blankScore as blankScore,halfRightScore as halfRightScore," |
| | |
| | | } |
| | | |
| | | /** |
| | | * 作业布置班级列表 |
| | | * 作业布置班级列表 |
| | | * |
| | | * @param examId |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/relatedclass/list", method = RequestMethod.GET) |
| | | public @ResponseBody List<Map<String, Object>> classList(String exerciseInfoId) { |
| | | // TODO 作业布置查询班级需要修改 |
| | | // TODO 作业布置查询班级需要修改 |
| | | return this.commonDAO.findListWithMapByHql( |
| | | "select s.classId as classId,s.name as className from ExerciseExamReClass c,ClsClass s where c.deleteFlag is false and s.deleteFlag is false" |
| | | + " and s.classId = c.classId and c.examId = :exerciseInfoId", |
| | |
| | | } |
| | | |
| | | /** |
| | | * 作业题库来源列表 |
| | | * 作业题库来源列表 |
| | | * |
| | | * @param examId |
| | | * @return |
| | |
| | | |
| | | |
| | | /** |
| | | * 学员得分详情列表 |
| | | * 学员得分详情列表 |
| | | * |
| | | * @param groupId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "学员得分详情列表", notes = "") |
| | | @ApiOperation(value = "学员得分详情列表", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "exerciseInfoId", value = "作业id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "exerciseInfoId", value = "作业id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = false, paramType="query", dataType = "String"), |
| | | }) |
| | | @RequestMapping(value = "/teacher/answerresultlist", method = RequestMethod.GET) |
| | | public @ResponseBody Result resultList(String keyword,String exerciseInfoId,String subjectId, Short status,Integer pageSize, |
| | |
| | | pageSize = pageSize != null && pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE; |
| | | pageNum = pageNum != null && pageNum > 0 ? pageNum : DEFAULT_PAGE_NUM; |
| | | |
| | | //作业数量 |
| | | //作业数量 |
| | | int totalCount = exerciseInfoService.queryStuExerciseListCount(keyword,exerciseInfoId,null,subjectId,status); |
| | | Pager pager = new Pager(pageSize,pageNum); |
| | | pager.setTotalCount(totalCount); |
| | |
| | | return new Result(true,"",CollectionUtils.newObjectMap("list", listResult,"pager", pager)); |
| | | } |
| | | |
| | | //查询个人需要做的作业 |
| | | @ApiOperation(value = "查询个人需要做的作业列表", notes = "") |
| | | //查询个人需要做的作业 |
| | | @ApiOperation(value = "查询个人需要做的作业列表", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "status", value = "作业状态查询(默认全部,0待完成,1已提交 ,2:已批阅,3需重写,4:逾期未交)", required = true, paramType="query", dataType = "Short"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "subjectId", value = "课程id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "status", value = "作业状态查询(默认全部,0待完成,1已提交 ,2:已批阅,3需重写,4:逾期未交)", required = true, paramType="query", dataType = "Short"), |
| | | }) |
| | | @RequestMapping(value = "/student/list", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryStudentExerciseList(String keyword, String subjectId, Short status, Integer pageSize, Integer pageNum, HttpServletRequest request) { |
| | | pageSize = pageSize != null && pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE; |
| | | pageNum = pageNum != null && pageNum > 0 ? pageNum : DEFAULT_PAGE_NUM; |
| | | //作业数量 |
| | | //作业数量 |
| | | int totalCount = exerciseInfoService.queryStuExerciseListCount(keyword,null,ClientUtils.getUserId(),subjectId,status); |
| | | List<ExerciseResultV> list = exerciseInfoService.queryStuExerciselist(keyword,null,ClientUtils.getUserId(),subjectId,status,pageSize, pageNum); |
| | | List<Map<String, Object>> listResult =QBeanUtils.listBean2ListMap(list, |
| | |
| | | } |
| | | |
| | | /** |
| | | * 开始做作业 |
| | | * 开始做作业 |
| | | * |
| | | * @param examId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "开始做作业", notes = "") |
| | | @ApiOperation(value = "开始做作业", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "exerciseInfoId", value = "作业id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "exerciseInfoId", value = "作业id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "studentUserId", value = "userId", required = true, paramType="query", dataType = "String"), |
| | | }) |
| | | @RequestMapping(value = "/student/startexercise", method = RequestMethod.GET) |
| | | public @ResponseBody Result doStartExercise(String exerciseInfoId, String classId,String studentUserId) { |
| | | System.out.println(ClientUtils.getUserId()+"做作业"+ClientUtils.getClassName()+"aaa"+ClientUtils.getClassId()); |
| | | System.out.println(ClientUtils.getUserId()+"做作业"+ClientUtils.getClassName()+"aaa"+ClientUtils.getClassId()); |
| | | if (StringUtils.isEmpty(exerciseInfoId)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | |
| | | if(StringUtils.isEmpty(studentUserId)){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 提交文件和写作作业 |
| | | * 提交文件和写作作业 |
| | | * |
| | | * @param examId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "提交文件和写作作业", notes = "") |
| | | @ApiOperation(value = "提交文件和写作作业", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "exerciseCompleteInfoId", value = "提交记录id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "content", value = "内容", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "fileId", value = "文件id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "filePath", value = "文件路径", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "submitType", value = "提交方式(1:已提交作业,待批阅 2:已批阅 3:需重写 重写完后重新提交状态变为 1)", required = true, paramType="query", dataType = "short"), |
| | | @ApiImplicitParam(name = "exerciseCompleteInfoId", value = "提交记录id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "content", value = "内容", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "fileId", value = "文件id", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "filePath", value = "文件路径", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "submitType", value = "提交方式(1:已提交作业,待批阅 2:已批阅 3:需重写 重写完后重新提交状态变为 1)", required = true, paramType="query", dataType = "short"), |
| | | }) |
| | | @RequestMapping(value = "/student/submitexercise", method = RequestMethod.POST) |
| | | public @ResponseBody Result doSubmitFileExercise( |
| | |
| | | @RequestParam(value = "filePath") String filePath, @RequestParam(value = "submitType") short submitType) { |
| | | |
| | | if (StringUtils.isEmpty(completeInfoId)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | |
| | | return this.exerciseInfoService.doSubmitOtherExerciseInfo(completeInfoId, content, fileId, filePath,submitType); |
| | | } |
| | | |
| | | /** |
| | | * 提交答题作业 |
| | | * 提交答题作业 |
| | | * |
| | | * @param examId |
| | | * @return |
| | |
| | | * @throws JsonMappingException |
| | | * @throws JsonParseException |
| | | */ |
| | | @ApiOperation(value = "提交答题作业", notes = "") |
| | | @ApiOperation(value = "提交答题作业", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "exerciseCompleteInfoId", value = "提交记录id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "exerciseInfoId", value = "作业id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "answers", value = "答题内容", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "exerciseCompleteInfoId", value = "提交记录id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "exerciseInfoId", value = "作业id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "answers", value = "答题内容", required = true, paramType="query", dataType = "String"), |
| | | }) |
| | | @RequestMapping(value = "/student/submitanswer", method = RequestMethod.POST) |
| | | public @ResponseBody Result doSubmitAnswerExercise(@RequestParam(value = "answers") String answers, |
| | |
| | | @RequestParam(value = "exerciseCompleteId") String exerciseCompleteId) throws Exception { |
| | | |
| | | if (StringUtils.isEmpty(answers)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | |
| | | ExerciseSubmitAnswerData answerData = new ObjectMapper().readValue(answers, ExerciseSubmitAnswerData.class); |
| | |
| | | return this.exerciseInfoService.doSubmitAnswerExerciseInfo(answerData, exerciseInfoId, exerciseCompleteId); |
| | | } |
| | | |
| | | @ApiOperation(value = "老师阅卷") |
| | | @ApiImplicitParams({@ApiImplicitParam(name="answerData", dataType="String", paramType="query", value="提交答案", required=true)}) |
| | | @ApiOperation(value = "老师阅卷") |
| | | @ApiImplicitParams({@ApiImplicitParam(name="answerData", dataType="String", paramType="query", value="提交答案", required=true)}) |
| | | @RequestMapping(value = "/teacher/check", method = RequestMethod.POST) |
| | | public @ResponseBody Object doCheck(@RequestBody ExerciseSubmitAnswerData answerData) { |
| | | return this.exerciseInfoService.doSubmitAnswerExerciseInfo(answerData, answerData.getExerciseInfoId(), answerData.getExerciseCompleteId()); |
| | | } |
| | | |
| | | /** |
| | | * 前端查看作业详情 |
| | | * 前端查看作业详情 |
| | | * |
| | | * @param examId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "查看学生作业详情", notes = "") |
| | | @ApiOperation(value = "查看学生作业详情", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "exerciseCompleteInfoId", value = "提交记录id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "exerciseCompleteInfoId", value = "提交记录id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classId", value = "班级id", required = false, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "studentUserId", value = "userId", required = true, paramType="query", dataType = "String"), |
| | | }) |
| | | @RequestMapping(value = "/student/detail", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryStudentExerciseDetail(String exerciseInfoId, String classId,String studentUserId) { |
| | | if (StringUtils.isEmpty(exerciseInfoId)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | Map<String, Object> detailMap = new HashMap<String,Object>(30); |
| | | ExerciseInfo exerciseInfo = this.commonDAO.read(ExerciseInfo.class, exerciseInfoId); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 初始化平均成绩和最高成绩 |
| | | * 初始化平均成绩和最高成绩 |
| | | * |
| | | * @param groupId |
| | | * @return |
| | |
| | | } |
| | | |
| | | /** |
| | | * 每道题得分详情 |
| | | * 每道题得分详情 |
| | | * |
| | | * @param groupId |
| | | * @return |