完成作业提交界面大致框架搭建、完成页面标题等部分接口和前端展示、引入作业倒计时显示。

This commit is contained in:
musteven 2025-04-07 16:57:01 +08:00
parent 50185cd723
commit 30809c3896
10 changed files with 261 additions and 156 deletions

View File

@ -32,4 +32,5 @@ export default {
getClassRanks:(config) => request.get('/problem/getClassRanks', config),//获取当前报告班级排名 getClassRanks:(config) => request.get('/problem/getClassRanks', config),//获取当前报告班级排名
getProblemInfo:(config) => request.get('/problem/getProblemInfo', config)//获取当前报告布置信息
} }

View File

@ -39,13 +39,10 @@ const paginationReactive = reactive({
}) })
const onStartExam = async (exam) => {//点击进入控件的逻辑 const onStartExam = async (exam) => {//点击进入控件的逻辑
const { id } = exam
try { try {
// await api.addExamInfo({ id })
const examId = exam.id const examId = exam.id
router.push({ name: 'ReportSubmit', params: { examId } }) const classId = exam.classId
router.push({ name: 'ReportSubmit', params: { examId,classId }, query: { fromclient: false } })
} catch (err) { } catch (err) {
console.log(err) console.log(err)
} }

View File

@ -1,40 +1,42 @@
<template> <template>
<p>Basic link button</p> <CommonPage show-footer :show-header="false">
<div class="mb-4">
<el-button <div class="page-content">
v-for="button in buttons" <h2 class="title">
:key="button.text" 实验名称:{{ title }}</h2>
:type="button.type" <h3 class="subtitle">
link 当前作业剩余时间:{{ countdown }}
> </h3>
{{ button.text }}
</el-button>
</div> </div>
<p>Disabled link button</p> <div class="layout-container">
<div> <Leftparts class="leftparts" />
<el-button <Rightparts class="rightparts" />
v-for="button in buttons"
:key="button.text"
:type="button.type"
link
disabled
>
{{ button.text }}
</el-button>
</div> </div>
<ReportActions class="bottom" />
</CommonPage>
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted } from 'vue' import { ref, reactive, onMounted } from 'vue'
import api from '@/api/user'; import api from '@/api/user';
import {useRoute} from 'vue-router'; import {useRoute} from 'vue-router';
import ReportActions from "@/views/user/report-submit/components/report-actions.vue";
import Leftparts from "@/views/user/report-submit/components/leftparts.vue";
import Rightparts from "@/views/user/report-submit/components/rightparts.vue";
const route = useRoute() const route = useRoute()
const { examId } = route.params const examId = route.params.examId;
const classId = route.params.classId;
const loading = ref(true); const loading = ref(true);
const title = ref(""); // 从API获取的作业名称
const examScores = ref([]); const examScores = ref([]);
const examName = ref(""); const examName = ref("");
const notifyMsg = ref(""); const countdown = ref(""); // 用于显示倒计时
// 将结束时间转换为Date对象
let endTime = null; // 结束时间初始化为null
const paginationReactive = reactive({ const paginationReactive = reactive({
page: 1, page: 1,
@ -60,11 +62,59 @@ const columns = [
// ... 列配置 // ... 列配置
]; ];
// 查询成绩的函数
const queryExamScores = async () => { const queryExamScores = async () => {
// ... 查询逻辑 //查询作业名称信息(直接复用查询排名)
try {
//查询作业名称信息(直接复用查询排名)
const res1 = await api.getStudentRank({ params: { examId } });
//查询作业时间等信息
const res = await api.getProblemInfo({ params: { classId, examId } });
title.value = res1.data.title; // 更新作业名称
// 将结束时间转换为Date对象
endTime = new Date(res.data.endTime[0], res.data.endTime[1] - 1, res.data.endTime[2], res.data.endTime[3], res.data.endTime[4]);
} catch (error) {
console.error("Failed to fetch exam scores or problem info:", error);
}
}; };
// 更新倒计时的函数
const updateCountdown = () => {
const now = new Date();
const timeleft = endTime - now; // 计算剩余时间
if (timeleft >= 0) {
// 将毫秒转换为天、时、分、秒
const days = Math.floor(timeleft / (1000 * 60 * 60 * 24));
const hours = Math.floor((timeleft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((timeleft % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeleft % (1000 * 60)) / 1000);
// 格式化倒计时字符串
countdown.value = `${days}天${hours}小时 ${minutes}分钟${seconds}秒`;
} else {
countdown.value = "作业已结束";
clearInterval(intervalId); // 清除定时器
}
};
// 使用setInterval来每秒更新倒计时
let intervalId = null;
onMounted(async () => {
await queryExamScores(); // 确保在挂载时查询数据
if (endTime) {
updateCountdown(); // 初始更新
intervalId = setInterval(updateCountdown, 1000); // 设置定时器
}
});
onUnmounted(() => {
if (intervalId) {
clearInterval(intervalId); // 组件卸载时清除定时器
}
});
// 行键函数 // 行键函数
const rowKey = (rowData) => { const rowKey = (rowData) => {
return rowData.id; return rowData.id;
@ -72,21 +122,50 @@ const rowKey = (rowData) => {
// 生命周期钩子 // 生命周期钩子
onMounted(() => { onMounted(() => {
console.log('Received examId:', examId); // 输出接收到的 examId queryExamScores(); // 挂载时查询作业名
// ... 挂载逻辑
}); });
const buttons = [
{ type: '', text: 'plain' },
{ type: 'primary', text: 'primary' },
{ type: 'success', text: 'success' },
{ type: 'info', text: 'info' },
{ type: 'warning', text: 'warning' },
{ type: 'danger', text: 'danger' },
]
</script> </script>
<style scoped> <style scoped>
/* 样式可以根据需要添加 */ .page-content {
width: 40%;
margin-left: 0px;
}
.title {
padding-left: 0px;
font-size: 22px;
font-weight: normal;
color: #333;
margin-bottom: 20px;
}
.subtitle {
font-size: 14px;
color: #363434;
margin-bottom: 10px;
}
.layout-container {
display: flex; /* 使用 Flexbox 布局 */
justify-content: space-between; /* 左右模块分布在容器两侧 */
height: auto; /* 高度自适应内容 */
}
.leftparts {
flex: 0 0 70%;
}
.rightparts {
flex: 0 0 30%;
}
.bottom {
position: fixed; /* 使用固定定位 */
left: 50%; /* 水平居中 */
transform: translateX(-50%); /* 使用transform调整实际位置 */
bottom: 0; /* 定位到页面底部 */
width: 100%; /* 宽度占满整个容器 */
text-align: center; /* 文本居中 */
}
</style> </style>

View File

@ -114,7 +114,7 @@ export default {
}, },
{ {
name: 'ReportSubmit', name: 'ReportSubmit',
path: 'report-submit', path: 'report-submit/:examId/:classId',
component: () => import('./report-submit/index.vue'), component: () => import('./report-submit/index.vue'),
meta: { meta: {
title: '作业详情', title: '作业详情',

View File

@ -61,7 +61,6 @@ const queryExamScores = async () => {
title.value = res.data.title; // 更新作业名称 title.value = res.data.title; // 更新作业名称
score.value = res.data.score; // 更新个人得分 score.value = res.data.score; // 更新个人得分
rank.value = res.data.rank; // 更新个人排名 rank.value = res.data.rank; // 更新个人排名
console.log(res1);
totalStudents.value = res1.data;// 更新班级总人数 totalStudents.value = res1.data;// 更新班级总人数
}; };

View File

@ -19,12 +19,12 @@ import ClassScore from '@/views/user/score-rank/components/class-score.vue'
} }
.personal-rank { .personal-rank {
flex: 0 0 20%; /* UserPersonalRank 占据 40% 的空间 */ flex: 0 0 20%; /* UserPersonalRank 占据 20% 的空间 */
/* 其他样式,例如 padding, margin 等 */ /* 其他样式,例如 padding, margin 等 */
} }
.class-score { .class-score {
flex: 0 0 80%; /* ClassScore 占据 60% 的空间 */ flex: 0 0 80%; /* ClassScore 占据 80% 的空间 */
/* 其他样式,例如 padding, margin 等 */ /* 其他样式,例如 padding, margin 等 */
} }
</style> </style>

View File

@ -27,32 +27,35 @@ public class ProblemController {
@Autowired @Autowired
private ProblemServiceI problemServiceI; private ProblemServiceI problemServiceI;
@PostMapping("/addScoringRubric") @PostMapping("/addScoringRubric")
public RespBean addScoringRubric(@RequestBody PMScoringRubric scoringRubric) { public RespBean addScoringRubric(@RequestBody PMScoringRubric scoringRubric) {
problemServiceI.addScoringRubric(scoringRubric); problemServiceI.addScoringRubric(scoringRubric);
return RespBean.ok("添加评分细则成功"); return RespBean.ok("添加评分细则成功");
} }
@PostMapping("/addScoringStandard") @PostMapping("/addScoringStandard")
public RespBean addScoringStandard(@RequestBody PMScoringStandard pmScoringStandard) { public RespBean addScoringStandard(@RequestBody PMScoringStandard pmScoringStandard) {
problemServiceI.addScoringStandard(pmScoringStandard); problemServiceI.addScoringStandard(pmScoringStandard);
List<ScoringStandard> scoringStandardList=problemServiceI.findStandardIdNoProblemId(); List<ScoringStandard> scoringStandardList = problemServiceI.findStandardIdNoProblemId();
if(scoringStandardList.size()>1) { if (scoringStandardList.size() > 1) {
problemServiceI.updateStandardId(scoringStandardList.get(0).getId()); problemServiceI.updateStandardId(scoringStandardList.get(0).getId());
} } else {
else{ for (ScoringStandard scoringStandard : scoringStandardList) {
for(ScoringStandard scoringStandard:scoringStandardList){
problemServiceI.updateStandardId(scoringStandard.getId()); problemServiceI.updateStandardId(scoringStandard.getId());
} }
} return RespBean.ok("添加评分标准成功"); }
return RespBean.ok("添加评分标准成功");
} }
@PostMapping("/addProblem") @PostMapping("/addProblem")
public RespBean addProblem(@RequestBody Problem problem, HttpServletRequest request) { public RespBean addProblem(@RequestBody Problem problem, HttpServletRequest request) {
String title= problem.getTitle(); String title = problem.getTitle();
//作业名称不能重复 //作业名称不能重复
String result= String result =
problemServiceI.findProblemByTitle(title); problemServiceI.findProblemByTitle(title);
if(result.equals("true")) if (result.equals("true"))
return RespBean.error( return RespBean.error(
"不能重复添加相同标题的作业"); "不能重复添加相同标题的作业");
//添加作业 //添加作业
@ -61,20 +64,21 @@ public class ProblemController {
problem.setAdminuserId(Integer.parseInt(userId)); problem.setAdminuserId(Integer.parseInt(userId));
problemServiceI.addProblem(problem); problemServiceI.addProblem(problem);
//更新评分标准标中的problemId //更新评分标准标中的problemId
List<Problem> problems= List<Problem> problems =
problemServiceI.findProblemIdByTitle(title); problemServiceI.findProblemIdByTitle(title);
if(problems.size()>1){ if (problems.size() > 1) {
problemServiceI.updateProblemId(problems.get(0).getId()); problemServiceI.updateProblemId(problems.get(0).getId());
}else{ } else {
for(Problem problem1:problems){ for (Problem problem1 : problems) {
problemServiceI.updateProblemId(problem1.getId()); problemServiceI.updateProblemId(problem1.getId());
} }
} }
return RespBean.ok("添加作业成功"); return RespBean.ok("添加作业成功");
} }
@PostMapping("/findScoringRubricNoStandardId") @PostMapping("/findScoringRubricNoStandardId")
public RespBean findScoringRubricNoStandardId() { public RespBean findScoringRubricNoStandardId() {
List<UScoringRubric> uScoringRubricList= List<UScoringRubric> uScoringRubricList =
problemServiceI.findScoringRubricNoStandardId(); problemServiceI.findScoringRubricNoStandardId();
if (uScoringRubricList != null) { if (uScoringRubricList != null) {
return RespBean.ok("获取评分细则列表成功!", return RespBean.ok("获取评分细则列表成功!",
@ -84,9 +88,10 @@ public class ProblemController {
} }
} }
@PostMapping("/findScoringStandardNoProblemId") @PostMapping("/findScoringStandardNoProblemId")
public RespBean findScoringStandardNoProblemId() { public RespBean findScoringStandardNoProblemId() {
List<UScoringStandard> uScoringStandardList= List<UScoringStandard> uScoringStandardList =
problemServiceI.findScoringStandardNoProblemId(); problemServiceI.findScoringStandardNoProblemId();
if (uScoringStandardList != null) { if (uScoringStandardList != null) {
return RespBean.ok("获取评分标准列表成功!", return RespBean.ok("获取评分标准列表成功!",
@ -96,10 +101,11 @@ public class ProblemController {
} }
} }
@PostMapping( @PostMapping(
"/findScoringStandardByProblemId") "/findScoringStandardByProblemId")
public RespBean findScoringStandardByProblemId(@RequestBody PMProblem pmProblem) { public RespBean findScoringStandardByProblemId(@RequestBody PMProblem pmProblem) {
List<UScoringStandard> uScoringStandardList= List<UScoringStandard> uScoringStandardList =
problemServiceI.findScoringStandardByProblemId(pmProblem.getId()); problemServiceI.findScoringStandardByProblemId(pmProblem.getId());
if (uScoringStandardList != null) { if (uScoringStandardList != null) {
return RespBean.ok("获取评分标准列表成功!", return RespBean.ok("获取评分标准列表成功!",
@ -109,17 +115,18 @@ public class ProblemController {
} }
} }
@PostMapping("/editProblem") @PostMapping("/editProblem")
public RespBean editProblem(@RequestBody PMProblem pmProblem) { public RespBean editProblem(@RequestBody PMProblem pmProblem) {
Integer id= pmProblem.getId(); Integer id = pmProblem.getId();
String title= pmProblem.getTitle(); String title = pmProblem.getTitle();
String description= pmProblem.getDescription(); String description = pmProblem.getDescription();
if(problemServiceI.findProblemByTitle(title,id)=="true"){ if (problemServiceI.findProblemByTitle(title, id) == "true") {
return RespBean.ok("作业名称重复"); return RespBean.ok("作业名称重复");
} }
boolean result = boolean result =
problemServiceI.editProblem(title, problemServiceI.editProblem(title,
description,id); description, id);
if (result == true) { if (result == true) {
return RespBean.ok("编辑作业成功", result); return RespBean.ok("编辑作业成功", result);
} else { } else {
@ -128,6 +135,7 @@ public class ProblemController {
} }
} }
@PostMapping("/deleteProblem") @PostMapping("/deleteProblem")
public RespBean deleteCourse(@RequestBody PMProblem pmProblem) { public RespBean deleteCourse(@RequestBody PMProblem pmProblem) {
problemServiceI.deleteProblem(pmProblem.getId()); problemServiceI.deleteProblem(pmProblem.getId());
@ -136,60 +144,67 @@ public class ProblemController {
//那么学生提交该作业的记录也要删除 //那么学生提交该作业的记录也要删除
return RespBean.ok("删除成功"); return RespBean.ok("删除成功");
} }
@PostMapping("/deleteScoringRubric") @PostMapping("/deleteScoringRubric")
public RespBean deleteScoringRubric(){ public RespBean deleteScoringRubric() {
problemServiceI.deleteScoringRubric(); problemServiceI.deleteScoringRubric();
return RespBean.ok("删除评分细则成功"); return RespBean.ok("删除评分细则成功");
} }
@PostMapping("/deleteScoringStandard") @PostMapping("/deleteScoringStandard")
public RespBean deleteScoringStandrd(){ public RespBean deleteScoringStandrd() {
problemServiceI.deleteScoringStandard(); problemServiceI.deleteScoringStandard();
return RespBean.ok("删除评分标准成功"); return RespBean.ok("删除评分标准成功");
} }
@PostMapping("/findAllProblemByCourseId") @PostMapping("/findAllProblemByCourseId")
public RespBean findAllProblemByCourseId(@RequestBody PMProblem pmProblem){ public RespBean findAllProblemByCourseId(@RequestBody PMProblem pmProblem) {
// if (pmProblem.getPageNum() < 1 || pmProblem.getPageSize() < 1) // if (pmProblem.getPageNum() < 1 || pmProblem.getPageSize() < 1)
// return RespBean.error("参数错误!"); // return RespBean.error("参数错误!");
DataGrid dataGrid= problemServiceI.findProblemByCourseId(pmProblem); DataGrid dataGrid = problemServiceI.findProblemByCourseId(pmProblem);
return RespBean.ok("查询作业库成功",dataGrid); return RespBean.ok("查询作业库成功", dataGrid);
} }
@PostMapping( @PostMapping(
"/findAllProblemByCourseIdAndClassId") "/findAllProblemByCourseIdAndClassId")
public RespBean findAllProblemByCourseIdAndClassId(@RequestBody PMProblem pmProblem){ public RespBean findAllProblemByCourseIdAndClassId(@RequestBody PMProblem pmProblem) {
DataGrid dataGrid= DataGrid dataGrid =
problemServiceI.findProblemByCourseIdAndClassId(pmProblem); problemServiceI.findProblemByCourseIdAndClassId(pmProblem);
return RespBean.ok("查询作业列表成功",dataGrid); return RespBean.ok("查询作业列表成功", dataGrid);
} }
@PostMapping( @PostMapping(
"/addTime") "/addTime")
public RespBean addTime(@RequestBody PMPostProblem pmPostProblem){ public RespBean addTime(@RequestBody PMPostProblem pmPostProblem) {
int num = int num =
problemServiceI.editSubmitReport(pmPostProblem.getEndTime(),pmPostProblem.getProblemId(),pmPostProblem.getStudentId()); problemServiceI.editSubmitReport(pmPostProblem.getEndTime(), pmPostProblem.getProblemId(), pmPostProblem.getStudentId());
if(num == 1) if (num == 1)
return RespBean.ok("加时成功"); return RespBean.ok("加时成功");
else else
return RespBean.error("加时失败"); return RespBean.error("加时失败");
} }
@PostMapping("/findProblemById") @PostMapping("/findProblemById")
public RespBean findProblemById(@RequestBody PMProblem pmProblem){ public RespBean findProblemById(@RequestBody PMProblem pmProblem) {
List<Problem> problems= List<Problem> problems =
problemServiceI.findProblemById(pmProblem.getId()); problemServiceI.findProblemById(pmProblem.getId());
return RespBean.ok("查询作业标题成功", return RespBean.ok("查询作业标题成功",
problems.get(0)); problems.get(0));
} }
@PostMapping("/findPostProblem") @PostMapping("/findPostProblem")
public RespBean findPostProblem(@RequestBody PMPostProblem pmPostProblem){ public RespBean findPostProblem(@RequestBody PMPostProblem pmPostProblem) {
List<PostProblem> postProblems=problemServiceI.findPostProblem(pmPostProblem.getProblemId(),pmPostProblem.getClassId()); List<PostProblem> postProblems = problemServiceI.findPostProblem(pmPostProblem.getProblemId(), pmPostProblem.getClassId());
List<PMPostProblem>pmPostProblems= List<PMPostProblem> pmPostProblems =
new ArrayList<>(); new ArrayList<>();
for(PostProblem postProblem:postProblems){ for (PostProblem postProblem : postProblems) {
PMPostProblem pmPostProblem1= PMPostProblem pmPostProblem1 =
new PMPostProblem(); new PMPostProblem();
if(postProblem.getAllow()==0) if (postProblem.getAllow() == 0)
pmPostProblem1.setAllow(false); pmPostProblem1.setAllow(false);
else pmPostProblem1.setAllow(true); else pmPostProblem1.setAllow(true);
pmPostProblem1.setStartTime(postProblem.getStartTime()); pmPostProblem1.setStartTime(postProblem.getStartTime());
@ -201,28 +216,31 @@ public class ProblemController {
pmPostProblems.get(0)); pmPostProblems.get(0));
} }
@PostMapping("/postProblem") @PostMapping("/postProblem")
public RespBean postProblem(@RequestBody PMPostProblem pmPostProblem){ public RespBean postProblem(@RequestBody PMPostProblem pmPostProblem) {
List<Integer> classList= List<Integer> classList =
pmPostProblem.getClassList(); pmPostProblem.getClassList();
for(Integer classId:classList){ for (Integer classId : classList) {
problemServiceI.postProblem(pmPostProblem,classId); problemServiceI.postProblem(pmPostProblem, classId);
} }
return RespBean.ok("发布作业成功"); return RespBean.ok("发布作业成功");
} }
@PostMapping("/updateSetup") @PostMapping("/updateSetup")
public RespBean updateSetup(@RequestBody PMPostProblem pmPostProblem){ public RespBean updateSetup(@RequestBody PMPostProblem pmPostProblem) {
int num = int num =
problemServiceI.editPostProblem(pmPostProblem.getClassId(),pmPostProblem.getProblemId(),pmPostProblem.getStartTime(),pmPostProblem.getEndTime(),pmPostProblem.getAllow()); problemServiceI.editPostProblem(pmPostProblem.getClassId(), pmPostProblem.getProblemId(), pmPostProblem.getStartTime(), pmPostProblem.getEndTime(), pmPostProblem.getAllow());
if(num == 1) if (num == 1)
return RespBean.ok("修改作业设置成功"); return RespBean.ok("修改作业设置成功");
else else
return RespBean.error("修改作业设置失败"); return RespBean.error("修改作业设置失败");
} }
//获取作业列表 //获取作业列表
@GetMapping("/getExamList") @GetMapping("/getExamList")
public RespBean getExamList(Integer pageNum,Integer pageSize, HttpServletRequest request) { public RespBean getExamList(Integer pageNum, Integer pageSize, HttpServletRequest request) {
if (pageNum < 1 || pageSize < 1) if (pageNum < 1 || pageSize < 1)
return RespBean.error("参数错误!"); return RespBean.error("参数错误!");
PMProblem pMproblem = new PMProblem(); PMProblem pMproblem = new PMProblem();
@ -246,37 +264,38 @@ public class ProblemController {
problemServiceI.findStatusByStudentIdAndProblems(Integer.parseInt(userId), pMproblems); problemServiceI.findStatusByStudentIdAndProblems(Integer.parseInt(userId), pMproblems);
//分页处理 //分页处理
DataGrid dataGrid = problemServiceI.dataGrid(pMproblems,pMproblem); DataGrid dataGrid = problemServiceI.dataGrid(pMproblems, pMproblem);
if (dataGrid != null) { if (dataGrid != null) {
return RespBean.ok("获取作业列表成功!",dataGrid); return RespBean.ok("获取作业列表成功!", dataGrid);
} else { } else {
return RespBean.error("获取作业列表失败!"); return RespBean.error("获取作业列表失败!");
} }
} }
@PostMapping("findStudentSubmit")
public RespBean findStudentSubmit(@RequestBody PMStudentSubmit pmStudentSubmit){ @PostMapping("findStudentSubmit")
public RespBean findStudentSubmit(@RequestBody PMStudentSubmit pmStudentSubmit) {
DataGrid dataGrid; DataGrid dataGrid;
if(pmStudentSubmit.getSelectedStatus().equals("weijiao")) if (pmStudentSubmit.getSelectedStatus().equals("weijiao"))
dataGrid= dataGrid =
problemServiceI.findWeijiaoList(pmStudentSubmit); problemServiceI.findWeijiaoList(pmStudentSubmit);
else dataGrid= else dataGrid =
problemServiceI.findYijiaoList(pmStudentSubmit); problemServiceI.findYijiaoList(pmStudentSubmit);
return RespBean.ok("获取学生提交报告列表成功!", return RespBean.ok("获取学生提交报告列表成功!",
dataGrid); dataGrid);
} }
//根据作业id和学生id获取学生当前报告成绩排名 //根据作业id和学生id获取学生当前报告成绩排名
@GetMapping("/getStudentRank") @GetMapping("/getStudentRank")
public RespBean getStudentRank(Integer examId,HttpServletRequest request){ public RespBean getStudentRank(Integer examId, HttpServletRequest request) {
DecodeToken decodeToken = new DecodeToken(request); DecodeToken decodeToken = new DecodeToken(request);
String UserId = decodeToken.getUserId(); String UserId = decodeToken.getUserId();
int userId=Integer.parseInt(UserId); int userId = Integer.parseInt(UserId);
UReportSubmitted ureportsubmitted= UReportSubmitted ureportsubmitted =
problemServiceI.findScoreAndRankByIds(examId,userId); problemServiceI.findScoreAndRankByIds(examId, userId);
if (ureportsubmitted != null) { if (ureportsubmitted != null) {
return RespBean.ok("查询成绩排名成功!",ureportsubmitted); return RespBean.ok("查询成绩排名成功!", ureportsubmitted);
} else { } else {
return RespBean.error("查询成绩排名失败!"); return RespBean.error("查询成绩排名失败!");
} }
@ -284,28 +303,25 @@ public RespBean findStudentSubmit(@RequestBody PMStudentSubmit pmStudentSubmit){
//获取当前作业班级排名信息 //获取当前作业班级排名信息
@GetMapping("/getClassRanks") @GetMapping("/getClassRanks")
public RespBean getClassRanks(Integer pageNum,Integer pageSize,Integer classId,Integer examId){ public RespBean getClassRanks(Integer pageNum, Integer pageSize, Integer classId, Integer examId) {
if (pageNum < 1 || pageSize < 1) List<UReportSubmitted> uReportsSubmitted = problemServiceI.findClassRankByIds(examId, classId);
return RespBean.error("参数错误!");
UReportSubmitted uReportSubmitted=new UReportSubmitted();
uReportSubmitted.setPageNum(pageNum);
uReportSubmitted.setPageSize(pageSize);
List<UReportSubmitted> uReportsSubmitted=problemServiceI.findClassRankByIds(examId,classId);
// //分页处理
// DataGrid dataGrid = problemServiceI.dataGrid(pMproblems,pMproblem);
//
if (uReportsSubmitted != null) { if (uReportsSubmitted != null) {
return RespBean.ok("获取班级排名列表成功!",uReportsSubmitted); return RespBean.ok("获取班级排名列表成功!", uReportsSubmitted);
} else { } else {
return RespBean.error("获取班级排名列表失败!"); return RespBean.error("获取班级排名列表失败!");
} }
} }
//获取当前作业班级排名信息
@GetMapping("/getProblemInfo")
public RespBean getProblemInfo(Integer classId, Integer examId) {
List<PostProblem> PostProblem = problemServiceI.findPostProblem(examId,classId);
if (!PostProblem.isEmpty()) {
// 直接获取列表中的第一个元素
PostProblem postProblem = PostProblem.get(0);
return RespBean.ok("获取实验具体信息成功!", postProblem);
} else {
return RespBean.error("获取实验具体信息失败!");
}
}
} }

View File

@ -17,21 +17,31 @@ public interface ProblemDaoI extends BaseDaoI<Problem> {
List<ReportSubmitted> findPMProblemStatusesByStudentIdAndProblemsIds(List<Integer> problemIds, Integer studentId); List<ReportSubmitted> findPMProblemStatusesByStudentIdAndProblemsIds(List<Integer> problemIds, Integer studentId);
UReportSubmitted getScoreAndRankByIds(int problemId, int userId); UReportSubmitted getScoreAndRankByIds(int problemId, int userId);
List<UReportSubmitted> getClassRankByIds(int problemId, int classId); List<UReportSubmitted> getClassRankByIds(int problemId, int classId);
public String findProblemByTitle(String title); public String findProblemByTitle(String title);
public String findProblemByTitle(String title,Integer id);
public String findProblemByTitle(String title, Integer id);
public List<Problem> findProblemIdByTitle(String title); public List<Problem> findProblemIdByTitle(String title);
public void addProblem(Problem problem); public void addProblem(Problem problem);
public long getAllProblemsNum(int courseId); public long getAllProblemsNum(int courseId);
List<Object[]> getProblemsByPage(Integer courseId, List<Object[]> getProblemsByPage(Integer courseId,
Integer classId,String selectedStatus, Integer classId, String selectedStatus,
int page, int rows); int page, int rows);
List<Problem> getProblemsByPage(Integer courseId,String title, List<Problem> getProblemsByPage(Integer courseId, String title,
int page, int rows); int page, int rows);
public List<Problem> findProblemById(int id); public List<Problem> findProblemById(int id);
public boolean editProblem(String title, public boolean editProblem(String title,
String description,Integer id); String description, Integer id);
public void deleteProblem(Integer id); public void deleteProblem(Integer id);
} }

View File

@ -289,6 +289,7 @@ public class ProblemDaoImpl extends BaseDaoImpl<Problem> implements ProblemDaoI{
"delete from Problem where id=" + id; "delete from Problem where id=" + id;
this.executeHql(hql); this.executeHql(hql);
} }
@Override @Override
public void addProblem(Problem problem) { public void addProblem(Problem problem) {
// TODO Auto-generated method stub // TODO Auto-generated method stub

View File

@ -319,6 +319,8 @@ public class ProblemServiceImpl implements ProblemServiceI {
public int editSubmitReport(LocalDateTime addTime,int problemId,int studentId){ public int editSubmitReport(LocalDateTime addTime,int problemId,int studentId){
return studentSubmitDao.updateAddTime(addTime,problemId,studentId); return studentSubmitDao.updateAddTime(addTime,problemId,studentId);
} }
@Override @Override
public DataGrid findProblemByCourseIdAndClassId(PMProblem pmProblem){ public DataGrid findProblemByCourseIdAndClassId(PMProblem pmProblem){
DataGrid dg = new DataGrid(); DataGrid dg = new DataGrid();