批阅提交、跳转下一份、打回功能实现

This commit is contained in:
zlm133588 2025-04-10 22:08:28 +08:00
parent 00562b42e0
commit dca09393fe
9 changed files with 202 additions and 28 deletions

View File

@ -31,8 +31,8 @@ Node 安装 18 及以上
### Build and Release
```shell
# Prod Environment
pnpm build
4. 导出功能的依赖
```shell
npm install xlsx file-saver

View File

@ -93,4 +93,7 @@ export default {
addTime:(data)=>request.post('/problem/addTime',data),
findProblemReview:(data)=>request.post('/problem/findProblemReview',data),
findScore:(data)=>request.post('/problem/findScore',data),
reviewProblem:(data)=>request.post('/problem/reviewProblem',data),
redoReport:(data)=>request.post('/problem/redoReport',data),
findNextReport:(data)=>request.post('/problem/findNextReport',data),
}

View File

@ -49,8 +49,8 @@
<n-form-item style='width: 20%'>
<label style='width: 100px'>教师评分:
</label>
<n-input v-model="problemReviewValue.score"
/>
<n-input
v-model:value="problemReviewValue.score" />
</n-form-item>
</div>
<div flex>
@ -74,7 +74,7 @@
style='width: 50%;margin-left: 30px'>
<n-input
type="textarea"
v-model="problemReviewValue.comment"
v-model:value="problemReviewValue.comment"
rows="6"
:autosize="{ minRows: 6, maxRows: 10 }"
/>
@ -136,8 +136,8 @@ const problemReviewValue=ref({
banji:'',
autoscore:90,
autocomment:``,
score:'',
comment:'',
score:"",
comment:"",
attachment:''
})
@ -170,23 +170,60 @@ const down = async() =>{
} catch (err) {
}
}
// const submit =async ()=>{
// if(problemInfoValue.value.name!==''){
// try {
// await api.Addproblem({
// ...problemInfoValue.value
// })
// $message.success("添加课程成功")
// tagsStore.removeTag(path.value)
const submit =async ()=>{
if(problemReviewValue.value.score!==''){
try {
await api.reviewProblem({
...problemReviewValue.value,
studentId:studentId,
problemId:problemId,
})
$message.success("批阅成功")
tagsStore.removeTag(path.value)
// await router.push({name: 'AdminProblemList'})
// } catch (err) {
// tagsStore.removeTag(path.value)
} catch (err) {
tagsStore.removeTag(path.value)
// await router.push({name: 'AdminProblemList'})
// }
// }else {
// $message.error("作业名称不能为空")
// }
// }
}
}else {
$message.error("教师评分不能为空")
}
}
const submitAndNext =async ()=>{
if(problemReviewValue.value.score!==''){
await api.reviewProblem({
...problemReviewValue.value,
studentId:studentId,
problemId:problemId,
})
$message.success("批阅成功")
}else {
$message.error("教师评分不能为空")
}
const res =await api.findNextReport({
problemId:problemId
})
if(res.message=="所有报告都批阅完成")
tagsStore.removeTag(path.value)
else
problemReviewValue.value=res.data
loading.value=false
}
const redo=async ()=>{
try {
await api.redoReport({
studentId:studentId,
problemId:problemId,
})
$message.success("打回成功")
tagsStore.removeTag(path.value)
// await router.push({name: 'AdminProblemList'})
} catch (err) {
tagsStore.removeTag(path.value)
// await router.push({name: 'AdminProblemList'})
}
}
const queryByPage = async () => {
loading.value = true
try {

View File

@ -127,6 +127,9 @@ const paginationReactive = reactive({
}
})
const columns=ref([])
const updateColumns=()=>{
if(selectedStatus.value==='weijiao'){
columns.value = [
@ -289,6 +292,23 @@ const onReview=async (studentId)=>{
const {id} = studentId
await router.push({name: 'AdminProblemReview', query:{classId: classId,problemId:problemId,courseId:courseId,studentId:id}})
}
const onBack=async (studentId)=>{
const {id} = studentId
try {
await api.redoReport({
studentId:id,
problemId:problemId,
})
$message.success("打回成功")
filterData()
// tagsStore.removeTag(path.value)
// await router.push({name: 'AdminProblemList'})
} catch (err) {
filterData()
// tagsStore.removeTag(path.value)
// await router.push({name: 'AdminProblemList'})
}
}
const onDeleteClass = async (classId)=>{
try {
await api.remove({ids:classId.username})

View File

@ -186,7 +186,28 @@ public class ProblemController {
return RespBean.error("加时失败");
}
@PostMapping(
"/reviewProblem")
public RespBean reviewProblem(@RequestBody PMReviewMessage pmReviewMessage) {
int num =
problemServiceI.editScoreAndComment(pmReviewMessage);
if (num == 1)
return RespBean.ok("批阅成功");
else
return RespBean.error("批阅失败");
}
@PostMapping(
"/redoReport")
public RespBean redoReport(@RequestBody PMReviewMessage pmReviewMessage) {
int num =
problemServiceI.redoReport(pmReviewMessage);
if (num == 1)
return RespBean.ok("打回成功");
else
return RespBean.error("打回失败");
}
@PostMapping("/findProblemById")
public RespBean findProblemById(@RequestBody PMProblem pmProblem) {
List<Problem> problems =
@ -312,6 +333,20 @@ public class ProblemController {
return RespBean.ok("获取批阅报告成功!",
reviewMessage);
}
@PostMapping("findNextReport")
public RespBean findNextReport(@RequestBody PMReviewMessage pmReviewMessage){
//找到下一个studentId
int studentId=
problemServiceI.findNextId(pmReviewMessage.getProblemId());
if(studentId==0)
return RespBean.error("所有报告都批阅完成");
else pmReviewMessage.setStudentId(studentId);
//根据studentId和problemId查找
PMReviewMessage reviewMessage=
problemServiceI.findProblemReview(pmReviewMessage);
return RespBean.ok("获取下一份批阅报告成功!",
reviewMessage);
}
//根据作业id和学生id获取学生当前报告成绩排名
@GetMapping("/getStudentRank")

View File

@ -12,7 +12,10 @@ public interface SubmitReportDaoI extends BaseDaoI<SubmitReport> {
public List<Object[]> findWeijiaoList(PMStudentSubmit pmStudentSubmit);
public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit);
public int updateAddTime(LocalDateTime addTime,int problemId,int studentId);
public int editScoreAndComment(PMReviewMessage pmReviewMessage);
public int redoReport(PMReviewMessage pmReviewMessage);
public List<Object[]> findProblemReview(PMReviewMessage pmReviewMessage);
public List<Object[]> findScoreList(PMStudentSubmit pmStudentSubmit);
public List<Integer> findNextId(int problemId);
}

View File

@ -8,6 +8,7 @@ import com.example.aes.user.dao.impl.BaseDaoImpl;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import javax.persistence.criteria.CriteriaBuilder;
import java.time.LocalDateTime;
import java.util.List;
@ -74,6 +75,44 @@ String chineseName=
return num;
}
@Override
public int editScoreAndComment(PMReviewMessage pmReviewMessage){
Float score= pmReviewMessage.getScore();
String comment=
pmReviewMessage.getComment();
String hql= "UPDATE SubmitReport sr SET" +
" sr.score= :score,sr" +
".comment=:comment,sr" +
".submissionStatus='已批阅' "
+ "WHERE sr.problemId = " +
":problemId" +
" AND sr.studentId= :studentId";
Query q = this.getCurrentSession().createQuery(hql);
q.setParameter("score",score);
q.setParameter("comment",comment);
q.setParameter("problemId",
pmReviewMessage.getProblemId());
q.setParameter("studentId",
pmReviewMessage.getStudentId());
int num = q.executeUpdate();
return num;
}
@Override
public int redoReport(PMReviewMessage pmReviewMessage){
String hql= "UPDATE SubmitReport sr set" +
" sr.submissionStatus='已领取'," +
"sr.submissionTime=null " +
"WHERE sr.problemId = " +
":problemId" +
" AND sr.studentId= :studentId";
Query q = this.getCurrentSession().createQuery(hql);
q.setParameter("problemId",
pmReviewMessage.getProblemId());
q.setParameter("studentId",
pmReviewMessage.getStudentId());
int num = q.executeUpdate();
return num;
}
@Override
public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit){
int classId= pmStudentSubmit.getClassId();
int problemId= pmStudentSubmit.getProblemId();
@ -186,4 +225,23 @@ String chineseName=
query.setParameter("problemId", problemId);
return query.getResultList();
}
@Override
public List<Integer> findNextId(int problemId){
String hql="SELECT " +
"sr.studentId " +
"FROM Users u " +
"INNER JOIN " +
" SubmitReport sr ON " +
"sr.studentId " +
"= u.id " +
"WHERE " +
" sr.problemId =:problemId " +
"and " +
"sr.submissionTime is not null " +
"and sr.submissionStatus='待批阅'";
Query q = this.getCurrentSession().createQuery(hql);
// query.setParameter("studentId", studentId);
q.setParameter("problemId", problemId);
return q.list();
}
}

View File

@ -320,7 +320,14 @@ public class ProblemServiceImpl implements ProblemServiceI {
return studentSubmitDao.updateAddTime(addTime,problemId,studentId);
}
@Override
public int editScoreAndComment(PMReviewMessage pmReviewMessage){
return studentSubmitDao.editScoreAndComment(pmReviewMessage);
}
@Override
public int redoReport(PMReviewMessage pmReviewMessage){
return studentSubmitDao.redoReport(pmReviewMessage);
}
@Override
public DataGrid findProblemByCourseIdAndClassId(PMProblem pmProblem){
DataGrid dg = new DataGrid();
@ -464,6 +471,14 @@ public class ProblemServiceImpl implements ProblemServiceI {
}return scoreList;
}
@Override
public int findNextId(int problemId){
List<Integer> nextList=
studentSubmitDao.findNextId(problemId);
if(nextList.size()!=0)
return studentSubmitDao.findNextId(problemId).get(0);
else return 0;
}
@Override
public int editPostProblem(int classId,
int problemId,LocalDateTime startTime,LocalDateTime endTime,boolean allow){
int n=0;

View File

@ -51,5 +51,8 @@ public interface ProblemServiceI {
public DataGrid findYijiaoList(PMStudentSubmit pmStudentSubmit);
public PMReviewMessage findProblemReview(PMReviewMessage pmReviewMessage);
public int editSubmitReport(LocalDateTime addTime,int problemId,int studentId);
public int editScoreAndComment(PMReviewMessage pmReviewMessage);
public int redoReport(PMReviewMessage pmReviewMessage);
public List<Float> findScoreList(PMStudentSubmit pmStudentSubmit);
public int findNextId(int problemId);
}