diff --git a/exam-module-exam/exam-module-exam-biz/pom.xml b/exam-module-exam/exam-module-exam-biz/pom.xml index 9aa338e5..e05a08b2 100644 --- a/exam-module-exam/exam-module-exam-biz/pom.xml +++ b/exam-module-exam/exam-module-exam-biz/pom.xml @@ -127,7 +127,61 @@ org.apache.tika tika-core + + + org.apache.poi + poi + 4.1.2 + + + org.apache.poi + poi-ooxml + 4.1.2 + + + + org.apache.poi + ooxml-schemas + 1.4 + + + + cn.afterturn + easypoi-base + 4.4.0 + + + org.apache.poi + poi + + + + org.apache.poi + poi-ooxml + + + org.apache.poi + ooxml-schemas + + + + + + + + + + org.apache.commons + commons-imaging + 1.0-alpha3 + + + + com.adobe.xmp + xmpcore + 6.1.11 + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperController.java index 95ed42de..6cb0369c 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperController.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperController.java @@ -123,12 +123,12 @@ public class EducationPaperController } /** - * 根据方案获取试卷 + * 根据方案获取试卷下拉 */ @GetMapping(value = "/getPaperByTaskId") public CommonResult getPaperByTaskId(@RequestParam(value = "taskId") String taskId) { - return CommonResult.success(educationPaperService.selectPaperByTaskId(taskId)); + return CommonResult.success(educationPaperService.selectPaperIdAndNumByTaskId(taskId)); } @@ -216,4 +216,17 @@ public class EducationPaperController return CommonResult.success(pageResult); } + + /** + * 下载试卷 + * @param paperIds + * @return + */ + @GetMapping("/addUpload/{paperIds}") + public void downLoad(@PathVariable String[] paperIds, HttpServletResponse response) throws Exception { + educationPaperService.downloadWord(paperIds,response); + } + + + } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperTaskController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperTaskController.java index 4f730022..3df38d23 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperTaskController.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/EducationPaperTaskController.java @@ -38,13 +38,8 @@ public class EducationPaperTaskController @GetMapping("/list") public CommonResult> list(PaperTaskPageVo educationPaperTask) { - PageResult pageResult = educationPaperTaskService.selectEducationPaperTaskList(educationPaperTask); - - - return CommonResult.success(BeanUtils.toBean(pageResult, EducationPaperTask.class)); - } /** * 查询试卷任务列表(学生端) diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperIdAndNum.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperIdAndNum.java new file mode 100644 index 00000000..999c3461 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperIdAndNum.java @@ -0,0 +1,13 @@ +package pc.exam.pp.module.exam.controller.admin.paper.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PaperIdAndNum { + private String num; + private String paperId; +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperQueWordDto.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperQueWordDto.java new file mode 100644 index 00000000..cf201773 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperQueWordDto.java @@ -0,0 +1,19 @@ +package pc.exam.pp.module.exam.controller.admin.paper.dto; + +import jdk.dynalink.linker.LinkerServices; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PaperQueWordDto { + private String content; + + private List answerList; + +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperWordDto.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperWordDto.java new file mode 100644 index 00000000..f7a8b2c6 --- /dev/null +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/paper/dto/PaperWordDto.java @@ -0,0 +1,23 @@ +package pc.exam.pp.module.exam.controller.admin.paper.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PaperWordDto { + //大写的一二三 + private String upperNum; + //题型 + private String type; + //每小题多少分 + private String score; + //共计多少分 + private String totalScore; + //题目 + private List que; +} diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/ExamQuestionController.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/ExamQuestionController.java index afafe917..fb85b019 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/ExamQuestionController.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/controller/admin/question/ExamQuestionController.java @@ -140,7 +140,6 @@ public class ExamQuestionController @PostMapping public CommonResult add(@RequestBody ExamQuestion examQuestion) { - System.out.println(examQuestion.getContent()+"content"); return success(examQuestionService.insertExamQuestion(examQuestion)); } @@ -151,7 +150,7 @@ public class ExamQuestionController @PutMapping public CommonResult edit(@RequestBody ExamQuestion examQuestion) { - return success(examQuestionService.updateExamQuestion(examQuestion)); + return success(examQuestionService.updateExamQuestion(examQuestion)); } /** diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperParam.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperParam.java index 1f123d6f..628e5ba3 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperParam.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperParam.java @@ -82,7 +82,16 @@ public class EducationPaperParam private String isSession; private String isTime; + // 默认 1 小时 @JsonFormat(pattern = "HH:mm:ss", timezone = "Asia/Shanghai") - private Time examTime = Time.valueOf("01:00:00"); // 默认 1 小时 + private Time examTime = Time.valueOf("01:00:00"); + //考试提醒 + private String warn; + //文件共享 + private String isFile; + //禁用外网 + private String isNet; + //禁止截屏 + private String isScreen; } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperScheme.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperScheme.java index 2a13f6ee..54933dd5 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperScheme.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/dataobject/EducationPaperScheme.java @@ -73,6 +73,11 @@ public class EducationPaperScheme // @Excel(name = "小计分数") private String subtotalScore; + /** + * 试卷大写题号 + */ + @TableField(exist = false) + private String upperCase; } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperMapper.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperMapper.java index 50555437..b80ebf1c 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperMapper.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/dal/mysql/paper/EducationPaperMapper.java @@ -2,6 +2,7 @@ package pc.exam.pp.module.exam.dal.mysql.paper; import java.util.List; +import java.util.Map; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -9,6 +10,7 @@ import pc.exam.pp.framework.common.pojo.PageResult; import pc.exam.pp.framework.mybatis.core.mapper.BaseMapperX; import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX; import pc.exam.pp.module.exam.controller.admin.paper.dto.EducationPaperStuDto; +import pc.exam.pp.module.exam.controller.admin.paper.dto.PaperIdAndNum; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperTaskPageVo; import pc.exam.pp.module.exam.dal.dataobject.EducationPaper; @@ -93,7 +95,7 @@ public interface EducationPaperMapper extends BaseMapperX String selectTaskIdByPaperId(String paperId); - List selectPaperByTaskId(String taskId); + List selectPaperByTaskId(String taskId); public int updateEducationByids(@Param("strings")List strings); @@ -129,5 +131,8 @@ public interface EducationPaperMapper extends BaseMapperX .eq(EducationPaper::getStatus, 0) ); } + + List selectPaperIdAndNumByTaskId(String taskId); + } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperServiceImpl.java index 6a4279da..6cfd23d7 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperServiceImpl.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperServiceImpl.java @@ -1,6 +1,10 @@ package pc.exam.pp.module.exam.service.paper; +import cn.afterturn.easypoi.word.WordExportUtil; +import com.alibaba.excel.util.StringUtils; +import jakarta.servlet.http.HttpServletResponse; +import org.apache.poi.xwpf.usermodel.*; import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -9,6 +13,9 @@ import pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils; import pc.exam.pp.framework.tenant.core.aop.TenantIgnore; import pc.exam.pp.framework.tenant.core.context.TenantContextHolder; import pc.exam.pp.module.exam.controller.admin.paper.dto.EducationPaperStuDto; +import pc.exam.pp.module.exam.controller.admin.paper.dto.PaperIdAndNum; +import pc.exam.pp.module.exam.controller.admin.paper.dto.PaperQueWordDto; +import pc.exam.pp.module.exam.controller.admin.paper.dto.PaperWordDto; import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo; import pc.exam.pp.module.exam.controller.admin.paper.vo.StuInfoPaper; @@ -18,7 +25,16 @@ import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper; import pc.exam.pp.module.exam.dal.mysql.question.SysFileMapper; import pc.exam.pp.module.exam.utils.uuid.IdUtils; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.sql.Time; import java.util.*; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; import static pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; @@ -456,6 +472,234 @@ public class EducationPaperServiceImpl implements IEducationPaperService } + @Override + public void downloadWord(String[] paperIds, HttpServletResponse response) throws Exception { + String zipFileName = "试卷.zip"; + + // 设置响应头 + response.setContentType("application/zip"); + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(zipFileName, "UTF-8")); + + try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) { + for (String paperId1 : paperIds) { + EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(paperId1); + String taskId = educationPaper.getTaskId(); + EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskId); + String taskSpecialty = educationPaperTask.getTaskSpecialty(); + EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId); + List educationPaperSchemes = educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskId); + + String[] chineseNumbers = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十"}; + + for (int i = 0; i < educationPaperSchemes.size(); i++) { + if (i < chineseNumbers.length) { + educationPaperSchemes.get(i).setUpperCase(chineseNumbers[i]); + } else { + educationPaperSchemes.get(i).setUpperCase("第" + (i + 1) + "项"); + } + } + + String wordpath = "/word/试卷.docx"; + String answerpath = "/word/参考答案.docx"; + String homeDir = System.getProperty("user.dir"); + String wordRealpath = homeDir + wordpath; + + String answerRealpath=homeDir+answerpath; + File realPath = new File(wordRealpath); + File realAnswerPath = new File(answerRealpath); + Time time = educationPaperParam.getExamTime(); + int hours = time.getHours(); + int minutes = time.getMinutes(); + int totalMinutes = hours * 60 + minutes; + + List quIds = educationPaperQuMapper.selectPaperQuByPaperId(educationPaper.getPaperId()); + List examQuestionList = examQuestionMapper.selectExamQuestionListByQuIds(quIds); + + List paperWordList = new ArrayList<>(); + + for (EducationPaperScheme educationPaperScheme : educationPaperSchemes) { + PaperWordDto paperWordDto = new PaperWordDto(); + paperWordDto.setUpperNum(educationPaperScheme.getUpperCase()); + paperWordDto.setType(educationPaperScheme.getSpName()); + paperWordDto.setScore(educationPaperScheme.getQuScores()); + paperWordDto.setTotalScore(educationPaperScheme.getSubtotalScore()); + + String type = paperWordDto.getType(); + List queList = examQuestionList.stream() + .filter(q -> type.equals(q.getSubjectName())) + .map(q -> { + PaperQueWordDto dto = new PaperQueWordDto(); + dto.setContent(q.getContent()); + if ("选择题".equals(q.getSubjectName())) { + dto.setAnswerList(q.getAnswerList()); + } + return dto; + }) + .collect(Collectors.toList()); + + paperWordDto.setQue(queList); + paperWordList.add(paperWordDto); + } + + Map params = new HashMap<>(); + params.put("paperNum", educationPaper.getNum()); + params.put("paperTime", totalMinutes); + params.put("paperScore", educationPaper.getPaperScore()); + params.put("specialty", taskSpecialty); + XWPFDocument word = WordExportUtil.exportWord07(realPath.getPath(), params); + + XWPFDocument wordAnswer = WordExportUtil.exportWord07(realAnswerPath.getPath(), params); + + + int columnCount = paperWordList.size(); + //写入表格 + XWPFTable table = word.createTable(3, 2 + columnCount); + table.getRow(0).getCell(0).setText("总 分"); + table.getRow(0).getCell(1).setText("题号"); + for (int i = 0; i < columnCount; i++) { + table.getRow(0).getCell(2 + i).setText(paperWordList.get(i).getUpperNum()); + } + table.getRow(1).getCell(0).setText("登分人"); + table.getRow(1).getCell(1).setText("题分"); + for (int i = 0; i < columnCount; i++) { + table.getRow(1).getCell(2 + i).setText(String.valueOf(paperWordList.get(i).getTotalScore())); + } + table.getRow(2).getCell(0).setText("复查人"); + table.getRow(2).getCell(1).setText("得分"); + for (int i = 0; i < columnCount; i++) { + table.getRow(2).getCell(2 + i).setText(""); + } + //写入试卷内容 + for (PaperWordDto item : paperWordList) { + String typeName = item.getType(); // 题型名,如 “单选题”、“多选题”等 + + + XWPFParagraph paragraph = word.createParagraph(); + XWPFRun run = paragraph.createRun(); + String line = item.getUpperNum() + "、" + item.getType() + + "(每小题" + item.getScore() + "分,共" + item.getTotalScore() + "分)"; + run.setText(line); + run.setFontSize(12); + run.setBold(true); + paragraph.setSpacingAfter(200); + + List que = item.getQue(); + if (que != null && !que.isEmpty()) { + Map answerMap = new LinkedHashMap<>(); // 参考答案 + int index = 1; + + + for (PaperQueWordDto paperQueWordDto : que) { + XWPFParagraph queParagraph = word.createParagraph(); + XWPFRun queRun = queParagraph.createRun(); + String rawContent = paperQueWordDto.getContent(); + String plainText = rawContent.replaceAll("<[^>]*>", ""); + String content = index + "、" + plainText; + + queRun.setText(content); + queRun.setFontSize(11); + queParagraph.setSpacingAfter(100); + + List answerList = paperQueWordDto.getAnswerList(); + //写入选择题选项 + if (answerList != null && !answerList.isEmpty()) { + char option = 'A'; + StringBuilder correctOptions = new StringBuilder(); + for (ExamQuestionAnswer examQuestionAnswer : answerList) { + XWPFParagraph optionParagraph = word.createParagraph(); + XWPFRun optionRun = optionParagraph.createRun(); + String optionContent = option + ". " + examQuestionAnswer.getContent(); + optionRun.setText(optionContent); + optionRun.setFontSize(10); + optionParagraph.setSpacingAfter(50); + + if ("0".equals(examQuestionAnswer.getIsRight())) { + correctOptions.append(option); + } + + option++; + } + // 添加到对应题型的答案集中 + answerMap + .computeIfAbsent(typeName, k -> new StringBuilder()) + .append(index).append("、").append(correctOptions).append("\n"); + + + } + index++; + } + if (!answerMap.isEmpty()) { + XWPFParagraph answerTitlePara = wordAnswer.createParagraph(); + XWPFRun titleRun = answerTitlePara.createRun(); + titleRun.setText("参考答案:"); + titleRun.setBold(true); + titleRun.setFontSize(12); + answerTitlePara.setSpacingAfter(200); + + for (Map.Entry entry : answerMap.entrySet()) { + String type = entry.getKey(); + StringBuilder answers = entry.getValue(); + + // 写题型标题 + XWPFParagraph typePara = wordAnswer.createParagraph(); + XWPFRun typeRun = typePara.createRun(); + typeRun.setText(type); // 如:单选题、多选题 + typeRun.setBold(true); + typeRun.setFontSize(11); + typePara.setSpacingAfter(100); + + // 写具体答案,按行写入,每行一个段落 + String[] lines = answers.toString().split("\n"); + for (String li : lines) { + XWPFParagraph para = wordAnswer.createParagraph(); + XWPFRun runanswer = para.createRun(); + runanswer.setText(li); + runanswer.setFontSize(11); + } + } + + + } + } + + + } + // 写试卷 Word + ByteArrayOutputStream wordOut = new ByteArrayOutputStream(); + word.write(wordOut); + String paperNo = educationPaper.getNum(); + String entryName = paperNo + "/试卷.docx"; + // 写入 Zip 中:每份 Word 为压缩包中的一个文件 + ZipEntry zipEntry = new ZipEntry(entryName); + zipOut.putNextEntry(zipEntry); + zipOut.write(wordOut.toByteArray()); + zipOut.closeEntry(); + + + // 写答案 Word + ByteArrayOutputStream answerOut = new ByteArrayOutputStream(); + wordAnswer.write(answerOut); + String answerEntryName = paperNo + "/参考答案.docx"; + ZipEntry answerEntry = new ZipEntry(answerEntryName); + zipOut.putNextEntry(answerEntry); + zipOut.write(answerOut.toByteArray()); + zipOut.closeEntry(); + } + + zipOut.flush(); + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("错误:" + e.getMessage()); + } + } + + + @Override + public List selectPaperIdAndNumByTaskId(String taskId) { + return educationPaperMapper.selectPaperIdAndNumByTaskId(taskId); + } + } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperTaskServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperTaskServiceImpl.java index 9bd687db..93fee8d8 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperTaskServiceImpl.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/EducationPaperTaskServiceImpl.java @@ -140,6 +140,10 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService educationPaperParam.setUploadTime("5"); educationPaperParam.setIsDel("0"); educationPaperParam.setIsSession("1"); + educationPaperParam.setIsFile("1"); + educationPaperParam.setIsNet("1"); + educationPaperParam.setIsScreen("1"); + educationPaperParam.setIsContent("1"); if ("1".equals(educationPaperTask.getTaskType())){ educationPaperParam.setIsRepeat("1"); educationPaperParam.setIsAnswer("1"); diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperService.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperService.java index 11429965..72b587b5 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperService.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/paper/IEducationPaperService.java @@ -1,14 +1,18 @@ package pc.exam.pp.module.exam.service.paper; +import jakarta.servlet.http.HttpServletResponse; import pc.exam.pp.framework.common.pojo.PageResult; import pc.exam.pp.module.exam.controller.admin.paper.dto.EducationPaperStuDto; +import pc.exam.pp.module.exam.controller.admin.paper.dto.PaperIdAndNum; import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo; import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo; import pc.exam.pp.module.exam.dal.dataobject.PaperListResponseVo; import pc.exam.pp.module.exam.dal.dataobject.EducationPaper; +import java.io.UnsupportedEncodingException; import java.util.List; +import java.util.Map; /** * 试卷Service接口 @@ -92,5 +96,11 @@ public interface IEducationPaperService PageResult selectStuEducationPaperList(PaperPageVo paperPageVo); ExamPaperVo stuInfoPaper(String taskid); + + void downloadWord(String[] paperIds, HttpServletResponse response) throws Exception; + + + List selectPaperIdAndNumByTaskId(String taskId); + } diff --git a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java index 3d74924b..b02dfc69 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java +++ b/exam-module-exam/exam-module-exam-biz/src/main/java/pc/exam/pp/module/exam/service/question/ExamQuestionServiceImpl.java @@ -731,7 +731,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService } examQuestionAnswer.setContent(content); examQuestionAnswerList.add(examQuestionAnswer); - // TODO: 保存到集合或数据库 + } System.out.println(examQuestionAnswerList); diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperMapper.xml index 8babb58f..18d98098 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperMapper.xml +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperMapper.xml @@ -21,6 +21,11 @@ + + + + + @@ -119,6 +124,9 @@ select task_id from education_paper where paper_id=#{paperId} + diff --git a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperParamMapper.xml b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperParamMapper.xml index 548212df..fdb1b247 100644 --- a/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperParamMapper.xml +++ b/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/exam/EducationPaperParamMapper.xml @@ -15,11 +15,8 @@ - - - @@ -28,10 +25,16 @@ + + + + + + - select param_id, task_id, is_number,is_content,is_answer_id,is_exam_password, exam_password, usb, save_grades, driver, directory, upload_time, is_time,exam_time,is_del,is_repeat ,is_answer,is_look,is_connect,is_session from education_paper_param + select param_id, task_id, is_number,is_content,is_answer_id,is_exam_password, exam_password, usb, save_grades, driver, directory, upload_time, is_time,exam_time,is_del,is_repeat ,is_answer,is_look,is_connect,is_session,warn,is_file,is_net,is_screen from education_paper_param diff --git a/word/参考答案.docx b/word/参考答案.docx new file mode 100644 index 00000000..86d3d50a Binary files /dev/null and b/word/参考答案.docx differ diff --git a/word/试卷.docx b/word/试卷.docx new file mode 100644 index 00000000..b4cd5fd0 Binary files /dev/null and b/word/试卷.docx differ