上一篇博客分享了我的审批功能。那么根据业务流程来,审批通过就到了会议通知。
本次分享,会议通知以及通知后参会情况反馈。
明确了,这次的目标,会议通知和反馈详情。
会议通知:需要参加会议的人都能再自己登陆后再会议通知界面查看会议,并反馈是否参会,以及原因。
反馈详情:会议的主持人可以在我的会议中查看会议详情,哪些人参会,哪些人不参加会议。哪些人未读会议通知。
编写对应的SQL语句
既然,分析完毕,那么就开始我们的编码工作吧。
MeetingFeedBack实体类
- package com.zking.entity;
-
- import java.io.Serializable;
- /**
- * 会议反馈表
- * @author Administrator
- *
- */
- public class MeetingFeedBack implements Serializable {
-
- private String id;
- private Long meetingId;
- private Integer personType;
- private Long personId;
- private Integer result;
- private String reason;
-
-
- private String title;
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Long getMeetingId() {
- return meetingId;
- }
-
- public void setMeetingId(Long meetingId) {
- this.meetingId = meetingId;
- }
-
- public Integer getPersonType() {
- return personType;
- }
-
- public void setPersonType(Integer personType) {
- this.personType = personType;
- }
-
- public Long getPersonId() {
- return personId;
- }
-
- public void setPersonId(Long personId) {
- this.personId = personId;
- }
-
- public Integer getResult() {
- return result;
- }
-
- public void setResult(Integer result) {
- this.result = result;
- }
-
- public String getReason() {
- return reason;
- }
-
- public void setReason(String reason) {
- this.reason = reason;
- }
-
- public MeetingFeedBack() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public String toString() {
- return "MeetingFeedBack [id=" + id + ", meetingId=" + meetingId + ", personType=" + personType + ", personId="
- + personId + ", result=" + result + ", reason=" + reason + "]";
- }
-
- }
MeetingFeedBackDao
- package com.zking.dao;
-
- import java.sql.SQLException;
- import java.util.List;
- import java.util.Map;
- import java.util.UUID;
-
- import com.zking.entity.MeetingFeedBack;
- import com.zking.util.BaseDao;
- import com.zking.util.PageBean;
-
- public class MeetingFeedBackDao extends BaseDao
{ -
- /**
- * 会议通知:查询出我(当前登陆用户)需要参与的会议及会议的反馈信息(参会、缺席以及未读)
- * @param back
- * @param pageBean
- * @return
- */
- public List
- queryMeetingFeedBackByUserId(MeetingFeedBack back,PageBean pageBean) throws InstantiationException, IllegalAccessException, SQLException{
- String sql="select t1.*,ifnull(f.result,-1) result from \r\n" +
- "(select * from t_oa_meeting_info where "
- + "find_in_set('"+back.getPersonId()+"',concat(canyuze,',',liexize,',',zhuchiren))) t1 \r\n" +
- "left join t_oa_meeting_feedback f on "
- + "t1.id=f.meetingId and personId="+back.getPersonId()+" where f.result is null ";
- sql += " order by t1.id desc";
- System.out.println(sql);
- return super.executeQuery(sql, pageBean);
- }
- //会议反馈
- public int add(MeetingFeedBack back) throws Exception {
- String sql = "insert into t_oa_meeting_feedback values(?,?,?,?,?,?)";
- //前端没有传递id到后台 自己生成
- back.setId(UUID.randomUUID().toString().replaceAll("-", ""));
- return super.executeUpdate(sql, back, new String[] {"id","meetingId","personType","personId","result","reason"});
- }
-
-
- }
MeetingFeedBackAction
- package com.zking.web;
-
- import java.io.IOException;
- import java.util.List;
- import java.util.Map;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
-
- import com.zking.dao.MeetingFeedBackDao;
- import com.zking.entity.MeetingFeedBack;
- import com.zking.framework.ActionSupport;
- import com.zking.framework.ModelDriver;
- import com.zking.util.CommonUtils;
- import com.zking.util.PageBean;
- import com.zking.util.R;
- import com.zking.util.ResponseUtil;
-
-
- public class MeetingFeedBackAction extends ActionSupport implements ModelDriver
{ - private MeetingFeedBack back=new MeetingFeedBack();
- private MeetingFeedBackDao backDao=new MeetingFeedBackDao();
- @Override
- public MeetingFeedBack getModel() {
- return back;
- }
-
- /**
- * 会议通知分页查询
- * @param req
- * @param resp
- */
- public String queryMeetingFeedBackByUserId(HttpServletRequest req,
- HttpServletResponse resp) throws ServletException,IOException{
- try {
- PageBean pageBean=new PageBean();
- pageBean.setRequest(req);
- List
- ResponseUtil.writeJson(resp, R.ok(0, "会议通知数据查询成功", pageBean.getTotal(), lst));
- } catch (Exception e) {
- e.printStackTrace();
- try {
- ResponseUtil.writeJson(resp, R.error(0, "会议通知数据查询失败"));
- } catch (Exception e1) {
- e1.printStackTrace();
- }
- }
-
- return null;
- }
- }
meetingNotify.jsp
- <%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8"%>
- <%@include file="/common/header.jsp"%>
- html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <script type="text/javascript" src="${pageContext.request.contextPath }/static/js/meeting/meetingNotify.js">script>
- head>
- <style>
- body{
- margin:15px;
- }
- .layui-table-cell {height: inherit;}
- .layui-layer-page .layui-layer-content { overflow: visible !important;}
- style>
- <body>
- <div class="layui-form-item" style="margin:15px 0px;">
- <div class="layui-inline">
- <label class="layui-form-label">会议标题label>
- <div class="layui-input-inline">
- <input type="hidden" id="personId" value="${user.id }"/>
- <input type="text" id="title" autocomplete="off" class="layui-input">
- div>
- div>
- <div class="layui-inline">
- <button id="btn_search" type="button" class="layui-btn"><i class="layui-icon layui-icon-search">i> 查询button>
- div>
- div>
- <table id="tb" lay-filter="tb" class="layui-table" style="margin-top:-15px">table>
-
- <script type="text/html" id="tbar">
- {{# if(d.result==-1){ }}
- <a class="layui-btn layui-btn-xs" lay-event="edit">是否参会a>
- {{# } }}
- script>
- body>
- html>
meetingNotify.js
- let layer,table,$,form,test;
- var row;
- layui.use(['layer','table','jquery','form','test'],function(){
- layer=layui.layer,
- table=layui.table,
- form=layui.form,
- test=layui.test,
- $=layui.jquery;
-
- initTable();
-
- //查询事件
- $('#btn_search').click(function(){
- query();
- });
-
- });
-
- //初始化数据表格(我的审批)
- function initTable(){
- table.render({ //执行渲染
- elem: '#tb', //指定原始表格元素选择器(推荐id选择器)
- height: 400, //自定义高度
- loading: false, //是否显示加载条(默认 true)
- cols: [[ //设置表头
- {field: 'id', title: '会议编号', width: 90},
- {field: 'title', title: '会议标题', width: 120},
- {field: 'location', title: '会议地点', width: 140},
- {field: 'startTime', title: '开始时间', width: 120,
- templet:function(d){
- return test.toDate(new Date(d.startTime));
- }
- },
- {field: 'endTime', title: '结束时间', width: 120,
- templet:function(d){
- return test.toDate(new Date(d.endTime));
- }
- },
- {field: 'result', title: '反馈状态', width: 120,
- templet: function(d){
- if(d.result==1)
- return "参会";
- else if(d.result==2)
- return "缺席";
- else
- return "未读";
- }
- },
- {field: '', title: '操作', width: 200,toolbar:'#tbar'},
- ]]
- });
- }
-
- //点击查询
- function query(){
- table.reload('tb', {
- url: '/feedBack.action', //请求地址
- method: 'POST', //请求方式,GET或者POST
- loading: true, //是否显示加载条(默认 true)
- page: true, //是否分页
- where: { //设定异步数据接口的额外参数,任意设
- 'methodName':'queryMeetingFeedBackByUserId',
- 'personId':$('#personId').val(),
- 'title':$('#title').val(),
- },
- request: { //自定义分页请求参数名
- pageName: 'page', //页码的参数名称,默认:page
- limitName: 'rows' //每页数据量的参数名,默认:limit
- },
- done: function (res, curr, count) {
- console.log(res);
- }
- });
-
- //工具条事件
- table.on('tool(tb)', function(obj){
- row = obj.data; //获得当前行数据
- var layEvent = obj.event;
- var tr = obj.tr;
- console.log(row);
- if(layEvent === 'edit'){ //是否参会
- openLayer(row.id);
- } else {
-
- }
- });
- }
- function openLayer(id){
- layer.open({
- type: 2,
- title: '会议反馈', //对话框标题
- area: ['660px', '400px'], //宽高
- skin: 'layui-layer-rim', //样式类名
- content: 'jsp/meeting/addFeedBack.jsp?id='+id,
- btn:['会议反馈','关闭'],
- yes:function(index,layero){
- let data= $(layero).find("iframe")[0].contentWindow.getData();
- addMeetingFeedBack(data);
- },
- btn2:function(){
- layer.closeAll();
- }
- });
- }
-
- // 对会议通知进行 参会/不参会的反馈
- function addMeetingFeedBack(params){
- params['methodName']="add";
- console.log(params);
- $.post('/feedBack.action',params,function(rs){
- if(rs.success){
- layer.closeAll();
- query();
- }else{
- layer.msg(rs.msg,{icon:5},function(){});
- }
- },'json');
- }
addFeedBack.jsp
- <%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8"%>
- <%@include file="/common/header.jsp"%>
- html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <script type="text/javascript" src="${pageContext.request.contextPath }/static/js/meeting/addFeedBack.js">script>
- head>
- <style>
- body{
- margin:5px;
- }
- style>
- <body>
- <div style="padding:10px;">
- <form class="layui-form layui-form-pane" lay-filter="back">
-
- <input type="hidden" name="meetingId" value="${param.id }"/>
- <input type="hidden" name="personId" value="${sessionScope.user.id }"/>
- <div class="layui-form-item">
- <label class="layui-form-label">人员类型label>
- <div class="layui-input-block">
- <select id="personType" name="personType">
- <option value="">请选择人员类型option>
- <option value="1">参会option>
- <option value="2">列席option>
- select>
- div>
- div>
- <div class="layui-form-item">
- <label class="layui-form-label">反馈结果label>
- <div class="layui-input-block">
- <select id="result" name="result">
- <option value="">请选择反馈结果option>
- <option value="1">参加option>
- <option value="2">不参加option>
- select>
- div>
- div>
- <div class="layui-form-item layui-form-text">
- <label class="layui-form-label">不参与会议的原因label>
- <div class="layui-input-block">
- <textarea placeholder="请输入内容" name="reason" class="layui-textarea">textarea>
- div>
- div>
- form>
- div>
- body>
- html>
addFeedBack.js
- let form,$;
- layui.use(['form','jquery'],function(){
- form=layui.form,
- $=layui.jquery;
- });
-
-
- function getData(){
- return form.val('back');
- }



