修复后台修改题目测试点分数导致数据丢失的问题

This commit is contained in:
Himit_ZH 2021-07-31 12:12:56 +08:00
parent 0b435f6863
commit 6cba427b1f
3 changed files with 7 additions and 7 deletions

View File

@ -3,7 +3,7 @@
<mapper namespace="top.hcode.hoj.dao.UserRecordMapper">
<select id="getACMRankList" resultType="top.hcode.hoj.pojo.vo.ACMRankVo" useCache="true">
SELECT u.uuid as uid,u.nickname,u.username,u.signature,u.avatar,
(SELECT COUNT( DISTINCT pid ) FROM user_acproblem WHERE uid =u.uuid) AS ac,
(SELECT COUNT( DISTINCT pid ) FROM user_acproblem WHERE uid = u.uuid) AS ac,
(SELECT COUNT(uid) FROM judge WHERE uid=u.uuid AND cid=0) AS total
FROM user_info u WHERE u.status = 0
ORDER BY ac DESC,total ASC
@ -12,9 +12,9 @@
<select id="getRecent7ACRank" resultType="top.hcode.hoj.pojo.vo.ACMRankVo">
SELECT u.uuid as uid,u.nickname,u.username,u.signature,u.avatar,
(SELECT COUNT( DISTINCT pid ) FROM user_acproblem WHERE uid =u.uuid
and DATE(gmt_create) >= DATE_SUB(CURDATE(),INTERVAL 7 DAY) ) AS ac,
and DATE(gmt_create) >= DATE_SUB(CURDATE(),INTERVAL 7 DAY)) AS ac,
(SELECT COUNT(uid) FROM judge WHERE uid=u.uuid AND cid=0
and DATE(gmt_create) >= DATE_SUB(CURDATE(),INTERVAL 7 DAY) )AS total
and DATE(submit_time) >= DATE_SUB(CURDATE(),INTERVAL 7 DAY)) AS total
FROM user_info u WHERE u.status = 0
ORDER BY ac DESC,total ASC LIMIT 10
</select>

View File

@ -293,8 +293,8 @@ public class ProblemServiceImpl extends ServiceImpl<ProblemMapper, Problem> impl
if (needDeleteProblemCases.size() > 0 || newProblemCaseList.size() > 0
|| needUpdateProblemCaseList.size() > 0 || !StringUtils.isEmpty(testcaseDir)) {
problem.setCaseVersion(caseVersion);
// 如果是选择上传测试文件的临时文件路径不为空则需要遍历对应文件夹读取数据写入数据库,先前的题目数据一并清空
if (problemDto.getIsUploadTestCase() && !StringUtils.isEmpty(testcaseDir)) {
// 如果是选择上传测试文件的则需要遍历对应文件夹读取数据写入数据库,先前的题目数据一并清空
if (problemDto.getIsUploadTestCase()) {
// 获取代理bean对象执行异步方法===根据测试文件初始info
applicationContext.getBean(ProblemServiceImpl.class).initUploadTestCase(problemDto.getIsSpj(), caseVersion, pid, testcaseDir, problemDto.getSamples());
} else {
@ -428,7 +428,7 @@ public class ProblemServiceImpl extends ServiceImpl<ProblemMapper, Problem> impl
String testCasesDir = Constants.File.TESTCASE_BASE_FOLDER.getPath() + File.separator + "problem_" + problemId;
// 将之前的临时文件夹里面的评测文件全部复制到指定文件夹(覆盖)
if (tmpTestcaseDir != null) {
if (!StringUtils.isEmpty(tmpTestcaseDir)) {
FileUtil.copyFilesFromDir(new File(tmpTestcaseDir), new File(testCasesDir), true);
}

View File

@ -41,7 +41,7 @@ public class Judge implements Serializable {
@ApiModelProperty(value = "用户名")
private String username;
@ApiModelProperty(value = "结果码具体参考文档")
@ApiModelProperty(value = "提交的时间")
private Date submitTime;
@ApiModelProperty(value = "结果码具体参考文档")