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

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

@ -30,13 +30,13 @@ Node 安装 18 及以上
### Build and Release ### Build and Release
```shell ```shell
# Prod Environment pnpm build
pnpm build
4.导出功能的依赖 4. 导出功能的依赖
```shell ```shell
npm install xlsx file-saver npm install xlsx file-saver
5.展示图标的依赖 5. 展示图标的依赖
```shell ```shell
npm install echarts npm install echarts

View File

@ -93,4 +93,7 @@ export default {
addTime:(data)=>request.post('/problem/addTime',data), addTime:(data)=>request.post('/problem/addTime',data),
findProblemReview:(data)=>request.post('/problem/findProblemReview',data), findProblemReview:(data)=>request.post('/problem/findProblemReview',data),
findScore:(data)=>request.post('/problem/findScore',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%'> <n-form-item style='width: 20%'>
<label style='width: 100px'>教师评分: <label style='width: 100px'>教师评分:
</label> </label>
<n-input v-model="problemReviewValue.score" <n-input
/> v-model:value="problemReviewValue.score" />
</n-form-item> </n-form-item>
</div> </div>
<div flex> <div flex>
@ -74,7 +74,7 @@
style='width: 50%;margin-left: 30px'> style='width: 50%;margin-left: 30px'>
<n-input <n-input
type="textarea" type="textarea"
v-model="problemReviewValue.comment" v-model:value="problemReviewValue.comment"
rows="6" rows="6"
:autosize="{ minRows: 6, maxRows: 10 }" :autosize="{ minRows: 6, maxRows: 10 }"
/> />
@ -136,8 +136,8 @@ const problemReviewValue=ref({
banji:'', banji:'',
autoscore:90, autoscore:90,
autocomment:``, autocomment:``,
score:'', score:"",
comment:'', comment:"",
attachment:'' attachment:''
}) })
@ -170,23 +170,60 @@ const down = async() =>{
} catch (err) { } catch (err) {
} }
} }
// const submit =async ()=>{ const submit =async ()=>{
// if(problemInfoValue.value.name!==''){ if(problemReviewValue.value.score!==''){
// try { try {
// await api.Addproblem({ await api.reviewProblem({
// ...problemInfoValue.value ...problemReviewValue.value,
// }) studentId:studentId,
// $message.success("添加课程成功") problemId:problemId,
// tagsStore.removeTag(path.value) })
// await router.push({name: 'AdminProblemList'}) $message.success("批阅成功")
// } catch (err) { tagsStore.removeTag(path.value)
// tagsStore.removeTag(path.value) // await router.push({name: 'AdminProblemList'})
// await router.push({name: 'AdminProblemList'}) } catch (err) {
// } tagsStore.removeTag(path.value)
// }else { // await router.push({name: 'AdminProblemList'})
// $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 () => { const queryByPage = async () => {
loading.value = true loading.value = true
try { try {

View File

@ -127,6 +127,9 @@ const paginationReactive = reactive({
} }
}) })
const columns=ref([]) const columns=ref([])
const updateColumns=()=>{ const updateColumns=()=>{
if(selectedStatus.value==='weijiao'){ if(selectedStatus.value==='weijiao'){
columns.value = [ columns.value = [
@ -289,6 +292,23 @@ const onReview=async (studentId)=>{
const {id} = studentId const {id} = studentId
await router.push({name: 'AdminProblemReview', query:{classId: classId,problemId:problemId,courseId:courseId,studentId:id}}) 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)=>{ const onDeleteClass = async (classId)=>{
try { try {
await api.remove({ids:classId.username}) await api.remove({ids:classId.username})

View File

@ -186,7 +186,28 @@ public class ProblemController {
return RespBean.error("加时失败"); 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") @PostMapping("/findProblemById")
public RespBean findProblemById(@RequestBody PMProblem pmProblem) { public RespBean findProblemById(@RequestBody PMProblem pmProblem) {
List<Problem> problems = List<Problem> problems =
@ -312,6 +333,20 @@ public class ProblemController {
return RespBean.ok("获取批阅报告成功!", return RespBean.ok("获取批阅报告成功!",
reviewMessage); 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获取学生当前报告成绩排名 //根据作业id和学生id获取学生当前报告成绩排名
@GetMapping("/getStudentRank") @GetMapping("/getStudentRank")

View File

@ -12,7 +12,10 @@ public interface SubmitReportDaoI extends BaseDaoI<SubmitReport> {
public List<Object[]> findWeijiaoList(PMStudentSubmit pmStudentSubmit); public List<Object[]> findWeijiaoList(PMStudentSubmit pmStudentSubmit);
public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit); public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit);
public int updateAddTime(LocalDateTime addTime,int problemId,int studentId); 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[]> findProblemReview(PMReviewMessage pmReviewMessage);
public List<Object[]> findScoreList(PMStudentSubmit pmStudentSubmit); 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.hibernate.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.persistence.criteria.CriteriaBuilder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@ -74,6 +75,44 @@ String chineseName=
return num; return num;
} }
@Override @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){ public List<Object[]> findYijiaoList(PMStudentSubmit pmStudentSubmit){
int classId= pmStudentSubmit.getClassId(); int classId= pmStudentSubmit.getClassId();
int problemId= pmStudentSubmit.getProblemId(); int problemId= pmStudentSubmit.getProblemId();
@ -186,4 +225,23 @@ String chineseName=
query.setParameter("problemId", problemId); query.setParameter("problemId", problemId);
return query.getResultList(); 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); 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 @Override
public DataGrid findProblemByCourseIdAndClassId(PMProblem pmProblem){ public DataGrid findProblemByCourseIdAndClassId(PMProblem pmProblem){
DataGrid dg = new DataGrid(); DataGrid dg = new DataGrid();
@ -464,6 +471,14 @@ public class ProblemServiceImpl implements ProblemServiceI {
}return scoreList; }return scoreList;
} }
@Override @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, public int editPostProblem(int classId,
int problemId,LocalDateTime startTime,LocalDateTime endTime,boolean allow){ int problemId,LocalDateTime startTime,LocalDateTime endTime,boolean allow){
int n=0; int n=0;

View File

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