【修改】 任务编号:添加逻辑为年月日+任务数量+1

This commit is contained in:
dlaren
2025-08-17 21:55:35 +08:00
parent 1c0ba2b8a0
commit 0175ccef67
4 changed files with 154 additions and 144 deletions

View File

@@ -18,7 +18,9 @@ import pc.exam.pp.module.exam.controller.admin.paper.dto.TempDto;
import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperTaskPageVo;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
import pc.exam.pp.module.exam.service.paper.IEducationPaperTaskService;
import static pc.exam.pp.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
import java.util.List;
@@ -31,8 +33,7 @@ import java.util.List;
@Tag(name = "管理后台 - 试卷任务")
@RestController
@RequestMapping("/exam/task")
public class EducationPaperTaskController
{
public class EducationPaperTaskController {
@Autowired
private IEducationPaperTaskService educationPaperTaskService;
@@ -41,15 +42,14 @@ public class EducationPaperTaskController
*/
@Operation(summary = "查询试卷任务列表(服务器端)")
@GetMapping("/list")
public CommonResult<PageResult<EducationPaperTask>> list(PaperTaskPageVo educationPaperTask)
{
public CommonResult<PageResult<EducationPaperTask>> list(PaperTaskPageVo educationPaperTask) {
PageResult<EducationPaperTask> pageResult = educationPaperTaskService.selectEducationPaperTaskList(educationPaperTask);
return CommonResult.success(BeanUtils.toBean(pageResult, EducationPaperTask.class));
}
@Operation(summary = "查询试卷任务列表(带试卷)")
@GetMapping("/listPaper")
public CommonResult<PageResult<EducationPaperTask>> taskAndPaperlist(PaperTaskPageVo educationPaperTask)
{
public CommonResult<PageResult<EducationPaperTask>> taskAndPaperlist(PaperTaskPageVo educationPaperTask) {
PageResult<EducationPaperTask> pageResult = educationPaperTaskService.selectEducationPaperAndTaskList(educationPaperTask);
return CommonResult.success(BeanUtils.toBean(pageResult, EducationPaperTask.class));
}
@@ -59,9 +59,8 @@ public class EducationPaperTaskController
*/
@Operation(summary = "查询试卷任务列表(学生端)")
@GetMapping("/stulist")
public CommonResult<PageResult<EducationPaperTask>> stulist(PaperTaskPageVo educationPaperTask)
{
PageResult<EducationPaperTask> pageResult =educationPaperTaskService.selectEducationPaperTaskListByStu(educationPaperTask);
public CommonResult<PageResult<EducationPaperTask>> stulist(PaperTaskPageVo educationPaperTask) {
PageResult<EducationPaperTask> pageResult = educationPaperTaskService.selectEducationPaperTaskListByStu(educationPaperTask);
return CommonResult.success(BeanUtils.toBean(pageResult, EducationPaperTask.class));
}
@@ -82,8 +81,7 @@ public class EducationPaperTaskController
*/
@Operation(summary = "获取试卷任务详细信息")
@GetMapping(value = "/{taskId}")
public CommonResult getInfo(@PathVariable("taskId") String taskId)
{
public CommonResult getInfo(@PathVariable("taskId") String taskId) {
return CommonResult.success(educationPaperTaskService.selectEducationPaperTaskByTaskId(taskId));
}
@@ -92,8 +90,7 @@ public class EducationPaperTaskController
*/
@Operation(summary = "新增试卷任务")
@PostMapping
public CommonResult add(@RequestBody EducationPaperTask educationPaperTask)
{
public CommonResult add(@RequestBody EducationPaperTask educationPaperTask) {
return CommonResult.success(educationPaperTaskService.insertEducationPaperTask(educationPaperTask));
}
@@ -103,8 +100,7 @@ public class EducationPaperTaskController
*/
@Operation(summary = "修改试卷任务")
@PutMapping
public CommonResult edit(@RequestBody EducationPaperTask educationPaperTask)
{
public CommonResult edit(@RequestBody EducationPaperTask educationPaperTask) {
return CommonResult.success(educationPaperTaskService.updateEducationPaperTask(educationPaperTask));
}
@@ -113,26 +109,25 @@ public class EducationPaperTaskController
*/
@Operation(summary = "删除试卷任务")
@DeleteMapping("/del/{taskId}")
public CommonResult remove(@PathVariable String taskId )
{
public CommonResult remove(@PathVariable String taskId) {
return CommonResult.success(educationPaperTaskService.deleteEducationPaperTaskByTaskId(taskId));
}
/**
* 批量删除试卷任务
*/
@Operation(summary = "批量删除试卷任务")
@DeleteMapping("/{taskIds}")
public CommonResult removeIds(@PathVariable String[] taskIds )
{
public CommonResult removeIds(@PathVariable String[] taskIds) {
return CommonResult.success(educationPaperTaskService.deleteEducationPaperTaskByTaskIds(taskIds));
}
/**
* 获取专业列表
*/
@Operation(summary = "获取专业列表")
@GetMapping("/getSpeciality")
public CommonResult getSpeciality()
{
public CommonResult getSpeciality() {
return CommonResult.success(educationPaperTaskService.getSpecialityList());
}
@@ -141,8 +136,7 @@ public class EducationPaperTaskController
*/
@Operation(summary = "获取题型列表")
@GetMapping("/getCourse")
public CommonResult getCourse()
{
public CommonResult getCourse() {
return CommonResult.success(educationPaperTaskService.getCourseList());
}
@@ -151,18 +145,17 @@ public class EducationPaperTaskController
*/
@Operation(summary = "获取关键字")
@GetMapping("/getKeywords")
public CommonResult getKeywords()
{
public CommonResult getKeywords() {
return CommonResult.success(educationPaperTaskService.getKeywords());
}
/**
* 获取知识点
*/
@Operation(summary = "获取知识点")
@GetMapping("/getPoints")
public CommonResult getPoints (@RequestParam(value = "name") String name)
{
return CommonResult.success(educationPaperTaskService.getPoints(name));
public CommonResult getPoints(@RequestParam(value = "name") String name) {
return CommonResult.success(educationPaperTaskService.getPoints(name));
}
@@ -174,39 +167,41 @@ public class EducationPaperTaskController
@PermitAll
public CommonResult fetchQuestionCount(@RequestBody SchemeParam param) {
Integer count= educationPaperTaskService.getQuCount(param);
Integer count = educationPaperTaskService.getQuCount(param);
return CommonResult.success(count);
}
/**
* 模板库 复制
*
* @param tempDto
* @return
*/
@Operation(summary = "模板库 复制")
@PostMapping("/submitSelection")
public CommonResult submitSelection(@RequestBody TempDto tempDto) {
System.out.println("接收到的任务ID: " + tempDto.getTaskId());
System.out.println("接收到的选项: " + tempDto.getOptions());
public CommonResult submitSelection(@RequestBody TempDto tempDto) {
System.out.println("接收到的任务ID: " + tempDto.getTaskId());
System.out.println("接收到的选项: " + tempDto.getOptions());
String taskId = tempDto.getTaskId();
if (taskId == null || taskId.trim().isEmpty()) {
return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(),"缺失模板方案参数Id!");
}
List<String> options = tempDto.getOptions();
return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(), "缺失模板方案参数Id!");
}
List<String> options = tempDto.getOptions();
if (options!=null&&options.size()>0){
if (options != null && options.size() > 0) {
educationPaperTaskService.submitSelection(tempDto);
}else {
return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(),"请选择复制的参数!");
}
} else {
return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(), "请选择复制的参数!");
}
return CommonResult.success("复制成功");
return CommonResult.success("复制成功");
}
/**
* 更改 任务状态
*
* @param statusDto
* @return
*/
@@ -221,13 +216,13 @@ public class EducationPaperTaskController
/**
* 学生端 根据任务id返回 试卷信息
*
* @param taskId
* @return
*/
@Operation(summary = "学生端 根据任务id返回 试卷信息")
@GetMapping(value = "/getPaperBytaskId")
public CommonResult getPaperBytaskId(@RequestParam(value = "taskId") String taskId)
{
public CommonResult getPaperBytaskId(@RequestParam(value = "taskId") String taskId) {
return CommonResult.success(educationPaperTaskService.selectPaperQuByPaperId(taskId));
}
@@ -240,7 +235,7 @@ public class EducationPaperTaskController
educationPaperTaskService.checkType(dto);
return CommonResult.success("题型更新成功");
} catch (Exception e) {
return CommonResult.error(9999999,e.getMessage());
return CommonResult.error(9999999, e.getMessage());
}

View File

@@ -24,6 +24,7 @@ import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionFileMapper;
import pc.exam.pp.module.exam.utils.date.DateUtils;
import pc.exam.pp.module.exam.utils.uuid.IdUtils;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@@ -89,11 +90,11 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
public PageResult<EducationPaperTask> selectEducationPaperTaskList(PaperTaskPageVo educationPaperTask) {
PageResult<EducationPaperTask> educationPaperTasks = educationPaperTaskMapper.selectEducationPaperTaskList(educationPaperTask);
List<EducationPaperTask> list = educationPaperTasks.getList();
if (list!=null&&list.size()>0){
if (list != null && list.size() > 0) {
for (EducationPaperTask paperTask : list) {
int count=0;
int count = 0;
List<EducationPaper> educationPapers = educationPaperMapper.selectPaperListByTaskId(paperTask.getTaskId());
if (educationPapers!=null&&educationPapers.size()>0){
if (educationPapers != null && educationPapers.size() > 0) {
for (EducationPaper educationPaper : educationPapers) {
try {
count += Integer.parseInt(educationPaper.getCounts());
@@ -106,13 +107,12 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
}
paperTask.setCount(String.valueOf(count));
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(paperTask.getTaskId());
paperTask.setEducationPaperParam(educationPaperParam);
}
}
return educationPaperTasks ;
return educationPaperTasks;
}
/**
@@ -126,6 +126,13 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
String uuid = IdUtils.simpleUUID();
educationPaperTask.setTaskId(uuid);
educationPaperTask.setCreateTime(DateUtils.getNowLocalDateTime());
// 添加任务编号
// 查询存在的任务数量
Long count = educationPaperTaskMapper.selectCount();
DateTimeFormatter formatter = DateTimeFormatter.BASIC_ISO_DATE;
String currentDate = LocalDate.now().format(formatter);
String taskNum = currentDate + String.valueOf(count + 1);
educationPaperTask.setTaskNum(taskNum);
EducationPaperParam educationPaperParam = new EducationPaperParam();
educationPaperParam.setParamId(IdUtils.simpleUUID());
educationPaperParam.setTaskId(uuid);
@@ -146,28 +153,28 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
educationPaperParam.setIsScreen("1");
educationPaperParam.setWarn("<p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;请仔细核对考试信息,并认真阅读本注意事项确认无误后点【开始考试】按钮进入考试系统。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;进入考试系统后系统自动计时考试结束前5分钟系统将提示您存盘请根据系统的提示交卷或存盘。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;进入考试系统后,须根据系统提示进行操作,任何因为与考试无关的操作造成的成绩错误由考生自行负责。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;单选试题操作完后系统会自动保存。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;所有操作类科目的试题,必须在相对应的操作环境中完成操作,并在该环境中直接保存文件,不要更改文件保存路径。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;Windows和网络操作题考生按照系统提示完成相应的操作即可。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;考试时间结束后,系统会自动提交考生答卷到考试服务器。提前完成的考生,选择【交卷】按钮提交试卷,出现【交卷成功】提示后方可离开,不要关闭交卷成功窗口,否则后果自负。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;如在考试过程中有任何疑问请举手与监考老师联系。</span></p><p><br></p>");
educationPaperParam.setIsContent("1");
if ("1".equals(educationPaperTask.getTaskType())){
if ("1".equals(educationPaperTask.getTaskType())) {
educationPaperParam.setIsRepeat("1");
educationPaperParam.setIsAnswer("1");
educationPaperParam.setIsLook("1");
educationPaperParam.setIsConnect("30");
educationPaperParam.setIsScore("1");
educationPaperParam.setIsScoreDetail("1");
}else {
} else {
educationPaperParam.setIsRepeat("0");
educationPaperParam.setIsAnswer("0");
educationPaperParam.setIsLook("0");
educationPaperParam.setIsScore("0");
educationPaperParam.setIsScoreDetail("0");
}
if ("0".equals(educationPaperTask.getTaskType())||"1".equals(educationPaperTask.getTaskType())||"3".equals(educationPaperTask.getTaskType())){
if ("0".equals(educationPaperTask.getTaskType()) || "1".equals(educationPaperTask.getTaskType()) || "3".equals(educationPaperTask.getTaskType())) {
educationPaperTask.setIsOne("0");
}else{
} else {
educationPaperTask.setIsOne("1");
}
// 新增任务参数
educationPaperParamMapper.insertEducationPaperParam(educationPaperParam);
// 新增任务
return educationPaperTaskMapper.insertEducationPaperTask(educationPaperTask);
}
@@ -201,15 +208,15 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
for (String taskId : taskIds) {
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectById(taskId);
if (educationPaperTask.getTaskType().equals("0")||educationPaperTask.getTaskType().equals("1")||educationPaperTask.getTaskType().equals("3")){
if (educationPaperTask.getTaskType().equals("0") || educationPaperTask.getTaskType().equals("1") || educationPaperTask.getTaskType().equals("3")) {
// 查询该任务下是否有试卷
int paperCount = educationPaperMapper.countPapersByTaskId(taskId);
if (paperCount == 0) {
canDeleteTaskIds.add(taskId);
}else {
} else {
cannotDeleteTaskIds.add(taskId);
}
}else {
} else {
canDeleteTaskIds.add(taskId);
}
@@ -223,9 +230,9 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
educationPaperTaskMapper.deleteEducationPaperTaskByTaskIds(
canDeleteTaskIds.toArray(new String[0]));
monitorMapper.deleteByTaskIds(canDeleteTaskIds.toArray(new String[0]));
if (!cannotDeleteTaskIds.isEmpty()){
List<String> taskNum= educationPaperMapper.selectTaskNumByids(cannotDeleteTaskIds);
return ("以下任务下有试卷:"+taskNum+",不能删除!");
if (!cannotDeleteTaskIds.isEmpty()) {
List<String> taskNum = educationPaperMapper.selectTaskNumByids(cannotDeleteTaskIds);
return ("以下任务下有试卷:" + taskNum + ",不能删除!");
}
@@ -242,7 +249,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
@Override
public String deleteEducationPaperTaskByTaskId(String taskId) {
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectById(taskId);
if (educationPaperTask.getTaskType().equals("0")||educationPaperTask.getTaskType().equals("1")||educationPaperTask.getTaskType().equals("3")){
if (educationPaperTask.getTaskType().equals("0") || educationPaperTask.getTaskType().equals("1") || educationPaperTask.getTaskType().equals("3")) {
// 1. 找出没有关联试卷的任务ID
List<String> canDeleteTaskIds = new ArrayList<>();
List<String> cannotDeleteTaskIds = new ArrayList<>();
@@ -250,7 +257,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
int paperCount = educationPaperMapper.countPapersByTaskId(taskId);
if (paperCount == 0) {
canDeleteTaskIds.add(taskId);
}else {
} else {
cannotDeleteTaskIds.add(taskId);
}
@@ -262,14 +269,13 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
educationPaperTaskMapper.deleteEducationPaperTaskByTaskIds(
canDeleteTaskIds.toArray(new String[0]));
monitorMapper.deleteByTaskIds(canDeleteTaskIds.toArray(new String[0]));
if (!cannotDeleteTaskIds.isEmpty()){
List<String> taskNum= educationPaperMapper.selectTaskNumByids(cannotDeleteTaskIds);
return ("以下任务下有试卷:"+taskNum+",不能删除!");
if (!cannotDeleteTaskIds.isEmpty()) {
List<String> taskNum = educationPaperMapper.selectTaskNumByids(cannotDeleteTaskIds);
return ("以下任务下有试卷:" + taskNum + ",不能删除!");
}
}
// monitorMapper.deleteByTaskId(taskId);
// educationPaperTaskMapper.deleteEducationPaperTaskByTaskId(taskId);
return "删除成功";
@@ -305,11 +311,11 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
return new ArrayList<>(keywordSet);
}
@Override
@Override
public List<ExamPaperKnowledgePoints> getPoints(String name) {
Long id= educationPaperTaskMapper.getPointIdByName(name);
return educationPaperTaskMapper.getPoints(id);
}
Long id = educationPaperTaskMapper.getPointIdByName(name);
return educationPaperTaskMapper.getPoints(id);
}
@Override
@TenantIgnore
@@ -340,7 +346,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
// System.out.println(keywords+"keywords");
// System.out.println(quLevel+"quLevel");
// System.out.println(spName+"spName");
return educationPaperTaskMapper.getQuCount(taskSpecialty, spName, quLevel, pointId, keywords,requiredTenantId);
return educationPaperTaskMapper.getQuCount(taskSpecialty, spName, quLevel, pointId, keywords, requiredTenantId);
}
@Override
@@ -359,8 +365,8 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
// 格式化时间为字符串
String timeString = now.format(formatter);
educationPaperTask.setTaskName(educationPaperTask.getTaskName()+timeString);
String timeString = now.format(formatter);
educationPaperTask.setTaskName(educationPaperTask.getTaskName() + timeString);
educationPaperTask.setIsTemplate(1);
educationPaperTaskMapper.insertEducationPaperTask(educationPaperTask);
@@ -390,7 +396,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
//获得 试卷试题
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(paperId);
int number=educationPaperMapper.selectCountPaperList();
int number = educationPaperMapper.selectCountPaperList();
// 格式化为8位不足前面补0
String formattedNumber = String.format("%08d", ++number);
@@ -428,7 +434,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
//复制考场设置
List<EducationPaperSession> educationPaperSessions = educationPaperSessionMapper.selectEducationPaperSessionByTaskId(taskId);
if (educationPaperSessions!=null&&educationPaperSessions.size()>0){
if (educationPaperSessions != null && educationPaperSessions.size() > 0) {
educationPaperSessions.forEach(session -> session.setSessionId(IdUtils.simpleUUID()));
educationPaperSessions.forEach(session -> session.setPaperId(null));
educationPaperSessions.forEach(session -> session.setTaskId(newtaskId));
@@ -446,9 +452,9 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
// 2. 复制所有试卷建立新旧ID映射
Map<String, String> paperIdMapping = new HashMap<>();
if (educationPapers!=null&&educationPapers.size()>0){
if (educationPapers != null && educationPapers.size() > 0) {
for (EducationPaper paper : educationPapers) {
int number=educationPaperMapper.selectCountPaperList();
int number = educationPaperMapper.selectCountPaperList();
// 格式化为8位不足前面补0
String formattedNumber = String.format("%08d", ++number);
@@ -468,22 +474,22 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
}
}
if (educationPaperSessions!=null&&educationPaperSessions.size()>0){
// 3. 处理考场分配
for (EducationPaperSession session : educationPaperSessions) {
session.setSessionId(IdUtils.simpleUUID());
session.setTaskId(newtaskId);
if (session.getPaperId() != null) {
String newPaperIds = Arrays.stream(session.getPaperId().split(","))
.map(paperIdMapping::get)
.collect(Collectors.joining(","));
session.setPaperId(newPaperIds);
}
}
if (educationPaperSessions != null && educationPaperSessions.size() > 0) {
// 3. 处理考场分配
for (EducationPaperSession session : educationPaperSessions) {
session.setSessionId(IdUtils.simpleUUID());
session.setTaskId(newtaskId);
if (session.getPaperId() != null) {
String newPaperIds = Arrays.stream(session.getPaperId().split(","))
.map(paperIdMapping::get)
.collect(Collectors.joining(","));
session.setPaperId(newPaperIds);
}
}
// 4. 批量插入考场
educationPaperSessionMapper.insertEducationPaperSessionList(educationPaperSessions);
}
// 4. 批量插入考场
educationPaperSessionMapper.insertEducationPaperSessionList(educationPaperSessions);
}
}
if (options.contains("5")) {
@@ -495,25 +501,25 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
@Override
public boolean changeStatus(String taskId, String status) {
return educationPaperTaskMapper.changeStatus(taskId,status);
return educationPaperTaskMapper.changeStatus(taskId, status);
}
@Override
public ExamPaperVo selectPaperQuByPaperId(String taskId) {
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId);
String paperId= educationPaperTaskMapper.selectPaperQuByPaperId(taskId);
String paperId = educationPaperTaskMapper.selectPaperQuByPaperId(taskId);
if (StringUtils.isBlank(paperId)){
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){
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()
@@ -524,21 +530,21 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
.collect(Collectors.toList());
for (ExamQuestion examQuestion : examQuestionList) {
//查找原始和素材试题文件
List<ExamQuestionFile> sysFileUploads =sysFileMapper.selectSysFileByQuidIN(examQuestion.getQuId());
List<ExamQuestionFile> sysFileUploads = sysFileMapper.selectSysFileByQuidIN(examQuestion.getQuId());
examQuestion.setFileUploads(sysFileUploads);
}
}
}
educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskId);
educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskId);
}
String nickname = SecurityFrameworkUtils.getLoginUserNickname();
Long userId=SecurityFrameworkUtils.getLoginUserId();
Long userId = SecurityFrameworkUtils.getLoginUserId();
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskId);
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(paperId);
//设置进入试卷 考生考试信息确认参数
StuInfoPaper stuInfoPaper=new StuInfoPaper();
StuInfoPaper stuInfoPaper = new StuInfoPaper();
stuInfoPaper.setQueNum(String.valueOf(quIds.size()));
stuInfoPaper.setNickName(nickname);
stuInfoPaper.setAnswerTime(educationPaperParam.getExamTime());
@@ -546,15 +552,15 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
stuInfoPaper.setTaskName(educationPaperTask.getTaskName());
EducationPaperPerson educationPaperPerson = educationPaperPersonMapper.selectByTaskIdAndPersonId(taskId, String.valueOf(userId));
ExamPaperVo examPaperVo=new ExamPaperVo();
if (educationPaperPerson!=null){
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();
String schoolName= examQuestionMapper.selectSchoolnameBytId(loginTenantId);
String schoolName = examQuestionMapper.selectSchoolnameBytId(loginTenantId);
stuInfoPaper.setUserName(SecurityFrameworkUtils.getLoginUserName());
stuInfoPaper.setSfz(SecurityFrameworkUtils.getLoginUserSFZ());
stuInfoPaper.setSchoolName(schoolName);
@@ -564,7 +570,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
examPaperVo.setPaperId(paperId);
examPaperVo.setEducationPaperParam(educationPaperParam);
examPaperVo.setStuInfoPaper(stuInfoPaper);
if (StringUtils.isNotBlank(educationPaper.getNum())){
if (StringUtils.isNotBlank(educationPaper.getNum())) {
examPaperVo.setPaperNum(educationPaper.getNum());
}
return examPaperVo;
@@ -575,19 +581,19 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
String taskType = educationPaperTask.getTaskType();
PageResult<EducationPaperTask> educationPaperTasks = educationPaperTaskMapper.selectEducationPaperTaskList(educationPaperTask);
Long stuId= SecurityFrameworkUtils.getLoginUserId();
Long stuId = SecurityFrameworkUtils.getLoginUserId();
List<EducationPaperTask> list = educationPaperTasks.getList();
List<String > taskIds= educationPaperPersonMapper.selectTaskIdByStuid(stuId);
if (list!=null&&list.size()>0&&taskIds!=null&&taskIds.size()>0){
List<String> taskIds = educationPaperPersonMapper.selectTaskIdByStuid(stuId);
if (list != null && list.size() > 0 && taskIds != null && taskIds.size() > 0) {
list = list.stream()
.filter(task -> taskIds.contains(task.getTaskId()))
.collect(Collectors.toList());
if ("0".equals(taskType)){
if ("0".equals(taskType)) {
for (EducationPaperTask paperTask : list) {
String taskId = paperTask.getTaskId();
int count=0;
int count = 0;
List<EducationPaper> educationPapers = educationPaperMapper.selectPaperListByTaskId(paperTask.getTaskId());
if (educationPapers!=null&&educationPapers.size()>0){
if (educationPapers != null && educationPapers.size() > 0) {
for (EducationPaper educationPaper : educationPapers) {
try {
count += Integer.parseInt(educationPaper.getCounts());
@@ -603,19 +609,19 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId);
//最高成绩
if ("0".equals(educationPaperParam.getSaveGrades())){
if ("0".equals(educationPaperParam.getSaveGrades())) {
String score= monitorMapper.selectByStuIdAndTaskIdTop(stuId,taskId);
if (StringUtils.isNotBlank(score)){
paperTask.setScore(score);
}else {
paperTask.setScore("0.0");
}
}else {
String score= monitorMapper.selectByStuIdAndTaskIdNew(stuId,taskId);
if (StringUtils.isNotBlank(score)){
String score = monitorMapper.selectByStuIdAndTaskIdTop(stuId, taskId);
if (StringUtils.isNotBlank(score)) {
paperTask.setScore(score);
}else {
} else {
paperTask.setScore("0.0");
}
} else {
String score = monitorMapper.selectByStuIdAndTaskIdNew(stuId, taskId);
if (StringUtils.isNotBlank(score)) {
paperTask.setScore(score);
} else {
paperTask.setScore("0.0");
}
}
@@ -624,10 +630,10 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
}
//查找 考试状态还没结束的 任务id ,取 交集
List<String > taskNoEndIds= monitorMapper.selectByStuIdAndTaskId(stuId);
List<String> taskNoEndIds = monitorMapper.selectByStuIdAndTaskId(stuId);
if(taskType.equals("1")){
if (list!=null&&list.size()>0&&taskNoEndIds!=null&&taskNoEndIds.size()>0){
if (taskType.equals("1")) {
if (list != null && list.size() > 0 && taskNoEndIds != null && taskNoEndIds.size() > 0) {
list = list.stream()
.filter(task -> taskNoEndIds.contains(task.getTaskId()))
.collect(Collectors.toList());
@@ -636,7 +642,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
educationPaperTasks.setList(list);
return educationPaperTasks;
}else {
} else {
return null;
}
}
@@ -648,7 +654,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
for (EducationPaperTask paperTask : list) {
String taskId = paperTask.getTaskId();
List<EducationPaper> educationPapers = educationPaperMapper.selectPaperListByTaskId(taskId);
List<EducationPaperScheme> educationPaperSchemeList=educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskId);
List<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskId);
paperTask.setEducationPaperList(educationPapers);
paperTask.setEducationPaperSchemeList(educationPaperSchemeList);
}
@@ -661,7 +667,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
throw new QueTypeException("题型参数不能为空");
}
List<EducationPaperScheme> educationPaperSchemeList=educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(dto.getTaskId());
List<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(dto.getTaskId());
if (educationPaperSchemeList == null) {
educationPaperSchemeList = new ArrayList<>();
}
@@ -678,7 +684,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
.filter(q -> !existingSpNames.contains(q))
.collect(Collectors.toList());
if (extraQue.size()>0){
if (extraQue.size() > 0) {
throw new QueTypeException("当前任务方案中不存在以下题型:" + String.join(",", extraQue));
}

View File

@@ -4,8 +4,10 @@ import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaper;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
import pc.exam.pp.module.exam.dal.dataobject.student.StuPaperScoreDO;
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperMapper;
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperTaskMapper;
import pc.exam.pp.module.exam.dal.mysql.student.StuPaperScoreMapper;
import pc.exam.pp.module.exam.dal.mysql.student.StuScoreVo;
@@ -25,6 +27,8 @@ public class StuPaperScoreServiceImpl implements StuPaperScoreService {
private StuPaperScoreMapper stuPaperScoreMapper;
@Resource
private EducationPaperMapper educationPaperMapper;
@Resource
private EducationPaperTaskMapper educationPaperTaskMapper;
@Override
public List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId, String temporaryId) {
@@ -50,7 +54,6 @@ public class StuPaperScoreServiceImpl implements StuPaperScoreService {
BigDecimal trueScore = new BigDecimal(0);
String stuNumber = "";
String nickName = "";
String taskId = "";
String picUrl = "";
List<StuScoreVo> stuScoreVos = stuPaperScoreMapper.getStuScore(stuId, paperId, temporaryId);
for (StuScoreVo scoreVo : stuScoreVos) {
@@ -68,7 +71,10 @@ public class StuPaperScoreServiceImpl implements StuPaperScoreService {
stuScoreVo.setPicUrl(picUrl);
// 4、通过paperId查询任务编号
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(paperId);
stuScoreVo.setTaskId(educationPaper.getTaskId());
// 5、通过任务编号查询任务信息
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(educationPaper.getTaskId());
// 6、将任务编号放入对象中
stuScoreVo.setTaskId(educationPaperTask.getTaskNum());
return stuScoreVo;
}