1.什么是OA
办公自动化(Office Automation,简称OA)是将现代化办公和计算机技术结合起来的一种新型的办公方式。办公自动化没有统一的定义,凡是在传统的办公室中采用各种新技术、新机器、新设备从事办公业务,都属于办公自动化的领域。通过实现办公自动化,或者说实现数字化办公,可以优化现有的管理组织结构,调整管理体制,在提高效率的基础上,增加协同办公能力,强化决策的一致性 。
OA软件的核心应用是:流程审批、协同工作、公文管理(国企和政府机关)、沟通工具、文档管理、信息中心、电子论坛、计划管理、项目管理、任务管理、会议管理、关联人员、系统集成、门户定制、通讯录、工作便签、问卷调查、常用工具(计算器、万年历等)。
2.初始化数据库及数据
表名 | 说明 |
---|---|
t_oa_meeting_info | 会议信息表 |
t_oa_meeting_feedback | 会议通知反馈表 |
t_oa_meeting_audit | 会议审批信息表 |
t_oa_meeting_option | 会议投票标题选项表 |
t_oa_meeting_room | 会议室信息表 |
t_oa_permission | 权限信息表 |
t_oa_role_permission | 角色权限表 |
t_oa_user | 用户信息表 |
下面是创建数据库所有的数据库脚本:
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50723
Source Host : localhost:3306
Source Schema : oa
Target Server Type : MySQL
Target Server Version : 50723
File Encoding : 65001
Date: 25/02/2022 10:41:07
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for t_oa_meeting_audit
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_audit`;
CREATE TABLE `t_oa_meeting_audit` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键,唯一标识',
`meetingId` bigint(11) NOT NULL COMMENT '外键,会议编号',
`auditor` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '审批人',
`sign` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '审批签字',
`createdate` timestamp(0) null DEFAULT NULL COMMENT '审批时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '会议审批信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_meeting_feedback
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_feedback`;
CREATE TABLE `t_oa_meeting_feedback` (
`id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键,唯一标识',
`meetingId` bigint(11) NOT NULL COMMENT '外键,会议编号',
`personType` int(2) NOT NULL COMMENT '人员类别:1参会2列席',
`personId` bigint(11) NOT NULL COMMENT '人员ID',
`result` int(2) NOT NULL COMMENT '反馈结果:1参加0不参加',
`reason` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '不参与会议的原因',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '会议通知反馈表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_meeting_info
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_info`;
CREATE TABLE `t_oa_meeting_info` (
`id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '主键,唯一标识',
`title` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '会议标题',
`content` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '会议内容',
`canyuze` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '参与人员',
`liexize` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '列席人员',
`zhuchiren` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主持人',
`location` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '会议地点',
`startTime` datetime(0) NOT NULL COMMENT '开始时间',
`endTime` datetime(0) NOT NULL COMMENT '结束时间',
`fujian` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '附件',
`state` int(2) NOT NULL DEFAULT 1 COMMENT '状态:0取消会议1待审核2驳回3待开4进行中5开启投票6结束会议,默认值为1',
`seatPic` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '会议排座图片地址',
`remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
`auditor` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '审批人',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '会议信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_meeting_option
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_option`;
CREATE TABLE `t_oa_meeting_option` (
`id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键,唯一标识',
`meetingId` bigint(11) NOT NULL COMMENT '会议ID',
`optionValue` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '选项标识(A/B/C/D)',
`optionText` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '选项描述',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '会议投票标题选项表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_meeting_room
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_meeting_room`;
CREATE TABLE `t_oa_meeting_room` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '会议室名称',
`equipment` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '会议设备',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '会议室信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_permission
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_permission`;
CREATE TABLE `t_oa_permission` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键,标识列',
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '权限名称',
`description` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '权限描述',
`url` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '菜单路径',
`pid` bigint(20) DEFAULT NULL COMMENT '父权限',
`ismenu` int(11) DEFAULT NULL COMMENT '是否为菜单 1、菜单 2、按钮',
`displayno` bigint(20) DEFAULT NULL COMMENT '展现顺序',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1305 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '权限信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_permission
-- ----------------------------
INSERT INTO `t_oa_permission` VALUES (10, '会议管理', NULL, NULL, -1, 1, 1);
INSERT INTO `t_oa_permission` VALUES (11, '投票管理', NULL, NULL, -1, 1, 9);
INSERT INTO `t_oa_permission` VALUES (12, '会议室管理', NULL, 'jsp/meeting/meetingRoom.jsp', -1, 1, 14);
INSERT INTO `t_oa_permission` VALUES (13, '系统管理', NULL, NULL, -1, 1, 15);
INSERT INTO `t_oa_permission` VALUES (1001, '会议发布', '发起会议', 'jsp/meeting/addMeeting.jsp', 10, 1, 2);
INSERT INTO `t_oa_permission` VALUES (1002, '会议通知', '别人发起的会议,需要你确认是否参加', 'jsp/meeting/meetingNotify.jsp', 10, 1, 3);
INSERT INTO `t_oa_permission` VALUES (1003, '我的会议', '我发起的,未审核->已审核', 'jsp/meeting/myMeeting.jsp', 10, 1, 4);
INSERT INTO `t_oa_permission` VALUES (1004, '我的审批', '我审批的会议', 'jsp/meeting/myAudit.jsp', 10, 1, 5);
INSERT INTO `t_oa_permission` VALUES (1005, '待开会议', '我参与的,但是还未开始的', 'jsp/meeting/meetingWaiting.jsp', 10, 1, 6);
INSERT INTO `t_oa_permission` VALUES (1006, '历史会议', '已经参与的', 'jsp/meeting/meetingHistory.jsp', 10, 1, 7);
INSERT INTO `t_oa_permission` VALUES (1007, '所有会议', '对所有会议进行汇总', 'jsp/meeting/meetingAll.jsp', 10, 1, 8);
INSERT INTO `t_oa_permission` VALUES (1101, '投票标题', '需要关联到会议标题(议题)', NULL, 11, 1, 10);
INSERT INTO `t_oa_permission` VALUES (1102, '投票选项', '需要关联到投票标题', NULL, 11, 1, 11);
INSERT INTO `t_oa_permission` VALUES (1103, '投票结果', '需要保留数据,可以看到谁投了什么票', NULL, 11, 1, 12);
INSERT INTO `t_oa_permission` VALUES (1104, '投票报表', '哪标题的哪个选项共投了多少票', NULL, 11, 1, 13);
INSERT INTO `t_oa_permission` VALUES (1301, '用户管理', NULL, 'jsp/system/userManage.jsp', 13, 1, 16);
INSERT INTO `t_oa_permission` VALUES (1302, '角色管理', NULL, NULL, 13, 1, 17);
INSERT INTO `t_oa_permission` VALUES (1303, '权限管理', NULL, NULL, 13, 1, 18);
INSERT INTO `t_oa_permission` VALUES (1304, '数据字典', NULL, NULL, 13, 1, 19);
-- ----------------------------
-- Table structure for t_oa_role_permission
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_role_permission`;
CREATE TABLE `t_oa_role_permission` (
`rid` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键,标识列',
`pid` bigint(20) NOT NULL COMMENT '权限ID',
PRIMARY KEY (`rid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色权限表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for t_oa_user
-- ----------------------------
DROP TABLE IF EXISTS `t_oa_user`;
CREATE TABLE `t_oa_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键,标识列',
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名: 唯一键 登陆时使用 禁止修改',
`loginName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '登录名',
`pwd` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
`rid` bigint(11) DEFAULT NULL COMMENT '用户角色:1 管理员 2 发起者 3 审批者 4 参与者 5 会议室管理员',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户信息表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of t_oa_user
-- ----------------------------
INSERT INTO `t_oa_user` VALUES (1, '张三', 'zhangsan', '1234', 4);
INSERT INTO `t_oa_user` VALUES (2, '李四', 'lisi', '1234', 4);
INSERT INTO `t_oa_user` VALUES (3, '王五', 'wangwu', '1234', 4);
INSERT INTO `t_oa_user` VALUES (4, '赵六', 'zhaoliu', '1234', 4);
INSERT INTO `t_oa_user` VALUES (5, '管理员', 'admin', '1234', 1);
SET FOREIGN_KEY_CHECKS = 1;
3.项目OA功能需求流程及说明
-
用户登录:后台采用MD5密码加密,前端采用ajax无刷新及json交互
-
左侧菜单:登录成功后跳转到会议OA后台页面并完成左侧菜单初始化及动态选项卡绑定操作
-
系统管理:用户管理模块增删改查实现
-
会议发布:新增OA会议信息
-
我的会议:完成我的会议信息展示、会议排座、送审、反馈详情及召开会议等功能
-
我的审批:完成会议审批操作:审批通过和审批驳回
-
会议通知:展示我需要参与的会议信息,并实现参会与不参会功能
-
待开会议:展示会议状态为待开的所有会议信息
-
历史会议:展示会议状态为已结束的所有会议信息
-
所有会议:展示所有的会议信息
4.项目搭建
1、基于idea创建OA Web Project工程完成OA会议系统项目搭建
2、创建实体类
3、创建UserDao,编写userLogin用户登入方法
/**
* 用户登入
* @param t_oa_user
* @return
*/
public T_oa_user userLogin(T_oa_user t_oa_user){
String sql="select * from t_oa_user where loginName='"+t_oa_user.getLoginName()+"'";
System.out.println(sql);
List<T_oa_user> t = super.executeQuery(sql, null, new CallBack<T_oa_user>() {
@Override
public List<T_oa_user> forEach(ResultSet rs) throws SQLException {
return CommonUtils.toList(rs, T_oa_user.class);
}
});
if(null!=t&&t.size()>0)
return t.get(0);
else
return null;
}
4、创建UserAction并登录实现,使用MD5对用户密码进行加密处理
1、MD5
package com.zking.oa.util;
/**
* 使用MD5算法对字符串进行加密的工具类。 MD5即Message-Digest
* Algorithm5(信息-摘要算法5),是一种用于产生数字签名的单项散列算法, 这个算法是不可逆的,
* 也就是说即使你看到源程序和算法描述,也无法将一个MD5的值变换回原始的字符串
*
*/
public class MD5 {
/*
* 下面这些S11-S44实际上是一个4*4的矩阵,在原始的C实现中是用#define 实现的, 这里把它们实现成为static
* final是表示了只读,切能在同一个进程空间内的多个 Instance间共享
*/
private static final int S11 = 7;
private static final int S12 = 12;
private static final int S13 = 17;
private static final int S14 = 22;
private static final int S21 = 5;
private static final int S22 = 9;
private static final int S23 = 14;
private static final int S24 = 20;
private static final int S31 = 4;
private static final int S32 = 11;
private static final int S33 = 16;
private static final int S34 = 23;
private static final int S41 = 6;
private static final int S42 = 10;
private static final int S43 = 15;
private static final int S44 = 21;
private static final byte[] PADDING = { -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0 };
/*
* 下面的三个成员是MD5计算过程中用到的3个核心数据,在原始的C实现中 被定义到MD5_CTX结构中
*
*/
private long[] state = new long[4]; // state (ABCD)
private long[] count = new long[2];// number of bits, modulo 2^64(lsbfirst)
private byte[] buffer = new byte[64]; // input buffer
/*
* digest,是最新一次计算结果的2进制内部表示,表示128bit的MD5值.
*/
private byte[] digest = new byte[16];
public MD5() {
md5Init();
}
/*
* getMD5ofStr是类MD5最主要的公共方法,入口参数是你想要进行MD5变换的字符串
* 返回的是变换完的结果,这个结果是从公共成员digestHexStr取得的.
*/
public String getMD5ofStr(String inbuf) {
md5Init();
md5Update(inbuf.getBytes(), inbuf.length());
md5Final();
String digestHexStr = "";
for (int i = 0; i < 16; i++) {
digestHexStr += byteHEX(digest[i]);
}
return digestHexStr;
}
/* md5Init是一个初始化函数,初始化核心变量,装入标准的幻数 */
private void md5Init() {
count[0] = 0L;
count[1] = 0L;
// /* Load magic initialization constants.
state[0] = 0x67452301L;
state[1] = 0xefcdab