| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/page", method = RequestMethod.POST) |
| | | public RestResponse<PageInfo<QuestionResponseVM>> pageList(@RequestBody QuestionPageRequestVM model) { |
| | | public RestResponse<PageInfo<QuestionResponseVM>> pageList(@RequestBody @Valid QuestionPageRequestVM model) { |
| | | PageInfo<Question> pageInfo = questionService.page(model); |
| | | PageInfo<QuestionResponseVM> page = PageInfoHelper.copyMap(pageInfo, q -> { |
| | | QuestionResponseVM vm = modelMapper.map(q, QuestionResponseVM.class); |
| | |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | public void importUser(@RequestPart("file") MultipartFile file) throws Exception { |
| | | public RestResponse importUser(@RequestPart("file") MultipartFile file) throws Exception { |
| | | List<QuestionEditVO> questionEditVOS = ExcelUtils.readMultipartFile(file, QuestionEditVO.class) |
| | | .stream().map(e -> { |
| | | e.setQuestionType(QuestionTypeEnum.get(e.getType())); |
| | | // e.setSubjectId(subjectMapper.getName(e.getSbNames()).getId()); |
| | | e.setGradeLevel(departmentMapper.getName(e.getDepartment()).getId()); |
| | | // e.setGradeLevel(departmentMapper.getName(e.getDepartment()).getId()); |
| | | return e; |
| | | }).collect(Collectors.toList()); |
| | | |
| | |
| | | |
| | | List<Subject> subjectList = subjectMapper.getNames(vm.getSbNames().split(",")); |
| | | |
| | | Integer[] arr =subjectList.stream().filter(e-> |
| | | e.getLevelName().equals(subjectList.get(0).getLevelName())) |
| | | Integer[] arr =subjectList.stream() |
| | | .map(Subject::getId).toArray(Integer[]::new); |
| | | |
| | | vm.setSubjectIds(arr); |
| | |
| | | vm.setCorrect(null); |
| | | } |
| | | |
| | | vm.setScore("2"); |
| | | vm.setDifficult(4); |
| | | |
| | | questionService.insertFullQuestion(vm, getCurrentUser().getId()); |
| | | questionEditItemVMS.clear(); |
| | | } |
| | | return RestResponse.ok(); |
| | | } |
| | | } |