【修改】 任务编号:添加逻辑为年月日+任务数量+1
This commit is contained in:
@@ -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,8 +59,7 @@ public class EducationPaperTaskController
|
||||
*/
|
||||
@Operation(summary = "查询试卷任务列表(学生端)")
|
||||
@GetMapping("/stulist")
|
||||
public CommonResult<PageResult<EducationPaperTask>> stulist(PaperTaskPageVo 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,17 +145,16 @@ 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)
|
||||
{
|
||||
public CommonResult getPoints(@RequestParam(value = "name") String name) {
|
||||
return CommonResult.success(educationPaperTaskService.getPoints(name));
|
||||
}
|
||||
|
||||
@@ -181,6 +174,7 @@ public class EducationPaperTaskController
|
||||
|
||||
/**
|
||||
* 模板库 复制
|
||||
*
|
||||
* @param tempDto
|
||||
* @return
|
||||
*/
|
||||
@@ -207,6 +201,7 @@ public class EducationPaperTaskController
|
||||
|
||||
/**
|
||||
* 更改 任务状态
|
||||
*
|
||||
* @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));
|
||||
}
|
||||
|
||||
|
@@ -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.*;
|
||||
@@ -106,7 +107,6 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
}
|
||||
paperTask.setCount(String.valueOf(count));
|
||||
|
||||
|
||||
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(paperTask.getTaskId());
|
||||
paperTask.setEducationPaperParam(educationPaperParam);
|
||||
}
|
||||
@@ -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);
|
||||
@@ -165,9 +172,9 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
} else {
|
||||
educationPaperTask.setIsOne("1");
|
||||
}
|
||||
|
||||
// 新增任务参数
|
||||
educationPaperParamMapper.insertEducationPaperParam(educationPaperParam);
|
||||
|
||||
// 新增任务
|
||||
return educationPaperTaskMapper.insertEducationPaperTask(educationPaperTask);
|
||||
}
|
||||
|
||||
@@ -269,7 +276,6 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
}
|
||||
|
||||
|
||||
|
||||
// monitorMapper.deleteByTaskId(taskId);
|
||||
// educationPaperTaskMapper.deleteEducationPaperTaskByTaskId(taskId);
|
||||
return "删除成功";
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -102,6 +102,7 @@ public class AutoToolsController {
|
||||
|
||||
/**
|
||||
* 开始考试 通过websocket进行传输时间
|
||||
*
|
||||
* @param stuInTheExam 信息
|
||||
* @return true
|
||||
*/
|
||||
@@ -178,6 +179,7 @@ public class AutoToolsController {
|
||||
|
||||
/**
|
||||
* 停止考试
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
@GetMapping("/stopExam")
|
||||
@@ -198,6 +200,7 @@ public class AutoToolsController {
|
||||
return CommonResult.success(false);
|
||||
}
|
||||
|
||||
// 时间转换
|
||||
public static String formatLongDuration(int totalSeconds) {
|
||||
int hours = totalSeconds / 3600;
|
||||
int minutes = (totalSeconds % 3600) / 60;
|
||||
|
Reference in New Issue
Block a user