|
@@ -6,10 +6,13 @@ import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
import cn.com.qmth.examcloud.core.questions.api.bean.ParsePaper;
|
|
import cn.com.qmth.examcloud.core.questions.api.bean.ParsePaper;
|
|
import cn.com.qmth.examcloud.core.questions.base.BeanCopierUtil;
|
|
import cn.com.qmth.examcloud.core.questions.base.BeanCopierUtil;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.base.SpringContextUtils;
|
|
import cn.com.qmth.examcloud.core.questions.base.StringSimilarityUtils;
|
|
import cn.com.qmth.examcloud.core.questions.base.StringSimilarityUtils;
|
|
import cn.com.qmth.examcloud.core.questions.base.enums.PaperType;
|
|
import cn.com.qmth.examcloud.core.questions.base.enums.PaperType;
|
|
import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
|
|
import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.dao.ExportServiceManageRepo;
|
|
import cn.com.qmth.examcloud.core.questions.dao.PaperRepo;
|
|
import cn.com.qmth.examcloud.core.questions.dao.PaperRepo;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.dao.entity.ExportServiceManage;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Paper;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Paper;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperSearchInfo;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperSearchInfo;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
|
|
@@ -18,8 +21,12 @@ import cn.com.qmth.examcloud.core.questions.service.QuesService;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperDetailExp;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperDetailExp;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperDetailUnitExp;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperDetailUnitExp;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperExp;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperExp;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.service.export.ExportPaperAbstractService;
|
|
|
|
+
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
|
+
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
+
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -61,10 +68,12 @@ public class PaperController extends ControllerSupport {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
QuesService quesService;
|
|
QuesService quesService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ ExportServiceManageRepo exportServiceManageRepo;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据Id获取试卷
|
|
* 根据Id获取试卷
|
|
- *
|
|
|
|
* @param paperId
|
|
* @param paperId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@@ -579,34 +588,35 @@ public class PaperController extends ControllerSupport {
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "预览试卷页面")
|
|
@ApiOperation(value = "预览试卷页面")
|
|
- @GetMapping(value = "/paper/pdf/{paperId}")
|
|
|
|
- public String viewPaper(Model model, @PathVariable String paperId) {
|
|
|
|
- PaperExp paper;
|
|
|
|
- try {
|
|
|
|
- paper = paperService.getPaperDto(paperId);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error(e.getMessage());
|
|
|
|
- throw new StatusException("500", "试卷信息不存在!");
|
|
|
|
|
|
+ @GetMapping(value = "/paper/pdf/{paperId}/{orgName}")
|
|
|
|
+ public String viewPaper(Model model, @PathVariable String paperId, @PathVariable String orgName) {
|
|
|
|
+ ExportServiceManage esm = exportServiceManageRepo.findByOrgName(orgName);
|
|
|
|
+ if (esm == null) {
|
|
|
|
+ esm = exportServiceManageRepo.findByOrgName("山东大学");
|
|
}
|
|
}
|
|
|
|
+ ExportPaperAbstractService exportPaperAbstractService = (ExportPaperAbstractService) SpringContextUtils.getBeanById(esm.getExportServiceName());
|
|
|
|
+ PaperExp paper = exportPaperAbstractService.previewPDF(paperId);
|
|
model.addAttribute("htmlList", JsonUtil.toJson(ParsePaper.convertPaperHtml(paper)));
|
|
model.addAttribute("htmlList", JsonUtil.toJson(ParsePaper.convertPaperHtml(paper)));
|
|
model.addAttribute("courseName", paper.getCourseName());
|
|
model.addAttribute("courseName", paper.getCourseName());
|
|
model.addAttribute("courseNo", paper.getCourseNo());
|
|
model.addAttribute("courseNo", paper.getCourseNo());
|
|
- return "paper";
|
|
|
|
|
|
+ String html = esm.getExportServiceName() + "_paper";
|
|
|
|
+ return html;
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "预览试卷答案页面")
|
|
@ApiOperation(value = "预览试卷答案页面")
|
|
- @GetMapping(value = "/paper/answer/pdf/{paperId}")
|
|
|
|
- public String viewPaperAnswer(Model model, @PathVariable String paperId) {
|
|
|
|
- PaperExp paper;
|
|
|
|
- try {
|
|
|
|
- paper = paperService.getPaperDto(paperId);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- throw new StatusException("500", "试卷信息不存在!");
|
|
|
|
|
|
+ @GetMapping(value = "/paper/answer/pdf/{paperId}/{orgName}")
|
|
|
|
+ public String viewPaperAnswer(Model model, @PathVariable String paperId, @PathVariable String orgName) {
|
|
|
|
+ ExportServiceManage esm = exportServiceManageRepo.findByOrgName(orgName);
|
|
|
|
+ if (esm == null) {
|
|
|
|
+ esm = exportServiceManageRepo.findByOrgName("山东大学");
|
|
}
|
|
}
|
|
|
|
+ ExportPaperAbstractService exportPaperAbstractService = (ExportPaperAbstractService) SpringContextUtils.getBeanById(esm.getExportServiceName());
|
|
|
|
+ PaperExp paper = exportPaperAbstractService.previewPDF(paperId);
|
|
model.addAttribute("htmlList", JsonUtil.toJson(ParsePaper.convertAnswerHtml(paper)));
|
|
model.addAttribute("htmlList", JsonUtil.toJson(ParsePaper.convertAnswerHtml(paper)));
|
|
model.addAttribute("courseNo", paper.getCourseNo());
|
|
model.addAttribute("courseNo", paper.getCourseNo());
|
|
model.addAttribute("courseName", paper.getCourseName());
|
|
model.addAttribute("courseName", paper.getCourseName());
|
|
- return "paperAnswer";
|
|
|
|
|
|
+ String html = esm.getExportServiceName() + "_answer";
|
|
|
|
+ return html;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|