【修改】笔试试卷 表格格式,返回试卷sort顺序等
This commit is contained in:
@@ -128,6 +128,7 @@
|
||||
<artifactId>tika-core</artifactId> <!-- 文件客户端:文件类型的识别 -->
|
||||
</dependency>
|
||||
<!-- Apache POI 相关 -->
|
||||
<!-- Apache POI 核心 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
@@ -141,9 +142,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>ooxml-schemas</artifactId>
|
||||
<version>1.4</version>
|
||||
<groupId>org.apache.xmlbeans</groupId>
|
||||
<artifactId>xmlbeans</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -154,7 +155,6 @@
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
|
@@ -0,0 +1,7 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.exception;
|
||||
|
||||
public class BizException extends RuntimeException {
|
||||
public BizException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@@ -1,9 +1,9 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.paper;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import pc.exam.pp.framework.common.pojo.CommonResult;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.ChangePaperQuVo;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperQu;
|
||||
import pc.exam.pp.module.exam.service.paper.IEducationPaperQuService;
|
||||
|
||||
@@ -88,8 +88,37 @@ public class EducationPaperQuController
|
||||
{
|
||||
return CommonResult.success(educationPaperQuService.selectPaperQuListByPaperId(paperId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 中心端 点击编辑 根据id获取试卷
|
||||
*/
|
||||
@GetMapping(value = "/getPaperCenter")
|
||||
public CommonResult getPaperCenter(@RequestParam(value = "paperId") String paperId)
|
||||
{
|
||||
return CommonResult.success(educationPaperQuService.selectPaperQuListByPaperIdCenter(paperId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更换试卷试题
|
||||
* @param changePaperQuVo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/changePaperQu")
|
||||
public CommonResult changePaperQu(@RequestBody ChangePaperQuVo changePaperQuVo)
|
||||
{
|
||||
return CommonResult.success(educationPaperQuService.changePaperQu(changePaperQuVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机更换试卷试题
|
||||
* @param changePaperQuVo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/changePaperQuRandom")
|
||||
public CommonResult changePaperQuRandom(@RequestBody ChangePaperQuVo changePaperQuVo)
|
||||
{
|
||||
return CommonResult.success(educationPaperQuService.changePaperQuRandom(changePaperQuVo));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -174,8 +174,8 @@ public class EducationPaperTaskController
|
||||
return CommonResult.success("复制成功");
|
||||
}
|
||||
|
||||
@PutMapping("/updateTaskStatus") // 更符合RESTful规范
|
||||
public CommonResult<Boolean> updateTaskStatus(@RequestBody StatusDto statusDto) { // 改为Integer类型
|
||||
@PutMapping("/updateTaskStatus")
|
||||
public CommonResult<Boolean> updateTaskStatus(@RequestBody StatusDto statusDto) {
|
||||
return CommonResult.success(
|
||||
educationPaperTaskService.changeStatus(statusDto.getTaskId(), statusDto.getStatus())
|
||||
);
|
||||
|
@@ -0,0 +1,15 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.paper.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ChangePaperQuVo {
|
||||
private String paperId;
|
||||
private String newQuId;
|
||||
private String oldQuId;
|
||||
private String subjectName;
|
||||
}
|
@@ -3,31 +3,32 @@ package pc.exam.pp.module.exam.controller.admin.paper.vo;
|
||||
import lombok.Data;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperParam;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperSession;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
|
||||
import java.util.List;
|
||||
@Data
|
||||
public class ExamPaperVo {
|
||||
String paperId;
|
||||
List<ExamQuestion> questionList;
|
||||
List<ExamQuestion> examQuestionList;
|
||||
List<EducationPaperScheme> educationPaperSchemeList;
|
||||
EducationPaperParam educationPaperParam;
|
||||
|
||||
EducationPaperSession educationPaperSession;
|
||||
StuInfoPaper stuInfoPaper;
|
||||
public ExamPaperVo() {
|
||||
}
|
||||
|
||||
public ExamPaperVo(List<ExamQuestion> examQuestionList, List<EducationPaperScheme> educationPaperSchemeList) {
|
||||
this.questionList = examQuestionList;
|
||||
this.examQuestionList = examQuestionList;
|
||||
this.educationPaperSchemeList = educationPaperSchemeList;
|
||||
}
|
||||
|
||||
public List<ExamQuestion> getExamQuestionList() {
|
||||
return questionList;
|
||||
return examQuestionList;
|
||||
}
|
||||
|
||||
public void setExamQuestionList(List<ExamQuestion> examQuestionList) {
|
||||
this.questionList = examQuestionList;
|
||||
this.examQuestionList = examQuestionList;
|
||||
}
|
||||
|
||||
public List<EducationPaperScheme> getEducationPaperSchemeList() {
|
||||
|
@@ -42,6 +42,9 @@ public class ExamPersonVo {
|
||||
@Min(value = 1, message = "每页条数最小值为 1")
|
||||
@Max(value = 100, message = "每页条数最大值为 100")
|
||||
private Integer pageSize = PAGE_SIZE;
|
||||
|
||||
private Integer offset;
|
||||
|
||||
public Integer getOffset() {
|
||||
return (this.pageNo - 1) * this.pageSize;
|
||||
}
|
||||
|
@@ -72,6 +72,9 @@ public class SessionStuPageReqVO {
|
||||
@Min(value = 1, message = "每页条数最小值为 1")
|
||||
@Max(value = 100, message = "每页条数最大值为 100")
|
||||
private Integer pageSize = PAGE_SIZE;
|
||||
|
||||
private Integer offset;
|
||||
|
||||
public Integer getOffset() {
|
||||
return (this.pageNo - 1) * this.pageSize;
|
||||
}
|
||||
|
@@ -20,7 +20,9 @@ import pc.exam.pp.framework.common.pojo.CommonResult;
|
||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.framework.excel.core.util.ExcelUtils;
|
||||
import pc.exam.pp.framework.tenant.core.aop.TenantIgnore;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.dto.StatusDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.dto.ExamQuestionDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.dto.QuStatusDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.vo.QueImportRespVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.question.vo.QuemportExcelVO;
|
||||
@@ -57,7 +59,7 @@ public class ExamQuestionController
|
||||
private IExamQuestionService examQuestionService;
|
||||
|
||||
/**
|
||||
* 查询试题(hyc)列表
|
||||
* 查询试题(hyc)列表 ,不带答案
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('system:question:list')")
|
||||
@GetMapping("/list")
|
||||
@@ -66,7 +68,12 @@ public class ExamQuestionController
|
||||
PageResult<ExamQuestion> pageResult = examQuestionService.selectExamQuestionList(questionVo);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/listAnswer")
|
||||
public CommonResult<PageResult<ExamQuestion>> listAnswer(QuestionVo questionVo)
|
||||
{
|
||||
PageResult<ExamQuestion> pageResult = examQuestionService.selectExamQuestionListAnswer(questionVo);
|
||||
return success(pageResult);
|
||||
}
|
||||
/**
|
||||
* 查询除了审核状态通过的其他状态的试题(试题推送)
|
||||
* @param questionVo
|
||||
@@ -260,4 +267,21 @@ public class ExamQuestionController
|
||||
return error(QESESTION_AUDIT_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改试题状态
|
||||
* @param quStatusDto
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/updateQuStatus")
|
||||
public CommonResult<Boolean> updateQuStatus(@RequestBody QuStatusDto quStatusDto) {
|
||||
return CommonResult.success(
|
||||
examQuestionService.changeStatus(quStatusDto.getQuId(), quStatusDto.getStatus())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,13 @@
|
||||
package pc.exam.pp.module.exam.controller.admin.question.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class QuStatusDto {
|
||||
private String quId;
|
||||
private String status;
|
||||
}
|
@@ -13,6 +13,8 @@ import pc.exam.pp.framework.common.pojo.PageParam;
|
||||
public class QuestionVo extends PageParam {
|
||||
|
||||
|
||||
private String quId;
|
||||
|
||||
private String subjectName;
|
||||
|
||||
private String quLevel;
|
||||
|
@@ -31,7 +31,7 @@ public class EducationPaperQu
|
||||
|
||||
/** 试题版本 */
|
||||
// @Excel(name = "试题版本")
|
||||
private String sort;
|
||||
private Integer sort;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -60,7 +60,7 @@ public class EducationPaperScheme
|
||||
// @Excel(name = "每题分数")
|
||||
private String quScores;
|
||||
|
||||
private String sort;
|
||||
private Integer sort;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> keyword;
|
||||
|
@@ -63,13 +63,13 @@ public class ExamQuestionAnswer
|
||||
|
||||
/** 排序 */
|
||||
// @Excel(name = "排序")
|
||||
private String sort;
|
||||
private Integer sort;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
|
||||
private List<ExamMysqlKeyword> examMysqlKeywordList;
|
||||
|
||||
public ExamQuestionAnswer(String answerId, String quId, String isRight, String image, String content, String contentIn, String scoreRate, String sort) {
|
||||
public ExamQuestionAnswer(String answerId, String quId, String isRight, String image, String content, String contentIn, String scoreRate, Integer sort) {
|
||||
this.answerId = answerId;
|
||||
this.quId = quId;
|
||||
this.isRight = isRight;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package pc.exam.pp.module.exam.dal.mysql.paper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.ChangePaperQuVo;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperQu;
|
||||
|
||||
import java.util.List;
|
||||
@@ -71,5 +72,10 @@ public interface EducationPaperQuMapper
|
||||
|
||||
List<EducationPaperQu> selectPaperQuListByPaperId(String paperId);
|
||||
|
||||
boolean changePaperQu(ChangePaperQuVo changePaperQuVo);
|
||||
|
||||
String selectRamdomQuId(ChangePaperQuVo changePaperQuVo);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -40,6 +40,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
*/
|
||||
default PageResult<ExamQuestion> selectExamQuestionList(QuestionVo questionVo) {
|
||||
return selectPage(questionVo, new LambdaQueryWrapperX<ExamQuestion>()
|
||||
.likeIfPresent(ExamQuestion::getQuId,questionVo.getQuId())
|
||||
.likeIfPresent(ExamQuestion::getQuLevel, questionVo.getQuLevel())
|
||||
.likeIfPresent(ExamQuestion::getCourseName , questionVo.getCourseName())
|
||||
.likeIfPresent(ExamQuestion::getPointNames , questionVo.getPointNames())
|
||||
@@ -138,5 +139,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
|
||||
void insertOrUpdateList(List<ExamQuestion> examQuestions);
|
||||
|
||||
|
||||
boolean changeStatus(@Param("quId") String quId
|
||||
,@Param("status") String status);
|
||||
|
||||
}
|
||||
|
@@ -185,13 +185,22 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
System.out.println("是否在允许入场时间段内:" + isWithinEntryTime);
|
||||
|
||||
if (isWithinEntryTime){
|
||||
long remainingSeconds = ChronoUnit.SECONDS.between(LocalDateTime.now(),
|
||||
DateUtil.toLocalDateTime(endTime));
|
||||
info.setRemainingTime(remainingSeconds > 0 ? remainingSeconds : 0);
|
||||
// 1. 计算剩余时间(秒)
|
||||
long remainingSeconds = ChronoUnit.SECONDS.between(LocalDateTime.now(), DateUtil.toLocalDateTime(endTime));
|
||||
remainingSeconds = Math.max(remainingSeconds, 0); // 防止负数
|
||||
|
||||
//判分后删除
|
||||
// 2. 获取测评时长(examTime 是 java.sql.Time)并转换为秒
|
||||
long examDurationSeconds = examTime.toLocalTime().toSecondOfDay(); // 将 HH:mm:ss 转为秒数
|
||||
|
||||
// 3. 规则判断:如果 remainingSeconds > examTime,则限制最大值为 examTime
|
||||
long finalRemaining = Math.min(remainingSeconds, examDurationSeconds);
|
||||
|
||||
// 4. 设置和返回
|
||||
info.setRemainingTime(finalRemaining);
|
||||
|
||||
// 判分后更新记录
|
||||
monitorMapper.updateById(info);
|
||||
return remainingSeconds > 0 ? remainingSeconds : 0;
|
||||
return finalRemaining;
|
||||
}else {
|
||||
return 0;
|
||||
}
|
||||
|
@@ -96,6 +96,7 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
|
||||
|
||||
@Override
|
||||
public PageResult<PersonRepDto> selectEducationPaperPersonBySessionId(ExamPersonVo examPersonVo) {
|
||||
examPersonVo.setOffset(examPersonVo.getOffset());
|
||||
List<EducationPaperPerson> educationPaperPeoples= educationPaperPersonMapper.selectEducationPaperPersonBySessionId(examPersonVo);
|
||||
long total= educationPaperPersonMapper.selectEducationPaperPersonBySessionIdTotal(examPersonVo.getSessionId());
|
||||
List<PersonRepDto> personRepDtos=new ArrayList<>();
|
||||
@@ -130,10 +131,12 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
|
||||
long total;
|
||||
String sessionId = sessionStuPageReqVO.getSessionId();
|
||||
if (StringUtils.isNotBlank(sessionId)){
|
||||
sessionStuPageReqVO.setOffset(sessionStuPageReqVO.getOffset());
|
||||
personRepDtos = educationPaperPersonMapper.selectEducationPaperPersonByNotInSessionId(sessionStuPageReqVO);
|
||||
total=educationPaperPersonMapper.selectEducationPaperPersonByNotInSessionIdTotal(sessionStuPageReqVO);
|
||||
}
|
||||
else {
|
||||
sessionStuPageReqVO.setOffset(sessionStuPageReqVO.getOffset());
|
||||
personRepDtos = educationPaperPersonMapper.selectEducationPaperPersonBySessionIdNotIn(sessionStuPageReqVO);
|
||||
total=educationPaperPersonMapper.selectEducationPaperPersonBySessionIdNotInTotal(sessionStuPageReqVO);
|
||||
|
||||
|
@@ -4,14 +4,21 @@ import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.ChangePaperQuVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.StuInfoPaper;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.*;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.*;
|
||||
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.service.question.IExamQuestionService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 试卷试题Service业务层处理
|
||||
@@ -40,6 +47,8 @@ public class EducationPaperQuServiceImpl implements IEducationPaperQuService
|
||||
private SysFileMapper sysFileMapper;
|
||||
@Autowired
|
||||
private EducationPaperTaskMapper educationPaperTaskMapper;
|
||||
@Autowired
|
||||
private IExamQuestionService examQuestionService;
|
||||
/**
|
||||
* 查询试卷试题
|
||||
*
|
||||
@@ -114,17 +123,30 @@ public class EducationPaperQuServiceImpl implements IEducationPaperQuService
|
||||
|
||||
@Override
|
||||
public ExamPaperVo selectPaperQuListByPaperId(String paperId) {
|
||||
System.out.println(paperId);
|
||||
List<String> quIds =educationPaperQuMapper.selectPaperQuByPaperId(paperId);
|
||||
List<ExamQuestion> examQuestionList=examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
List<ExamQuestion> examQuestionList=new ArrayList<>();
|
||||
|
||||
if (quIds!=null&&quIds.size()>0){
|
||||
examQuestionList =examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
if (examQuestionList!=null&&examQuestionList.size()>0){
|
||||
|
||||
// 根据 quIds 顺序重新排序 examQuestionList
|
||||
Map<String, ExamQuestion> questionMap = examQuestionList.stream()
|
||||
.collect(Collectors.toMap(ExamQuestion::getQuId, Function.identity()));
|
||||
examQuestionList = quIds.stream()
|
||||
.map(questionMap::get)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (ExamQuestion examQuestion : examQuestionList) {
|
||||
//查找原始和素材试题文件
|
||||
List<SysFileUpload> sysFileUploads =sysFileMapper.selectSysFileByQuidIN(examQuestion.getQuId());
|
||||
examQuestion.setFileUploads(sysFileUploads);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
String taskid=educationPaperMapper.selectTaskIdByPaperId(paperId);
|
||||
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskid);
|
||||
List<EducationPaperScheme> educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskid);
|
||||
@@ -143,7 +165,12 @@ public class EducationPaperQuServiceImpl implements IEducationPaperQuService
|
||||
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(paperId);
|
||||
EducationPaperPerson educationPaperPerson = educationPaperPersonMapper.selectByTaskIdAndPersonId(taskid, String.valueOf(userId));
|
||||
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskid);
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
|
||||
if (educationPaperPerson!=null){
|
||||
String sessionId = educationPaperPerson.getSessionId();
|
||||
EducationPaperSession educationPaperSession = educationPaperSessionMapper.selectEducationPaperSessionBySessionId(sessionId);
|
||||
examPaperVo.setEducationPaperSession(educationPaperSession);
|
||||
stuInfoPaper.setBatch(educationPaperPerson.getBatch());
|
||||
}
|
||||
Long loginTenantId = SecurityFrameworkUtils.getLoginTenantId();
|
||||
@@ -155,7 +182,6 @@ public class EducationPaperQuServiceImpl implements IEducationPaperQuService
|
||||
stuInfoPaper.setUserName(SecurityFrameworkUtils.getLoginUserName());
|
||||
stuInfoPaper.setSfz(SecurityFrameworkUtils.getLoginUserSFZ());
|
||||
stuInfoPaper.setSex(SecurityFrameworkUtils.getLoginUserSEX());
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
examPaperVo.setPaperId(paperId);
|
||||
examPaperVo.setExamQuestionList(examQuestionList);
|
||||
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
|
||||
@@ -164,5 +190,71 @@ public class EducationPaperQuServiceImpl implements IEducationPaperQuService
|
||||
|
||||
return examPaperVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean changePaperQu(ChangePaperQuVo changePaperQuVo) {
|
||||
return educationPaperQuMapper.changePaperQu(changePaperQuVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean changePaperQuRandom(ChangePaperQuVo changePaperQuVo) {
|
||||
//根据 试卷id 随机查找不在此时卷的 试题id
|
||||
String quId= educationPaperQuMapper.selectRamdomQuId(changePaperQuVo);
|
||||
|
||||
if (quId!=null){
|
||||
changePaperQuVo.setNewQuId(quId);
|
||||
educationPaperQuMapper.changePaperQu(changePaperQuVo);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExamPaperVo selectPaperQuListByPaperIdCenter(String paperId) {
|
||||
System.out.println(paperId);
|
||||
List<String> quIds =educationPaperQuMapper.selectPaperQuByPaperId(paperId);
|
||||
List<ExamQuestion> examQuestionList=new ArrayList<>();
|
||||
if (quIds != null && !quIds.isEmpty()) {
|
||||
examQuestionList = examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
// 按 quIds 顺序重建 examQuestionList
|
||||
if (examQuestionList != null && !examQuestionList.isEmpty()) {
|
||||
// 查询得到 map 方便按 id 查找
|
||||
Map<String, ExamQuestion> questionMap = examQuestionList.stream()
|
||||
.collect(Collectors.toMap(ExamQuestion::getQuId, Function.identity()));
|
||||
|
||||
// 先对所有题目做完整信息更新和知识点设置
|
||||
for (String quId : quIds) {
|
||||
ExamQuestion examQuestion = questionMap.get(quId);
|
||||
if (examQuestion == null) continue;
|
||||
|
||||
if ("编程题".equals(examQuestion.getSubjectName())) {
|
||||
ExamQuestion fullExamQuestion = examQuestionService.selectExamQuestionByQuId(examQuestion.getQuId());
|
||||
questionMap.put(quId, fullExamQuestion);
|
||||
}
|
||||
|
||||
if ("程序设计".equals(examQuestion.getSubjectName())) {
|
||||
List<ExamQuestionAnswer> answerList = examQuestionService.getPointById(examQuestion.getQuId());
|
||||
examQuestion.setAnswerList(answerList);
|
||||
}
|
||||
}
|
||||
|
||||
// 按 quIds 顺序重建 examQuestionList
|
||||
examQuestionList = quIds.stream()
|
||||
.map(questionMap::get)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String taskid=educationPaperMapper.selectTaskIdByPaperId(paperId);
|
||||
List<EducationPaperScheme> educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskid);
|
||||
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
examPaperVo.setPaperId(paperId);
|
||||
examPaperVo.setExamQuestionList(examQuestionList);
|
||||
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
|
||||
|
||||
return examPaperVo;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,8 +4,18 @@ 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.util.Units;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.nodes.Node;
|
||||
import org.jsoup.nodes.TextNode;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
@@ -25,13 +35,13 @@ 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.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.sql.Time;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
@@ -56,6 +66,8 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
@Autowired
|
||||
private EducationPaperTaskMapper educationPaperTaskMapper;
|
||||
|
||||
@Autowired
|
||||
private EducationPaperSessionMapper educationPaperSessionMapper;
|
||||
@Autowired
|
||||
private EducationPaperQuMapper educationPaperQuMapper;
|
||||
|
||||
@@ -215,7 +227,7 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
EducationPaperQu educationPaperQu=new EducationPaperQu();
|
||||
educationPaperQu.setPaperId(uuid);
|
||||
educationPaperQu.setQuId(examQuestionId);
|
||||
educationPaperQu.setSort(String.valueOf(sort++));
|
||||
educationPaperQu.setSort(sort++);
|
||||
educationPaperQus.add(educationPaperQu);
|
||||
}
|
||||
educationPaperQuMapper.insertEducationPaperQuList(educationPaperQus);
|
||||
@@ -421,24 +433,43 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
EducationPaperQu educationPaperQu=new EducationPaperQu();
|
||||
educationPaperQu.setPaperId(uuid);
|
||||
educationPaperQu.setQuId(examQuestionId);
|
||||
educationPaperQu.setSort(String.valueOf(sort++));
|
||||
educationPaperQu.setSort(sort++);
|
||||
educationPaperQus.add(educationPaperQu);
|
||||
}
|
||||
educationPaperQuMapper.insertEducationPaperQuList(educationPaperQus);
|
||||
}
|
||||
|
||||
List<String> quIds =educationPaperQuMapper.selectPaperQuByPaperId(uuid);
|
||||
List<ExamQuestion> examQuestionList=examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
// List<ExamQuestion> examQuestionList=examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
// if (examQuestionList!=null&&examQuestionList.size()>0){
|
||||
// for (ExamQuestion examQuestion : examQuestionList) {
|
||||
// //查找原始和素材试题文件
|
||||
// List<SysFileUpload> sysFileUploads =sysFileMapper.selectSysFileByQuidIN(examQuestion.getQuId());
|
||||
// examQuestion.setFileUploads(sysFileUploads);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
List<ExamQuestion> examQuestionList=new ArrayList<>();
|
||||
|
||||
if (quIds!=null&&quIds.size()>0){
|
||||
examQuestionList =examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
if (examQuestionList!=null&&examQuestionList.size()>0){
|
||||
|
||||
// 根据 quIds 顺序重新排序 examQuestionList
|
||||
Map<String, ExamQuestion> questionMap = examQuestionList.stream()
|
||||
.collect(Collectors.toMap(ExamQuestion::getQuId, Function.identity()));
|
||||
examQuestionList = quIds.stream()
|
||||
.map(questionMap::get)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (ExamQuestion examQuestion : examQuestionList) {
|
||||
//查找原始和素材试题文件
|
||||
List<SysFileUpload> sysFileUploads =sysFileMapper.selectSysFileByQuidIN(examQuestion.getQuId());
|
||||
examQuestion.setFileUploads(sysFileUploads);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//设置进入试卷 考生考试信息确认参数
|
||||
String nickname = SecurityFrameworkUtils.getLoginUserNickname();
|
||||
@@ -448,8 +479,11 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
StuInfoPaper stuInfoPaper=new StuInfoPaper();
|
||||
stuInfoPaper.setQueNum(String.valueOf(educationPaperQus.size()));
|
||||
stuInfoPaper.setNickName(nickname);
|
||||
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
if (educationPaperPerson!=null){
|
||||
String sessionId = educationPaperPerson.getSessionId();
|
||||
EducationPaperSession educationPaperSession = educationPaperSessionMapper.selectEducationPaperSessionBySessionId(sessionId);
|
||||
examPaperVo.setEducationPaperSession(educationPaperSession);
|
||||
stuInfoPaper.setBatch(educationPaperPerson.getBatch());
|
||||
}
|
||||
stuInfoPaper.setAnswerTime(educationPaperParam.getExamTime());
|
||||
@@ -461,7 +495,7 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
String schoolName= examQuestionMapper.selectSchoolnameBytId(loginTenantId);
|
||||
stuInfoPaper.setSchoolName(schoolName);
|
||||
stuInfoPaper.setSex(SecurityFrameworkUtils.getLoginUserSEX());
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
|
||||
examPaperVo.setExamQuestionList(examQuestionList);
|
||||
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
|
||||
examPaperVo.setEducationPaperParam(educationPaperParam);
|
||||
@@ -553,22 +587,33 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
|
||||
int columnCount = paperWordList.size();
|
||||
//写入表格
|
||||
XWPFTable table = word.createTable(3, 2 + columnCount);
|
||||
XWPFTable table = word.createTable(3, 3 + columnCount);
|
||||
table.getRow(0).getCell(0).setText("总 分");
|
||||
table.getRow(0).getCell(1).setText("题号");
|
||||
table.getRow(0).getCell(2).setText("题号");
|
||||
for (int i = 0; i < columnCount; i++) {
|
||||
table.getRow(0).getCell(2 + i).setText(paperWordList.get(i).getUpperNum());
|
||||
table.getRow(0).getCell(3 + i).setText(paperWordList.get(i).getUpperNum());
|
||||
}
|
||||
table.getRow(1).getCell(0).setText("登分人");
|
||||
table.getRow(1).getCell(1).setText("题分");
|
||||
table.getRow(1).getCell(2).setText("题分");
|
||||
for (int i = 0; i < columnCount; i++) {
|
||||
table.getRow(1).getCell(2 + i).setText(String.valueOf(paperWordList.get(i).getTotalScore()));
|
||||
table.getRow(1).getCell(3 + i).setText(String.valueOf(paperWordList.get(i).getTotalScore()));
|
||||
}
|
||||
table.getRow(2).getCell(0).setText("复查人");
|
||||
table.getRow(2).getCell(1).setText("得分");
|
||||
table.getRow(2).getCell(2).setText("得分");
|
||||
for (int i = 0; i < columnCount; i++) {
|
||||
table.getRow(2).getCell(2 + i).setText("");
|
||||
table.getRow(2).getCell(3 + i).setText("");
|
||||
}
|
||||
// 设置第二列(索引为1)的固定宽度
|
||||
for (int rowIndex = 0; rowIndex < 3; rowIndex++) {
|
||||
XWPFTableCell cell = table.getRow(rowIndex).getCell(1);
|
||||
cell.setText(""); // 保持为空白,手动填写名字
|
||||
CTTc ctTc = cell.getCTTc();
|
||||
CTTcPr tcPr = ctTc.isSetTcPr() ? ctTc.getTcPr() : ctTc.addNewTcPr();
|
||||
CTTblWidth width = tcPr.isSetTcW() ? tcPr.getTcW() : tcPr.addNewTcW();
|
||||
width.setType(STTblWidth.DXA);
|
||||
width.setW(BigInteger.valueOf(900));
|
||||
}
|
||||
|
||||
//写入试卷内容
|
||||
for (PaperWordDto item : paperWordList) {
|
||||
String typeName = item.getType(); // 题型名,如 “单选题”、“多选题”等
|
||||
@@ -592,11 +637,11 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
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);
|
||||
String rawContent = paperQueWordDto.getContent();
|
||||
String prefix = index + "、";
|
||||
// 使用封装方法
|
||||
insertHtmlContentIntoRun(queRun, rawContent, prefix);
|
||||
queRun.setFontSize(11);
|
||||
queParagraph.setSpacingAfter(100);
|
||||
|
||||
@@ -608,11 +653,17 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
for (ExamQuestionAnswer examQuestionAnswer : answerList) {
|
||||
XWPFParagraph optionParagraph = word.createParagraph();
|
||||
XWPFRun optionRun = optionParagraph.createRun();
|
||||
String optionContent = option + ". " + examQuestionAnswer.getContent();
|
||||
optionRun.setText(optionContent);
|
||||
|
||||
String optionPrefix = option + ". ";
|
||||
String rawOptionContent = examQuestionAnswer.getContent();
|
||||
|
||||
// 使用封装方法
|
||||
insertHtmlContentIntoRun(optionRun, rawOptionContent, optionPrefix);
|
||||
|
||||
optionRun.setFontSize(10);
|
||||
optionParagraph.setSpacingAfter(50);
|
||||
|
||||
|
||||
if ("0".equals(examQuestionAnswer.getIsRight())) {
|
||||
correctOptions.append(option);
|
||||
}
|
||||
@@ -623,8 +674,6 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
answerMap
|
||||
.computeIfAbsent(typeName, k -> new StringBuilder())
|
||||
.append(index).append("、").append(correctOptions).append("\n");
|
||||
|
||||
|
||||
}
|
||||
index++;
|
||||
}
|
||||
@@ -700,6 +749,49 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
return educationPaperMapper.selectPaperIdAndNumByTaskId(taskId);
|
||||
}
|
||||
|
||||
public void insertHtmlContentIntoRun(XWPFRun run, String htmlContent, String prefix) {
|
||||
try {
|
||||
if (prefix != null) {
|
||||
run.setText(prefix);
|
||||
}
|
||||
|
||||
Document doc = Jsoup.parse(htmlContent);
|
||||
Element body = doc.body();
|
||||
|
||||
processNode(body, run);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void processNode(Node node, XWPFRun run) {
|
||||
for (Node child : node.childNodes()) {
|
||||
if (child instanceof TextNode) {
|
||||
String text = ((TextNode) child).text();
|
||||
run.setText(text);
|
||||
} else if (child instanceof Element) {
|
||||
Element el = (Element) child;
|
||||
|
||||
if (el.tagName().equalsIgnoreCase("img")) {
|
||||
String imgUrl = el.attr("src");
|
||||
try (InputStream imgStream = new URL(imgUrl).openStream()) {
|
||||
run.addPicture(
|
||||
imgStream,
|
||||
XWPFDocument.PICTURE_TYPE_JPEG,
|
||||
"image.jpg",
|
||||
Units.toEMU(100), // 宽度
|
||||
Units.toEMU(60) // 高度
|
||||
);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
// 继续递归处理内部元素,如 <p>、<span> 等
|
||||
processNode(el, run);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -27,6 +27,7 @@ import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -417,19 +418,31 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId);
|
||||
String paperId= educationPaperTaskMapper.selectPaperQuByPaperId(taskId);
|
||||
|
||||
if (StringUtils.isBlank(paperId)){
|
||||
return null;
|
||||
}
|
||||
List<ExamQuestion> examQuestionList=new ArrayList<>();
|
||||
List<EducationPaperScheme> educationPaperSchemeList=new ArrayList<>();
|
||||
List<String> quIds=new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(paperId)){
|
||||
quIds =educationPaperQuMapper.selectPaperQuByPaperId(paperId);
|
||||
if (quIds!=null&&quIds.size()>0){
|
||||
examQuestionList =examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
if (examQuestionList!=null&&examQuestionList.size()>0){
|
||||
|
||||
// 根据 quIds 顺序重新排序 examQuestionList
|
||||
Map<String, ExamQuestion> questionMap = examQuestionList.stream()
|
||||
.collect(Collectors.toMap(ExamQuestion::getQuId, Function.identity()));
|
||||
examQuestionList = quIds.stream()
|
||||
.map(questionMap::get)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
for (ExamQuestion examQuestion : examQuestionList) {
|
||||
//查找原始和素材试题文件
|
||||
List<SysFileUpload> sysFileUploads =sysFileMapper.selectSysFileByQuidIN(examQuestion.getQuId());
|
||||
examQuestion.setFileUploads(sysFileUploads);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskId);
|
||||
}
|
||||
@@ -448,7 +461,11 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
stuInfoPaper.setTaskName(educationPaperTask.getTaskName());
|
||||
|
||||
EducationPaperPerson educationPaperPerson = educationPaperPersonMapper.selectByTaskIdAndPersonId(taskId, String.valueOf(userId));
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
if (educationPaperPerson!=null){
|
||||
String sessionId = educationPaperPerson.getSessionId();
|
||||
EducationPaperSession educationPaperSession = educationPaperSessionMapper.selectEducationPaperSessionBySessionId(sessionId);
|
||||
examPaperVo.setEducationPaperSession(educationPaperSession);
|
||||
stuInfoPaper.setBatch(educationPaperPerson.getBatch());
|
||||
}
|
||||
Long loginTenantId = SecurityFrameworkUtils.getLoginTenantId();
|
||||
@@ -457,7 +474,6 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
stuInfoPaper.setSfz(SecurityFrameworkUtils.getLoginUserSFZ());
|
||||
stuInfoPaper.setSchoolName(schoolName);
|
||||
stuInfoPaper.setSex(SecurityFrameworkUtils.getLoginUserSEX());
|
||||
ExamPaperVo examPaperVo=new ExamPaperVo();
|
||||
examPaperVo.setExamQuestionList(examQuestionList);
|
||||
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
|
||||
examPaperVo.setPaperId(paperId);
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package pc.exam.pp.module.exam.service.paper;
|
||||
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.ChangePaperQuVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperQu;
|
||||
|
||||
@@ -63,5 +64,11 @@ public interface IEducationPaperQuService
|
||||
|
||||
ExamPaperVo selectPaperQuListByPaperId(String paperId);
|
||||
|
||||
boolean changePaperQu(ChangePaperQuVo changePaperQuVo);
|
||||
|
||||
boolean changePaperQuRandom(ChangePaperQuVo changePaperQuVo);
|
||||
|
||||
ExamPaperVo selectPaperQuListByPaperIdCenter(String paperId);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -6,6 +6,7 @@ import com.alibaba.excel.util.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -22,6 +23,7 @@ import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExamin
|
||||
import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.RabbitMQSendInfoVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.*;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.specialty.ExamSpecialty;
|
||||
import pc.exam.pp.module.exam.dal.mysql.mysqlkeyword.MysqlKeywordMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.question.*;
|
||||
import pc.exam.pp.module.exam.dal.mysql.questionexamine.QuestionExamineMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.specialty.ExamSpecialtyMapper;
|
||||
@@ -63,6 +65,8 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
|
||||
private ExamSpecialtyMapper examSpecialtyMapper;
|
||||
@Autowired
|
||||
private RabbitmqUtils rabbitMqService;
|
||||
@Autowired
|
||||
private MysqlKeywordMapper mysqlKeywordMapper;
|
||||
/**
|
||||
* 查询试题(hyc)
|
||||
*
|
||||
@@ -722,7 +726,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
|
||||
ExamQuestionAnswer examQuestionAnswer = new ExamQuestionAnswer();
|
||||
examQuestionAnswer.setAnswerId(IdUtils.simpleUUID());
|
||||
examQuestionAnswer.setQuId(quId);
|
||||
examQuestionAnswer.setSort(String.valueOf(i++));
|
||||
examQuestionAnswer.setSort(i++);
|
||||
// 判断是否为正确答案,忽略大小写和空格
|
||||
if (option.equalsIgnoreCase(importUser.getAnswer().trim())) {
|
||||
examQuestionAnswer.setIsRight("1"); // 正确
|
||||
@@ -781,7 +785,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
|
||||
ExamQuestionAnswer examQuestionAnswer = new ExamQuestionAnswer();
|
||||
examQuestionAnswer.setAnswerId(IdUtils.simpleUUID());
|
||||
examQuestionAnswer.setQuId(quId);
|
||||
examQuestionAnswer.setSort(String.valueOf(i++));
|
||||
examQuestionAnswer.setSort(i++);
|
||||
// 判断是否为正确答案,忽略大小写和空格
|
||||
if (option.equalsIgnoreCase(importUser.getAnswer().trim())) {
|
||||
examQuestionAnswer.setIsRight("1"); // 正确
|
||||
@@ -808,6 +812,40 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
|
||||
return respVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean changeStatus(String quId, String status) {
|
||||
return examQuestionMapper.changeStatus(quId,status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ExamQuestion> selectExamQuestionListAnswer(QuestionVo questionVo) {
|
||||
PageResult<ExamQuestion> examQuestionPageResult = examQuestionMapper.selectExamQuestionList(questionVo);
|
||||
List<ExamQuestion> list = examQuestionPageResult.getList();
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (ExamQuestion examQuestion : list) {
|
||||
String quId = examQuestion.getQuId();
|
||||
List<ExamQuestionAnswer> examQuestionAnswers = examQuestionAnswerMapper.selectExamQuestionAnswerByQuId(quId);
|
||||
examQuestion.setAnswerList(examQuestionAnswers);
|
||||
}
|
||||
}
|
||||
return examQuestionPageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamQuestionAnswer> getPointById(String quId) {
|
||||
List<ExamQuestionAnswer> examQuestionAnswers = examQuestionAnswerMapper.selectExamQuestionAnswerByQuId(quId);
|
||||
if (!CollectionUtils.isEmpty(examQuestionAnswers)) {
|
||||
for (ExamQuestionAnswer examQuestionAnswer : examQuestionAnswers) {
|
||||
String answerId = examQuestionAnswer.getAnswerId();
|
||||
List<ExamMysqlKeyword> newKeywordList = mysqlKeywordMapper.selectList(
|
||||
new QueryWrapper<ExamMysqlKeyword>().eq("answer_id", answerId)
|
||||
);
|
||||
examQuestionAnswer.setExamMysqlKeywordList(newKeywordList);
|
||||
}
|
||||
}
|
||||
return examQuestionAnswers;
|
||||
}
|
||||
|
||||
private void validateChoice(String a, String b, String c, String d, String answer) {
|
||||
// A 和 B 必须存在
|
||||
if (StringUtils.isBlank(a) || StringUtils.isBlank(b)) {
|
||||
|
@@ -11,6 +11,7 @@ import pc.exam.pp.module.exam.controller.admin.questionexamine.vo.QuestionExamin
|
||||
import pc.exam.pp.module.exam.controller.admin.rabbitmq.vo.RabbitMQSendInfoVO;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -103,4 +104,9 @@ public interface IExamQuestionService
|
||||
|
||||
QueImportRespVO importUserList(List<QuemportExcelVO> list, Boolean updateSupport);
|
||||
|
||||
boolean changeStatus(String quId, String status);
|
||||
|
||||
PageResult<ExamQuestion> selectExamQuestionListAnswer(QuestionVo questionVo);
|
||||
|
||||
List<ExamQuestionAnswer> getPointById(String quId);
|
||||
}
|
||||
|
@@ -70,8 +70,8 @@
|
||||
specialty_name = #{taskSpecialty}
|
||||
AND subject_name = #{educationPaperScheme.spName}
|
||||
AND tenant_id =#{tId}
|
||||
and audit = 0
|
||||
and status = 0
|
||||
and audit = '0'
|
||||
and status = '0'
|
||||
and deleted ='0'
|
||||
<if test="educationPaperScheme.quLevel != null and educationPaperScheme.quLevel != ''">
|
||||
AND qu_level = #{educationPaperScheme.quLevel}
|
||||
|
@@ -101,7 +101,7 @@
|
||||
AND s.class_id = #{classId}
|
||||
</if>
|
||||
ORDER BY s.id DESC
|
||||
|
||||
LIMIT #{pageSize} OFFSET #{offset}
|
||||
</select>
|
||||
<select id="selectStuIdByTaskId" resultType="java.lang.String">
|
||||
|
||||
|
@@ -34,6 +34,11 @@
|
||||
<include refid="selectEducationPaperQuVo"/>
|
||||
where paper_id = #{paperId}
|
||||
</select>
|
||||
<select id="selectRamdomQuId" resultType="java.lang.String">
|
||||
SELECT qu_id from exam_question WHERE subject_name =#{subjectName} and qu_id not IN
|
||||
(select qu_id from education_paper_qu where paper_id =#{paperId})ORDER BY RAND()
|
||||
LIMIT 1;
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertEducationPaperQu" parameterType="EducationPaperQu">
|
||||
@@ -66,6 +71,12 @@
|
||||
</trim>
|
||||
where paper_id = #{paperId}
|
||||
</update>
|
||||
<update id="changePaperQu">
|
||||
update education_paper_qu
|
||||
set qu_id = #{newQuId}
|
||||
where paper_id = #{paperId} and qu_id = #{oldQuId}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteEducationPaperQuByPaperId" parameterType="String">
|
||||
delete from education_paper_qu where paper_id = #{paperId}
|
||||
|
@@ -90,8 +90,8 @@
|
||||
WHERE specialty_name = #{taskSpecialty}
|
||||
AND subject_name = #{spName}
|
||||
AND tenant_id =#{tId}
|
||||
and audit = 0
|
||||
and status = 0
|
||||
and audit = '0'
|
||||
and status = '0'
|
||||
<if test="quLevel != null and quLevel != ''">
|
||||
AND qu_level = #{quLevel}
|
||||
</if>
|
||||
|
@@ -283,6 +283,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
|
||||
</update>
|
||||
<update id="changeStatus">
|
||||
UPDATE exam_question
|
||||
set status =#{status}
|
||||
where qu_id =#{quId}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
@@ -3,6 +3,7 @@ package pc.exam.pp.module.judgement.controller.admin.getpoints;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import pc.exam.pp.framework.common.pojo.CommonResult;
|
||||
import pc.exam.pp.framework.tenant.core.aop.TenantIgnore;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer;
|
||||
import pc.exam.pp.module.judgement.controller.admin.getpoints.vo.Points;
|
||||
import pc.exam.pp.module.judgement.controller.admin.getpoints.vo.PointsVo;
|
||||
@@ -23,6 +24,7 @@ public class GetPointsController {
|
||||
* @return 得分
|
||||
*/
|
||||
@PostMapping("/get_filePoint")
|
||||
@TenantIgnore
|
||||
public CommonResult get_file_point(@RequestBody PointsVo pointsVo) throws IOException {
|
||||
return CommonResult.success(examGetPointsService.get_file_point(pointsVo));
|
||||
}
|
||||
@@ -31,6 +33,7 @@ public class GetPointsController {
|
||||
* @return 得分
|
||||
*/
|
||||
@PostMapping("/get_mysql_point")
|
||||
@TenantIgnore
|
||||
public CommonResult get_mysql_point(@RequestBody PointsVo pointsVo) throws IOException {
|
||||
return CommonResult.success(examGetPointsService.get_mysql_point(pointsVo));
|
||||
}
|
||||
@@ -47,11 +50,13 @@ public class GetPointsController {
|
||||
* @return 得分
|
||||
*/
|
||||
@PostMapping("/update_mysql_point")
|
||||
@TenantIgnore
|
||||
public CommonResult update_mysql_point(@RequestBody Points points) {
|
||||
return CommonResult.success(examGetPointsService.update_mysql_point(points));
|
||||
}
|
||||
|
||||
@GetMapping("/get_Point_id/{quId}")
|
||||
@TenantIgnore
|
||||
public CommonResult getPointById(@PathVariable("quId") String quId) {
|
||||
return CommonResult.success(examGetPointsService.getPointById(quId));
|
||||
}
|
||||
@@ -60,6 +65,7 @@ public class GetPointsController {
|
||||
* @return 得分
|
||||
*/
|
||||
@PostMapping("/set_browser_point")
|
||||
@TenantIgnore
|
||||
//todo 老师自己设置,不读文件
|
||||
public CommonResult get_browser_point(@RequestBody Points points) {
|
||||
return CommonResult.success(examGetPointsService.get_browser_point(points));
|
||||
|
@@ -78,7 +78,7 @@ public class ExamGetPointsServiceImpl implements ExamGetPointsService{
|
||||
answer.setContent(key); // 设置文件路径
|
||||
answer.setScoreRate("1");
|
||||
//这里设置answer的排序,按照循环次数来
|
||||
answer.setSort(String.valueOf(sortCounter.getAndIncrement())); // 按顺序设置排序值
|
||||
answer.setSort(sortCounter.getAndIncrement()); // 按顺序设置排序值
|
||||
if (value.startsWith("仅存在于 "+stuFilePath)) {
|
||||
answer.setContentIn("考察删除");
|
||||
} else if (value.startsWith("仅存在于 "+answerFilePath)) {
|
||||
@@ -89,7 +89,7 @@ public class ExamGetPointsServiceImpl implements ExamGetPointsService{
|
||||
}
|
||||
return answer;
|
||||
})
|
||||
.sorted(Comparator.comparingInt(answer -> Integer.parseInt(answer.getSort()))) // 按 sort 排序
|
||||
.sorted(Comparator.comparingInt(answer -> answer.getSort())) // 按 sort 排序
|
||||
.collect(Collectors.toList());
|
||||
answerList.addAll(formattedDifferences);
|
||||
zip_file_sth.delete();
|
||||
@@ -188,7 +188,7 @@ public class ExamGetPointsServiceImpl implements ExamGetPointsService{
|
||||
//设置sort
|
||||
AtomicInteger sortCounter = new AtomicInteger(1);
|
||||
points.getQuestionAnswerList().forEach(answer -> {
|
||||
answer.setSort(String.valueOf(sortCounter.getAndIncrement()));
|
||||
answer.setSort(sortCounter.getAndIncrement());
|
||||
});
|
||||
List<ExamQuestionAnswer> questionAnswerList = points.getQuestionAnswerList();
|
||||
for (ExamQuestionAnswer examQuestionAnswer : questionAnswerList) {
|
||||
@@ -267,7 +267,7 @@ public class ExamGetPointsServiceImpl implements ExamGetPointsService{
|
||||
String answerId = IdUtils.simpleUUID();
|
||||
answer.setAnswerId(answerId);
|
||||
answer.setQuId(quId); // 以防前端未传
|
||||
answer.setSort(String.valueOf(counter.getAndIncrement())); // 设置排序字段(String 类型)
|
||||
answer.setSort(counter.getAndIncrement()); // 设置排序字段(String 类型)
|
||||
List<ExamMysqlKeyword> keywordList = answer.getExamMysqlKeywordList();
|
||||
if (!CollectionUtils.isEmpty(keywordList)) {
|
||||
for (ExamMysqlKeyword keyword : keywordList) {
|
||||
|
@@ -15,6 +15,7 @@ import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperFileDO;
|
||||
import pc.exam.pp.module.exam.dal.mysql.monitor.MonitorMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperParamMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperSessionMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperTaskMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.student.StuPaperFileMapper;
|
||||
import pc.exam.pp.module.exam.utils.uuid.IdUtils;
|
||||
|
Reference in New Issue
Block a user