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