给撤回按钮加了点判断逻辑。
This commit is contained in:
parent
a30ecee6a5
commit
9ced850b88
|
|
@ -118,8 +118,7 @@ const onWithdraw = () => { //撤回提交
|
|||
emit('clickWithdraw');
|
||||
ElMessage.success('撤回成功!');
|
||||
} catch (error) {
|
||||
console.error("Failed to Withdraw:", error);
|
||||
ElMessage.error('撤回时发生错误!');
|
||||
|
||||
}
|
||||
}).catch(() => {
|
||||
// 用户取消撤回
|
||||
|
|
|
|||
|
|
@ -466,8 +466,15 @@ public class ProblemController {
|
|||
String UserId = decodeToken.getUserId();
|
||||
int userId = Integer.parseInt(UserId);
|
||||
submitReport.setStudentId(userId);
|
||||
|
||||
if (problemServiceI.findReportSubmitted(submitReport)) {
|
||||
String submissionstatus=problemServiceI.findReportSubmittedStatus(submitReport);
|
||||
if(submissionstatus.equals("2")){
|
||||
return RespBean.error("实验报告已撤回!");
|
||||
}
|
||||
else if(submissionstatus.equals("0")){
|
||||
return RespBean.error("尚未提交实验报告!");
|
||||
}
|
||||
else{
|
||||
boolean result = problemServiceI.withdrawSubmitInfo(submitReport);
|
||||
if (result) {
|
||||
return RespBean.ok("撤回信息更新成功");
|
||||
|
|
@ -475,6 +482,7 @@ public class ProblemController {
|
|||
return RespBean.error("撤回信息更新失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
return RespBean.error("未找到该学生提交信息!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,5 @@ public interface SubmitReportDaoI extends BaseDaoI<SubmitReport> {
|
|||
public boolean updateReportSubmitted(SubmitReport submitReport);
|
||||
public boolean updateReportSubmittedForSubmission(SubmitReport submitReport);
|
||||
public boolean withdrawReportSubmitted(SubmitReport submitReport);
|
||||
public String getReportSubmittedStatus(SubmitReport submitReport);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -357,4 +357,24 @@ public class SubmitReportDaoImpl extends BaseDaoImpl<SubmitReport> implements Su
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReportSubmittedStatus(SubmitReport submitReport) {
|
||||
Session session = this.getCurrentSession();
|
||||
String submissionStatus = null; // 默认为 null,表示没有找到状态或发生错误
|
||||
try {
|
||||
// 构建查询语句
|
||||
String hql = "SELECT submissionStatus FROM SubmitReport WHERE problemId = :problemId AND studentId = :studentId AND adminuserId = :adminuserId";
|
||||
|
||||
Query<String> query = session.createQuery(hql, String.class);
|
||||
query.setParameter("problemId", submitReport.getProblemId());
|
||||
query.setParameter("studentId", submitReport.getStudentId());
|
||||
query.setParameter("adminuserId", submitReport.getAdminuserId());
|
||||
|
||||
submissionStatus = query.uniqueResult();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return submissionStatus;
|
||||
}
|
||||
}
|
||||
|
|
@ -510,6 +510,11 @@ public int redoReport(PMReviewMessage pmReviewMessage){
|
|||
return studentSubmitDao.withdrawReportSubmitted(submitReport);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findReportSubmittedStatus(SubmitReport submitReport) {
|
||||
return studentSubmitDao.getReportSubmittedStatus(submitReport);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int editPostProblem(int classId,
|
||||
int problemId,LocalDateTime startTime,LocalDateTime endTime,boolean allow){
|
||||
|
|
|
|||
|
|
@ -61,4 +61,5 @@ public interface ProblemServiceI {
|
|||
boolean updateSubmitInfoToProps(SubmitReport submitReport);//学生更新报告信息(保存,之前保存过)
|
||||
boolean updateSubmitInfoForSubmission(SubmitReport submitReport);//学生提交报告
|
||||
boolean withdrawSubmitInfo(SubmitReport submitReport);//学生撤回报告
|
||||
String findReportSubmittedStatus(SubmitReport submitReport);//查询该学生之前已经提交过该问题的报告状态
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue