• OA项目之待开会议&所有会议


    目录

    1.准备工作

    2.待开会议前后端

    MeetingInfoDao:

    MeetingInfoAction:


    1.准备工作

     

     sq语句

    1.待开会议:

    select CONCAT(canyuze,',',liexize,',',zhuchiren)
    , a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren, b.`name` zhuchirenname,a.location, 
    DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime, 
    DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime, 
    a.state, 

            case a.state 
            when 0 then '取消会议' 
            when 1 then '新建' 
            when 2 then '待审核' 
            when 3 then '驳回' 
            when 4 then '待开' 
            when 5 then '进行中' 
            when 6 then '开启投票' 
            when 7 then '结束会议' 
            else '其他' end 
    ) meetingstate, 
    a.seatPic,a.remark,a.auditor, 
    c.`name` auditorname from t_oa_meeting_info a 
    inner join t_oa_user b on a.zhuchiren = b.id 
    left join t_oa_user c on a.auditor = c.id where 1=1 and state
    =4 and FIND_IN_SET(6, CONCAT(canyuze,',',liexize,',',zhuchiren))

    运行结果:

     2.所有会议:

    select
     a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren, b.`name` zhuchirenname,a.location, 
    DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime, 
    DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime, 
    a.state, 

            case a.state 
            when 0 then '取消会议' 
            when 1 then '新建' 
            when 2 then '待审核' 
            when 3 then '驳回' 
            when 4 then '待开' 
            when 5 then '进行中' 
            when 6 then '开启投票' 
            when 7 then '结束会议' 
            else '其他' end 
    ) meetingstate, 
    a.seatPic,a.remark,a.auditor, 
    c.`name` auditorname from t_oa_meeting_info a 
    inner join t_oa_user b on a.zhuchiren = b.id 
    left join t_oa_user c on a.auditor = c.id where 1=1 and state
    =4 and FIND_IN_SET(6, CONCAT(a.canyuze,',',a.liexize,',',a.zhuchiren,',',IFNULL(a.auditor,-1)))

    2.待开会议前后端

    jsp界面:

    1. <%@ page language="java" contentType="text/html; charset=UTF-8"
    2. pageEncoding="UTF-8"%>
    3. <%@include file="/common/header.jsp"%>
    4. html>
    5. <html>
    6. <head>
    7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    8. <script type="text/javascript" src="${pageContext.request.contextPath }/static/js/meeting/meetingWaiting.js">script>
    9. head>
    10. <style>
    11. body{
    12. margin:15px;
    13. }
    14. .layui-table-cell {height: inherit;}
    15. .layui-layer-page .layui-layer-content { overflow: visible !important;}
    16. style>
    17. <body>
    18. <div class="layui-form-item">
    19. <div class="layui-inline">
    20. <label class="layui-form-label">会议标题:label>
    21. <div class="layui-input-inline">
    22. <input type="hidden" id="userid" value="${sessionScope.user.id }"/>
    23. <input type="text" id="title" autocomplete="off"
    24. class="layui-input">
    25. div>
    26. div>
    27. <div class="layui-inline">
    28. <button id="btn_meeting_search" class="layui-btn layui-btn-normal">
    29. <i class="layui-icon">i> 查询
    30. button>
    31. div>
    32. div>
    33. <table style="margin-top: -15px;" id="tb_meeting" lay-filter="tb_meeting">table>
    34. body>
    35. html>

    js界面:

    1. let layer,form,table,$;
    2. var row;
    3. layui.use(['layer','form','table'],function(){
    4. layer=layui.layer,form=layui.form,table=layui.table,$=layui.jquery;
    5. //初始化会议列表
    6. initMeeting();
    7. //绑定查询按钮的点击事件
    8. $('#btn_meeting_search').click(function(){
    9. query();
    10. });
    11. });
    12. //1.初始化会议列表
    13. function initMeeting(){
    14. table.render({ //执行渲染
    15. elem: '#tb_meeting', //指定原始表格元素选择器(推荐id选择器)
    16. height: 400, //自定义高度
    17. loading: false, //是否显示加载条(默认 true)
    18. cols: [[ //设置表头
    19. {field: 'title', title: '会议标题', width: 180},
    20. {field: 'location', title: '会议地点', width: 120},
    21. {field: 'startTime', title: '开始时间', width: 180},
    22. {field: 'endTime', title: '结束时间', width: 180},
    23. {field: 'meetingstate', title: '会议状态', width: 90},
    24. {field: 'zhuchirenname', title: '主持人', width: 120},
    25. //{field: '', title: '操作', width: 260, toolbar: '#tbMeeting'}
    26. ]]
    27. });
    28. }
    29. //2.待开会议
    30. function query(){
    31. table.reload('tb_meeting', {
    32. url: 'info.action', //请求地址
    33. method: 'POST', //请求方式,GET或者POST
    34. loading: true, //是否显示加载条(默认 true)
    35. page: true, //是否分页
    36. where: { //设定异步数据接口的额外参数,任意设
    37. 'methodName':'queryMeetingInfoByState',
    38. 'title':$('#title').val(),
    39. 'zhuchiren':$('#userid').val(),
    40. 'state':4
    41. },
    42. request: { //自定义分页请求参数名
    43. pageName: 'page', //页码的参数名称,默认:page
    44. limitName: 'rows' //每页数据量的参数名,默认:limit
    45. },
    46. done: function (res, curr, count) {
    47. //查询完成的回调函数
    48. }
    49. });
    50. }

    MeetingInfoDao:

    1. package com.zking.dao;
    2. import java.sql.SQLException;
    3. import java.util.List;
    4. import java.util.Map;
    5. import com.zking.entity.MeetingInfo;
    6. import com.zking.util.BaseDao;
    7. import com.zking.util.PageBean;
    8. import com.zking.util.StringUtils;
    9. public class MeetingInfoDao extends BaseDao{
    10. //会议信息的新增
    11. public int add(MeetingInfo t) throws Exception {
    12. String sql = "insert into t_oa_meeting_info(title,content,canyuze,liexize,zhuchiren,location,startTime,endTime,remark) values(?,?,?,?,?,?,?,?,?)";
    13. return super.executeUpdate(sql, t, new String[] {"title","content","canyuze","liexize","zhuchiren","location","startTime","endTime","remark"});
    14. }
    15. private String getSQL() {
    16. return "SELECT\r\n" +
    17. " a.id,\r\n" +
    18. " a.title,\r\n" +
    19. " a.content,\r\n" +
    20. " a.liexize,\r\n" +
    21. " a.zhuchiren,\r\n" +
    22. " b.`name` zhuchirenname,\r\n" +
    23. " a.location,\r\n" +
    24. " DATE_FORMAT( a.startTime, '%y-%m-%d %H-%m-%s' ) startTime,\r\n" +
    25. " DATE_FORMAT( a.endTime, '%y-%m-%d %H-%m-%s' ) endTime,\r\n" +
    26. " a.state,\r\n" +
    27. " (\r\n" +
    28. "CASE\r\n" +
    29. " a.state \r\n" +
    30. " WHEN 0 THEN\r\n" +
    31. " '取消会议' \r\n" +
    32. " WHEN 1 THEN\r\n" +
    33. " '新建' \r\n" +
    34. " WHEN 2 THEN\r\n" +
    35. " '待审核' \r\n" +
    36. " WHEN 3 THEN\r\n" +
    37. " '驳回' \r\n" +
    38. " WHEN 4 THEN\r\n" +
    39. " '待开' \r\n" +
    40. " WHEN 5 THEN\r\n" +
    41. " '进行中' \r\n" +
    42. " WHEN 6 THEN\r\n" +
    43. " '开启投票' \r\n" +
    44. " WHEN 7 THEN\r\n" +
    45. " '结束会议' ELSE '其他' \r\n" +
    46. "END \r\n" +
    47. " ) meetingstate,\r\n" +
    48. " a.seatPic,\r\n" +
    49. " a.remark,\r\n" +
    50. " a.auditor,\r\n" +
    51. " c.`name` auditorname \r\n" +
    52. "FROM\r\n" +
    53. " t_oa_meeting_info a\r\n" +
    54. " INNER JOIN t_oa_user b ON a.zhuchiren = b.id\r\n" +
    55. " LEFT JOIN t_oa_user c ON a.auditor = c.id and 1=1 ";
    56. }
    57. //我的会议SQL,后续其他的菜单也会使用
    58. public List> myInfos(MeetingInfo info,PageBean pageBean)
    59. throws SQLException, InstantiationException, IllegalAccessException {
    60. String sql=getSQL();
    61. //拿到会议标题
    62. String title = info.getTitle();
    63. if(StringUtils.isNotBlank(title)) {
    64. sql +=" and title like '%"+title+"%' ";
    65. }
    66. sql +=" and zhuchiren = "+info.getZhuchiren();
    67. return super.executeQuery(sql, pageBean);
    68. }
    69. //设置会议排座图片
    70. public int updateSeatPicById(MeetingInfo info) throws Exception {
    71. String sql = "update t_oa_meeting_info set seatPic=? where id = ? ";
    72. return super.executeUpdate(sql, info, new String[] {"seatPic","id"});
    73. }
    74. //会议送审
    75. public int updateAuditorById(MeetingInfo info) throws Exception {
    76. String sql = "update t_oa_meeting_info set auditor=?,state=2 where id = ? ";
    77. return super.executeUpdate(sql, info, new String[] {"auditor","id"});
    78. }
    79. //我的审批
    80. public List> myAudit(MeetingInfo info, PageBean pageBean) throws Exception {
    81. String sql=getSQL();
    82. //拿到会议标题
    83. String title = info.getTitle();
    84. if(StringUtils.isNotBlank(title)) {
    85. sql +=" and a.title like '%"+title+"%' ";
    86. }
    87. sql +=" and auditor = "+info.getAuditor();
    88. sql+=" and a.state = 2";
    89. //降序
    90. sql+=" order by a.id desc";
    91. return super.executeQuery(sql, pageBean);
    92. }
    93. //待开会议
    94. public List> queryMeetingInfoByState(MeetingInfo info, PageBean pageBean) throws Exception {
    95. String sql = "select CONCAT(canyuze,',',liexize,',',zhuchiren)\r\n" +
    96. " , a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren, b.`name` zhuchirenname,a.location, \r\n" +
    97. " DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime, \r\n" +
    98. " DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime, \r\n" +
    99. " a.state, \r\n" +
    100. " ( \r\n" +
    101. " case a.state \r\n" +
    102. " when 0 then '取消会议' \r\n" +
    103. " when 1 then '新建' \r\n" +
    104. " when 2 then '待审核' \r\n" +
    105. " when 3 then '驳回' \r\n" +
    106. " when 4 then '待开' \r\n" +
    107. " when 5 then '进行中' \r\n" +
    108. " when 6 then '开启投票' \r\n" +
    109. " when 7 then '结束会议' \r\n" +
    110. " else '其他' end \r\n" +
    111. " ) meetingstate, \r\n" +
    112. " a.seatPic,a.remark,a.auditor, \r\n" +
    113. " c.`name` auditorname from t_oa_meeting_info a \r\n" +
    114. " inner join t_oa_user b on a.zhuchiren = b.id \r\n" +
    115. " left join t_oa_user c on a.auditor = c.id where 1=1 and state\r\n" +
    116. " =4 and FIND_IN_SET("+info.getZhuchiren()+", CONCAT(canyuze,',',liexize,',',zhuchiren))";
    117. return super.executeQuery(sql, pageBean);
    118. }
    119. //所有会议
    120. public List> allInfos(MeetingInfo info, PageBean pageBean) throws Exception {
    121. String sql = "select\r\n" +
    122. " a.id,a.title,a.content,a.canyuze,a.liexize,a.zhuchiren, b.`name` zhuchirenname,a.location, \r\n" +
    123. " DATE_FORMAT(a.startTime,'%Y-%m-%d %H-%m-%s') startTime, \r\n" +
    124. " DATE_FORMAT(a.endTime,'%Y-%m-%d %H-%m-%s') endTime, \r\n" +
    125. " a.state, \r\n" +
    126. " ( \r\n" +
    127. " case a.state \r\n" +
    128. " when 0 then '取消会议' \r\n" +
    129. " when 1 then '新建' \r\n" +
    130. " when 2 then '待审核' \r\n" +
    131. " when 3 then '驳回' \r\n" +
    132. " when 4 then '待开' \r\n" +
    133. " when 5 then '进行中' \r\n" +
    134. " when 6 then '开启投票' \r\n" +
    135. " when 7 then '结束会议' \r\n" +
    136. " else '其他' end \r\n" +
    137. " ) meetingstate, \r\n" +
    138. " a.seatPic,a.remark,a.auditor, \r\n" +
    139. " c.`name` auditorname from t_oa_meeting_info a \r\n" +
    140. " inner join t_oa_user b on a.zhuchiren = b.id \r\n" +
    141. " left join t_oa_user c on a.auditor = c.id where 1=1\r\n" +
    142. " and FIND_IN_SET("+info.getZhuchiren()+", CONCAT(a.canyuze,',',a.liexize,',',a.zhuchiren,',',IFNULL(a.auditor,-1)))\r\n" +
    143. " \r\n" +
    144. " \r\n" +
    145. "";
    146. return super.executeQuery(sql, pageBean);
    147. }
    148. }

    MeetingInfoAction:

    1. package com.zking.web;
    2. import java.util.Date;
    3. import java.util.List;
    4. import java.util.Map;
    5. import java.util.UUID;
    6. import javax.servlet.http.HttpServletRequest;
    7. import javax.servlet.http.HttpServletResponse;
    8. import org.apache.commons.beanutils.ConvertUtils;
    9. import com.zking.dao.MeetingInfoDao;
    10. import com.zking.entity.MeetingInfo;
    11. import com.zking.framework.ActionSupport;
    12. import com.zking.framework.ModelDriver;
    13. import com.zking.util.Base64ImageUtils;
    14. import com.zking.util.MyDateConverter;
    15. import com.zking.util.PageBean;
    16. import com.zking.util.PropertiesUtil;
    17. import com.zking.util.R;
    18. import com.zking.util.ResponseUtil;
    19. import com.zking.util.StringUtils;
    20. public class MeetingInfoAction extends ActionSupport implements ModelDriver{
    21. private MeetingInfo info = new MeetingInfo();
    22. private MeetingInfoDao infoDao = new MeetingInfoDao();
    23. @Override
    24. public MeetingInfo getModel() {
    25. //转换器
    26. ConvertUtils.register(new MyDateConverter(), Date.class);
    27. return info;
    28. }
    29. public String updateSeatPicById (HttpServletRequest req, HttpServletResponse resp) {
    30. /**
    31. * 1.接收界面传递到后台的图片对应的字符串
    32. * 2.借助工具类将字符串生成一个图片,保存到配置文件所配置的路径下
    33. * 3.添加服务器硬盘与请求地址的映射,即可访问
    34. * 4.将请求地址保存到数据库中
    35. */
    36. // E:/temp/images/T280/
    37. try {
    38. //获取图片的存放地址
    39. String dirPath = PropertiesUtil.getValue("dirPath");
    40. //获取浏览器的请求路径,为了后续保存到数据库serverPath=/upload/paizuo/
    41. String serverPath = PropertiesUtil.getValue("serverPath");
    42. //随机生产一个图片名
    43. String fileName = UUID.randomUUID().toString().replaceAll("-", "")+".png";
    44. info.getSeatPic();//图片字符串
    45. Base64ImageUtils.GenerateImage(info.getSeatPic()
    46. .replaceAll("data:image/png;base64,", ""), dirPath+fileName);
    47. //将seatPic中的内容修改为请求地址
    48. info.setSeatPic(serverPath + fileName);
    49. //修改会议排座数据库图片对应的数据库列段
    50. //rs影响行数n
    51. int rs = infoDao.updateSeatPicById(info);
    52. if(rs>0) {
    53. ResponseUtil.writeJson(resp, R.ok(200, "会议排座成功"));
    54. }
    55. else {
    56. ResponseUtil.writeJson(resp, R.error(0, "会议排座失败"));
    57. }
    58. } catch (Exception e) {
    59. e.printStackTrace();
    60. try {
    61. ResponseUtil.writeJson(resp, R.ok(0,"会议排座失败"));
    62. } catch (Exception e1) {
    63. // TODO Auto-generated catch block
    64. e1.printStackTrace();
    65. }
    66. }
    67. return null;
    68. }
    69. public String add (HttpServletRequest req, HttpServletResponse resp) {
    70. try {
    71. //rs影响行数
    72. int rs =infoDao.add(info);
    73. if(rs>0) {
    74. ResponseUtil.writeJson(resp, R.ok(200, "会议信息数据新增成功"));
    75. }
    76. else {
    77. ResponseUtil.writeJson(resp, R.error(0, "会议信息数据新增失败"));
    78. }
    79. } catch (Exception e) {
    80. e.printStackTrace();
    81. try {
    82. ResponseUtil.writeJson(resp, R.ok(0,"会议信息数据新增失败"));
    83. } catch (Exception e1) {
    84. // TODO Auto-generated catch block
    85. e1.printStackTrace();
    86. }
    87. }
    88. return null;
    89. }
    90. //我的会议
    91. public String myInfos (HttpServletRequest req, HttpServletResponse resp) {
    92. try {
    93. PageBean pageBean = new PageBean();
    94. pageBean.setRequest(req);
    95. List> list= infoDao.myInfos(info, pageBean);
    96. //注意:layui中的数据表格的格式
    97. ResponseUtil.writeJson(resp, R.ok(0, "我的会议 数据查询成功",pageBean.getTotal(), list ));
    98. } catch (Exception e) {
    99. e.printStackTrace();
    100. try {
    101. ResponseUtil.writeJson(resp, R.ok(0,"我的会议数据查询失败"));
    102. } catch (Exception e1) {
    103. // TODO Auto-generated catch block
    104. e1.printStackTrace();
    105. }
    106. }
    107. return null;
    108. }
    109. // 根据会议ID更新会议的审批人(送审)
    110. public String updateAuditorById(HttpServletRequest req, HttpServletResponse resp) {
    111. try {
    112. int rs = infoDao.updateAuditorById(info);
    113. if (rs > 0) {
    114. ResponseUtil.writeJson(resp, R.ok(200, "会议审批成功"));
    115. }else {
    116. ResponseUtil.writeJson(resp, R.error(0, "会议审批失败"));
    117. }
    118. } catch (Exception e) {
    119. e.printStackTrace();
    120. try {
    121. ResponseUtil.writeJson(resp, R.error(0, "会议审批失败"));
    122. } catch (Exception e1) {
    123. e1.printStackTrace();
    124. }
    125. }
    126. return null;
    127. }
    128. // 我的审批
    129. public String myAudit(HttpServletRequest req, HttpServletResponse resp) {
    130. try {
    131. PageBean pageBean = new PageBean();
    132. pageBean.setRequest(req);
    133. List> infos = infoDao.myAudit(info, pageBean);
    134. ResponseUtil.writeJson(resp, R.ok(0, "我的审批查询成功!!!", pageBean.getTotal(), infos));
    135. } catch (Exception e) {
    136. e.printStackTrace();
    137. try {
    138. ResponseUtil.writeJson(resp, R.error(0, "我的审批查询失败"));
    139. } catch (Exception e1) {
    140. e1.printStackTrace();
    141. }
    142. }
    143. return null;
    144. }
    145. //待开会议queryMeetingInfoByState
    146. public String queryMeetingInfoByState (HttpServletRequest req, HttpServletResponse resp) {
    147. try {
    148. PageBean pageBean = new PageBean();
    149. pageBean.setRequest(req);
    150. List> list= infoDao.queryMeetingInfoByState(info, pageBean);
    151. //注意:layui中的数据表格的格式
    152. ResponseUtil.writeJson(resp, R.ok(0, "待开会议数据查询成功",pageBean.getTotal(), list ));
    153. } catch (Exception e) {
    154. e.printStackTrace();
    155. try {
    156. ResponseUtil.writeJson(resp, R.ok(0,"待开会议数据查询失败"));
    157. } catch (Exception e1) {
    158. // TODO Auto-generated catch block
    159. e1.printStackTrace();
    160. }
    161. }
    162. return null;
    163. }
    164. //allInfos所有会议
    165. public String allInfos (HttpServletRequest req, HttpServletResponse resp) {
    166. try {
    167. PageBean pageBean = new PageBean();
    168. pageBean.setRequest(req);
    169. List> list= infoDao.allInfos(info, pageBean);
    170. //注意:layui中的数据表格的格式
    171. ResponseUtil.writeJson(resp, R.ok(0, "所有会议数据查询成功",pageBean.getTotal(), list ));
    172. } catch (Exception e) {
    173. e.printStackTrace();
    174. try {
    175. ResponseUtil.writeJson(resp, R.ok(0,"所有会议数据查询失败"));
    176. } catch (Exception e1) {
    177. // TODO Auto-generated catch block
    178. e1.printStackTrace();
    179. }
    180. }
    181. return null;
    182. }
    183. }

    运行效果:

     

  • 相关阅读:
    面试时被问到职业规划,怎样回答才最加分?
    scripts/Makefile.host 分析【fixdep、conf】
    Java的HTML转义工具
    AI视觉应用的4G远程测试
    为什么香港服务器最适合海外建站使用
    数据导入与预处理-第6章-03数据规约
    2022年Redis最新面试题第1篇 - Redis基础知识
    策略模式优雅实践
    如何实现微服务
    【RPC】gRPC 安装及使用
  • 原文地址:https://blog.csdn.net/m0_68211831/article/details/126063104