LayUi——OA项目 03(会议排座&送审)

本文档介绍了使用LayUI在OA项目中实现会议排座和送审功能的详细步骤,包括后端的MeetingInfoDao和MeetingInfoAction处理,前端的myMeeting.js、seatPic.jsp及myMeeting.jsp的配置与实现,最后展示了运行效果。
摘要由CSDN通过智能技术生成

目录

一、后端

1、MeetingInfoDao

2、MeetingInfoAction

3、配置文件和服务器

二、前端

1、myMeeting.js

2、seatPic.jsp

3、myMeeting.jsp

三、运行效果


一、后端

1、MeetingInfoDao

package com.zking.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.zking.entity.MeetingInfo;
import com.zking.util.BaseDao;
import com.zking.util.PageBean;
import com.zking.util.StringUtils;

public class MeetingInfoDao extends BaseDao<MeetingInfo> {
	// 添加会议信息
	public int add(MeetingInfo info) throws Exception {
		String sql = "insert into t_oa_meeting_info(title,content,canyuze,liexize,zhuchiren,\r\n"
				+ "location,startTime,endTime,remark) values(?,?,?,?,?,?,?,?,?)";
		return super.executeUpdate(sql, info, new String[] { "title", "content", "canyuze", "liexize", "zhuchiren",
				"location", "startTime", "endTime", "remark" });
	}
	
	//我的会议SQL,后续其他的菜单也会使用
	private String getSQL() {
		return "select a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren\r\n" + 
				",b.name zhuchirenname,\r\n" + 
				"a.location,\r\n" + 
				"DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime,\r\n" + 
				"DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime,\r\n" + 
				"a.state,\r\n" + 
				"(\r\n" + 
				"	case a.state\r\n" + 
				"	when 0 then '取消会议'\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" + 
				"	when 6 then '开启投票'\r\n" + 
				"	when 7 then '结束会议'\r\n" + 
				"	else '其他' end\r\n" + 
				") meetingstate,\r\n" + 
				"a.seatPic,a.remark,a.auditor,\r\n" + 
				"c.name auditorname\r\n" + 
				"from t_oa_meeting_info a\r\n" + 
				"inner join t_oa_user b on a.zhuchiren=b.id\r\n" + 
				"left join t_oa_user c on a.auditor=c.id and 1=1 ";
	}
	//我的会议
	public List<Map<String, Object>> myInfos(MeetingInfo info, PageBean pageBean)
			throws SQLException, InstantiationException, IllegalAccessException {
		String sql = getSQL();
		//会议标题
		String title = info.getTitle();
		if(StringUtils.isNotBlank(title)) {
			sql+=" and title like '%"+title+"%'";
		}
		sql+=" and zhuchiren="+info.getZhuchiren();
		return super.executeQuery(sql, pageBean);
	}

//	设置会议排座图片
	public int updateSeatPicById(MeetingInfo info) throws Exception {
		String sql =" update t_oa_meeting_info set seatPic=? where id=?";
		return super.executeUpdate(sql, info, new String[] {"seatPic","id"});
	}

//	根据会议ID更新会议的审批人(送审)
	public int updateAuditorById(MeetingInfo info) throws Exception {
		String sql="update t_oa_meeting_info set auditor=?,state=2 where id=?";
		return super.executeUpdate(sql, info, new String[] {"auditor","id"});
	}
	
}

2、MeetingInfoAction

package com.zking.web;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;

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.Base64ImageUtils;
import com.zking.util.MyDateConverter;
import com.zking.util.PageBean;
import com.zking.util.PropertiesUtil;
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 meetingInfoDao = new MeetingInfoDao();

	@Override
	public MeetingInfo getModel() {
		//方式二:
	    ConvertUtils.register(new MyDateConverter(),Date.class);
		return info;
	}
	
	public String updateSeatPicById(HttpServletRequest req, HttpServletResponse resp) {
		/*
		 * 1.接收前端页面传递到后台的图片对应的字符串
		 * 2.借助工具类将字符串生成一个图片,保存到配置文件所配置的路径下
		 * 3.添加服务器硬盘与请求地址的映射,即可访问
		 * 4.将请求地址保存到数据库中
		 */
		try {
//			E:/temp/images/T280/abcdefg.png
//			获取图片的存放地址	dirPath=E:/temp/images/T280/
			String dirPath = PropertiesUtil.getValue("dirPath");
//			获取浏览器请求路径,为了后续保存到数据库    serverPath=/upload/paizuo/
			String serverPath = PropertiesUtil.getValue("serverPath");
//			随机生成一个图片名称
			String fileName = UUID.randomUUID().toString().replaceAll("-", "")+".png";
			info.getSeatPic();//图片字符串
			Base64ImageUtils.GenerateImage(info.getSeatPic().replaceAll(
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值