|
@@ -1,599 +1,604 @@
|
|
|
-package com.qmth.cqb.paper.web;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
-
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.data.domain.Example;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
-import org.springframework.data.domain.PageImpl;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
-
|
|
|
-import com.google.gson.Gson;
|
|
|
-import com.qmth.cqb.paper.dao.PaperRepo;
|
|
|
-import com.qmth.cqb.paper.dto.PaperDetailExp;
|
|
|
-import com.qmth.cqb.paper.dto.PaperDetailUnitExp;
|
|
|
-import com.qmth.cqb.paper.dto.PaperExp;
|
|
|
-import com.qmth.cqb.paper.model.Paper;
|
|
|
-import com.qmth.cqb.paper.model.PaperSearchInfo;
|
|
|
-import com.qmth.cqb.paper.service.PaperService;
|
|
|
-import com.qmth.cqb.question.model.Question;
|
|
|
-import com.qmth.cqb.question.service.QuesService;
|
|
|
-import com.qmth.cqb.utils.BeanCopierUtil;
|
|
|
-import com.qmth.cqb.utils.StringSimilarityUtils;
|
|
|
-import com.qmth.cqb.utils.enums.PaperType;
|
|
|
-
|
|
|
-import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
|
|
|
-import cn.com.qmth.examcloud.common.uac.annotation.Uac;
|
|
|
-import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
|
|
|
-import cn.com.qmth.examcloud.common.uac.enums.RoleMeta;
|
|
|
-import cn.com.qmth.examcloud.common.uac.enums.UacPolicy;
|
|
|
-import cn.com.qmth.examcloud.common.util.ErrorMsg;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-
|
|
|
-/**
|
|
|
- * Created by songyue on 16/12/28.
|
|
|
- */
|
|
|
-@RestController
|
|
|
-@RequestMapping("${api_cqb}/")
|
|
|
-public class PaperController {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- PaperService paperService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- PaperRepo paperRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- Gson gson;
|
|
|
-
|
|
|
- @Value("${question.reduplicate.similarity}")
|
|
|
- private double reduplicateSimilarity;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- QuesService quesService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据Id获取试卷
|
|
|
- *
|
|
|
- * @param paperId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "根据Id获取试卷", notes = "根据Id获取试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/paper/{paperId}")
|
|
|
- public ResponseEntity getPaperById(@PathVariable String paperId) {
|
|
|
- return new ResponseEntity(paperService.getPaperDto(paperId), HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存试卷
|
|
|
- *
|
|
|
- * @param paper
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "保存试卷", notes = "保存试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @PutMapping(value = "/paper")
|
|
|
- public ResponseEntity savePaperById(HttpServletRequest request, @RequestBody PaperExp paper) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- Map<String, Object> msgMap = paperService.savePaper(paper, user);
|
|
|
- if ("success".equals(msgMap.get("msg"))) {
|
|
|
- return new ResponseEntity(msgMap, HttpStatus.OK);
|
|
|
- } else {
|
|
|
- return new ResponseEntity(msgMap, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询所有导入试卷
|
|
|
- *
|
|
|
- * @param paperSearchInfo
|
|
|
- * @param curPage
|
|
|
- * @param pageSize
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "查询所有导入试卷", notes = "查询所有导入试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/importPaper/{curPage}/{pageSize}")
|
|
|
- public ResponseEntity getImportPapers(HttpServletRequest request,
|
|
|
- @ModelAttribute PaperSearchInfo paperSearchInfo,
|
|
|
- @PathVariable int curPage,
|
|
|
- @PathVariable int pageSize) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
- return new ResponseEntity(paperService.getImportPapers(paperSearchInfo, curPage, pageSize), HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "查询所有待审核和审核不通过的导入试卷", notes = "查询所有待审核和审核不通过的导入试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/importPaperNotSuccess/{curPage}/{pageSize}")
|
|
|
- public ResponseEntity getImportPapersNotSuccess(HttpServletRequest request,
|
|
|
- @ModelAttribute PaperSearchInfo paperSearchInfo, @PathVariable int curPage, @PathVariable int pageSize) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
- return new ResponseEntity(paperService.getImportPapersNotSuccess(paperSearchInfo, curPage, pageSize),
|
|
|
- HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "根据条件查询导入试卷", notes = "根据条件查询导入试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/getImportPaper")
|
|
|
- public ResponseEntity<List<Paper>> getImportPapersBySearch(HttpServletRequest request,
|
|
|
- @ModelAttribute PaperSearchInfo paperSearchInfo) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
- return new ResponseEntity<List<Paper>>(paperService.getImportPapersBySearch(paperSearchInfo), HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "根据条件查询已组试卷", notes = "根据条件查询已组试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/getGenPaper")
|
|
|
- public ResponseEntity<List<Paper>> getGenPapersBySearch(HttpServletRequest request,
|
|
|
- @ModelAttribute PaperSearchInfo paperSearchInfo) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
- return new ResponseEntity<List<Paper>>(paperService.getGenPapersBySearch(paperSearchInfo), HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询所有已组试卷
|
|
|
- *
|
|
|
- * @param paperSearchInfo
|
|
|
- * @param curPage
|
|
|
- * @param pageSize
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "查询所有已组试卷", notes = "查询所有已组试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/genPaper/{curPage}/{pageSize}")
|
|
|
- public ResponseEntity getGenPapers(HttpServletRequest request, @ModelAttribute PaperSearchInfo paperSearchInfo,
|
|
|
- @PathVariable int curPage, @PathVariable int pageSize) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
- return new ResponseEntity(paperService.getGenPapers(paperSearchInfo, curPage, pageSize), HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除试卷
|
|
|
- *
|
|
|
- * @param paperIds
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "删除试卷", notes = "删除试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @DeleteMapping(value = "/paper/{paperIds}")
|
|
|
- public ResponseEntity delPaper(@PathVariable String paperIds) {
|
|
|
- List<String> paperList = Stream.of(paperIds.split(",")).collect(Collectors.toList());
|
|
|
- Map<String, Object> msgMap = paperService.deletePapers(paperList);
|
|
|
- if (msgMap.get("msg").equals("success")) {
|
|
|
- return new ResponseEntity(msgMap, HttpStatus.OK);
|
|
|
- } else {
|
|
|
- return new ResponseEntity(msgMap, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量通过试卷
|
|
|
- *
|
|
|
- * @param paperSearchInfo
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "批量通过试卷", notes = "批量通过试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @PutMapping(value = "/paper/pass")
|
|
|
- public ResponseEntity passPapers(@RequestBody PaperSearchInfo paperSearchInfo) {
|
|
|
- paperService.passPapers(Arrays.asList(paperSearchInfo.getPaperIds()));
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量不通过试卷
|
|
|
- *
|
|
|
- * @param paperSearchInfo
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "批量不通过试卷", notes = "批量不通过试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @PutMapping(value = "/paper/noPass")
|
|
|
- public ResponseEntity noPassPapers(@RequestBody PaperSearchInfo paperSearchInfo) {
|
|
|
- paperService.noPassPapers(Arrays.asList(paperSearchInfo.getPaperIds()));
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量待审核试卷
|
|
|
- *
|
|
|
- * @param paperSearchInfo
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "批量待审核试卷", notes = "批量待审核试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @PutMapping(value = "/paper/draft")
|
|
|
- public ResponseEntity initPapers(@RequestBody PaperSearchInfo paperSearchInfo) {
|
|
|
- paperService.backPapers(Arrays.asList(paperSearchInfo.getPaperIds()));
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取卷库考试试卷
|
|
|
- *
|
|
|
- * @param examId
|
|
|
- * @param courseCode
|
|
|
- * @param groupCode
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "获取卷库考试试卷", notes = "获取卷库考试试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/paper/list/{examId}/{courseCode}/{groupCode}")
|
|
|
- public List<Paper> listPaperById(@PathVariable String examId, @PathVariable String courseCode,
|
|
|
- @PathVariable String groupCode) {
|
|
|
- return paperService.listExamPapers(Long.parseLong(examId), courseCode, groupCode);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增考试试卷
|
|
|
- *
|
|
|
- * @param examId
|
|
|
- * @param courseCode
|
|
|
- * @param groupCode
|
|
|
- * @param paperId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "新增考试试卷", notes = "新增考试试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @PostMapping(value = "/paper/join/{examId}/{courseCode}/{groupCode}/{paperId}")
|
|
|
- public ResponseEntity joinExamPaper(@PathVariable String examId, @PathVariable String courseCode,
|
|
|
- @PathVariable String groupCode, @PathVariable String paperId) {
|
|
|
- paperService.joinToExamPaper(Long.parseLong(examId), courseCode, groupCode, paperId);
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除考试试卷
|
|
|
- *
|
|
|
- * @param examId
|
|
|
- * @param courseCode
|
|
|
- * @param groupCode
|
|
|
- * @param paperId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "删除考试试卷", notes = "删除考试试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @DeleteMapping(value = "/paper/release/{examId}/{courseCode}/{groupCode}/{paperId}")
|
|
|
- public ResponseEntity releaseExamPaper(@PathVariable String examId, @PathVariable String courseCode,
|
|
|
- @PathVariable String groupCode, @PathVariable String paperId) {
|
|
|
-
|
|
|
- paperService.releaseExamPaper(Long.parseLong(examId), courseCode, groupCode, paperId);
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取卷库考试试卷类型集合
|
|
|
- *
|
|
|
- * @param examId
|
|
|
- * @param courseCode
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "获取考试试卷类型集合", notes = "获取考试试卷类型集合")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/paper/groupCode/{examId}/{courseCode}")
|
|
|
- public Set<String> listGroup(@PathVariable String examId, @PathVariable String courseCode) {
|
|
|
- return paperService.listGroupCodes(Long.parseLong(examId), courseCode);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除考试试卷类型
|
|
|
- *
|
|
|
- * @param examId
|
|
|
- * @param courseCode
|
|
|
- * @param groupCode
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "删除考试试卷类型", notes = "删除考试试卷类型")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @DeleteMapping(value = "/paper/groupCode/{examId}/{courseCode}/{groupCode}")
|
|
|
- public ResponseEntity deleteGroup(@PathVariable String examId, @PathVariable String courseCode,
|
|
|
- @PathVariable String groupCode) {
|
|
|
- paperService.deletGroupCode(Long.parseLong(examId), courseCode, groupCode);
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除导入试卷中的试题
|
|
|
- *
|
|
|
- * @param questionId
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "删除导入试卷中的试题", notes = "删除导入试卷中的试题")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @DeleteMapping(value = "/paper/deleteQuestion/{questionId}")
|
|
|
- public ResponseEntity deleteImportPaperQuestion(HttpServletRequest request, @PathVariable String questionId) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- List<String> paperNames = paperService.deleteImportQuestionById(questionId, user);
|
|
|
- return new ResponseEntity(paperNames, HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 向导入试卷中的新增试题
|
|
|
- *
|
|
|
- * @param paperId
|
|
|
- * @param paperDetailId
|
|
|
- * @param question
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "向导入试卷中的新增试题", notes = "向导入试卷中的新增试题")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @PostMapping(value = "/paper/addQuestion/{paperId}/{paperDetailId}")
|
|
|
- public ResponseEntity<Object> insertQuestionToPaper(HttpServletRequest request, @PathVariable String paperId,
|
|
|
- @PathVariable String paperDetailId, @RequestBody Question question) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- return new ResponseEntity<Object>(paperService.insertQuestionToPaper(paperId, paperDetailId, question, user),
|
|
|
- HttpStatus.OK);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "获取试卷的重复试题", notes = "获取试卷的重复试题")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/paper/{paperId}/reduplicate-questions")
|
|
|
- public ResponseEntity reduplicateQuestions(@PathVariable String paperId) {
|
|
|
-
|
|
|
- List<PaperDetailUnitExp> allPaperDetailUnitList = new ArrayList<>();
|
|
|
- // List<String> reduplicateId = new ArrayList<>();
|
|
|
- List<Set<String>> reduplicateId = new ArrayList<>();
|
|
|
-
|
|
|
- PaperExp paperExp = paperService.getPaperDto(paperId);
|
|
|
- List<PaperDetailExp> paperDetailExpList = paperExp.getPaperDetails();
|
|
|
- if (paperDetailExpList != null && paperDetailExpList.size() > 0) {
|
|
|
- for (PaperDetailExp paperDetailExp : paperDetailExpList) {
|
|
|
- if (paperDetailExp.getPaperDetailUnits() != null) {
|
|
|
- allPaperDetailUnitList.addAll(paperDetailExp.getPaperDetailUnits());
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- int length = allPaperDetailUnitList.size();
|
|
|
- for (int i = 0; i < length - 1; i++) {
|
|
|
- PaperDetailUnitExp paperDetailUnitExp1 = allPaperDetailUnitList.get(i);
|
|
|
- String quesText1 = quesService.getExtractText(paperDetailUnitExp1.getQuestion());
|
|
|
- if (StringUtils.isEmpty(quesText1)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- for (int j = i + 1; j < length; j++) {
|
|
|
- PaperDetailUnitExp paperDetailUnitExp2 = allPaperDetailUnitList.get(j);
|
|
|
- String quesText2 = quesService.getExtractText(paperDetailUnitExp2.getQuestion());
|
|
|
- if (StringUtils.isEmpty(quesText2)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- double similarity = StringSimilarityUtils.getSimilarityWithCosinesBySeg(quesText1, quesText2);
|
|
|
- if (similarity > reduplicateSimilarity) {
|
|
|
- boolean found = false;
|
|
|
- for (int k = 0; k < reduplicateId.size(); k++) {
|
|
|
- if (reduplicateId.get(k).contains(paperDetailUnitExp1.getId())
|
|
|
- && !reduplicateId.get(k).contains(paperDetailUnitExp2.getId())) {
|
|
|
- found = true;
|
|
|
- reduplicateId.get(k).add(paperDetailUnitExp2.getId());
|
|
|
- break;
|
|
|
- } else if (!reduplicateId.get(k).contains(paperDetailUnitExp1.getId())
|
|
|
- && reduplicateId.get(k).contains(paperDetailUnitExp2.getId())) {
|
|
|
- found = true;
|
|
|
- reduplicateId.get(k).add(paperDetailUnitExp1.getId());
|
|
|
- break;
|
|
|
- } else if (reduplicateId.get(k).contains(paperDetailUnitExp1.getId())
|
|
|
- && reduplicateId.get(k).contains(paperDetailUnitExp2.getId())) {
|
|
|
- found = true;
|
|
|
- // 两个题都在分组里,就不加了
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (!found) {
|
|
|
- Set<String> redupSet = new HashSet<>();
|
|
|
-
|
|
|
- redupSet.add(paperDetailUnitExp1.getId());
|
|
|
- redupSet.add(paperDetailUnitExp2.getId());
|
|
|
- reduplicateId.add(redupSet);
|
|
|
- }
|
|
|
- // reduplicateId.add(paperDetailUnitExp1.getId());
|
|
|
- // reduplicateId.add(paperDetailUnitExp2.getId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return new ResponseEntity(reduplicateId, HttpStatus.OK);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据试题获取试卷名称
|
|
|
- *
|
|
|
- * @param
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "获取试题所在的试卷名称", notes = "获取试题所在的试卷名称")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/paper/listNames/{questionId}")
|
|
|
- public ResponseEntity getPaperNamesByQuesId(@PathVariable String questionId) {
|
|
|
- return new ResponseEntity(paperService.getPaperNamesByQuestionId(questionId), HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据试题获取试卷名称
|
|
|
- *
|
|
|
- * @param
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "查询用于选题的试题列表", notes = "查询用于选题的试题列表")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/paper/listQuestion/{paperId}/{curPage}/{pageSize}")
|
|
|
- public ResponseEntity<Object> listQuestionforSelect(HttpServletRequest request,
|
|
|
- @PathVariable String paperId,
|
|
|
- @PathVariable int curPage,
|
|
|
- @PathVariable int pageSize,
|
|
|
- @RequestParam(name = "quesType") String quesType,
|
|
|
- @RequestParam(name = "quesBody") String quesBody) {
|
|
|
- AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
|
|
|
- if(accessUser == null){
|
|
|
- return new ResponseEntity<Object>(new PageImpl<Question>(new ArrayList<Question>()),HttpStatus.OK);
|
|
|
- }
|
|
|
- QuesStructType quesStructType = null;
|
|
|
- if (StringUtils.isNotEmpty(quesType)) {
|
|
|
- quesStructType = QuesStructType.valueOf(quesType);
|
|
|
- }
|
|
|
- Page<Question> questionPageList = paperService.listQuestionforSelect(paperId,curPage,pageSize,quesStructType,accessUser,quesBody);
|
|
|
- return new ResponseEntity<Object>(questionPageList,HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 向试卷中某道大题插入多道试题(已存在的试题)
|
|
|
- *
|
|
|
- * @param paperId
|
|
|
- * @param paperDetailId
|
|
|
- * @param questions
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "向导入试卷中的新增试题", notes = "向导入试卷中的新增试题")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @PostMapping(value = "/paper/selectQuestions/{paperId}/{paperDetailId}")
|
|
|
- public ResponseEntity selectQuestionsToPaper(HttpServletRequest request, @PathVariable String paperId,
|
|
|
- @PathVariable String paperDetailId, @RequestBody List<Question> questions) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- return new ResponseEntity(paperService.selectQuestionsToPaper(paperId, paperDetailId, questions, user),
|
|
|
- HttpStatus.OK);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param paperSearchInfo
|
|
|
- * @param ids
|
|
|
- * @param curPage
|
|
|
- * @param pageSize
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "查询所有导入试卷(not in paperIds)", notes = "查询所有导入试卷(not in paperIds)")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/importPaper/{ids}/{curPage}/{pageSize}")
|
|
|
- public ResponseEntity getImportPapersNotInIds(HttpServletRequest request,
|
|
|
- @ModelAttribute PaperSearchInfo paperSearchInfo, @PathVariable String[] ids, @PathVariable int curPage,
|
|
|
- @PathVariable int pageSize) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
- if (ids != null && ids.length > 0) {
|
|
|
- return new ResponseEntity(paperService.getImportPapersNotInIds(paperSearchInfo, ids, curPage, pageSize),
|
|
|
- HttpStatus.OK);
|
|
|
- } else {
|
|
|
- return new ResponseEntity(paperService.getImportPapers(paperSearchInfo, curPage, pageSize), HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param paperSearchInfo
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "查询该课程的所有导入试卷", notes = "查询该课程的所有导入试卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value = "/importPaper/course")
|
|
|
- public ResponseEntity getImportPapersByCourseNo(HttpServletRequest request,
|
|
|
- @ModelAttribute PaperSearchInfo paperSearchInfo) {
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
- paperService.formatPaperSearchInfo(paperSearchInfo);
|
|
|
- Paper importPaper = BeanCopierUtil.copyProperties(paperSearchInfo, Paper.class);
|
|
|
- importPaper.setPaperType(PaperType.IMPORT);
|
|
|
- return new ResponseEntity(paperRepo.findAll(Example.of(importPaper)), HttpStatus.OK);
|
|
|
-
|
|
|
- }
|
|
|
- /**
|
|
|
- * 使用原卷
|
|
|
- * @param request
|
|
|
- * @param paperIds
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "复制导入试卷为组卷", notes = "复制导入试卷为组卷")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @PutMapping(value = "/useBasePaper/{paperIds}")
|
|
|
- public ResponseEntity useBasePaper(HttpServletRequest request,@PathVariable String paperIds){
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- try{
|
|
|
- String[] paperIdArray = paperIds.split(",");
|
|
|
- for(int i = 0;i<paperIdArray.length;i++){
|
|
|
- Paper oldpaper = paperRepo.findOne(paperIdArray[i]);
|
|
|
- boolean result = paperService.checkPaperName(oldpaper.getName(), PaperType.GENERATE,user.getRootOrgId()+"");
|
|
|
- if(!result){
|
|
|
- return new ResponseEntity(new ErrorMsg("考试试卷:"+oldpaper.getName()+"已经存在"),HttpStatus.OK);
|
|
|
- }
|
|
|
- }
|
|
|
- paperService.useBasePaper(paperIds, user.getName());
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- }catch(Exception e){
|
|
|
- return new ResponseEntity(e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 上传音频文件检查
|
|
|
- * @param paperId
|
|
|
- * @param filesName
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value="上传音频文件检查",notes="上传音频文件检查")
|
|
|
- @PostMapping(value="/checkRadioFile/{paperId}")
|
|
|
- public ResponseEntity checkRadioFile(@PathVariable String paperId,@RequestBody List<String> filesName){
|
|
|
- Map<String, String> errorMessage = paperService.checkRadioFile(paperId, filesName);
|
|
|
- return new ResponseEntity(errorMessage,HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value="上传音频文件", notes="上传音频文件")
|
|
|
- @PostMapping(value="/uploadRadio/{paperId}")
|
|
|
- public ResponseEntity uploadRadio(List<MultipartFile> files,@PathVariable String paperId,HttpServletRequest request){
|
|
|
- AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
- try {
|
|
|
- paperService.uploadRadio(files, paperId, user);
|
|
|
- return new ResponseEntity(HttpStatus.OK);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return new ResponseEntity(e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据id获取试卷的html片段集合
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value="根据id获取试卷的html片段集合", notes="根据id获取试卷的html片段集合")
|
|
|
- @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
- @GetMapping(value="/paper/pdf/{paperId}")
|
|
|
- public ResponseEntity<Object> getPaperPDFById(@PathVariable String paperId){
|
|
|
- Map<String, Object> mag = paperService.getPaperPDF(paperId);
|
|
|
- return new ResponseEntity<Object>(mag,HttpStatus.OK);
|
|
|
- }
|
|
|
-}
|
|
|
+package com.qmth.cqb.paper.web;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.data.domain.Example;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.PageImpl;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import com.google.gson.Gson;
|
|
|
+import com.qmth.cqb.paper.dao.PaperRepo;
|
|
|
+import com.qmth.cqb.paper.dto.PaperDetailExp;
|
|
|
+import com.qmth.cqb.paper.dto.PaperDetailUnitExp;
|
|
|
+import com.qmth.cqb.paper.dto.PaperExp;
|
|
|
+import com.qmth.cqb.paper.model.Paper;
|
|
|
+import com.qmth.cqb.paper.model.PaperSearchInfo;
|
|
|
+import com.qmth.cqb.paper.service.PaperService;
|
|
|
+import com.qmth.cqb.question.model.Question;
|
|
|
+import com.qmth.cqb.question.service.QuesService;
|
|
|
+import com.qmth.cqb.utils.BeanCopierUtil;
|
|
|
+import com.qmth.cqb.utils.StringSimilarityUtils;
|
|
|
+import com.qmth.cqb.utils.enums.PaperType;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
|
|
|
+import cn.com.qmth.examcloud.common.uac.annotation.Uac;
|
|
|
+import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
|
|
|
+import cn.com.qmth.examcloud.common.uac.enums.RoleMeta;
|
|
|
+import cn.com.qmth.examcloud.common.uac.enums.UacPolicy;
|
|
|
+import cn.com.qmth.examcloud.common.util.ErrorMsg;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by songyue on 16/12/28.
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("${api_cqb}/")
|
|
|
+public class PaperController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PaperService paperService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PaperRepo paperRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ Gson gson;
|
|
|
+
|
|
|
+ @Value("${question.reduplicate.similarity}")
|
|
|
+ private double reduplicateSimilarity;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ QuesService quesService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据Id获取试卷
|
|
|
+ *
|
|
|
+ * @param paperId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "根据Id获取试卷", notes = "根据Id获取试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/paper/{paperId}")
|
|
|
+ public ResponseEntity getPaperById(@PathVariable String paperId) {
|
|
|
+ return new ResponseEntity(paperService.getPaperDto(paperId), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存试卷
|
|
|
+ *
|
|
|
+ * @param paper
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "保存试卷", notes = "保存试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @PutMapping(value = "/paper")
|
|
|
+ public ResponseEntity savePaperById(HttpServletRequest request, @RequestBody PaperExp paper) {
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ Map<String, Object> msgMap = paperService.savePaper(paper, user);
|
|
|
+ if ("success".equals(msgMap.get("msg"))) {
|
|
|
+ return new ResponseEntity(msgMap, HttpStatus.OK);
|
|
|
+ } else {
|
|
|
+ return new ResponseEntity(msgMap, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询所有导入试卷
|
|
|
+ *
|
|
|
+ * @param paperSearchInfo
|
|
|
+ * @param curPage
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "查询所有导入试卷", notes = "查询所有导入试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/importPaper/{curPage}/{pageSize}")
|
|
|
+ public ResponseEntity getImportPapers(HttpServletRequest request,
|
|
|
+ @ModelAttribute PaperSearchInfo paperSearchInfo,
|
|
|
+ @PathVariable int curPage,
|
|
|
+ @PathVariable int pageSize) {
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
+ return new ResponseEntity(paperService.getImportPapers(paperSearchInfo, curPage, pageSize), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询所有待审核和审核不通过的导入试卷", notes = "查询所有待审核和审核不通过的导入试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/importPaperNotSuccess/{curPage}/{pageSize}")
|
|
|
+ public ResponseEntity getImportPapersNotSuccess(HttpServletRequest request,
|
|
|
+ @ModelAttribute PaperSearchInfo paperSearchInfo, @PathVariable int curPage, @PathVariable int pageSize) {
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
+ return new ResponseEntity(paperService.getImportPapersNotSuccess(paperSearchInfo, curPage, pageSize),
|
|
|
+ HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据条件查询导入试卷", notes = "根据条件查询导入试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/getImportPaper")
|
|
|
+ public ResponseEntity<List<Paper>> getImportPapersBySearch(HttpServletRequest request,
|
|
|
+ @ModelAttribute PaperSearchInfo paperSearchInfo) {
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
+ return new ResponseEntity<List<Paper>>(paperService.getImportPapersBySearch(paperSearchInfo), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据条件查询已组试卷", notes = "根据条件查询已组试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/getGenPaper")
|
|
|
+ public ResponseEntity<List<Paper>> getGenPapersBySearch(HttpServletRequest request,
|
|
|
+ @ModelAttribute PaperSearchInfo paperSearchInfo) {
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
+ return new ResponseEntity<List<Paper>>(paperService.getGenPapersBySearch(paperSearchInfo), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询所有已组试卷
|
|
|
+ *
|
|
|
+ * @param paperSearchInfo
|
|
|
+ * @param curPage
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "查询所有已组试卷", notes = "查询所有已组试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/genPaper/{curPage}/{pageSize}")
|
|
|
+ public ResponseEntity getGenPapers(HttpServletRequest request, @ModelAttribute PaperSearchInfo paperSearchInfo,
|
|
|
+ @PathVariable int curPage, @PathVariable int pageSize) {
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
+ return new ResponseEntity(paperService.getGenPapers(paperSearchInfo, curPage, pageSize), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除试卷
|
|
|
+ *
|
|
|
+ * @param paperIds
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "删除试卷", notes = "删除试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @DeleteMapping(value = "/paper/{paperIds}")
|
|
|
+ public ResponseEntity delPaper(@PathVariable String paperIds) {
|
|
|
+ List<String> paperList = Stream.of(paperIds.split(",")).collect(Collectors.toList());
|
|
|
+ Map<String, Object> msgMap = paperService.deletePapers(paperList);
|
|
|
+ if (msgMap.get("msg").equals("success")) {
|
|
|
+ return new ResponseEntity(msgMap, HttpStatus.OK);
|
|
|
+ } else {
|
|
|
+ return new ResponseEntity(msgMap, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量通过试卷
|
|
|
+ *
|
|
|
+ * @param paperSearchInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "批量通过试卷", notes = "批量通过试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @PutMapping(value = "/paper/pass")
|
|
|
+ public ResponseEntity passPapers(@RequestBody PaperSearchInfo paperSearchInfo) {
|
|
|
+ paperService.passPapers(Arrays.asList(paperSearchInfo.getPaperIds()));
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量不通过试卷
|
|
|
+ *
|
|
|
+ * @param paperSearchInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "批量不通过试卷", notes = "批量不通过试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @PutMapping(value = "/paper/noPass")
|
|
|
+ public ResponseEntity noPassPapers(@RequestBody PaperSearchInfo paperSearchInfo) {
|
|
|
+ paperService.noPassPapers(Arrays.asList(paperSearchInfo.getPaperIds()));
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量待审核试卷
|
|
|
+ *
|
|
|
+ * @param paperSearchInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "批量待审核试卷", notes = "批量待审核试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @PutMapping(value = "/paper/draft")
|
|
|
+ public ResponseEntity initPapers(@RequestBody PaperSearchInfo paperSearchInfo) {
|
|
|
+ paperService.backPapers(Arrays.asList(paperSearchInfo.getPaperIds()));
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取卷库考试试卷
|
|
|
+ *
|
|
|
+ * @param examId
|
|
|
+ * @param courseCode
|
|
|
+ * @param groupCode
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取卷库考试试卷", notes = "获取卷库考试试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/paper/list/{examId}/{courseCode}/{groupCode}")
|
|
|
+ public List<Paper> listPaperById(@PathVariable String examId, @PathVariable String courseCode,
|
|
|
+ @PathVariable String groupCode) {
|
|
|
+ return paperService.listExamPapers(Long.parseLong(examId), courseCode, groupCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增考试试卷
|
|
|
+ *
|
|
|
+ * @param examId
|
|
|
+ * @param courseCode
|
|
|
+ * @param groupCode
|
|
|
+ * @param paperId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "新增考试试卷", notes = "新增考试试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @PostMapping(value = "/paper/join/{examId}/{courseCode}/{groupCode}/{paperId}")
|
|
|
+ public ResponseEntity joinExamPaper(@PathVariable String examId, @PathVariable String courseCode,
|
|
|
+ @PathVariable String groupCode, @PathVariable String paperId) {
|
|
|
+ paperService.joinToExamPaper(Long.parseLong(examId), courseCode, groupCode, paperId);
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除考试试卷
|
|
|
+ *
|
|
|
+ * @param examId
|
|
|
+ * @param courseCode
|
|
|
+ * @param groupCode
|
|
|
+ * @param paperId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "删除考试试卷", notes = "删除考试试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @DeleteMapping(value = "/paper/release/{examId}/{courseCode}/{groupCode}/{paperId}")
|
|
|
+ public ResponseEntity releaseExamPaper(@PathVariable String examId, @PathVariable String courseCode,
|
|
|
+ @PathVariable String groupCode, @PathVariable String paperId) {
|
|
|
+
|
|
|
+ paperService.releaseExamPaper(Long.parseLong(examId), courseCode, groupCode, paperId);
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取卷库考试试卷类型集合
|
|
|
+ *
|
|
|
+ * @param examId
|
|
|
+ * @param courseCode
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取考试试卷类型集合", notes = "获取考试试卷类型集合")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/paper/groupCode/{examId}/{courseCode}")
|
|
|
+ public Set<String> listGroup(@PathVariable String examId, @PathVariable String courseCode) {
|
|
|
+ return paperService.listGroupCodes(Long.parseLong(examId), courseCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除考试试卷类型
|
|
|
+ *
|
|
|
+ * @param examId
|
|
|
+ * @param courseCode
|
|
|
+ * @param groupCode
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "删除考试试卷类型", notes = "删除考试试卷类型")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @DeleteMapping(value = "/paper/groupCode/{examId}/{courseCode}/{groupCode}")
|
|
|
+ public ResponseEntity deleteGroup(@PathVariable String examId, @PathVariable String courseCode,
|
|
|
+ @PathVariable String groupCode) {
|
|
|
+ paperService.deletGroupCode(Long.parseLong(examId), courseCode, groupCode);
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除导入试卷中的试题
|
|
|
+ *
|
|
|
+ * @param questionId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "删除导入试卷中的试题", notes = "删除导入试卷中的试题")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @DeleteMapping(value = "/paper/deleteQuestion/{questionId}")
|
|
|
+ public ResponseEntity deleteImportPaperQuestion(HttpServletRequest request, @PathVariable String questionId) {
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ List<String> paperNames = paperService.deleteImportQuestionById(questionId, user);
|
|
|
+ return new ResponseEntity(paperNames, HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 向导入试卷中的新增试题
|
|
|
+ *
|
|
|
+ * @param paperId
|
|
|
+ * @param paperDetailId
|
|
|
+ * @param question
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "向导入试卷中的新增试题", notes = "向导入试卷中的新增试题")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @PostMapping(value = "/paper/addQuestion/{paperId}/{paperDetailId}")
|
|
|
+ public ResponseEntity<Object> insertQuestionToPaper(HttpServletRequest request, @PathVariable String paperId,
|
|
|
+ @PathVariable String paperDetailId, @RequestBody Question question) {
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ return new ResponseEntity<Object>(paperService.insertQuestionToPaper(paperId, paperDetailId, question, user),
|
|
|
+ HttpStatus.OK);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取试卷的重复试题", notes = "获取试卷的重复试题")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/paper/{paperId}/reduplicate-questions")
|
|
|
+ public ResponseEntity reduplicateQuestions(@PathVariable String paperId) {
|
|
|
+
|
|
|
+ List<PaperDetailUnitExp> allPaperDetailUnitList = new ArrayList<>();
|
|
|
+ // List<String> reduplicateId = new ArrayList<>();
|
|
|
+ List<Set<String>> reduplicateId = new ArrayList<>();
|
|
|
+
|
|
|
+ PaperExp paperExp = paperService.getPaperDto(paperId);
|
|
|
+ List<PaperDetailExp> paperDetailExpList = paperExp.getPaperDetails();
|
|
|
+ if (paperDetailExpList != null && paperDetailExpList.size() > 0) {
|
|
|
+ for (PaperDetailExp paperDetailExp : paperDetailExpList) {
|
|
|
+ if (paperDetailExp.getPaperDetailUnits() != null) {
|
|
|
+ allPaperDetailUnitList.addAll(paperDetailExp.getPaperDetailUnits());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int length = allPaperDetailUnitList.size();
|
|
|
+ for (int i = 0; i < length - 1; i++) {
|
|
|
+ PaperDetailUnitExp paperDetailUnitExp1 = allPaperDetailUnitList.get(i);
|
|
|
+ String quesText1 = quesService.getExtractText(paperDetailUnitExp1.getQuestion());
|
|
|
+ if (StringUtils.isEmpty(quesText1)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (int j = i + 1; j < length; j++) {
|
|
|
+ PaperDetailUnitExp paperDetailUnitExp2 = allPaperDetailUnitList.get(j);
|
|
|
+ String quesText2 = quesService.getExtractText(paperDetailUnitExp2.getQuestion());
|
|
|
+ if (StringUtils.isEmpty(quesText2)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ double similarity = StringSimilarityUtils.getSimilarityWithCosinesBySeg(quesText1, quesText2);
|
|
|
+ if (similarity > reduplicateSimilarity) {
|
|
|
+ boolean found = false;
|
|
|
+ for (int k = 0; k < reduplicateId.size(); k++) {
|
|
|
+ if (reduplicateId.get(k).contains(paperDetailUnitExp1.getId())
|
|
|
+ && !reduplicateId.get(k).contains(paperDetailUnitExp2.getId())) {
|
|
|
+ found = true;
|
|
|
+ reduplicateId.get(k).add(paperDetailUnitExp2.getId());
|
|
|
+ break;
|
|
|
+ } else if (!reduplicateId.get(k).contains(paperDetailUnitExp1.getId())
|
|
|
+ && reduplicateId.get(k).contains(paperDetailUnitExp2.getId())) {
|
|
|
+ found = true;
|
|
|
+ reduplicateId.get(k).add(paperDetailUnitExp1.getId());
|
|
|
+ break;
|
|
|
+ } else if (reduplicateId.get(k).contains(paperDetailUnitExp1.getId())
|
|
|
+ && reduplicateId.get(k).contains(paperDetailUnitExp2.getId())) {
|
|
|
+ found = true;
|
|
|
+ // 两个题都在分组里,就不加了
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!found) {
|
|
|
+ Set<String> redupSet = new HashSet<>();
|
|
|
+
|
|
|
+ redupSet.add(paperDetailUnitExp1.getId());
|
|
|
+ redupSet.add(paperDetailUnitExp2.getId());
|
|
|
+ reduplicateId.add(redupSet);
|
|
|
+ }
|
|
|
+ // reduplicateId.add(paperDetailUnitExp1.getId());
|
|
|
+ // reduplicateId.add(paperDetailUnitExp2.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new ResponseEntity(reduplicateId, HttpStatus.OK);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据试题获取试卷名称
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取试题所在的试卷名称", notes = "获取试题所在的试卷名称")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/paper/listNames/{questionId}")
|
|
|
+ public ResponseEntity getPaperNamesByQuesId(@PathVariable String questionId) {
|
|
|
+ return new ResponseEntity(paperService.getPaperNamesByQuestionId(questionId), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据试题获取试卷名称
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "查询用于选题的试题列表", notes = "查询用于选题的试题列表")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/paper/listQuestion/{paperId}/{curPage}/{pageSize}")
|
|
|
+ public ResponseEntity<Object> listQuestionforSelect(HttpServletRequest request,
|
|
|
+ @PathVariable String paperId,
|
|
|
+ @PathVariable int curPage,
|
|
|
+ @PathVariable int pageSize,
|
|
|
+ @RequestParam(name = "quesType") String quesType,
|
|
|
+ @RequestParam(name = "quesBody") String quesBody) {
|
|
|
+ AccessUser accessUser = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ if(accessUser == null){
|
|
|
+ return new ResponseEntity<Object>(new PageImpl<Question>(new ArrayList<Question>()),HttpStatus.OK);
|
|
|
+ }
|
|
|
+ QuesStructType quesStructType = null;
|
|
|
+ if (StringUtils.isNotEmpty(quesType)) {
|
|
|
+ quesStructType = QuesStructType.valueOf(quesType);
|
|
|
+ }
|
|
|
+ Page<Question> questionPageList = paperService.listQuestionforSelect(paperId,curPage,pageSize,quesStructType,accessUser,quesBody);
|
|
|
+ return new ResponseEntity<Object>(questionPageList,HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 向试卷中某道大题插入多道试题(已存在的试题)
|
|
|
+ *
|
|
|
+ * @param paperId
|
|
|
+ * @param paperDetailId
|
|
|
+ * @param questions
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "向导入试卷中的新增试题", notes = "向导入试卷中的新增试题")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @PostMapping(value = "/paper/selectQuestions/{paperId}/{paperDetailId}")
|
|
|
+ public ResponseEntity selectQuestionsToPaper(HttpServletRequest request, @PathVariable String paperId,
|
|
|
+ @PathVariable String paperDetailId, @RequestBody List<Question> questions) {
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ return new ResponseEntity(paperService.selectQuestionsToPaper(paperId, paperDetailId, questions, user),
|
|
|
+ HttpStatus.OK);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param paperSearchInfo
|
|
|
+ * @param ids
|
|
|
+ * @param curPage
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "查询所有导入试卷(not in paperIds)", notes = "查询所有导入试卷(not in paperIds)")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/importPaper/{ids}/{curPage}/{pageSize}")
|
|
|
+ public ResponseEntity getImportPapersNotInIds(HttpServletRequest request,
|
|
|
+ @ModelAttribute PaperSearchInfo paperSearchInfo, @PathVariable String[] ids, @PathVariable int curPage,
|
|
|
+ @PathVariable int pageSize) {
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
+ if (ids != null && ids.length > 0) {
|
|
|
+ return new ResponseEntity(paperService.getImportPapersNotInIds(paperSearchInfo, ids, curPage, pageSize),
|
|
|
+ HttpStatus.OK);
|
|
|
+ } else {
|
|
|
+ return new ResponseEntity(paperService.getImportPapers(paperSearchInfo, curPage, pageSize), HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param paperSearchInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "查询该课程的所有导入试卷", notes = "查询该课程的所有导入试卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @GetMapping(value = "/importPaper/course")
|
|
|
+ public ResponseEntity getImportPapersByCourseNo(HttpServletRequest request,
|
|
|
+ @ModelAttribute PaperSearchInfo paperSearchInfo) {
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ paperSearchInfo.setOrgId(user.getRootOrgId().toString());
|
|
|
+ paperService.formatPaperSearchInfo(paperSearchInfo);
|
|
|
+ Paper importPaper = BeanCopierUtil.copyProperties(paperSearchInfo, Paper.class);
|
|
|
+ importPaper.setPaperType(PaperType.IMPORT);
|
|
|
+ return new ResponseEntity(paperRepo.findAll(Example.of(importPaper)), HttpStatus.OK);
|
|
|
+
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 使用原卷
|
|
|
+ * @param request
|
|
|
+ * @param paperIds
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "复制导入试卷为组卷", notes = "复制导入试卷为组卷")
|
|
|
+ @Uac(roles={RoleMeta.QUESTION_ADMIN,RoleMeta.SUPER_ADMIN},policy=UacPolicy.IN)
|
|
|
+ @PutMapping(value = "/useBasePaper/{paperIds}")
|
|
|
+ public ResponseEntity useBasePaper(HttpServletRequest request,@PathVariable String paperIds){
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ try{
|
|
|
+ String[] paperIdArray = paperIds.split(",");
|
|
|
+ for(int i = 0;i<paperIdArray.length;i++){
|
|
|
+ Paper oldpaper = paperRepo.findOne(paperIdArray[i]);
|
|
|
+ boolean result = paperService.checkPaperName(oldpaper.getName(), PaperType.GENERATE,user.getRootOrgId()+"");
|
|
|
+ if(!result){
|
|
|
+ return new ResponseEntity(new ErrorMsg("考试试卷:"+oldpaper.getName()+"已经存在"),HttpStatus.OK);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ paperService.useBasePaper(paperIds, user.getName());
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ }catch(Exception e){
|
|
|
+ return new ResponseEntity(e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传音频文件检查
|
|
|
+ * @param paperId
|
|
|
+ * @param filesName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value="上传音频文件检查",notes="上传音频文件检查")
|
|
|
+ @PostMapping(value="/checkRadioFile/{paperId}")
|
|
|
+ public ResponseEntity checkRadioFile(@PathVariable String paperId,@RequestBody List<String> filesName){
|
|
|
+ Map<String, String> errorMessage = paperService.checkRadioFile(paperId, filesName);
|
|
|
+ return new ResponseEntity(errorMessage,HttpStatus.OK);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="上传音频文件", notes="上传音频文件")
|
|
|
+ @PostMapping(value="/uploadRadio/{paperId}")
|
|
|
+ public ResponseEntity uploadRadio(List<MultipartFile> files,@PathVariable String paperId,HttpServletRequest request){
|
|
|
+ AccessUser user = (AccessUser) request.getAttribute("accessUser");
|
|
|
+ try {
|
|
|
+ paperService.uploadRadio(files, paperId, user);
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResponseEntity(e.getMessage(),HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id获取试卷的html片段集合
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value="根据id获取试卷的html片段集合", notes="根据id获取试卷的html片段集合")
|
|
|
+ @GetMapping(value="/paper/pdf/{paperId}")
|
|
|
+ public ResponseEntity<Object> getPaperPDFById(@PathVariable String paperId){
|
|
|
+ Map<String, Object> mag;
|
|
|
+ try {
|
|
|
+ mag = paperService.getPaperPDF(paperId);
|
|
|
+ return new ResponseEntity<Object>(mag,HttpStatus.OK);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResponseEntity<Object>(e.getMessage(),HttpStatus.OK);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|