作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
管理员角色包含以下功能:
管理员登录,修改管理员资料,用户管理,公告管理,报销类型管理,系别信息管理,报销审核管理等功能。
用户角色包含以下功能:
用户登录,修改个人资料,查看公告,报销类型查看,系别信息查看,报销审批查看等功能。
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
1. 后端:Spring+SpringMVC+Mybatis
2. 前端:HTML+CSS+JavaScript+jsp
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
package com.jubilantz.controller;import com.jubilantz.entity.EasNotice;
import com.jubilantz.entity.EasUser;
import com.jubilantz.services.EasNoticeService;
import com.jubilantz.services.EasUserService;
import com.jubilantz.utils.PageUtil;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** @Author JubilantZ* @Date: 2021/4/28 20:25*/
@RequestMapping("/main")
@Controller
public class EasMainController {@Autowiredprivate EasNoticeService easNoticeService;@Autowiredprivate EasUserService easUserService;@RequestMapping("/homePage")public String homePage() throws Exception{return "system/home/homePage";}// @RequestMapping(value="/getNotice",method = RequestMethod.GET)
// @ResponseBody
// public Map getNotice(@RequestParam(defaultValue = "1") Integer page,
// @RequestParam(defaultValue = "2") Integer limit,
// EasNotice easNotice) throws Exception {
// Map map = new HashMap<>();
//System.out.println("模糊查询的内容为:"+easNotice.getContent());
//
// EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象
//
// //判断用户有没有 角色 有就返回角色id 没有就返回1000
//
// Integer roleId = easUserService.findRoleIdByUserId(easUser.getId());
//
//
// String strRoleId =roleId +"";System.out.println("roleId:"+roleId);System.out.println("strRoleId:"+strRoleId);
// PageUtil pageUtil = new PageUtil(page,limit);
//
// //没有角色
// if(roleId == null || !(strRoleId.length() >0 || roleId == 2)){//全体可见的部分公告,没要求
// //type = 1 全员可见 type = 2 教师可见 type = 3 草稿 管理员可见
// int type = 1;
// int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
// pageUtil.setTotal(count);
// pageUtil.setCount(limit);
// int totalPage = pageUtil.getTotalPage();System.out.println("总页数为"+totalPage);
//
// List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
//
// map.put("totalPage",totalPage);
// map.put("count",count);
// map.put("data",list);
// map.put("code",0);
// map.put("msg","");
// }else if(roleId == 3){//增加教师公告可见
// int type = 2;
// int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
// List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
// pageUtil.setTotal(count);
// pageUtil.setCount(limit);
// int totalPage = pageUtil.getTotalPage();System.out.println("总页数为"+totalPage);
//
// map.put("totalPage",totalPage);
// map.put("count",count);
// map.put("data",list);
// map.put("code",0);
// map.put("msg","");
// }else{//管理员可见全部
// int type = 3;
// int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);
// List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);
//
// pageUtil.setTotal(count);
// pageUtil.setCount(limit);
// int totalPage = pageUtil.getTotalPage();
//
// map.put("totalPage",totalPage);
//
// map.put("count",count);
// map.put("data",list);
// map.put("code",0);
// map.put("msg","");
// }
//
// return map;
// }@RequestMapping(value="/getNotice",method = RequestMethod.GET)@ResponseBodypublic Map getNotice(@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "2") Integer limit,EasNotice easNotice) throws Exception {Map map = new HashMap<>();
// System.out.println("模糊查询的内容为:"+easNotice.getContent());EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象//判断用户有没有 角色 有就返回角色id 没有就返回1000List rolelist = easUserService.findRoleIdByUserId2(easUser.getId());PageUtil pageUtil = new PageUtil(page,limit);if(rolelist.size() >= 2){int type = 3;int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);pageUtil.setTotal(count);pageUtil.setCount(limit);int totalPage = pageUtil.getTotalPage();map.put("totalPage",totalPage);map.put("count",count);map.put("data",list);map.put("code",0);map.put("msg","");}else {if(rolelist.size() == 0 || rolelist.get(0) == 2){//type = 1 全员可见 type = 2 教师可见 type = 3 草稿 管理员可见int type = 1;int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);pageUtil.setTotal(count);pageUtil.setCount(limit);int totalPage = pageUtil.getTotalPage();
// System.out.println("总页数为"+totalPage);List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);map.put("totalPage",totalPage);map.put("count",count);map.put("data",list);map.put("code",0);map.put("msg","");}else if(rolelist.get(0) == 3) {int type = 2;int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);pageUtil.setTotal(count);pageUtil.setCount(limit);int totalPage = pageUtil.getTotalPage();
// System.out.println("总页数为"+totalPage);map.put("totalPage",totalPage);map.put("count",count);map.put("data",list);map.put("code",0);map.put("msg","");}else{int type = 3;int count = easNoticeService.getCountByTypeAndEasNotice(type,easNotice);List list = easNoticeService.getNoticeListByTypeAndEasNotice(type,easNotice,pageUtil);pageUtil.setTotal(count);pageUtil.setCount(limit);int totalPage = pageUtil.getTotalPage();map.put("totalPage",totalPage);map.put("count",count);map.put("data",list);map.put("code",0);map.put("msg","");}}return map;}//点击查看具体通知@RequestMapping(value="/lookNotice")public ModelAndView look(Integer id){ModelAndView modelAndView = new ModelAndView();
// System.out.println("我是通知id:"+id);List list = easNoticeService.getNoticeById(id);modelAndView.addObject("noticeList",list);modelAndView.setViewName("system/notice/homeNotice");return modelAndView;}}
如果也想学习本系统,下面领取。关注并回复:148ssm