Accept Merge Request #84: (hyc -> master)
Merge Request: 【修改】生成笔试试卷和试卷答案后端 Created By: @华允传 Accepted By: @华允传 URL: https://g-iswv8783.coding.net/p/education/d/pengchen-exam-java/git/merge/84?initial=true
This commit is contained in:
@@ -127,7 +127,61 @@
|
||||
<groupId>org.apache.tika</groupId>
|
||||
<artifactId>tika-core</artifactId> <!-- 文件客户端:文件类型的识别 -->
|
||||
</dependency>
|
||||
<!-- Apache POI 相关 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>ooxml-schemas</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-base</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>ooxml-schemas</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-imaging</artifactId>
|
||||
<version>1.0-alpha3</version> <!-- 使用最新版本 -->
|
||||
</dependency>
|
||||
<!-- Adobe 官方 XMPCore 库 -->
|
||||
<dependency>
|
||||
<groupId>com.adobe.xmp</groupId>
|
||||
<artifactId>xmpcore</artifactId>
|
||||
<version>6.1.11</version> <!-- 最新稳定版 -->
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -38,13 +38,8 @@ public class EducationPaperTaskController
|
||||
@GetMapping("/list")
|
||||
public CommonResult<PageResult<EducationPaperTask>> list(PaperTaskPageVo educationPaperTask)
|
||||
{
|
||||
|
||||
PageResult<EducationPaperTask> pageResult = educationPaperTaskService.selectEducationPaperTaskList(educationPaperTask);
|
||||
|
||||
|
||||
|
||||
return CommonResult.success(BeanUtils.toBean(pageResult, EducationPaperTask.class));
|
||||
|
||||
}
|
||||
/**
|
||||
* 查询试卷任务列表(学生端)
|
||||
|
@@ -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;
|
||||
}
|
@@ -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<ExamQuestionAnswer> answerList;
|
||||
|
||||
}
|
@@ -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<PaperQueWordDto> que;
|
||||
}
|
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
|
||||
}
|
||||
|
@@ -73,6 +73,11 @@ public class EducationPaperScheme
|
||||
// @Excel(name = "小计分数")
|
||||
private String subtotalScore;
|
||||
|
||||
/**
|
||||
* 试卷大写题号
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String upperCase;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -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<EducationPaper>
|
||||
|
||||
String selectTaskIdByPaperId(String paperId);
|
||||
|
||||
List<String> selectPaperByTaskId(String taskId);
|
||||
List<String> selectPaperByTaskId(String taskId);
|
||||
|
||||
public int updateEducationByids(@Param("strings")List<String> strings);
|
||||
|
||||
@@ -129,5 +131,8 @@ public interface EducationPaperMapper extends BaseMapperX<EducationPaper>
|
||||
.eq(EducationPaper::getStatus, 0)
|
||||
);
|
||||
}
|
||||
|
||||
List<PaperIdAndNum> selectPaperIdAndNumByTaskId(String taskId);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -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<EducationPaperScheme> 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<String> quIds = educationPaperQuMapper.selectPaperQuByPaperId(educationPaper.getPaperId());
|
||||
List<ExamQuestion> examQuestionList = examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
|
||||
List<PaperWordDto> 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<PaperQueWordDto> 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<String, Object> 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<PaperQueWordDto> que = item.getQue();
|
||||
if (que != null && !que.isEmpty()) {
|
||||
Map<String, StringBuilder> 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<ExamQuestionAnswer> 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<String, StringBuilder> 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<PaperIdAndNum> selectPaperIdAndNumByTaskId(String taskId) {
|
||||
return educationPaperMapper.selectPaperIdAndNumByTaskId(taskId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -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");
|
||||
|
@@ -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<EducationPaperStuDto> selectStuEducationPaperList(PaperPageVo paperPageVo);
|
||||
|
||||
ExamPaperVo stuInfoPaper(String taskid);
|
||||
|
||||
void downloadWord(String[] paperIds, HttpServletResponse response) throws Exception;
|
||||
|
||||
|
||||
List<PaperIdAndNum> selectPaperIdAndNumByTaskId(String taskId);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -731,7 +731,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
|
||||
}
|
||||
examQuestionAnswer.setContent(content);
|
||||
examQuestionAnswerList.add(examQuestionAnswer);
|
||||
// TODO: 保存到集合或数据库
|
||||
|
||||
}
|
||||
|
||||
System.out.println(examQuestionAnswerList);
|
||||
|
@@ -21,6 +21,11 @@
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="EducationPaper" id="PaperIdAndNumResult">
|
||||
<result property="paperId" column="paper_id" />
|
||||
<result property="num" column="num" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="ExamQuestion" id="ExamQuestionResult">
|
||||
<result property="quId" column="qu_id" />
|
||||
@@ -119,6 +124,9 @@ select task_id from education_paper where paper_id=#{paperId}
|
||||
<select id="selectCountPaperList" resultType="java.lang.Integer">
|
||||
select count(*) from education_paper
|
||||
</select>
|
||||
<select id="selectPaperIdAndNumByTaskId" resultMap="PaperIdAndNumResult">
|
||||
select paper_id ,num from education_paper where task_id=#{taskId} and deleted ='0'
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertEducationPaper" parameterType="EducationPaper">
|
||||
|
@@ -15,11 +15,8 @@
|
||||
<result property="usb" column="usb" />
|
||||
<result property="saveGrades" column="save_grades" />
|
||||
<result property="driver" column="driver" />
|
||||
|
||||
<result property="isTime" column="is_time" />
|
||||
<result property="examTime" column="exam_time" />
|
||||
|
||||
|
||||
<result property="directory" column="directory" />
|
||||
<result property="uploadTime" column="upload_time" />
|
||||
<result property="isDel" column="is_del" />
|
||||
@@ -28,10 +25,16 @@
|
||||
<result property="isLook" column="is_look" />
|
||||
<result property="isConnect" column="is_connect" />
|
||||
<result property="isSession" column="is_session" />
|
||||
<result property="warn" column="warn" />
|
||||
<result property="isFile" column="is_file" />
|
||||
<result property="isNet" column="is_net" />
|
||||
<result property="isScreen" column="is_screen" />
|
||||
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEducationPaperParamVo">
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="selectEducationPaperParamList" parameterType="EducationPaperParam" resultMap="EducationPaperParamResult">
|
||||
@@ -81,7 +84,10 @@
|
||||
<if test="isLook != null">is_look,</if>
|
||||
<if test="isConnect != null">is_connect,</if>
|
||||
<if test="isSession != null">is_session,</if>
|
||||
|
||||
<if test="warn != null">warn,</if>
|
||||
<if test="isFile != null">is_file,</if>
|
||||
<if test="isNet != null">is_net,</if>
|
||||
<if test="isScreen != null">is_screen,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="paramId != null">#{paramId},</if>
|
||||
@@ -98,14 +104,16 @@
|
||||
<if test="uploadTime != null">#{uploadTime},</if>
|
||||
<if test="isTime != null">#{isTime},</if>
|
||||
<if test="examTime != null">#{examTime},</if>
|
||||
|
||||
<if test="isDel != null">#{isDel},</if>
|
||||
<if test="isRepeat != null">#{isRepeat},</if>
|
||||
<if test="isAnswer != null">#{isAnswer},</if>
|
||||
<if test="isLook != null">#{isLook},</if>
|
||||
<if test="isConnect != null">#{isConnect},</if>
|
||||
<if test="isSession != null">#{isSession},</if>
|
||||
|
||||
<if test="warn != null">#{warn},</if>
|
||||
<if test="isFile != null">#{isFile},</if>
|
||||
<if test="isNet != null">#{isNet},</if>
|
||||
<if test="isScreen != null">#{isScreen},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -131,6 +139,10 @@
|
||||
<if test="isLook != null">is_look = #{isLook},</if>
|
||||
<if test="isConnect != null">is_connect = #{isConnect},</if>
|
||||
<if test="isSession != null">is_session = #{isSession},</if>
|
||||
<if test="warn != null">warn = #{warn},</if>
|
||||
<if test="isFile != null">is_file = #{isFile},</if>
|
||||
<if test="isNet != null">is_net = #{isNet},</if>
|
||||
<if test="isScreen != null">is_screen = #{isScreen},</if>
|
||||
|
||||
</trim>
|
||||
where param_id = #{paramId}
|
||||
|
@@ -42,7 +42,7 @@
|
||||
where scheme_id = #{schemeId}
|
||||
</select>
|
||||
<select id="selectEducationPaperTaskByTaskId" resultMap="EducationPaperSchemeResult">
|
||||
select * from education_paper_scheme where task_id =#{taskid}
|
||||
select * from education_paper_scheme where task_id =#{taskid} order by sort asc
|
||||
</select>
|
||||
|
||||
<insert id="insertEducationPaperScheme" parameterType="EducationPaperScheme">
|
||||
|
BIN
word/参考答案.docx
Normal file
BIN
word/参考答案.docx
Normal file
Binary file not shown.
BIN
word/试卷.docx
Normal file
BIN
word/试卷.docx
Normal file
Binary file not shown.
Reference in New Issue
Block a user