diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/AdminContestController.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/AdminContestController.java index d50f14ff..906035dc 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/AdminContestController.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/AdminContestController.java @@ -198,7 +198,8 @@ public class AdminContestController { @RequestParam(value = "currentPage", required = false) Integer currentPage, @RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "cid", required = false) Long cid, - @RequestParam(value = "problemType", required = false) Integer problemType) { + @RequestParam(value = "problemType", required = false) Integer problemType, + @RequestParam(value = "oj", required = false) String oj) { if (cid == null) { return CommonResult.errorResponse("参数错误!", CommonResult.STATUS_NOT_FOUND); } @@ -227,8 +228,8 @@ public class AdminContestController { if (problemType != null) { // 必备条件 隐藏的不可取来做比赛题目 problemQueryWrapper // vj题目不限制赛制 - .and(wrapper->wrapper.eq("type", problemType) - .or().eq("is_remote", true)) + .and(wrapper -> wrapper.eq("type", problemType) + .or().eq("is_remote", true)) .ne("auth", 2); } @@ -248,6 +249,15 @@ public class AdminContestController { .like("author", keyword)); } + // 根据oj筛选过滤 + if (oj != null && !"All".equals(oj)) { + if (!Constants.RemoteOJ.isRemoteOJ(oj)) { + problemQueryWrapper.eq("is_remote", false); + } else { + problemQueryWrapper.eq("is_remote", true).likeLeft("problem_id", oj); + } + } + IPage problemList = problemService.page(iPage, problemQueryWrapper); HashMap contestProblem = new HashMap<>(); contestProblem.put("problemList", problemList); diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/ContestController.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/ContestController.java index 2c56a07f..7454c938 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/ContestController.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/ContestController.java @@ -226,10 +226,10 @@ public class ContestController { if (contest.getSealRank() && contest.getStatus().intValue() == Constants.Contest.STATUS_RUNNING.getCode() && contest.getSealRankTime().before(new Date())) { contestProblemList = contestProblemService.getContestProblemList(cid, contest.getStartTime(), contest.getEndTime(), - contest.getSealRankTime(), isAdmin); + contest.getSealRankTime(), isAdmin, contest.getAuthor()); } else { contestProblemList = contestProblemService.getContestProblemList(cid, contest.getStartTime(), contest.getEndTime(), - null, isAdmin); + null, isAdmin, contest.getAuthor()); } if (contestProblemList.size() == 0) { @@ -321,9 +321,15 @@ public class ContestController { contest.getSealRankTime().before(new Date())) { sealRankTime = contest.getSealRankTime(); } + + // 筛去 比赛管理员和超级管理员的提交 + List superAdminList = contestRecordService.getSuperAdminList(); + List superAdminUidList = superAdminList.stream().map(UserInfo::getUuid).collect(Collectors.toList()); + superAdminUidList.add(contest.getUid()); + // 获取题目的提交记录 ProblemCountVo problemCount = judgeService.getContestProblemCount(contestProblem.getPid(), contestProblem.getId(), - contestProblem.getCid(), contest.getStartTime(), sealRankTime); + contestProblem.getCid(), contest.getStartTime(), sealRankTime, superAdminUidList); // 获取题目的代码模板 QueryWrapper codeTemplateQueryWrapper = new QueryWrapper<>(); diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/ContestProblemMapper.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/ContestProblemMapper.java index 49c58c2c..ca0c050b 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/ContestProblemMapper.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/ContestProblemMapper.java @@ -23,5 +23,5 @@ import java.util.List; public interface ContestProblemMapper extends BaseMapper { List getContestProblemList(@Param("cid") Long cid, @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("sealTime") Date sealTime, - @Param("isAdmin") Boolean isAdmin); + @Param("isAdmin") Boolean isAdmin, @Param("adminList") List adminList); } diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/JudgeMapper.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/JudgeMapper.java index 064e222a..558e0ec0 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/JudgeMapper.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/JudgeMapper.java @@ -11,6 +11,7 @@ import top.hcode.hoj.pojo.vo.JudgeVo; import top.hcode.hoj.pojo.vo.ProblemCountVo; import java.util.Date; +import java.util.List; /** @@ -35,7 +36,8 @@ public interface JudgeMapper extends BaseMapper { int getTodayJudgeNum(); ProblemCountVo getContestProblemCount(@Param("pid") Long pid, @Param("cpid") Long cpid, @Param("cid") Long cid, - @Param("startTime") Date startTime, @Param("sealRankTime") Date sealRankTime); + @Param("startTime") Date startTime, @Param("sealRankTime") Date sealRankTime, + @Param("adminList") List adminList); ProblemCountVo getProblemCount(@Param("pid") Long pid); } diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/ContestProblemMapper.xml b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/ContestProblemMapper.xml index 5a2e8967..84444037 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/ContestProblemMapper.xml +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/ContestProblemMapper.xml @@ -6,6 +6,13 @@ (select count(*) from judge cpid=cp.id and cid=cp.cid and pid=cp.pid + + and uid NOT IN + + #{item} + + AND submit_time >= #{startTime} AND #{endTime}>submit_time @@ -22,6 +29,13 @@ (select count(*) from judge cpid=cp.id and cid=cp.cid and pid =cp.pid and status=0 + + and uid NOT IN + + #{item} + + AND submit_time >= #{startTime} AND #{endTime}>=submit_time diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/JudgeMapper.xml b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/JudgeMapper.xml index 3ee47e52..fc5e8ab4 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/JudgeMapper.xml +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/JudgeMapper.xml @@ -91,6 +91,13 @@ and #{sealRankTime} > submit_time + + and uid NOT IN + + #{item} + + diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/ContestProblemService.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/ContestProblemService.java index 27671d19..7d7b275e 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/ContestProblemService.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/ContestProblemService.java @@ -16,5 +16,6 @@ import java.util.List; * @since 2020-10-23 */ public interface ContestProblemService extends IService { - List getContestProblemList(Long cid, Date startTime, Date endTime, Date sealTime, Boolean isAdmin); + List getContestProblemList(Long cid, Date startTime, Date endTime, Date sealTime, + Boolean isAdmin, String contestAuthorUid); } diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/JudgeService.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/JudgeService.java index 248c6ee1..532fd04e 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/JudgeService.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/JudgeService.java @@ -8,6 +8,7 @@ import top.hcode.hoj.pojo.vo.JudgeVo; import top.hcode.hoj.pojo.vo.ProblemCountVo; import java.util.Date; +import java.util.List; /** @@ -29,7 +30,7 @@ public interface JudgeService extends IService { void failToUseRedisPublishJudge(Long submitId, Long pid, Boolean isContest); - ProblemCountVo getContestProblemCount(Long pid, Long cpid, Long cid, Date startTime, Date sealRankTime); + ProblemCountVo getContestProblemCount(Long pid, Long cpid, Long cid, Date startTime, Date sealRankTime, List adminList); ProblemCountVo getProblemCount(Long pid); } diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ContestProblemServiceImpl.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ContestProblemServiceImpl.java index ec945e50..3bd5fb8a 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ContestProblemServiceImpl.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ContestProblemServiceImpl.java @@ -3,6 +3,7 @@ package top.hcode.hoj.service.impl; import org.springframework.beans.factory.annotation.Autowired; import top.hcode.hoj.pojo.entity.ContestProblem; import top.hcode.hoj.dao.ContestProblemMapper; +import top.hcode.hoj.pojo.entity.UserInfo; import top.hcode.hoj.pojo.vo.ContestProblemVo; import top.hcode.hoj.service.ContestProblemService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -10,6 +11,7 @@ import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** *

@@ -25,8 +27,16 @@ public class ContestProblemServiceImpl extends ServiceImpl getContestProblemList(Long cid, Date startTime, Date endTime, Date sealTime,Boolean isAdmin) { - return contestProblemMapper.getContestProblemList(cid, startTime,endTime,sealTime,isAdmin); + public List getContestProblemList(Long cid, Date startTime, Date endTime, Date sealTime, Boolean isAdmin, String contestAuthorUid) { + // 筛去 比赛管理员和超级管理员的提交 + List superAdminList = contestRecordService.getSuperAdminList(); + List superAdminUidList = superAdminList.stream().map(UserInfo::getUuid).collect(Collectors.toList()); + superAdminUidList.add(contestAuthorUid); + + return contestProblemMapper.getContestProblemList(cid, startTime, endTime, sealTime, isAdmin, superAdminUidList); } } diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/JudgeServiceImpl.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/JudgeServiceImpl.java index 9f9edd90..03cf5f9a 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/JudgeServiceImpl.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/JudgeServiceImpl.java @@ -15,6 +15,7 @@ import org.springframework.stereotype.Service; import top.hcode.hoj.utils.Constants; import java.util.Date; +import java.util.List; /** @@ -71,8 +72,8 @@ public class JudgeServiceImpl extends ServiceImpl implements } @Override - public ProblemCountVo getContestProblemCount(Long pid, Long cpid, Long cid, Date startTime, Date sealRankTime) { - return judgeMapper.getContestProblemCount(pid, cpid, cid, startTime, sealRankTime); + public ProblemCountVo getContestProblemCount(Long pid, Long cpid, Long cid, Date startTime, Date sealRankTime, List adminList) { + return judgeMapper.getContestProblemCount(pid, cpid, cid, startTime, sealRankTime, adminList); } @Override diff --git a/hoj-vue/src/views/admin/problem/ProblemList.vue b/hoj-vue/src/views/admin/problem/ProblemList.vue index bd445c43..c20f2cda 100644 --- a/hoj-vue/src/views/admin/problem/ProblemList.vue +++ b/hoj-vue/src/views/admin/problem/ProblemList.vue @@ -43,10 +43,32 @@ @keyup.enter.native="filterByKeyword" > + + + + + + + + + @@ -315,6 +337,7 @@ export default { data() { return { problemListAuth: 0, + oj: 'Mine', pageSize: 10, total: 0, problemList: [], @@ -392,6 +415,7 @@ export default { currentPage: page, keyword: this.keyword, cid: this.contestId, + oj: this.oj, }; if (this.problemListAuth != 0) { params['auth'] = this.problemListAuth; @@ -485,7 +509,7 @@ export default { this.$alert(this.$i18n.t('m.Download_Testcase_Success'), 'Tips'); }); }, - ProblemListChangeAuth() { + ProblemListChangeFilter() { this.currentChange(1); }, filterByKeyword() { diff --git a/hoj-vue/src/views/oj/problem/ProblemList.vue b/hoj-vue/src/views/oj/problem/ProblemList.vue index 6fff579f..c3bbe1a6 100644 --- a/hoj-vue/src/views/oj/problem/ProblemList.vue +++ b/hoj-vue/src/views/oj/problem/ProblemList.vue @@ -294,11 +294,6 @@ export default { table: true, tag: true, }, - page: { - currentPage: 1, - pageSize: 30, - totalResult: 300, - }, filterConfig: { remote: true }, routeName: '', query: { @@ -310,6 +305,9 @@ export default { }, }; }, + created() { + this.init(); + }, mounted() { this.PROBLEM_LEVEL = Object.assign({}, PROBLEM_LEVEL); @@ -336,7 +334,7 @@ export default { this.$refs.problemList.refreshColumn(); this.loadings.table = false; }, 200); - this.init(); + this.getData(); }, methods: { init() { @@ -350,10 +348,13 @@ export default { if (this.query.currentPage < 1) { this.query.currentPage = 1; } - this.getTagList(this.query.oj); + }, + getData() { + this.getTagList(this.query.oj); this.getProblemList(); }, + pushRouter() { this.$router.push({ path: '/problem', @@ -549,11 +550,13 @@ export default { $route(newVal, oldVal) { if (newVal !== oldVal) { this.init(); + this.getData(); } }, isAuthenticated(newVal) { if (newVal === true) { this.init(); + this.getData(); } }, }, diff --git a/hoj-vue/src/views/oj/status/SubmissionList.vue b/hoj-vue/src/views/oj/status/SubmissionList.vue index 96e4c2b0..78021bc5 100644 --- a/hoj-vue/src/views/oj/status/SubmissionList.vue +++ b/hoj-vue/src/views/oj/status/SubmissionList.vue @@ -349,6 +349,9 @@ export default { RULE_TYPE: {}, }; }, + created() { + this.init(); + }, mounted() { this.JUDGE_STATUS = Object.assign({}, JUDGE_STATUS); this.JUDGE_STATUS_LIST = Object.assign({}, JUDGE_STATUS); @@ -360,7 +363,7 @@ export default { delete this.JUDGE_STATUS_LIST['6']; delete this.JUDGE_STATUS_LIST['7']; delete this.JUDGE_STATUS_LIST['-10']; - this.init(); + this.getData(); }, methods: { init() { @@ -380,6 +383,9 @@ export default { } this.limit = parseInt(query.limit) || 15; this.routeName = this.$route.name; + }, + + getData() { // ACM比赛没有必要显示分数列 if (this.contestID && this.contestRuleType == RULE_TYPE.ACM) { this.loadingTable = true; @@ -392,6 +398,7 @@ export default { } this.getSubmissions(); }, + buildQuery() { return { onlyMine: this.formFilter.onlyMine, @@ -750,10 +757,12 @@ export default { clearInterval(this.refreshStatus); } this.init(); + this.getData(); } }, isAuthenticated() { this.init(); + this.getData(); }, }, beforeRouteLeave(to, from, next) {