java发送会议邀请邮件模板_用代码给Messenger用户发送通知

[PHP]

import java.util.Iterator;

import org.jivesoftware.smack.ConnectionConfiguration;

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.XMPPException;

import org.jivesoftware.smack.packet.DefaultPacketExtension;

import org.jivesoftware.smack.packet.Message;

import com.justep.system.data.KSQL;

import com.justep.system.data.Row;

import com.justep.system.data.Table;

public class SendNotice {

public static void SendNoticeToMeet(String rowid) throws XMPPException {

//获取msg服务器信息

String sql = "select m.fMsgSendPsnID,m.fMsgSendPsnCode,

m.fMsgSendPsnName,o.sPassword,m.fMsgServerIP,m.fMsgDomain from OA_MT_MsgSendCfg m join SA_OPPerson o on m.fMsgSendPsnID = o";

Table stab = KSQL.select(sql, null, "/OA/meeting/data", null);

Row srow = stab.iterator().next();

String serverID = srow.getString("fMsgServerIP"); //msg服务器电脑ip

String domain = srow.getString("fMsgDomain"); // 域名

domain = String.format("@%s/xmsg", domain);

//获取发送者信息

String ssql = "select u.fApplyPsnID,o.sName,o.sCode,o.sPassword "

+ "from OA_MT_UseApply u join SA_OPPerson o"

+ " on u.fApplyPsnID = o where u = '" + rowid + "'";

Table stab1 = KSQL.select(ssql, null, "/OA/meeting/data", null);

Row srow1 = stab1.iterator().next();

String sCode = srow1.getString("sCode");// 发送者sCode

String senderID = srow1.getString("fApplyPsnID");// 发送者sID

String pwd = srow1.getString("sPassword");// 发送者登录系统密码

//登录msg服务器,发送通知

ConnectionConfiguration config = new ConnectionConfiguration(serverID,

5222); // 根据msg服务器ip和端口,获取配置信息

XMPPConnection conn = null;

conn = new XMPPConnection(config);

conn.connect();

try {

conn.login(sCode, pwd); // 登录msg服务器

} catch (XMPPException e) {

conn.disconnect();

throw e;

}

String ksql = "select mu.fPersonID from OA_MT_UseApplyPsns mu where mu.fMasterID = '" + rowid + "'";

Table tab = KSQL.select(ksql, null, "/OA/meeting/data", null);

Iterator rows = tab.iterator();

while (rows.hasNext()) {

Row row = rows.next();

String recvId = row.getString("fPersonID");// 接收者sid

String sendUserJID = senderID + "@" + domain + "/xmsg";

String recvUserJID = recvId + domain;

long threadID = System.currentTimeMillis();

String thread = String.valueOf(threadID);

double flag = Math.random() * 1000;

String packetID = "xmsg_" + String.valueOf(flag);

Message msgX = new Message();

msgX.setFrom(sendUserJID);

msgX.setTo(recvUserJID);

msgX.setSubject("消息标题");

msgX.setType(Message.Type.normal);

msgX.setThread(thread);

msgX.setPacketID(packetID);

String S = "开会通知:

/boardroomUseApplyDetail/mainActivity.w?applyID="+ rowid +"\">会议详细内容

";

DefaultPacketExtension ext = new DefaultPacketExtension("html", "http://jabber.org/protocol/xhtml-im");

ext.setValue("body", S);

msgX.setBody(S); // 发送内容

msgX.addExtension(ext);

conn.sendPacket(msgX);

}

conn.disconnect();

}

}[/PHP]

本文由WeX5君整理,WeX5一款开源免费的html5开发工具,H5 App开发就用WeX5!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值