当前位置:网站首页>OA项目之项目简介&会议发布

OA项目之项目简介&会议发布

2022-08-11 05:35:00 雨沐笙

目录

 一、会议OA的原型图业务介绍

二、会议OA的表设计

三、多功能下拉框

四、会议新增


 一、会议OA的原型图业务介绍

①、主界面-->会议发布

参与人员与列席人员的区别

列席人员有投票的权限,参与人员只能旁听;主持人:谁发起的会议,谁主持。

②、会议发布--->我的会议

会议发布完成之后,会在我的会议中展现出来

 选中刚发布的会议,进行对参加该会议的人员进行会议排座

以上是简化过,排座完后,点击下载,然后会在会议排座那一列呈现出来

当会议发布者排座完,点击送审即可, 不一定要选择上级,也可以是平级,毕竟别人也要参见。

  ③、会议审批

当选中的审批人员登录该系统可以在我的审批中看见刚刚发布者的提交过来的会议,点击审批即可

 

 审批完之后,发布者可以在我的会议中进行查看,如果是待开的话,参与会议的人员登录系统,可以在会议通知中进行查看要参加的会议,并且决定是否要参加。但是又三种情况 1)、参加 2)不参加 3)未读

④、会议通知(参与人员)

 进行人员类型选择和反馈结果选择,以及反馈内容的填写,最后点击保存即可

⑤我的会议(发布者)

当所有参加会议人员反馈完,发布者可以在我的会议进行参看反馈详情

以上还有个未读人员没有加上去 

⑥待开会议(发布者)

 当发布者查看反馈详情后,知道原本要参加多少人,实际要参加多少人。发布者可以在待开会议中查看所有的待开会议。

 ⑦投票标题

到了时间每一个会议都会有个主题,然后就到投票环节

上传附件:是将某某的履历进行上传

⑧投票选项

 ⑨投票结果

投票完成后可以在投票结果中进行查看

 点击所属会议进行查询

 点击所属投票标题继续查询

 投票结果一般只有最高权限的人可以进行查看

⑩数据报表

 以上便是主流程,次流程便是会议室管理

点击新增 

主线业务就是 会议管理,次要的就是投票管理,再次要的就是会议室管理

二、会议OA的表设计

根据原型图进行表设计

 

 

以上便是会议OA所用到的表,但是今天就完成 会议管理该模块

主要用到的表:用户表、权限表、会议信息表、会议通知审批表、会议通知反馈表

三、多功能下拉框

 文档地址:https://hnzzmsf.github.io/example/example_v4.html#download
 下载地址:https://github.com/hnzzmsf/layui-formSelects

要实现以上该下拉框就是需要用到formSelects,以上是下单地址和文档地址

它是介于layui的插件

下载方法

得到一个压缩包 

 将以下四个放到项目中

 1、使用步骤:导入formSelects,将资料中的《layui-formSelects-master.zip》解压并导入dist目录中的核心js和css到项目的指定路径中

按照该层级结构把js放进去 

2、在页面中引入核心JS和CSS

 引入js

let $,formSelects;
layui.use(['jquery','formSelects'],function(){
	$=layui.jquery,formSelects=layui.formSelects;
	formSelects.btns('canyuze', ['select', 'remove', 'reverse']);
})

页面引入

<!-- 引入formSelects核心css -->
<link rel="stylesheet" href="${pageContext.request.contextPath }/static/js/plugins/formSelects/formSelects-v4.css" />
<!-- 引入formSelects核心js -->
<script src="${pageContext.request.contextPath }/static/js/plugins/formSelects/formSelects-v4.js" type="text/javascript" charset="utf-8"></script>

 效果:

3、 定义formSelects组件及表单验证设置
官方文档本地绑数据

 效果:

 如图可见 有效果 证明是没有问题可以进行下一步操作了

分析addMeeting.js中的数据可以知道 需要name和value的格式数据,那么sql语句应为

select id as value,name from t_oa_user

UserDao:

package com.zking.dao;
 
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
 
import com.zking.entity.User;
import com.zking.util.BaseDao;
import com.zking.util.PageBean;
 
public  class UserDao extends BaseDao<User> {
	
	
	public User login(User user) throws Exception {
		String sql = "select * from t_oa_user where loginName='"+user.getLoginName()+"' and pwd='"+user.getPwd()+"' ";
//		return super.executeQuery(sql, clz, pageBean);
		//根据sql查询符合条件的用户,通常只会返回一条数据
		List<User> users = super.executeQuery(sql, User.class,null);
		return users == null || users.size() == 0 ? null : users.get(0);
	}
	
//	查询用户信息及对应的角色 角色是通过case when得到的
	public List<Map<String, Object>> list(User user,PageBean pageBean) throws Exception{
		String sql = "select * \r\n " + 
				", \r\n " + 
				"(case rid \r\n " + 
				"when 1 then '管理员' \r\n" + 
				"when 2 then '发起者' \r\n" + 
				"when 3 then '审批者' \r\n" + 
				"when 4 then '参与者' \r\n" + 
				"when 5 then '会议室管理员' \r\n" + 
				"else '其他' end ) roleName \r\n" + 
				"FROM t_oa_user where 1 = 1";
		String name = user.getName();
		if(com.zking.util.StringUtils.isNotBlank(name)) {
			sql += " and name like '%"+name+"%'";
		}
		//当实体类的属性完全包含数据库查询出来的列段的时候使用
//		super.executeQuery(sql, User.class, pageBean) 返回List<Map<String, Object>>,对应的是联表查询,单个实体类对象,不完全包含查询的列段
		return super.executeQuery(sql, pageBean);
	}
	
	//查询所有用户 用于绑定多功能下拉框
	public List<Map<String, Object>> queryUserAll(User user,PageBean pageBean) throws Exception{
		String sql = "select id as value,name from t_oa_user";
		return super.executeQuery(sql, pageBean);
	}
	
	public int add(User user) throws Exception {
		String sql = "insert into t_oa_user(name,loginName,pwd) values(?,?,?)";
		return super.executeUpdate(sql,user,new String[] {"name","loginName","pwd"});
	}
	
	public int del(User user) throws Exception {
		String sql = "delete from t_oa_user where id=?";
		return super.executeUpdate(sql,user,new String[] {"id"});
	}
	
	public int edit(User user) throws Exception {
		String sql = "update  t_oa_user set name=?,loginName=?,pwd=? where id=?";
		return super.executeUpdate(sql,user,new String[] {"name","loginName","pwd","id"});
	}
	
	
 
	
}

UserAction

package com.zking.web;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.apache.catalina.util.RequestUtil;
 
import com.zking.dao.UserDao;
import com.zking.entity.User;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.PageBean;
import com.zking.util.R;
import com.zking.util.ResponseUtil;
 
public class UserAction extends ActionSupport implements ModelDriver<User>{
 
	private User user = new User();
	
	private UserDao userDao = new UserDao();
	
	
	public String login(HttpServletRequest req, HttpServletResponse resp) {
		try {
			User u = userDao.login(user);
			//通过账户名密码查到了用户记录
			if(u != null) {
//				登录成功
				//ResponseUtil.writeJson(resp, new R().data("code", 200).data("msg","成功"));
				ResponseUtil.writeJson(resp, R.ok(200, "成功"));
			}
			else {
//				登录失败
				//ResponseUtil.writeJson(resp, new R().data("code",0).data("msg","账户或密码错误"));
				ResponseUtil.writeJson(resp, R.error(0, "账户或密码错误"));
			}
		} catch (Exception e) {
			// TODO: handle exception
		}
		return null;
	}
	
	//用户查询
	public String list(HttpServletRequest req, HttpServletResponse resp) {
		try {
			PageBean pageBean = new PageBean();
			pageBean.setRequest(req);
			List<Map<String, Object>> users = userDao.list(user, pageBean);
//			注意:layui中的数据表格的格式
			ResponseUtil.writeJson(resp, R.ok(0, "用户数据查询成功",pageBean.getTotal(),users));
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			try {
				ResponseUtil.writeJson(resp, R.error(0, "用户数据查询失败"));
			} catch (Exception e2) {
				// TODO: handle exception
				e2.printStackTrace();
			}
		}
		return null;
	}
	
	//查询所有用户用于绑定多功能下拉框
	public String queryUserAll(HttpServletRequest req, HttpServletResponse resp) {
		try {
			List<Map<String, Object>> users = userDao.queryUserAll(user, null);
//			注意:layui中的数据表格的格式
			ResponseUtil.writeJson(resp, R.ok(0, "多功能下拉框数据查询成功",users));
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			try {
				ResponseUtil.writeJson(resp, R.error(0, "多功能下拉框数据查询失败"));
			} catch (Exception e2) {
				// TODO: handle exception
				e2.printStackTrace();
			}
		}
		return null;
	}
	
	
	
	public String add(HttpServletRequest req, HttpServletResponse resp) {
		try {
			//影响行数
			int rs = userDao.add(user);
			if(rs>0) {
				ResponseUtil.writeJson(resp, R.ok(200, "用户数据新增成功"));
			}
			else {
				ResponseUtil.writeJson(resp, R.error(0, "用户数据新增失败"));
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			try {
				ResponseUtil.writeJson(resp, R.error(0, "用户数据查询失败"));
			} catch (Exception e2) {
				// TODO: handle exception
				e2.printStackTrace();
			}
		}
		return null;
	}
	
	public String del(HttpServletRequest req, HttpServletResponse resp) {
		try {
			//影响行数
			int rs = userDao.del(user);
			if(rs>0) {
				ResponseUtil.writeJson(resp, R.ok(200, "用户数据删除成功"));
			}
			else {
				ResponseUtil.writeJson(resp, R.error(0, "用户数据删除失败"));
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			try {
				ResponseUtil.writeJson(resp, R.error(0, "用户数据删除失败"));
			} catch (Exception e2) {
				// TODO: handle exception
				e2.printStackTrace();
			}
		}
		return null;
	}
	
	
	public String edit(HttpServletRequest req, HttpServletResponse resp) {
		try {
			//影响行数
			int rs = userDao.edit(user);
			if(rs>0) {
				ResponseUtil.writeJson(resp, R.ok(200, "用户数据修改成功"));
			}
			else {
				ResponseUtil.writeJson(resp, R.error(0, "用户数据修改失败"));
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			try {
				ResponseUtil.writeJson(resp, R.error(0, "用户数据修改失败"));
			} catch (Exception e2) {
				// TODO: handle exception
				e2.printStackTrace();
			}
		}
		return null;
	}
	
	@Override
	public User getModel() {
		return user;
	}
 
}

然后在addMeeting.js中测试一下

let $,formSelects;
layui.use(['jquery','formSelects'],function(){
	$=layui.jquery
	,formSelects=layui.formSelects;
//	添加多功能下拉框选项
	formSelects.btns('canyuze', ['select', 'remove', 'reverse']);
	formSelects.btns('liexize', ['select', 'remove', 'reverse']);
	
	$.getJSON("user.action",{methodName:"queryUserAll"},function(rs){
		console.log(rs);
	});
	//local模式
	formSelects.data('canyuze', 'local', {
	    arr: [
	        {"name": "广州", "value": 3},
	        {"name": "深圳", "value": 4},
	        {"name": "天津", "value": 5}
	    ]
	});
	
	
});

效果: 

若像如图这样的错误 并且在之前已经拿到数据却报错

错误代码块

let $,formSelects;
layui.use(['jquery','formSelects'],function(){
	$=layui.jquery
	,formSelects=layui.formSelects;
//	添加多功能下拉框选项
	formSelects.btns('canyuze', ['select', 'remove', 'reverse']);
	formSelects.btns('liexize', ['select', 'remove', 'reverse']);
	
	$.getJSON("user.action",{methodName:"queryUserAll"},function(rs){
		console.log(rs);
	});
	//local模式
	formSelects.data('canyuze', 'local', {
	    arr:rs.data
	});
	
	
});

解决办法:看绑定数据的代码是否在得到json方法里面

 真确的代码块

let $,formSelects;
layui.use(['jquery','formSelects'],function(){
	$=layui.jquery
	,formSelects=layui.formSelects;
//	添加多功能下拉框选项
	formSelects.btns('canyuze', ['select', 'remove', 'reverse']);
	formSelects.btns('liexize', ['select', 'remove', 'reverse']);
	
	$.getJSON("user.action",{methodName:"queryUserAll"},function(rs){
		console.log(rs);
		//local模式
		formSelects.data('canyuze', 'local', {
		    arr: rs.data
		});
		
	});
 
});

将列席者进行绑定 

 addMeeting.js

let $,formSelects;
layui.use(['jquery','formSelects'],function(){
	$=layui.jquery
	,formSelects=layui.formSelects;
//	添加多功能下拉框选项
	formSelects.btns('canyuze', ['select', 'remove', 'reverse']);
	formSelects.btns('liexize', ['select', 'remove', 'reverse']);
	
	$.getJSON("user.action",{methodName:"queryUserAll"},function(rs){
		console.log(rs);
		//local模式
		formSelects.data('canyuze','local', {
		    arr: rs.data
		});
		
		formSelects.data('liexize','local', {
		    arr: rs.data
		});
		
	});
 
});

效果:

 要实现会议时间的范围选择 进入layui官网:日期和时间组件文档 - Layui

 addMeeting.js

let $,formSelects,laydate;
layui.use(['jquery','formSelects'],function(){
	$=layui.jquery
	,formSelects=layui.formSelects
	,laydate=layui.laydate;
//	添加多功能下拉框选项
	formSelects.btns('canyuze', ['select', 'remove', 'reverse']);
	formSelects.btns('liexize', ['select', 'remove', 'reverse']);
	
	$.getJSON("user.action",{methodName:"queryUserAll"},function(rs){
		console.log(rs);
		//local模式
		formSelects.data('canyuze','local', {
		    arr: rs.data
		});
		
		formSelects.data('liexize','local', {
		    arr: rs.data
		});
	});
	
	 //日期时间范围
	  laydate.render({
	    elem: '#dt'
	    ,type: 'datetime'
	    ,range: true
	  });
 
});

 效果:

四、会议新增

怎么提交form表单

 写一个实体类--->MeetingInfo

package com.zking.entity;
 
import java.util.Date;
 
//数据库会议信息表t_oa_meeting_info对应的实体类
public class MeetingInfo {
    private Long id;
 
    private String title;
 
    private String content;
 
    private String canyuze;
 
    private String liexize;
 
    private String zhuchiren;
 
    private String location;
 
    private Date startTime;
 
    private Date endTime;
 
    private String fujian;
 
    private Integer state;
 
    private String seatPic;
 
    private String remark;
    
    private String auditor;
 
	public String getAuditor() {
		return auditor;
	}
 
	public void setAuditor(String auditor) {
		this.auditor = auditor;
	}
 
	public Long getId() {
		return id;
	}
 
	public void setId(Long id) {
		this.id = id;
	}
 
	public String getTitle() {
		return title;
	}
 
	public void setTitle(String title) {
		this.title = title;
	}
 
	public String getContent() {
		return content;
	}
 
	public void setContent(String content) {
		this.content = content;
	}
 
	public String getCanyuze() {
		return canyuze;
	}
 
	public void setCanyuze(String canyuze) {
		this.canyuze = canyuze;
	}
 
	public String getLiexize() {
		return liexize;
	}
 
	public void setLiexize(String liexize) {
		this.liexize = liexize;
	}
 
	public String getZhuchiren() {
		return zhuchiren;
	}
 
	public void setZhuchiren(String zhuchiren) {
		this.zhuchiren = zhuchiren;
	}
 
	public String getLocation() {
		return location;
	}
 
	public void setLocation(String location) {
		this.location = location;
	}
 
	public Date getStartTime() {
		return startTime;
	}
 
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
 
	public Date getEndTime() {
		return endTime;
	}
 
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
 
	public String getFujian() {
		return fujian;
	}
 
	public void setFujian(String fujian) {
		this.fujian = fujian;
	}
 
	public Integer getState() {
		return state;
	}
 
	public void setState(Integer state) {
		this.state = state;
	}
 
	public String getSeatPic() {
		return seatPic;
	}
 
	public void setSeatPic(String seatPic) {
		this.seatPic = seatPic;
	}
 
	public String getRemark() {
		return remark;
	}
 
	public void setRemark(String remark) {
		this.remark = remark;
	}
 
	public MeetingInfo() {
		super();
		// TODO Auto-generated constructor stub
	}
 
	@Override
	public String toString() {
		return "MeetingInfo [id=" + id + ", title=" + title + ", content=" + content + ", canyuze=" + canyuze
				+ ", liexize=" + liexize + ", zhuchiren=" + zhuchiren + ", location=" + location + ", startTime="
				+ startTime + ", endTime=" + endTime + ", fujian=" + fujian + ", state=" + state + ", seatPic=" + seatPic + ", remark=" + remark + "]";
	}
    
}

MeetingInfoDao

package com.zking.dao;
 
import com.zking.entity.MeetingInfo;
import com.zking.util.BaseDao;
 
public class MeetingInfoDao extends BaseDao<MeetingInfo>{
	
	//会议信息的新增
	public int add(MeetingInfo t) throws Exception {
		String sql = "insert into t_oa_meeting_info(title,content,canyuze,liexize,zhuchiren,location,startTime,endTime,remark) values(?,?,?,?,?,?,?,?,?)";
		return super.executeUpdate(sql, t, new String[] {"title","content","canyuze","liexize","zhuchiren","location","startTime","endTime","remark"});
	}
}

MeetingInfoAction

package com.zking.web;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import com.zking.dao.MeetingInfoDao;
import com.zking.entity.MeetingInfo;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.R;
import com.zking.util.ResponseUtil;
 
public class MeetingInfoAction extends ActionSupport implements ModelDriver<MeetingInfo>{
 
	private MeetingInfo info = new MeetingInfo();
	private MeetingInfoDao infoDao = new MeetingInfoDao();
	
	@Override
	public MeetingInfo getModel() {
		return info;
	}
	
	
	public String add(HttpServletRequest req, HttpServletResponse resp) {
		try {
			//影响行数
			int rs = infoDao.add(info);
			if(rs>0) {
				ResponseUtil.writeJson(resp, R.ok(200, "会议信息数据新增成功"));
			}
			else {
				ResponseUtil.writeJson(resp, R.error(0, "会议信息数据新增失败"));
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			try {
				ResponseUtil.writeJson(resp, R.error(0, "会议信息数据新增失败"));
			} catch (Exception e2) {
				// TODO: handle exception
				e2.printStackTrace();
			}
		}
		return null;
	}
	
}

mvc.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
	
	<action path="/user" type="com.zking.web.UserAction">
	</action>
 
	<action path="/permission" type="com.zking.web.PermissionAction">
	</action>
 
 
	
	<action path="/info" type="com.zking.web.MeetingInfoAction">
	</action>
</config>

当我们从登录界面进去 填完发布会议的立即提交 时 控制台会报错

原因:前端拿的时间时string类型 实体类时date类型

 MeetingInfoAction

package com.zking.web;
 
import java.sql.Date;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.apache.commons.beanutils.ConvertUtils;
 
import com.zking.dao.MeetingInfoDao;
import com.zking.entity.MeetingInfo;
import com.zking.framework.ActionSupport;
import com.zking.framework.ModelDriver;
import com.zking.util.MyDateConverter;
import com.zking.util.R;
import com.zking.util.ResponseUtil;
 
public class MeetingInfoAction extends ActionSupport implements ModelDriver<MeetingInfo>{
 
	private MeetingInfo info = new MeetingInfo();
	private MeetingInfoDao infoDao = new MeetingInfoDao();
	
	@Override
	public MeetingInfo getModel() {
		//注入一个转换器
		ConvertUtils.register(new MyDateConverter(), Date.class);
		return info;
	}
	
	
	public String add(HttpServletRequest req, HttpServletResponse resp) {
		try {
			//影响行数
			int rs = infoDao.add(info);
			if(rs>0) {
				ResponseUtil.writeJson(resp, R.ok(200, "会议信息数据新增成功"));
			}
			else {
				ResponseUtil.writeJson(resp, R.error(0, "会议信息数据新增失败"));
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			try {
				ResponseUtil.writeJson(resp, R.error(0, "会议信息数据新增失败"));
			} catch (Exception e2) {
				// TODO: handle exception
				e2.printStackTrace();
			}
		}
		return null;
	}
	
}

原网站

版权声明
本文为[雨沐笙]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_62604616/article/details/125918064