| | |
| | | import com.mindskip.xzs.domain.enums.QuestionTypeEnum; |
| | | import com.mindskip.xzs.domain.question.QuestionItemObject; |
| | | import com.mindskip.xzs.domain.question.QuestionObject; |
| | | import com.mindskip.xzs.domain.vo.DeptQuestionVO; |
| | | import com.mindskip.xzs.excel.*; |
| | | import com.mindskip.xzs.repository.DepartmentMapper; |
| | | import com.mindskip.xzs.repository.DeptQuestionMapper; |
| | | import com.mindskip.xzs.repository.SubjectMapper; |
| | | import com.mindskip.xzs.service.*; |
| | | import com.mindskip.xzs.utility.*; |
| | |
| | | |
| | | private final QuestionService questionService; |
| | | private final TextContentService textContentService; |
| | | |
| | | private final SubjectMapper subjectMapper; |
| | | |
| | | private final DepartmentMapper departmentMapper; |
| | | |
| | | private final QuestionSubjectService questionSubjectService; |
| | | private final DeptQuestionMapper deptQuestionMapper; |
| | | |
| | | private static final String SPLIT = "、"; |
| | | |
| | | @Autowired |
| | | public QuestionController(QuestionService questionService, TextContentService textContentService, SubjectMapper subjectMapper, DepartmentMapper departmentMapper, QuestionSubjectService questionSubjectService) { |
| | | public QuestionController(QuestionService questionService, TextContentService textContentService, SubjectMapper subjectMapper, DepartmentMapper departmentMapper, QuestionSubjectService questionSubjectService, DeptQuestionMapper deptQuestionMapper) { |
| | | this.questionService = questionService; |
| | | this.textContentService = textContentService; |
| | | this.subjectMapper = subjectMapper; |
| | | this.departmentMapper = departmentMapper; |
| | | this.questionSubjectService = questionSubjectService; |
| | | this.deptQuestionMapper = deptQuestionMapper; |
| | | } |
| | | |
| | | @RequestMapping(value = "/page", method = RequestMethod.POST) |
| | |
| | | e.setSubName(subjectMapper.page(subjectPageRequestVM).get(0).getName()); |
| | | return e; |
| | | }).collect(Collectors.toList())); |
| | | // 查询题目所属部门 |
| | | String deptNames = deptQuestionMapper.deptByQuestionId(q.getId()).stream().map(DeptQuestionVO::getDeptName).collect(Collectors.joining("、")); |
| | | vm.setDeptNames(deptNames); |
| | | return vm; |
| | | }); |
| | | return RestResponse.ok(page); |
| | |
| | | EasyExcel.write(response.getOutputStream(), QuestionImportVO.class) |
| | | .sheet("模板") |
| | | .registerWriteHandler(new SelectExcel(subjectNameList)) |
| | | .registerWriteHandler(new FixedMergeCellStrategy(2, 4, Arrays.asList(1, 2, 3, 6, 7, 8, 9))) |
| | | .registerWriteHandler(new FixedMergeCellStrategy(2, 4, Arrays.asList(0, 1, 2, 5, 6, 7, 8))) |
| | | .doWrite(data); |
| | | } |
| | | |
| | | @GetMapping("/question/export") |
| | | public void importQuestion(QuestionExportVO query, HttpServletResponse response) throws IOException { |
| | | query.formartTime(); |
| | | @PostMapping("/question/export") |
| | | public void exportQuestion(@RequestBody QuestionExportVO query, HttpServletResponse response) throws IOException { |
| | | // 查询导出数据 |
| | | List<QuestionImportVO> exportData = questionService.export(query); |
| | | // 构建数据 |