作者主页:夜未央5788

简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

OA办公管理系统,这是一款由JSP+SSM(spring+springmvc+mybatis)+MySQL实现的简单的OA办公管理系统,主要实现的功能有员工注册登录,自动计算当前月迟到、早退、加班、缺勤天数并根据图表展示,任务管理(任务发布、更新、删除、进度条展示完成度),通知管理(通知发布、更新、删除),站内信发布、回复、删除等,发布公告和任务及站内信时可上传图片等。

环境需要

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版本;

6.是否Maven项目:否;

技术栈

1. 后端:Spring+SpringMVC+Mybatis

2. 前端:JSP+CSS+JavaScript

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目;
3. 将项目中db.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/OAManagerSys 登录 注意:路径必须为/OAManagerSys,否则会有图片加载不出来
管理员账号/密码:admin/admin

账号/密码:zhangtao/123

运行截图

相关代码

账户控制器

package com.noa.controller;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
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 org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;import com.noa.exception.CustomException;
import com.noa.po.Employee;
import com.noa.po.EmployeeCustom;
import com.noa.service.EmployeeService;
import com.noa.service.SysService;@Controller
public class AccountController {@Autowiredprivate EmployeeService employeeService;@Autowiredprivate SysService sysService;EmployeeCustom activeEmp;@RequestMapping("/login")public String login(Model model, HttpServletRequest request) throws Exception {String exceptionClassName = (String) request.getAttribute("shiroLoginFailure");if (exceptionClassName != null) {if (UnknownAccountException.class.getName().equals(exceptionClassName)) {// 最终会抛给异常处理器model.addAttribute("message", "账号不存在");} else if (IncorrectCredentialsException.class.getName().equals(exceptionClassName)) {model.addAttribute("message", "用户名/密码错误");// throw new CustomException("用户名/密码错误");} else {model.addAttribute("message", "未知错误");// throw new Exception();// 最终在异常处理器生成未知错误}}// 访问/login时, 自动进行认证,认证成功后直接跳转出去// 初次访问时exceptionClassName== null直接到这里// 认证失败时exceptionClassName!= null , 传递信息后又回到这里return "misc/login";}@RequestMapping(value = "/signup", method = RequestMethod.GET)public String showSignupPage(Model model) throws Exception {return "misc/signup";}@RequestMapping(value = "/signup", method = RequestMethod.POST)public String checkUsername(Model model, Employee employee) throws Exception {try {employeeService.checkUsername(employee);model.addAttribute("employee", employee);model.addAttribute("positionList", sysService.getAbleToRegPos());return "misc/signup_detail";} catch (CustomException e) {model.addAttribute("message", e.getMessage());}return "misc/signup";}@RequestMapping(value = "/signup2", method = RequestMethod.POST)public String confirmPosition(Model model, Employee employee, MultipartFile employee_pic) throws Exception {// 上传图片String originalFilename = employee_pic.getOriginalFilename();if (employee_pic != null && originalFilename != null && originalFilename.trim() != "") {employee.setPic(sysService.uploadPic("employee", employee_pic));}model.addAttribute("employee", employee);model.addAttribute("departmentList", sysService.getAbleToRegDep(employee.getPositionId()));return "misc/signup_dep";}@RequestMapping(value = "/formal_signup", method = RequestMethod.POST)public String register(Model model, Employee employee) throws Exception {try {employeeService.register(employee);UsernamePasswordToken token = new UsernamePasswordToken(employee.getUsername(), employee.getPassword());SecurityUtils.getSubject().login(token);return "redirect:home";} catch (CustomException e) {model.addAttribute("message", e.getMessage());}// 注册失败return "misc/signup_detail";}@RequestMapping("/logout")public String logout(HttpSession session) throws Exception {activeEmp = (EmployeeCustom) session.getAttribute("activeEmp");employeeService.logout(activeEmp);session.removeAttribute("activeEmp");session.invalidate();return "redirect:/login";}@RequestMapping("/refuse")public String refuse() throws Exception {return "misc/refuse";}}

员工控制器

package com.noa.controller;import java.util.ArrayList;
import java.util.List;import javax.servlet.http.HttpSession;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;import com.noa.po.Employee;
import com.noa.po.EmployeeCustom;
import com.noa.service.EmployeeService;
import com.noa.service.SysService;@Controller
public class EmployeeController {@Autowiredprivate EmployeeService employeeService;@Autowiredprivate SysService sysService;@RequestMapping(value = "/changeStage")public void changeState(Model model, HttpRequest request, HttpSession session, Integer state) throws Exception {}@RequestMapping(value = "/search_emp")public String showSearchPage(Model model, String name, Integer depId, Integer state) throws Exception {List<EmployeeCustom> employeeList = new ArrayList<EmployeeCustom>();if ((name != null && name.trim() != "") || depId != null || state != null) {Employee condition = new Employee();if (name != null && name.trim() != "") {condition.setName(name);model.addAttribute("name", name);}if (depId != null) {condition.setDepartmentId(depId);model.addAttribute("depId", depId);}if (state != null) {condition.setWorkingState(state);model.addAttribute("state", state);}employeeList = employeeService.findEmployee(condition);} else {// show all employeeemployeeList = employeeService.findEmployee(new Employee());}model.addAttribute("employeeList", employeeList);model.addAttribute("allDepartment", sysService.getAllDepartment());return "search/search_emp";}}

首页控制器

package com.noa.controller;import java.util.List;import javax.servlet.http.HttpSession;import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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 com.noa.po.Announcement;
import com.noa.po.AnnouncementCustom;
import com.noa.po.EmployeeCustom;
import com.noa.service.AnnouncementService;
import com.noa.service.AttendanceService;
import com.noa.service.EmployeeService;
import com.noa.service.SysService;@Controller
public class HomeController {@AutowiredEmployeeService employeeService;@AutowiredAttendanceService attendanceService;@AutowiredAnnouncementService announcementService;@AutowiredSysService sysService;EmployeeCustom activeEmp;@RequestMapping("/home")public String showHome(Model model,HttpSession session) throws Exception{activeEmp = (EmployeeCustom) SecurityUtils.getSubject().getPrincipal();session.setAttribute("activeEmp", activeEmp);//展示出勤率,[0]正常 [1]加班 [2]迟到早退 [3]缺席[4]剩余天数int[] attendance = attendanceService.countMonthState(activeEmp);model.addAttribute("attendance",attendance);//公告一览List<AnnouncementCustom> announceList = announcementService.showAllAnnouncement(activeEmp);model.addAttribute("announceList", announceList);//可发布公告的对象model.addAttribute("departmentList", sysService.getAbleToAnnounceDeps());return "/home/home";}@RequestMapping("/announce.action")@RequiresPermissions(value={"announce:create:all","announce:create:main","announce:create:sub"},logical=Logical.OR)public String annouce(HttpSession session,String target,Announcement announcement) throws Exception{activeEmp = (EmployeeCustom)session.getAttribute("activeEmp");announcement.setText(announcement.getText().replaceAll("\r\n", "<br>"));announcementService.announce(announcement, activeEmp);return "redirect:/home";}@RequestMapping("/delete_announce.action")public String deleteAnnouce(HttpSession session,Integer delete_id) throws Exception{announcementService.deleteAnnouncement(delete_id);return "redirect:/home";}}

邮件控制器

package com.noa.controller;import java.util.ArrayList;
import java.util.List;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;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 org.springframework.web.multipart.MultipartFile;import com.noa.po.EmployeeCustom;
import com.noa.po.Mail;
import com.noa.po.MailCustom;
import com.noa.service.EmployeeService;
import com.noa.service.MailService;
import com.noa.service.SysService;@Controller
@RequestMapping("/mail")
@SuppressWarnings("all")
public class MailController {@Autowiredprivate MailService mailService;@Autowiredprivate EmployeeService employeeService;@Autowiredprivate SysService sysService;// 展示收到的邮件@RequestMapping("")public String showMailPage(Model model, HttpSession session, HttpServletRequest request) throws Exception {List<MailCustom> mailList = new ArrayList<MailCustom>();switch ((String) request.getParameter("view")) {case "all":mailList = mailService.findMailToMe((EmployeeCustom) session.getAttribute("activeEmp"));model.addAttribute("isSend", false);break;case "unread":mailList = mailService.findUnreadMailToMe((EmployeeCustom) session.getAttribute("activeEmp"));model.addAttribute("isSend", false);break;case "read":mailList = mailService.findReadMailToMe((EmployeeCustom) session.getAttribute("activeEmp"));model.addAttribute("isSend", false);break;case "send":mailList = mailService.findMailSendByMe((EmployeeCustom) session.getAttribute("activeEmp"));model.addAttribute("isSend", true);break;default:mailList = mailService.findMailToMe((EmployeeCustom) session.getAttribute("activeEmp"));model.addAttribute("isSend", false);break;}model.addAttribute("mailList", mailList);model.addAttribute("isInbox", true);// mail_common中右上角的的按钮return "mail/mail_inbox";}@RequestMapping("/mail_view")public String showMailDetail(Model model, HttpServletRequest request) throws Exception {MailCustom mailDetail = mailService.showMailDetail(Integer.parseInt(request.getParameter("mail_id")),Integer.parseInt(request.getParameter("otherside_id")));model.addAttribute("mail", mailDetail);model.addAttribute("isSend", Boolean.parseBoolean(request.getParameter("isSend")));return "mail/mail_view";}@RequestMapping("/send_mail.action")public String sendMail(Mail mail, MultipartFile mail_pic) throws Exception {// 上传图片// 原始名称String originalFilename = null;if (mail_pic != null) {originalFilename = mail_pic.getOriginalFilename();} if (mail_pic != null && originalFilename != null && originalFilename.trim() != "") {mail.setPic(sysService.uploadPic("mail", mail_pic));}// 将新图片名称写入mail.setText(mail.getText().replaceAll("\r\n", "<br>"));mailService.sendMail(mail);return "redirect:/mail?view=all";}@RequestMapping("/mail_compose")public String showComposeForm(Model model, Integer receiver) throws Exception {if (receiver != null) {model.addAttribute("receiver", employeeService.findEmployeeById(receiver));}return "mail/mail_compose";}}

如果也想学习本系统,下面领取。关注并回复:172ssm

SSM公司企业OA管理系统相关推荐

  1. 计算机毕业设计ssm电影售票管理系统n9y72系统+程序+源码+lw+远程部署

    计算机毕业设计ssm电影售票管理系统n9y72系统+程序+源码+lw+远程部署 计算机毕业设计ssm电影售票管理系统n9y72系统+程序+源码+lw+远程部署 本源码技术栈: 项目架构:B/S架构 开 ...

  2. 计算机毕业设计ssm毕业设计过程管理系统049a8系统+程序+源码+lw+远程部署

    计算机毕业设计ssm毕业设计过程管理系统049a8系统+程序+源码+lw+远程部署 计算机毕业设计ssm毕业设计过程管理系统049a8系统+程序+源码+lw+远程部署 本源码技术栈: 项目架构:B/S ...

  3. 计算机毕业设计ssm课堂考勤管理系统t6x5x系统+程序+源码+lw+远程部署

    计算机毕业设计ssm课堂考勤管理系统t6x5x系统+程序+源码+lw+远程部署 计算机毕业设计ssm课堂考勤管理系统t6x5x系统+程序+源码+lw+远程部署 本源码技术栈: 项目架构:B/S架构 开 ...

  4. 计算机毕业设计ssm汽车售后服务管理系统

    最新计算机专业原创毕业设计参考选题都有源码+数据库是近期作品 你的选题刚好在下面有,有时间看到机会给您发 1 ssm基于Vue的网上书籍购买商城 2 ssm高校社团管理系统 3 ssm学生社团管理 4 ...

  5. ssm校园宿舍管理系统

    ssm校园宿舍管理系统 登录注册模块 进入系统需要进行注册,如果注册过,可以直接输入用户名与密码进行登录. 系统管理模块 系统管理模块包括宿舍管理员登录.普通用户登录.用户密码修改.用户管理,退出系统 ...

  6. 计算机毕业设计ssm红旗家具城管理系统29a0m系统+程序+源码+lw+远程部署

    计算机毕业设计ssm红旗家具城管理系统29a0m系统+程序+源码+lw+远程部署 计算机毕业设计ssm红旗家具城管理系统29a0m系统+程序+源码+lw+远程部署 本源码技术栈: 项目架构:B/S架构 ...

  7. java计算机毕业设计基于Ssm学生信息管理系统源码+数据库+系统+lw文档+mybatis+运行部署

    java计算机毕业设计基于Ssm学生信息管理系统源码+数据库+系统+lw文档+mybatis+运行部署 java计算机毕业设计基于Ssm学生信息管理系统源码+数据库+系统+lw文档+mybatis+运 ...

  8. 计算机毕业设计ssm情报综合管理系统36zgo系统+程序+源码+lw+远程部署

    计算机毕业设计ssm情报综合管理系统36zgo系统+程序+源码+lw+远程部署 计算机毕业设计ssm情报综合管理系统36zgo系统+程序+源码+lw+远程部署 本源码技术栈: 项目架构:B/S架构 开 ...

  9. 计算机毕业设计springboot基于审批流的OA管理系统t4q46源码+系统+程序+lw文档+部署

    计算机毕业设计springboot基于审批流的OA管理系统t4q46源码+系统+程序+lw文档+部署 计算机毕业设计springboot基于审批流的OA管理系统t4q46源码+系统+程序+lw文档+部 ...

最新文章

  1. Oracle Dataguard 主备库的切换方法
  2. 读书笔记 - 《21世纪的管理挑战》
  3. 蓝桥杯java第五届决赛第二题--六角幻方
  4. C#中的Explicit和Implicit了解一下吧
  5. 信息学奥赛一本通 1080:余数相同问题 | OpenJudge NOI 小学奥数/2.1 7647:余数相同问题
  6. yarn-cli 缓存(转)
  7. 多个vue项目之间跳转_Vue六,路由,ElementUI
  8. 服务器上Oracle System如何修改system用户密码
  9. Google常用搜索技巧
  10. 如何在不支持双面打印的打印机上实现双面打印
  11. 经济学中的同比环比,负增长,正增长
  12. 各种串口助手工具分享
  13. python 相似形态 股票_比对相似k线软件 python比对股市k线相似性
  14. graphpad做折线图_Graphpad作折线图的思想
  15. 计算机应用专业的简历自我介绍,计算机应用个人简历模板
  16. WhatsApp 电脑版如何下载安装?
  17. 《孙子兵法作战指挥之军形篇》
  18. amoled和super amoled哪个更伤眼 amoled和super amoled的显示效果
  19. Java项目:JavaWeb实现网上图书商城系统
  20. 实验七 函数程序设计 张玉生《C语言程序设计实训教程》双色版 配套实验书答案 (纯手打, 仅供参考)

热门文章

  1. python爬虫专家_Python爬虫入门教程:微医挂号网专家团队数据抓取pyspider
  2. JavaScript原型详解(通俗易懂)
  3. 数据结构与算法--第二章pro题解
  4. [日企面试问题]日本企業面接問題
  5. 打工与创业的有什么区别,丨国仁网络资讯
  6. SDL解析——SDL简介
  7. 扫描普通二维码跳转到微信小程序指定页面
  8. c语言数组读心术,读心术
  9. PMP 模拟200题
  10. 淘宝、飞猪、闲鱼全都挂了!阿里程序员要被祭天了?