Java项目:SSM高校教职工差旅报销管理系统
作者主页:夜未央5788
简介: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<String,Object> getNotice(@RequestParam(defaultValue = "1") Integer page,
// @RequestParam(defaultValue = "2") Integer limit,
// EasNotice easNotice) throws Exception {
// Map<String,Object> 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<EasNotice> 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<EasNotice> 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<EasNotice> 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<String,Object> getNotice(@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "2") Integer limit,EasNotice easNotice) throws Exception {Map<String,Object> map = new HashMap<>();
// System.out.println("模糊查询的内容为:"+easNotice.getContent());EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal();//获取EasUser对象//判断用户有没有 角色 有就返回角色id 没有就返回1000List<Integer> 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<EasNotice> 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<EasNotice> 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<EasNotice> 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<EasNotice> 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<EasNotice> list = easNoticeService.getNoticeById(id);modelAndView.addObject("noticeList",list);modelAndView.setViewName("system/notice/homeNotice");return modelAndView;}}
通知控制器
package com.jubilantz.controller;import com.jubilantz.entity.EasNotice;
import com.jubilantz.services.EasNoticeService;
import com.jubilantz.utils.PageUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** @Author JubilantZ* @Date: 2021/4/27 11:35*/
@RequestMapping("/easNotice")
@Controller
public class EasNoticeController {@Autowiredprivate EasNoticeService easNoticeService;@RequestMapping("/index")@RequiresPermissions("notice:query")public String index() throws Exception{return "system/notice/adminNoticeList";}@ResponseBody@RequestMapping("/list")public Map<String, Object> getNoticeList(@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "10") Integer limit,@RequestParam(defaultValue="")String searchKey) throws Exception {Map<String,Object> map = new HashMap<>();//一共三个权限 获取全部的行数int type = 3;int count = easNoticeService.getCountByType(type,searchKey);PageUtil pageUtil = new PageUtil(page,limit);List<EasNotice> list = easNoticeService.getNoticeListByType(type,searchKey,pageUtil);map.put("count",count);map.put("data",list);map.put("code",0);map.put("msg","");return map;}@RequestMapping("/look")public ModelAndView showNotice(){return new ModelAndView("system/notice/notice");}@RequestMapping("/addPage")public ModelAndView toAddPage() {return new ModelAndView("system/notice/noticeAdd");}@RequestMapping("/addNotice")@ResponseBodypublic Map<String, Object> addNotice(@RequestParam(defaultValue="2")Integer opType, EasNotice easNotice) throws Exception {Map<String, Object> map = new HashMap<>();
// System.out.println("通知id:"+easNotice.getId());
// System.out.println("opType为:"+opType);
// System.out.println("content为:"+easNotice.getContent());int res = 0;//opType等于0是添加 1是更新if (opType == 0) {try {res = easNoticeService.addNotice(easNotice);} catch (Exception e) {
// System.out.println("添加失败!");map.put("result",false);}if (res > 0){map.put("result",true);}else{map.put("result",false);}} else if (opType == 1) {res = easNoticeService.updateNotice(easNotice);if (res > 0) {map.put("result",true);}else{map.put("result",false);}};return map;}@ResponseBody@RequestMapping("/deleteNotice")public Map<String, Object> deleteNotice(EasNotice easNotice) {Map<String, Object> map = new HashMap<>();if (easNoticeService.deleteNotice(easNotice) > 0) {map.put("result",true);map.put("msg","删除成功");}else {map.put("result",false);map.put("msg","删除失败");}return map;}/*** 批量删除通知* @param nIds* @return*/@ResponseBody@RequestMapping("/deleteList")public Map<String, Object> deleteNoticeList(String nIds) {Map<String, Object> map = new HashMap<>();List<Integer> list = new ArrayList<Integer>();try {String[] ids = nIds.split(",");for (String id: ids) {list.add(Integer.parseInt(id));}if (easNoticeService.deleteNoticeList(list) > 0) {map.put("result",true);map.put("msg","批量删除成功");}else {map.put("result",false);map.put("msg","批量删除失败");}} catch (Exception e) {e.printStackTrace();map.put("result",false);map.put("msg","批量删除失败");}return map;}@ResponseBody@RequestMapping(value="/uploadImg")public String uploadImg(MultipartFile file, HttpServletRequest request) throws IOException {System.out.println("comming!");String path = request.getSession().getServletContext().getRealPath("/images");System.out.println("path>>"+path);//获取上传图片的名称String fileName = file.getOriginalFilename();System.out.println("fileName>>"+fileName);
// //获取图片的后缀 例:.jpg
// fileName = fileName.substring(fileName.lastIndexOf("."), fileName.length());
// System.out.println("fileName1>>"+fileName);
// //生成图片名称
// fileName = System.currentTimeMillis() + fileName; //System.currentTimeMillis()产生一个当前的毫秒 +文件后缀 例.jpgSystem.out.println("fileName2>>"+fileName);File dir = new File(path, fileName);System.out.println("File>>"+dir);if(!dir.exists()){dir.mkdirs();}
// MultipartFile自带的解析方法file.transferTo(dir);String jsonStr = "{\"code\":0,\"msg\":\"\",\"count\":" + null + ",\"data\":" + "{\"src\":\"" + "/images/" + fileName + "\"}" + "}";return jsonStr;}
}
权限控制器
package com.jubilantz.controller;import com.jubilantz.entity.EasPermission;
import com.jubilantz.mappers.EasPermissionMapper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.ResponseBody;import java.util.HashMap;
import java.util.List;
import java.util.Map;@Controller
@RequestMapping("/easPermission")
public class EasPermissionController {@Autowiredprivate EasPermissionMapper easPermissionMapper;@RequestMapping("/index")@RequiresPermissions("permission:query")public String index() throws Exception{return "system/permission/index";}@RequestMapping("/parentList")@ResponseBodypublic List<EasPermission> parentList() {return easPermissionMapper.getParentPers();}@RequestMapping("/list")@ResponseBodypublic Map<String,Object> list() throws Exception {Map<String,Object> map = new HashMap<>();map.put("code",0);map.put("msg",null);map.put("data",easPermissionMapper.getAll());return map;}
}
PropertyValueController
package com.smzy.controller;import com.smzy.pojo.Product;
import com.smzy.pojo.Property;
import com.smzy.pojo.PropertyValue;
import com.smzy.service.ProductService;
import com.smzy.service.PropertyService;
import com.smzy.service.PropertyValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;import java.util.List;@Controller
@RequestMapping("/admin")
public class PropertyValueController {@Autowiredprivate PropertyValueService propertyValueService;@Autowiredprivate PropertyService propertyService;@Autowiredprivate ProductService productService;@RequestMapping("/listPropertyValue")public String findAll(Model model ,Integer product_id ,Integer category_id) {List<PropertyValue> propertyValues = propertyValueService.findByProductId(product_id);model.addAttribute("propertyValues",propertyValues);Product product = productService.get(product_id);model.addAttribute("product",product);List<Property> properties = propertyService.findAll(category_id);model.addAttribute("properties",properties);return "admin/listPropertyValue";}@RequestMapping("/addPropertyValueView")public String addPropertyValueView(Model model ,Integer product_id,Integer category_id) {List<PropertyValue> propertyValues = propertyValueService.findByProductId(product_id);model.addAttribute("propertiesValue",propertyValues);List<Property> properties = propertyService.findAll(category_id);model.addAttribute("properties",properties);Product product = productService.get(product_id);model.addAttribute("product",product);return "admin/addPropertyValueView";}@RequestMapping("/addPropertyValue")public String add(PropertyValue propertyValue ){int product_id = propertyValue.getProduct_id();int category_id = productService.get(product_id).getCategory_id();propertyValueService.add(propertyValue);return "redirect:listPropertyValue?product_id=" + product_id + "&category_id=" + category_id;}@RequestMapping("/deletePropertyValue")public String delete(Integer id) {int product_id = propertyValueService.get(id).getProduct_id();int category_id = productService.get(product_id).getCategory_id();propertyValueService.delete(id);return "redirect:listPropertyValue?product_id=" + product_id + "&category_id=" + category_id;}@RequestMapping("/editPropertyValue")public String edit(Integer id ,Model model) {PropertyValue propertyValue = propertyValueService.get(id);model.addAttribute("propertyValue",propertyValue);Product product = productService.get(propertyValue.getProperty_id());model.addAttribute("product",product);return "admin/editPropertyValue";}@RequestMapping("/updatePropertyValue")public String update(PropertyValue propertyValue) {Integer product_id = propertyValue.getProduct_id();Integer category_id = productService.get(product_id).getCategory_id();propertyValueService.update(propertyValue);return "redirect:listPropertyValue?product_id=" + product_id + "&category_id=" + category_id;}
}
如果也想学习本系统,下面领取。关注并回复:148ssm
Java项目:SSM高校教职工差旅报销管理系统相关推荐
- 基于javaweb的高校教职工差旅报销管理系统(java+ssm+jsp+html+mysql)
基于javaweb的高校教职工差旅报销管理系统(java+ssm+jsp+html+mysql) 运行环境 Java≥8.MySQL≥5.7.Tomcat≥8 开发工具 eclipse/idea/my ...
- java项目-第78期基于ssm的慢病报销管理系统-毕业设计
java项目-第78期基于ssm的慢病报销管理系统-毕业设计 1.项目简述 基本信息:用户管理.菜单管理.角色管理.行政区域管理.农合机构管理.医疗机构管理 业务功能:慢性病分类管理.家庭档案管理.参 ...
- java计算机毕业设计Web企业差旅在线管理系统源码+mysql数据库+系统+lw文档+部署
java计算机毕业设计Web企业差旅在线管理系统源码+mysql数据库+系统+lw文档+部署 java计算机毕业设计Web企业差旅在线管理系统源码+mysql数据库+系统+lw文档+部署 本源码技术栈 ...
- java计算机毕业设计高校四六级报名管理系统源程序+mysql+系统+lw文档+远程调试
java计算机毕业设计高校四六级报名管理系统源程序+mysql+系统+lw文档+远程调试 java计算机毕业设计高校四六级报名管理系统源程序+mysql+系统+lw文档+远程调试 本源码技术栈: 项目 ...
- (附源码)ssm高校学生档案信息管理系统 毕业设计 010936
ssm高校学生档案信息管理系统 摘要 在社会快速发展的影响下,教育事业蓬勃发展,大大增加了学校的数量.多样性.教育质量等要求,使教育的管理和运营比过去更加困难.依照这一现实为基础,设计一个快捷而又方便 ...
- java计算机毕业设计高校实习实训管理系统源码+mysql数据库+系统+lw文档+部署
java计算机毕业设计高校实习实训管理系统源码+mysql数据库+系统+lw文档+部署 java计算机毕业设计高校实习实训管理系统源码+mysql数据库+系统+lw文档+部署 本源码技术栈: 项目架构 ...
- ssm高校学生档案信息管理系统 毕业设计- 附源码010936
ssm高校学生档案信息管理系统 摘要 在社会快速发展的影响下,教育事业蓬勃发展,大大增加了学校的数量.多样性.教育质量等要求,使教育的管理和运营比过去更加困难.依照这一现实为基础,设计一个快捷而又方便 ...
- 基于java项目ssm二手书交易平台设计与实现(论文+程序设计源码+数据库文件)
1 绪论 4 1.1 项目开发背景 4 1.2 项目开发意义 5 1.3 项目主要的内容 5 2 相关技术介绍及系统环境开发条件 6 2.1相关技术介绍 6 2.2系统环境开发条件 7 3 系统的需求 ...
- java计算机毕业设计高校实习实训管理系统MyBatis+系统+LW文档+源码+调试部署
java计算机毕业设计高校实习实训管理系统MyBatis+系统+LW文档+源码+调试部署 java计算机毕业设计高校实习实训管理系统MyBatis+系统+LW文档+源码+调试部署 本源码技术栈: 项目 ...
- java毕业生设计高校设备采购审批管理系统计算机源码+系统+mysql+调试部署+lw
java毕业生设计高校设备采购审批管理系统计算机源码+系统+mysql+调试部署+lw java毕业生设计高校设备采购审批管理系统计算机源码+系统+mysql+调试部署+lw 本源码技术栈: 项目架构 ...
最新文章
- 盖茨、奥巴马、马斯克账号被黑,推特遭大规模黑客攻击
- 急速JavaScript全栈教程
- javascript判断数组是否包含了指定的元素
- Linux ext3grep 恢复数据
- 用 SpringBoot,亲自打造一个在线题库系统
- Simple Web Server
- Google BBR拥塞控制算法模型初探
- POJ NOI MATH-7829 神奇序列求和
- Shader实例:NGUI制作网格样式血条
- Select2.js学习总结
- raw格式怎么打开转换成jpg?迅捷图片转换器3步搞定
- better-scroll基本使用
- 复习————吃饭睡觉打豆豆
- 从贫穷到富有——我的修行之路
- uniapp 分享到微信、QQ、朋友圈
- 计算机网络英文简称汇总
- 温哥华岛大学计算机科学,温哥华岛大学有几个校区?
- C语言编程>第十一周 ② N名学生的成绩已在主函数中放入一个带头结点的链表结构中,a指向链表的头结点。请编写函数fun,它的功能是:找出学生的最高分,由函数返回。
- arcgis图斑尖角检查_ArcGIS消除零碎图斑(Eliminate)
- ”为什么有这么多人执着于中文编程?”第二春:新评论的一并回应