package com.ctgu.controller;
import com.ctgu.common.Const;
import com.ctgu.enums.AccountEnum;
import com.ctgu.model.*;
import com.ctgu.service.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.stream.Collectors;
import static com.ctgu.common.Const.TeacherLevel;
@Controller
@RequestMapping(value = "/manage")
public class ManageController {
private static Log LOG = LogFactory.getLog(ManageController.class);
@Autowired
private AccountService accountService;
@Autowired
private SubjectService subjectService;
@Autowired
private ContestService contestService;
@Autowired
private QuestionService questionService;
@Autowired
private GradeService gradeService;
@Autowired
private PostService postService;
@Autowired
private CommentService commentService;
@Autowired
private ClassService classService;
@Autowired
private QuestionnaireService questionnaireService;
/**
* 管理员登录页
*/
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login(HttpServletRequest request, Model model) {
Account currentAccount = (Account) request.getSession().getAttribute(Const.CURRENT_ACCOUNT);
model.addAttribute(Const.CURRENT_ACCOUNT, currentAccount);
if (currentAccount == null) {
return "manage/manage-login";
} else {
return "redirect:/manage/contest/list";
}
}
/**
* 用户管理
*/
@RequestMapping(value = "/account/list", method = RequestMethod.GET)
public String accountList(HttpServletRequest request,
@RequestParam(value = "page", defaultValue = "1") int page,
Model model) {
Account currentAccount = (Account) request.getSession().getAttribute(Const.CURRENT_ACCOUNT);
//TODO::处理
//currentAccount = accountService.getAccountByUsername("admin");
model.addAttribute(Const.CURRENT_ACCOUNT, currentAccount);
if (currentAccount == null || currentAccount.getLevel() < 1) {
//return "redirect:/";
return "error/404";
} else {
//Map<String, Object> data = accountService.getAccounts(page, Const.accountPageSize);
Map<String, Object> data = accountService.getAccountsByLevel(page, Const.accountPageSize, 1);
model.addAttribute(Const.DATA, data);
return "manage/manage-accountList";
}
}
/**
* 用户管理
*/
@RequestMapping(value="/account/{level}/list", method= RequestMethod.GET)
public String accountLevelList(HttpServletRequest request,
@RequestParam(value = "page", defaultValue = "1") int page,
@PathVariable("level") Integer level,
Model model) {
Account currentAccount = (Account) request.getSession().getAttribute(Const.CURRENT_ACCOUNT);
//TODO::处理
//currentAccount = accountService.getAccountByUsername("admin");
model.addAttribute(Const.CURRENT_ACCOUNT, currentAccount);
if (currentAccount == null || currentAccount.getLevel() < 1) {
//return "redirect:/";
return "error/404";
} else {
//Map<String, Object> data = accountService.getAccounts(page, Const.accountPageSize);
Map<String, Object> data = accountService.getAccountsByLevel(page, Const.accountPageSize, level);
data.put("subjects", subjectService.getSubjects());
model.addAttribute(Const.DATA, data);
return "manage/manage-account" + AccountEnum.getAccountEnum(level).getName() + "List";
}
}
/**
* 考试管理
*/
@RequestMapping(value = "/contest/list", method = RequestMethod.GET)
public String contestList(HttpServletRequest request,
@RequestParam(value = "page", defaultValue = "1") int page,
Model model) {
Account currentAccount = (Account) request.getSession().getAttribute(Const.CURRENT_ACCOUNT);
//TODO::处理
//currentAccount = accountService.getAccountByUsername("admin");
model.addAttribute(Const.CURRENT_ACCOUNT, currentAccount);
if (currentAccount == null || currentAccount.getLevel() < 1) {
//return "redirect:/";
return "error/404";
} else {
Map<String, Object> data = null;
if (currentAccount.getLevel() == AccountEnum.ADMIN.getLevel()) {
data = contestService.getContests(page, Const.contestPageSize);
} else {
data = contestService.getContestsByAccountId(page, Const.subjectPageSize, currentAccount.getId());
}
List<Subject> subjects = subjectService.getSubjects();
data.put("subjects", subjects);
model.addAttribute(Const.DATA, data);
return "manage/manage-contestBoard";
}
}
/**
* 考试管理-查看试题
*/
@RequestMapping(value = "/contest/{contestId}/problems", method = RequestMethod.GET)
public String contestProblemList(HttpServletRequest request,
@PathVariable("contestId") Integer contestId, Model model) {
Account currentAccount = (Account) request.getSession().getAttribute(Const.CURRENT_ACCOUNT);
//TODO::处理
//currentAccount = accountService.getAccountByUsername("admin");
model.addAttribute(Const.CURRENT_ACCOUNT, currentAccount);
if (currentAccount == null || currentAccount.getLevel() < 1) {
//return "redirect:/";
return "error/404";
} else {
Map<String, Object> data = new HashMap<>();
List<Question> questions = questionService.getQuestionsByContestId(contestId);
Contest contest = contestService.getContestById(contestId);
data.put("questionsSize", questions.size());
data.put("questions", questions);
data.put("contest", contest);
model.addAttribute(Const.DATA, data);
return "manage/manage-editContestProblem";
}
}
/**
* 題目管理
*/
@RequestMapping(value = "/question/list", method = RequestMethod.GET)
public String questionList(HttpServletRequest request,
@RequestParam(value = "page", defaultValue = "1") int page,
@RequestParam(value = "content", defaultValue = "") String content,
Model model) {
Account currentAccount = (Account) request.getSession().getAttribute(Const.CURRENT_ACCOUNT);
//TODO::处理
//currentAccount = accountService.getAccountByUsername("admin");
model.addAttribute(Const.CURRENT_ACCOUNT, currentAccount);
if (currentAccount == null || currentAccount.getLevel() < 1) {
//return "redirect:/";
return "error/404";
} else {
Map<String, Object> data = questionService.getQuestionsByContent(page,
Const.questionPageSize, content);
List<Question> questions = (List<Question>) data.get("questions");
List<Subject> subjects = subjectService.getSubjects();
Map<Integer, String> subjectId2name = subjects.stream().
collect(Collectors.toMap(Subject::getId, Subj
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于javaweb的试题库管理系统源码+数据库(期末大作业).zip已获导师指导并通过的97分的高分大作业设计项目,可作为毕业设计、课程设计和期末大作业,下载即用无需修改,项目完整确保可以运行。 基于javaweb的试题库管理系统源码+数据库(期末大作业).zip已获导师指导并通过的97分的高分大作业设计项目,可作为毕业设计、课程设计和期末大作业,下载即用无需修改,项目完整确保可以运行。基于javaweb的试题库管理系统源码+数据库(期末大作业).zip已获导师指导并通过的97分的高分大作业设计项目,可作为毕业设计、课程设计和期末大作业,下载即用无需修改,项目完整确保可以运行。基于javaweb的试题库管理系统源码+数据库(期末大作业).zip已获导师指导并通过的97分的高分大作业设计项目,可作为毕业设计、课程设计和期末大作业,下载即用无需修改,项目完整确保可以运行。基于javaweb的试题库管理系统源码+数据库(期末大作业).zip已获导师指导并通过的97分的高分大作业设计项目,可作为毕业设计、课程设计和期末大作业,下载即用无需修改,项目完整确保可以运行。
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![thumb](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![thumb](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 1087 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
- xiaolin07232023-12-03没有达到要求,无法运行,文件中有虚假信息
- 2301_773509042024-06-10怎么能有这么好的资源!只能用感激涕零来形容TAT...
- 2301_763135602024-07-03这个资源总结的也太全面了吧,内容详实,对我帮助很大。
![avatar](https://profile-avatar.csdnimg.cn/3c1ed7f2fabc439d9d14e4ccad1864d6_chengxuyuanlaow.jpg!1)
猰貐的新时代
- 粉丝: 1w+
- 资源: 2496
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)