【新增】 学生分数试卷绑定新增临时ID,方式同一学生同一试卷数据冲突
This commit is contained in:
@@ -34,6 +34,10 @@ public class StuPaperScoreDO extends TenantBaseDO {
|
||||
* 试卷ID
|
||||
*/
|
||||
private String paperId;
|
||||
/**
|
||||
* 临时ID,每次做题都会变
|
||||
*/
|
||||
private String temporaryId;
|
||||
/**
|
||||
* 试题ID
|
||||
*/
|
||||
|
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface StuPaperScoreMapper extends BaseMapperX<StuPaperScoreDO> {
|
||||
|
||||
List<StuPaperScoreDO> findByStuIdAndPaperId(@Param("stuId") Long stuId, @Param("paperId") String paperId);
|
||||
List<StuPaperScoreDO> findByStuIdAndPaperId(@Param("stuId") Long stuId, @Param("paperId") String paperId, @Param("temporaryId") String temporaryId);
|
||||
|
||||
List<StuScoreVo> getStuScore(@Param("stuId") Long stuId, @Param("paperId") String paperId);
|
||||
|
||||
|
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface StuPaperScoreService {
|
||||
|
||||
List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId);
|
||||
List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId, String temporaryId);
|
||||
|
||||
void insertStuPaperScore(StuPaperScoreDO stuPaperScoreDO);
|
||||
|
||||
|
@@ -27,8 +27,8 @@ public class StuPaperScoreServiceImpl implements StuPaperScoreService {
|
||||
private EducationPaperMapper educationPaperMapper;
|
||||
|
||||
@Override
|
||||
public List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId) {
|
||||
return stuPaperScoreMapper.findByStuIdAndPaperId(stuId, paperId);
|
||||
public List<StuPaperScoreDO> findByStuIDAndPaperId(Long stuId, String paperId, String temporaryId) {
|
||||
return stuPaperScoreMapper.findByStuIdAndPaperId(stuId, paperId, temporaryId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -9,7 +9,7 @@
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
<select id="findByStuIdAndPaperId" resultType="pc.exam.pp.module.exam.dal.dataobject.student.StuPaperScoreDO">
|
||||
SELECT * FROM exam_stu_paper_score WHERE stu_id = #{stuId} AND paper_id = #{paperId} order by sort ASC
|
||||
SELECT * FROM exam_stu_paper_score WHERE stu_id = #{stuId} AND paper_id = #{paperId} AND paper_id = #{temporaryId} order by sort ASC
|
||||
</select>
|
||||
|
||||
|
||||
|
@@ -23,8 +23,6 @@ import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperSessionMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.student.StuScoreVo;
|
||||
import pc.exam.pp.module.exam.service.paper.IEducationPaperParamService;
|
||||
import pc.exam.pp.module.exam.service.paper.IEducationPaperSessionService;
|
||||
import pc.exam.pp.module.exam.service.paper.IEducationPaperTaskService;
|
||||
import pc.exam.pp.module.exam.service.stuPaperScore.StuPaperScoreService;
|
||||
import pc.exam.pp.module.judgement.controller.admin.autoTools.vo.StuInTheExam;
|
||||
import pc.exam.pp.module.judgement.controller.admin.autoTools.vo.StuPaperReqVo;
|
||||
@@ -79,7 +77,7 @@ public class AutoToolsController {
|
||||
StuScoreVo stuScoreVo = stuPaperScoreService.getStuScore(stuPaperReqVo.getStuId(),stuPaperReqVo.getPaperId());
|
||||
stuPaperScoreInfoVos.setStuInfoReqVo(stuScoreVo);
|
||||
// 3、查询学生试卷得分信息
|
||||
stuPaperScoreInfoVos.setStuPaperScoreDOList(stuPaperScoreService.findByStuIDAndPaperId(stuPaperReqVo.getStuId(),stuPaperReqVo.getPaperId()));
|
||||
stuPaperScoreInfoVos.setStuPaperScoreDOList(stuPaperScoreService.findByStuIDAndPaperId(stuPaperReqVo.getStuId(),stuPaperReqVo.getPaperId(), stuPaperReqVo.getTemporaryId()));
|
||||
// 4、查询学生试卷内容信息
|
||||
List<String> quIds = educationPaperQuMapper.selectPaperQuByPaperId(stuPaperReqVo.getPaperId());
|
||||
List<ExamQuestion> examQuestionList = examQuestionMapper.selectExamQuestionListByQuIds(quIds);
|
||||
@@ -92,7 +90,7 @@ public class AutoToolsController {
|
||||
// 一条一条进行查询试题,防止顺序错乱
|
||||
stuPaperScoreInfoVos.setExamQuestionList(examQuestionList);
|
||||
// 5、查询学生试卷分析
|
||||
List<StuPaperScoreDO> scoreDOS = stuPaperScoreService.findByStuIDAndPaperId(stuPaperReqVo.getStuId(),stuPaperReqVo.getPaperId());
|
||||
List<StuPaperScoreDO> scoreDOS = stuPaperScoreService.findByStuIDAndPaperId(stuPaperReqVo.getStuId(),stuPaperReqVo.getPaperId(), stuPaperReqVo.getTemporaryId());
|
||||
String judgementStr = "<p>试卷分析</p>";
|
||||
for (StuPaperScoreDO scoreDO : scoreDOS) {
|
||||
judgementStr += "<p>---------------------------------------</p>";
|
||||
@@ -111,7 +109,9 @@ public class AutoToolsController {
|
||||
public CommonResult<String> startExam(@RequestBody StuInTheExam stuInTheExam) {
|
||||
HttpServletRequest request = ServletUtils.getRequest();
|
||||
// 获取登录token
|
||||
String token = SecurityFrameworkUtils.obtainAuthorization(request,
|
||||
String token = null;
|
||||
if (request != null) {
|
||||
token = SecurityFrameworkUtils.obtainAuthorization(request,
|
||||
securityProperties.getTokenHeader(), securityProperties.getTokenParameter());
|
||||
// 获取登录用户
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
@@ -172,6 +172,7 @@ public class AutoToolsController {
|
||||
taskManager.startTask(stuInTheExam, stuTheExamInfo, refreshToken, countdown, new AtomicInteger(0));
|
||||
return CommonResult.success(refreshToken);
|
||||
}
|
||||
}
|
||||
return CommonResult.success("未登录");
|
||||
}
|
||||
|
||||
@@ -182,7 +183,9 @@ public class AutoToolsController {
|
||||
@GetMapping("/stopExam")
|
||||
public CommonResult<Boolean> stopExam() {
|
||||
HttpServletRequest request = ServletUtils.getRequest();
|
||||
String token = SecurityFrameworkUtils.obtainAuthorization(request,
|
||||
String token = null;
|
||||
if (request != null) {
|
||||
token = SecurityFrameworkUtils.obtainAuthorization(request,
|
||||
securityProperties.getTokenHeader(), securityProperties.getTokenParameter());
|
||||
OAuth2AccessTokenDO oAuth2AccessTokenDO = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get("oauth2_access_token:"+token), OAuth2AccessTokenDO.class);
|
||||
if (oAuth2AccessTokenDO != null) {
|
||||
@@ -191,6 +194,7 @@ public class AutoToolsController {
|
||||
taskManager.stopTask(refreshToken);
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
}
|
||||
return CommonResult.success(false);
|
||||
}
|
||||
|
||||
@@ -199,6 +203,6 @@ public class AutoToolsController {
|
||||
int minutes = (totalSeconds % 3600) / 60;
|
||||
int seconds = totalSeconds % 60;
|
||||
|
||||
return String.format("%d:%02d:%02d", hours, minutes, seconds);
|
||||
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
|
||||
}
|
||||
}
|
||||
|
@@ -13,5 +13,6 @@ public class StuPaperReqVo {
|
||||
@Schema(description = "试卷号")
|
||||
private String paperId;
|
||||
|
||||
|
||||
@Schema(description = "临时ID")
|
||||
private String temporaryId;
|
||||
}
|
||||
|
@@ -101,7 +101,7 @@ public class TaskManager {
|
||||
int minutes = (totalSeconds % 3600) / 60;
|
||||
int seconds = totalSeconds % 60;
|
||||
|
||||
return String.format("%d:%02d:%02d", hours, minutes, seconds);
|
||||
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user