会议管理设计与实现文档
会议管理
数据库:meetingdb
数据表:1、meeting_info 2、meeting_join_user (一对多关系)
菜单
1、我发起的会议(公开)
2、待参与的会议(公开)
3、待审批的会议(管理员,经理,主管)
4、所有会议列表(管理员)
注: 角色目前是按照个人自己的设计的角色,后期需要改为省平台的对应的角色
创建会议:创建会议时,把相关参与人的数据插入到meeting_join_user表
删除会议:删除会议时,把相关参与人的数据从meeting_join_user表删除
预览会议详情页面:查看会议详情信息
查询会议参与人列表:查看会议参与人的信息列表
带参与会议列表:
回复是否参与会议:弹窗回复是否参与会议
会议流程图:
员工:创建会议(提交)s----审批(提交)----发布
经理、主管:创建会议(提交)-----发布
运行效果图:
员工:(我发起的会议,待参与的会议)
主管、经理:(我发起的会议,待参与的会议,待审批的会议)
管理员:(我发起的会议,待参与的会议,待审批的会议、所有会议管理列表)
开发技术关键点记录:
添加数据:
在保存操作的 动作后,或者动作前,进行对C表添加数据。
A表添加数据时,向C表也添加数据:
(function(){
var doc = getCurrentDocument();
var meeting_id=getItemValueAsString("meeting_id");
var aa = doc.getItemValueAsString("user_list"); //表单用户选择框字段
if(!aa.equals("")&& aa.length()>0){
var docids = splitText(aa, ";");
var userlist = createObject("java.util.ArrayList");
for (var i = 0; i < docids.length; i++) {
if (docids != null) {
var userVO = getUserById(docids[i]);
userlist.add(userVO);
}
}
var formProcess = getFormProcess();
var process = getDocumentProcess();
var form = formProcess.doViewByFormName("meeting_join_user" , getApplication());
if(userlist!=null && userlist.size()>0){
for(var i = 0; i < userlist.size(); i++){//循环条件
var dataUser = userlist.get(i);
var itemDoc = process.doNew(form,getWebUser(),createParamsTable());
var userid=dataUser.getId();
var sql = "select * from tlk_meeting_join_user where item_meeting_id='"+meeting_id;
sql +="' and item_user_id='"+userid+"'";
var existlist = queryBySQL(sql);
if(existlist!=null && existlist.size()>0){
}else{
var depts = dataUser.getDepartments();
var departmentName = "";
for (var iter = depts.iterator(); iter.hasNext();) {
var dept = iter.next();
departmentName = dept.getName();
}
//itemDoc.setParent(doc.getId());
itemDoc.setAuthor(userid);
//itemDoc.setIstmp(false);
itemDoc.setApplicationid(getApplication());
itemDoc.setDomainid(dataUser.getDomainid());
itemDoc.addStringItem("meeting_id", meeting_id);
itemDoc.addStringItem("user_id", userid);
itemDoc.addStringItem("username", dataUser.getName());
itemDoc.addStringItem("tel_phone", dataUser.getTelephone());
itemDoc.addStringItem("department", departmentName);
itemDoc.addStringItem("message", "");
itemDoc.addStringItem("status", "wait");
itemDoc.addDateItem("add_date", getToday());
process.doCreate(itemDoc);
}
}
}
}
})()
删除数据:
A表删除数据时,向C表也删除数据:
(跟添加数据时的原理一样):
(function(){
var params = getParameter("_selects");
if(params!=null && params!=""){
var recordids = splitText(params,";");//得到选中记录组的id
var recordid = "";
var appid=getApplication();//获取应用ID
var a=new Packages.cn.myapps.core.deploy.application.ejb.ApplicationProcessBean();//实例化application的应用处理类
var avo=a.doView(appid);//获取软件应用对象
var did=avo.getDatasourceid();//获取数据源的ID
var db=new Packages.cn.myapps.core.dynaform.dts.datasource.ejb.DataSourceProcessBean();//实例化数据源的应用处理类
var kk=db.doView(did);//获取数据源对象
var dbsname=kk.getName();//获取数据源名称
var process = new Packages.cn.myapps.core.dynaform.document.ejb.DocumentProcessBean(getApplication()); //实例化文档对象
for(var i=0;i<recordids.length;i++){
var id = recordids[i];
//process.doRemove(recordids[i]);//根据文档ID,删除文档对象
var sql = "delete from tlk_meeting_join_user where parent='"+id+"'";
if(!"".equals(dbsname)){
deleteByDSName(dbsname,sql);
}
}
}
})()
待参加会议数据查询:
数据查询SQL
(function(){
var user = getWebUser();
var userid = user.getId();
var sql="";
if(null!=userid || !"".equals(userid)){
sql = "select u.item_status, m.* from tlk_meeting_join_user as u LEFT JOIN tlk_meeting_info as m on u.ITEM_MEETING_ID =m.ITEM_MEETING_ID where u.ITEM_USER_ID='"+userid+"' and m.ITEM_MEETING_STATUS='已发布' and m.ITEM_START_TIME>=now()";
}
return sql;
})()
视图列跳转视图(当前页)
查询会议参与人列表
(function(){
var request = $WEB.getParamsTable().getHttpRequest();//获取当前 request
var curr= getCurrentDocument();
var meetingId=getItemValueAsString("meeting_id");
//var uid = getWebUser().getId();
var url1="http://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
var view_id="11e6-10d5-c8907e8b-a931-c7e163d030f2";//视图 id,浏览器的http请求可以看到
var oldUrl = url1+
"/portal/dynaform/view/displayView.action?_viewid="+view_id+"&clearTemp=true&application=11e6-10c7-cb2f4e2b-a931-c7e163d030f2&meetingId="+meetingId+"&_resourceid=11e6-10da-4b00d761-a931-c7e163d030f2";
var rtn = "<a style=\"cursor:pointer;\" href='"+oldUrl+"' title='查询参会人' ><font color='blue' >查询参会人</font></a>";
return rtn;
})();
视图上接收参数去查询相关的记录:
(function(){
var request = $WEB.getParamsTable().getHttpRequest();
var meetingId = request.getParameter("meetingId");
if(isNotNull(meetingId)){
request.getSession().setAttribute("usermeetingId",meetingId);
}else{
meetingId = request.getSession().getAttribute("usermeetingId");
}
println("=======mid=========="+meetingId);
var sql="select * from tlk_meeting_join_user where item_meeting_id='"+meetingId+"'";
return sql;
})()
视图列跳转表单(弹窗)
回复会议:
(function(){
var doc = getCurrentDocument();//当前的文档对象
var meetingid = doc.getItemValueAsString("meeting_id");//获取所在行的会议id
var user = getWebUser();
var userid = user.getId();//获取当前用户的ID
println("=======m======="+meetingid);
println("=======u======="+userid);
var docid="";//记录id
var formid="11e6-10d2-5c67ecc1-a931-c7e163d030f2";//相应记录的表单id 固定的
if(meetingid!=null && userid!=null){
var sql = "select * from tlk_meeting_join_user where item_meeting_id='"+meetingid;
sql +="' and item_user_id='"+userid+"'";
var userlist = queryBySQL(sql);
println("============="+userlist.size());
if(userlist!=null && userlist.size()>0){ //遍历结果集
for(var iter1 = userlist.iterator();iter1.hasNext();){
var itemdoc = iter1.next();
if(itemdoc!=null){
docid=itemdoc.getId();//获取查询出的文档的id
println("======m======"+itemdoc.getItemValueAsString("meeting_id"));
println("======u======"+itemdoc.getItemValueAsString("user_id"));
}
}
}
}
var subject = "回复";
var request = $WEB.getParamsTable().getHttpRequest();//获取当前request
var url1="http://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
var oldUrl = url1+"/portal/dynaform/document/view.action?user_reply=yes&_docid="+docid+"&_formid="+formid;
oldUrl += "&application="+getApplication();
oldUrl += "&isedit=true&signatureExist=false";
var url = "OBPM.dialog.show({opener:window.parent,title:'回复会议',url:'"+oldUrl+"',width:960,height:500,close:function(){}})";
return "<a style=\"cursor:pointer;\" οnclick=\""+url+";\"><font color='blue'>"+subject+"</font></a>";
})();
表单操作跳转模板表单(会议详情页)(预览)
视图列跳转模板表单
(function(){
var id="";
var formid="";
var applicationid="";
var url="";
var pnama=getItemValueAsString("meeting_id");
var sql="select id ,formid, applicationid,DOMAINID from tlk_meeting_info where item_meeting_id='"+pnama+"'";
var querys=queryBySQL(sql);
//println("sql****"+sql);
if(querys!=null&& querys.size()>0){
var iter = querys.iterator();
if(iter != null && iter.hasNext()){
doc = iter.next();
id = doc.getId();
formid=doc.getFormid();
applicationid=doc.getApplicationid();
}
var request = $WEB.getParamsTable().getHttpRequest();
url += "http://" + request.getServerName()+":" + request.getServerPort() + request.getContextPath();
var templateForm="11e6-1259-48d33857-8df4-1fe7f193ff40";//模板id
url += "/portal/dynaform/document/view.action?_docid="+id+"&_formid="+formid+"&_templateForm="+templateForm+"&application="+applicationid;
}
return url;
})()
流程中判断角色是否允许进入路径
判断角色是否允许进入路径:(主管、经理)
var rtn = false;
var curDoc = getCurrentDocument();
var webUser = curDoc.getAuthor();
var roles = webUser.getRoles();
if(roles != null && roles.size()>0){
for(var iter = roles.iterator();iter.hasNext();){
var roleVo = iter.next();
var roleName = roleVo.getName();
if("主管".equals(roleName)||"经理".equals(roleName)){
rtn = true;
break;
}
}
}
rtn;
判断角色是否允许进入路径:(员工)(代码基本都差不多一致,只是返回true/false调整一下)
var rtn = true;
var curDoc = getCurrentDocument();
var webUser = curDoc.getAuthor();
var roles = webUser.getRoles();
if(roles != null && roles.size()>0){
for(var iter = roles.iterator();iter.hasNext();){
var roleVo = iter.next();
var roleName = roleVo.getName();
if("主管".equals(roleName)||"经理".equals(roleName)){
rtn = false;
break;
}
}
}
rtn;
路劲执行的脚本:(更改数据库meeting_status字段的状态)
var doc =getCurrentDocument();
doc.findItem("meeting_status").setValue("待审批");
var doc =getCurrentDocument();
doc.findItem("meeting_status").setValue("已发布");
流程执行路径发布时 发送站内信、短信的、邮件
var doc =getCurrentDocument();
doc.findItem("meeting_status").setValue("已发布");
var userIds = doc.getItemValueAsString("user_list");
var meetingTitle = doc.getItemValueAsString("title");
var startTime = doc.getItemValueAsString("start_time");
var address = doc.getItemValueAsString("address");
//发送信息通知参会人
var send_way = doc.getItemValueAsString("send_way");
var msgtitle=meetingTitle;
var msgcontent="请各位准时出席《"+meetingTitle+"》会议,开始时间:"+startTime+"地点:"+address;
var receiverId=userIds;
var msgdescription="";
var emailpassword="";
var senderid=doc.getItemValueAsString("user_id");
var uid = getWebUser().getId();
println("======cu======="+uid)
println("======s======="+senderid)
//调用
#include "autosqllib";
deliverMassage(send_way, msgtitle, msgcontent, receiverId,msgdescription,emailpassword, senderid);
/*
函数格式:
deliverMassage(manner, msgtitle, msgcontent, receiverId, msgdescription, emailpassword, senderid)
函数说明:
Manner: 是发送类别 "10,20,30";字符串类型 title : 是主题
msgContent:内容
receiverId:收件人的id
msgdescription :描述
emailpassword :要发送邮件时,需要的邮箱密码
senderid :类型的值 (可不传)(date类型
*/
function deliverMassage(manner, title, content, receiverId, description, emailpassword, senderid) {
content = description + content;
var curuserprocess = getUserProcess();
var curuser = getWebUser();
var userIds = receiverId;
if (manner.indexOf("10") > -1) {
var MSreceiver = createObject("java.util.ArrayList");
MSreceiver = getUserIdList(userIds);
if (MSreceiver != null && MSreceiver.size() > 0) {
for (var j = 0; j < MSreceiver.size(); j++) {
sendMessage(senderid, MSreceiver.get(j), title, content);
}
}
}
if (manner.indexOf("20") > -1) {
var docid = getId();
var receiver = "";
var isReply = false;
var isMass = true;
var SMSuser = createObject("java.util.ArrayList");
SMSuser = getUserList(userIds);
if (SMSuser != null && SMSuser.size()) {
if (SMSuser.size() == 0) {
isMass = false;
}
for (var i = 0; i < SMSuser.size(); i++) {
receiver = receiver + SMSuser.get(i).getTelephone() + ",";
}
sendSMS(docid, title, content, receiver, isReply, isMass);
}
}
if (manner.indexOf("30") > -1 && emailpassword) {
var userVO = curuserprocess.doView(senderid);
var from = userVO.getEmail();
// [email]niro@teemlink.com[/email]
var to = "";
// [email]zhangjuzhang@yahoo.com[/email]
var SMuser = createObject("java.util.ArrayList");
SMuser = getUserList(userIds);
var i = from.indexOf("@");
var host = from.substring(i + 1);
// teemlink.com
var user = from;
// [email]niro@teemlink.com[/email]
// var emailpassword=getItemValue("emailpassword"); 123456
var bbc = null;
// 抄送
var validate = true;
var subject = title;
var body = content;
if (SMuser != null && SMuser.size() > 0) {
for (var i = 0; i < SMuser.size(); i++) {
to = SMuser.get(i).getEmail();
sendMail(from, to, subject, body, host, user, emailpassword, bbc, validate);
}
}
}
}
//获取userid结合返回list集合
function getUserIdList(userIds) {
var userProcess = getUserProcess();
var userIdList = createObject("java.util.ArrayList");
var userList = createObject("java.util.ArrayList");
var doc = getCurrentDocument();
// var domainid = getDomainid();
userIdList = userIds.split(";");
for ( var i = 0; i < userIdList.length; i++) {
var user = userProcess.doView(userIdList[i]);
userList.add(user.getId());
}
return userList;
}
//获取用户对象集合
function getUserList(userIds) {
var userProcess = getUserProcess();
var userIdList = createObject("java.util.ArrayList");
var userList = createObject("java.util.ArrayList");
var doc = getCurrentDocument();
// var domainid = getDomainid();
userIdList = userIds.split(";");
for ( var i = 0; i < userIdList.length; i++) {
var user = userProcess.doView(userIdList[i]);
var userVo = getUserById(user.getId());
userList.add(userVo);
}
return userList;
}
删除
主表数据删除时,删除子表数据,这里没有把主表id和子表的parent关联起来
而是使用自己设置的字段来关联
/删除动作后后后后执行的脚本//
(function(){
var params = getParameter("_selects");
if(params!=null && params!=""){
var recordids = splitText(params,";");//得到选中记录组的id
var appid=getApplication();//获取应用ID
var a=new Packages.cn.myapps.core.deploy.application.ejb.ApplicationProcessBean();//实例化application的应用处理类
var avo=a.doView(appid);//获取软件应用对象
var did=avo.getDatasourceid();//获取数据源的ID
var db=new Packages.cn.myapps.core.dynaform.dts.datasource.ejb.DataSourceProcessBean();//实例化数据源的应用处理类
var kk=db.doView(did);//获取数据源对象
var dbsname=kk.getName();//获取数据源名称
for(var i=0;i<recordids.length;i++){
var meeting_id ="";
var selectSql="select id,domainid,item_meeting_id from tlk_meeting_info where id='"+recordids[i]+"'";
var datas=queryBySQL(selectSql);
println("========="+datas.size());
for(var iter = datas.iterator();iter.hasNext();){
var doc= iter.next();
meeting_id= doc.getItemValueAsString("meeting_id");
}
println("=====mid======="+meeting_id);
//process.doRemove(recordids[i]);//根据文档ID,删除文档对象
var sql = "delete from tlk_meeting_join_user where item_meeting_id='"+meeting_id+"'";
if(!"".equals(dbsname)){
deleteByDSName(dbsname,sql);
}
}
}
})()
//删除动作前前前执行的脚本//
(function(){
var params = getParameter("_selects");
if(params!=null && params!=""){
var recordids = splitText(params,";");//得到选中记录组的id
var appid=getApplication();//获取应用ID
var a=new Packages.cn.myapps.core.deploy.application.ejb.ApplicationProcessBean();//实例化application的应用处理类
var avo=a.doView(appid);//获取软件应用对象
var did=avo.getDatasourceid();//获取数据源的ID
var db=new Packages.cn.myapps.core.dynaform.dts.datasource.ejb.DataSourceProcessBean();//实例化数据源的应用处理类
var kk=db.doView(did);//获取数据源对象
var dbsname=kk.getName();//获取数据源名称
var process = new Packages.cn.myapps.core.dynaform.document.ejb.DocumentProcessBean(getApplication()); //实例化文档对象
for(var i=0;i<recordids.length;i++){
var selectdoc = process.doView(recordids[i]);//根据ID查询document对象。
println("=====doc======="+selectdoc);
var mid = selectdoc.getItemValueAsString("meeting_id");
println("=====mid======="+mid);
//process.doRemove(recordids[i]);//根据文档ID,删除文档对象
var sql = "delete from tlk_meeting_join_user where item_meeting_id='"+mid+"'";
if(!"".equals(dbsname)){
deleteByDSName(dbsname,sql);
}
}
}
})()
//删除动作前前前执行的脚本///
(function(){
var params = getParameter("_selects");
if(params!=null && params!=""){
var recordids = splitText(params,";");//得到选中记录组的id
var appid=getApplication();//获取应用ID
var a=new Packages.cn.myapps.core.deploy.application.ejb.ApplicationProcessBean();//实例化application的应用处理类
var avo=a.doView(appid);//获取软件应用对象
var did=avo.getDatasourceid();//获取数据源的ID
var db=new Packages.cn.myapps.core.dynaform.dts.datasource.ejb.DataSourceProcessBean();//实例化数据源的应用处理类
var kk=db.doView(did);//获取数据源对象
var dbsname=kk.getName();//获取数据源名称
var process = new Packages.cn.myapps.core.dynaform.document.ejb.DocumentProcessBean(getApplication()); //实例化文档对象
for(var i=0;i<recordids.length;i++){
var selectdoc=findDocument(recordids[i]);
println("=====doc======="+selectdoc);
var mid = selectdoc.getItemValueAsString("meeting_id");
println("=====mid======="+mid);
//process.doRemove(recordids[i]);//根据文档ID,删除文档对象
var sql = "delete from tlk_meeting_join_user where item_meeting_id='"+mid+"'";
if(!"".equals(dbsname)){
deleteByDSName(dbsname,sql);
}
}
}
})()