`
public void itemClick(ItemClickEvent evt) {
// TODO Auto-generated method stub
super.itemClick(evt);
if (StringUtils.equals("itg_pctestitem", evt.getItemKey())) {
testMessage(evt, "itg_pctestitem");
} else if (StringUtils.equals("itg_mobiletestitem", evt.getItemKey())) {
testMessage(evt, "itg_mobiletestitem");
}
}
public void testMessage(ItemClickEvent e, String type) {
String userId = RequestContext.get().getUserId();// 取用登录户Id
MessageInfo message = new MessageInfo();
ArrayList<Long> receivers = new ArrayList<Long>();
// "1085366744006004736"
receivers.add(Long.parseLong("879710192898412544"));
message.setUserIds(receivers);// 接收用户
message.setSenderName("zsy");
message.setSenderId(Long.parseLong(userId));// 消息发送者
message.setEntityNumber("ap_payapply");// 单据标识
message.setOperation("save");
// 获取付款申请单主键ID
IListView view = (IListView) this.getView();
String pkId = view.getSelectedRows().get(0).getPrimaryKeyValue().toString();
message.setBizDataId(Long.parseLong(pkId));// 单据主键
message.setTag("重要,必读");// 业务标签
message.setPubaccNumber("flowassist");
if (type.equals("itg_pctestitem")) {
String pcUrl = DBUtil.getParamValue("pcpayapply");
message.setContentUrl(pcUrl + pkId);// PC端
} else if (type.equals("itg_mobiletestitem")) {
String mUrl = DBUtil.getParamValue("mobilepayapply");
message.setMobContentUrl(mUrl + pkId);
}
message.setTitle("您有一条待办的付款申请单!");
message.setContent("您有一份待确认的付款申请单,单号:XX,金额:¥0.00,请点击确认");// 详情消息描述
message.setType(MessageInfo.TYPE_MESSAGE);// 推送消息的类型
Long msgId = MessageCenterServiceHelper.sendMessage(message);// 推送消息
}
`