基于javaweb+mysql的springboot学生学科竞赛管理系统设计和实现(java+springboot+ssm+maven+html)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot学生学科竞赛管理系统设计和实现(java+springboot+ssm+maven+html)
主要技术、spring、 springmvc、 springboot、 mybatis 、 jquery 、 layUI、md5 、bootstarp.js tomcat、、拦截器等项目 主要功能:登录、用户、菜单管理、角色管理、权限管理、立项申请、报名、结、经费管理、审核、统计等
用户登录:输入账号密码和验证码登录登录、登陆后根据用户权限显示不同菜单、角色灵活控制。
管理后主要功能模块:用户管理、角色管理、承菜管理、权限管理、竞赛报名管理、经费申请和审核管理、项目结题管理、立项申请管理等具体功能
用户管理:用户列表的显示、数据的添加以及删除修改等操作。
角色管理:通过给用户绑定角色、角色控制菜单灵活显示菜单权限功能。用户可以新建多角色
菜单管理:
系统日志监控:aop切面编程实现日志记录操作
业务模块功能;
立项申请:
立项审核:
活动经费预算申请:
立项申请个人赛以及团队赛报名管理:录入报名相关信息字段
项目结题管理:
项目完成之后选择项目进行资金使用统计结题:录入金额
项目结题统计:
代码结构:idea、eclipse直接导入就可运行
}
@RestController
@RequestMapping("/sys/closing")
public class ClosingController extends AbstractController {
@Autowired
private ClosingService closingService;
@RequestMapping("/list")
public R list(Map<String, Object> params){
PageUtils page = closingService.queryPage(params);
return R.ok().put("page", page);
}
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
Closing closing = closingService.getById(id);
return R.ok().put("closing", closing);
}
@RequestMapping("/save")
public R save(@RequestBody Closing closing){
closing.setRanking(closing.getRanking());
closing.setTotalMoney(closing.getTotalMoney());
closingService.saveOrUpdate(closing);
return R.ok();
}
@RequestMapping("/update")
public R update(@RequestBody Closing closing){
closingService.updateById(closing);
closing.setTotalMoney(closing.getTotalMoney());
closingService.saveOrUpdate(closing);
return R.ok();
}
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
closingService.removeByIds(Arrays.asList(ids));
// MCity dict = cityService.getById(id);
//
// return R.ok().put("city", dict);
// }
//
// /**
// * 保存
// */
// @RequestMapping("/save")
@RequiresPermissions("sys:city:save")
// public R save(@RequestBody MCity city){
// //校验类型
// ValidatorUtils.validateEntity(city);
//
// cityService.save(city);
//
// return R.ok();
// }
//
// /**
// * 修改
// */
// @RequestMapping("/update")
// @RequiresPermissions("sys:city:update")
// public R update(@RequestBody MCity city){
// //校验类型
// ValidatorUtils.validateEntity(city);
//
// cityService.updateById(city);
//
// return R.ok();
// }
//
// /**
// * 删除
// */
// @RequestMapping("/delete")
// @RequiresPermissions("sys:city:delete")
// public R delete(@RequestBody Long[] ids){
// cityService.removeByIds(Arrays.asList(ids));
//
// return R.ok();
// }
//
//}
@Override
public boolean isFinished() {
return true;
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setReadListener(ReadListener readListener) {
}
@Override
public int read() throws IOException {
return bis.read();
}
};
}
@Override
public String getParameter(String name) {
String value = super.getParameter(xssEncode(name));
if (StringUtils.isNotBlank(value)) {
value = xssEncode(value);
}
return value;
}
@Override
public String[] getParameterValues(String name) {
String[] parameters = super.getParameterValues(name);
if (parameters == null || parameters.length == 0) {
return null;
}
for (int i = 0; i < parameters.length; i++) {
parameters[i] = xssEncode(parameters[i]);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("sys:dept:save")
public R save(@RequestBody SysDeptEntity dept){
sysDeptService.save(dept);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("sys:dept:update")
public R update(@RequestBody SysDeptEntity dept){
sysDeptService.updateById(dept);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("sys:dept:delete")
public R delete(long deptId){
//判断是否有子部门
List<Long> deptList = sysDeptService.queryDetpIdList(deptId);
if(deptList.size() > 0){
return R.error("请先删除子部门");
}
sysDeptService.removeById(deptId);
return R.ok();
}
}
/**
* 系统配置信息
*
*/
@RestController
@RequestMapping("/sys/config")
public class SysConfigController extends AbstractController {
@Autowired
private SysConfigService sysConfigService;
/**
* 所有配置列表
*/
@RequestMapping("/list")
@RequiresPermissions("sys:config:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysConfigService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 配置信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("sys:config:info")
@ResponseBody
public R info(@PathVariable("id") Long id){
SysConfigEntity config = sysConfigService.getById(id);
return R.ok().put("config", config);
//生成文字验证码
String text = producer.createText();
//生成图片验证码
BufferedImage image = producer.createImage(text);
//保存到shiro session
ShiroUtils.setSessionAttribute(Constants.KAPTCHA_SESSION_KEY, text);
ServletOutputStream out = response.getOutputStream();
ImageIO.write(image, "jpg", out);
}
/**
* 登录
*/
@ResponseBody
@RequestMapping(value = "/sys/login", method = RequestMethod.POST)
public R login(String username, String password, String captcha) {
String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
if(!captcha.equalsIgnoreCase(kaptcha)){
return R.error("验证码不正确");
}
try{
Subject subject = ShiroUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(username, password);//md5+Jiayan
subject.login(token);
}catch (UnknownAccountException e) {
return R.error(e.getMessage());
}catch (IncorrectCredentialsException e) {
return R.error("账号或密码不正确");
}catch (LockedAccountException e) {
return R.error("账号已被锁定,请联系管理员");
}catch (AuthenticationException e) {
return R.error("账户验证失败");
}
return R.ok();
}
/**
* 退出
public R save(@RequestBody Team team) {
team.setBmTime(new Date());
teamService.save(team);
Closing closing = new Closing();
closing.setBid(team.getId());
closing.setJtType("团队赛");
closing.setStartTime(new Date());
closing.setTitle(team.getTitle());
closingService.save(closing);
return R.ok();
}
@RequestMapping("/update")
public R update(@RequestBody Team team) {
if (team.getId() == null) {
save(team);
} else {
teamService.updateById(team);
}
return R.ok();
}
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) {
teamService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
expenditureService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
@RestController
@RequestMapping("/sys/apply")
public class ApplyController extends AbstractController {
@Autowired
private ApplyService applyService;
@RequestMapping("/list")
public R list(Map<String, Object> params) {
PageUtils page = applyService.queryPage(params);
return R.ok().put("page", page);
}
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id) {
Apply apply = applyService.getById(id);
return R.ok().put("apply", apply);
}
@RequestMapping("/save")
public R save(@RequestBody Apply apply) {
apply.setAuditStu("未审核");
applyService.save(apply);
return R.ok();
}
@RequestMapping("/auditById")
public R auditById(@RequestParam("id") Integer id, @RequestParam("auditStu") String auditStu) {
applyService.auditById(auditStu, id);
return R.ok();
}
@Override
public void setReadListener(ReadListener readListener) {
}
@Override
public int read() throws IOException {
return bis.read();
}
};
}
@Override
public String getParameter(String name) {
String value = super.getParameter(xssEncode(name));
if (StringUtils.isNotBlank(value)) {
value = xssEncode(value);
}
return value;
}
@Override
public String[] getParameterValues(String name) {
String[] parameters = super.getParameterValues(name);
if (parameters == null || parameters.length == 0) {
return null;
}
for (int i = 0; i < parameters.length; i++) {
parameters[i] = xssEncode(parameters[i]);
}
return parameters;
}
@Override
public Map<String,String[]> getParameterMap() {
Map<String,String[]> map = new LinkedHashMap<>();
Map<String,String[]> parameters = super.getParameterMap();
for (String key : parameters.keySet()) {
String[] values = parameters.get(key);
for (int i = 0; i < values.length; i++) {
values[i] = xssEncode(values[i]);
}
map.put(key, values);
}
return map;
}
@Override
public String getHeader(String name) {
String value = super.getHeader(xssEncode(name));
if (StringUtils.isNotBlank(value)) {
// /**
// * 删除
// */
// @RequestMapping("/delete")
// @RequiresPermissions("sys:city:delete")
// public R delete(@RequestBody Long[] ids){
// cityService.removeByIds(Arrays.asList(ids));
//
// return R.ok();
// }
//
//}
@RestController
@RequestMapping("sys/dict")
public class SysDictController {
@Autowired
private SysDictService sysDictService;
@RequestMapping("/list")
@RequiresPermissions("sys:dict:list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = sysDictService.queryPage(params);
return R.ok().put("page", page);
}
@RequestMapping("/info/{id}")
@RequiresPermissions("sys:dict:info")
public R info(@PathVariable("id") Long id) {
SysDictEntity dict = sysDictService.getById(id);
return R.ok().put("dict", dict);
}
@RequestMapping("/save")
public R save(@RequestBody SysDictEntity dict) {
sysDictService.save(dict);
return R.ok();
}
private String xssEncode(String input) {
return htmlFilter.filter(input);
}
/**
* 获取最原始的request
*/
public HttpServletRequest getOrgRequest() {
return orgRequest;
}
/**
* 获取最原始的request
*/
public static HttpServletRequest getOrgRequest(HttpServletRequest request) {
if (request instanceof XssHttpServletRequestWrapper) {
return ((XssHttpServletRequestWrapper) request).getOrgRequest();
}
return request;
}
}
/**
* .
*
*
*
*
*/
/**
* 系统菜单
*
*/
@RestController
@RequestMapping("/sys/menu")
public class SysMenuController extends AbstractController {
@Autowired
private SysMenuService sysMenuService;
/**
* 导航菜单
*/
@RequestMapping("/nav")
public R nav(){
List<SysMenuEntity> menuList = sysMenuService.getUserMenuList(getUserId());
return R.ok().put("menuList", menuList);
}
/**
* 所有菜单列表
*/
@RequestMapping("/list")
@RequiresPermissions("sys:menu:list")
public List<SysMenuEntity> list(){
List<SysMenuEntity> menuList = sysMenuService.list();
for(SysMenuEntity sysMenuEntity : menuList){
SysMenuEntity parentMenuEntity = sysMenuService.getById(sysMenuEntity.getParentId());
if(parentMenuEntity != null){
sysMenuEntity.setParentName(parentMenuEntity.getName());
}
}
return menuList;
}
/**
* 选择菜单(添加、修改菜单)
*/
@RequestMapping("/select")
@RequiresPermissions("sys:menu:select")
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("sys:dept:update")
public R update(@RequestBody SysDeptEntity dept){
sysDeptService.updateById(dept);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("sys:dept:delete")
public R delete(long deptId){
//判断是否有子部门
List<Long> deptList = sysDeptService.queryDetpIdList(deptId);
if(deptList.size() > 0){
return R.error("请先删除子部门");
}
sysDeptService.removeById(deptId);
return R.ok();
}
}
/**
* .
*
*
*
*
*/
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
//设置IP地址
sysLog.setIp(IPUtils.getIpAddr(request));
//用户名
String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
sysLog.setUsername(username);
sysLog.setTime(time);
sysLog.setCreateDate(new Date());
//保存系统日志
sysLogService.save(sysLog);
}
}
/**
* .
*
*
*
*
*/
/**
* 登录相关
*
*/
@Controller
public class SysLoginController {
@Autowired
ValidatorUtils.validateEntity(config);
sysConfigService.update(config);
return R.ok();
}
/**
* 删除配置
*/
@SysLog("删除配置")
@RequestMapping("/delete")
@RequiresPermissions("sys:config:delete")
public R delete(@RequestBody Long[] ids){
sysConfigService.deleteBatch(ids);
return R.ok();
}
}
@RestController
@RequestMapping("/sys/team")
public class TeamController extends AbstractController {
@Autowired
private TeamService teamService;
@Autowired
private ClosingService closingService;
@RequestMapping("/list")
public R list(Map<String, Object> params) {
@RequestMapping("/info/{menuId}")
@RequiresPermissions("sys:menu:info")
public R info(@PathVariable("menuId") Long menuId){
SysMenuEntity menu = sysMenuService.getById(menuId);
return R.ok().put("menu", menu);
}
/**
* 保存
*/
@SysLog("保存菜单")
@RequestMapping("/save")
@RequiresPermissions("sys:menu:save")
public R save(@RequestBody SysMenuEntity menu){
//数据校验
verifyForm(menu);
sysMenuService.save(menu);
return R.ok();
}
/**
* 修改
*/
@SysLog("修改菜单")
@RequestMapping("/update")
@RequiresPermissions("sys:menu:update")
public R update(@RequestBody SysMenuEntity menu){
//数据校验
verifyForm(menu);
sysMenuService.updateById(menu);
return R.ok();
}
/**
* 删除
*/
@SysLog("删除菜单")
@RequestMapping("/delete")
@RequiresPermissions("sys:menu:delete")
public R delete(long menuId){
if(menuId <= 31){
// ip = ip.substring(0, ip.indexOf(","));
// }
// }
return ip;
}
}
@RestController
@RequestMapping("/sys/closing")
public class ClosingController extends AbstractController {
@Autowired
private ClosingService closingService;
@RequestMapping("/list")
public R list(Map<String, Object> params){
PageUtils page = closingService.queryPage(params);
return R.ok().put("page", page);
}
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
Closing closing = closingService.getById(id);
return R.ok().put("closing", closing);
}
@RequestMapping("/save")
public R save(@RequestBody Closing closing){
/**
* 系统菜单
*
*/
@RestController
@RequestMapping("/sys/menu")
public class SysMenuController extends AbstractController {
@Autowired
private SysMenuService sysMenuService;
/**
* 导航菜单
*/
@RequestMapping("/nav")
public R nav(){
List<SysMenuEntity> menuList = sysMenuService.getUserMenuList(getUserId());
return R.ok().put("menuList", menuList);
}
/**
* 所有菜单列表
*/
@RequestMapping("/list")
@RequiresPermissions("sys:menu:list")
public List<SysMenuEntity> list(){
List<SysMenuEntity> menuList = sysMenuService.list();
for(SysMenuEntity sysMenuEntity : menuList){
SysMenuEntity parentMenuEntity = sysMenuService.getById(sysMenuEntity.getParentId());
if(parentMenuEntity != null){
sysMenuEntity.setParentName(parentMenuEntity.getName());