1.获取须要发送的信息json
Map person = getPersonOrg(PERSONUUID); String Id= (String) person.get("USERID"); Id = Id == null ? "" : Id.trim(); List<String> List = StringUtils.str2List(Id); Map<String, Object> tMap = new HashMap<String, Object>(); tMap.put("msgType", "new_lraderTask"); tMap.put("msg", "您有一条待任务"); tMap.put("msgId",ddd); tMap.put("msgTo", Id); demoPushAccountList(List, "", tMap);
2.腾讯信鸽推送服务方法code
/** * @note 腾讯信鸽推送服务 * @author * @date 2016-07-2 * @param accountList 推送账号列表 * @param title 标题 * @param custom 自定义参数 * @return 推送结果 */ public org.json.JSONObject demoPushAccountList(List<String> accountList, String title, Map<String, Object> custom) { org.json.JSONObject ret =new org.json.JSONObject(); try { String accessIdStr = Configuration.getString("ACCESS_ID");// 目标应用ID int accessIdInt = Integer.parseInt(accessIdStr); String secretKey = Configuration.getString("SECRET_KEY");// 目标应用密钥 XingeApp xinge = new XingeApp(accessIdInt, secretKey); Message message = new Message(); message.setTitle(title); message.setContent(""); message.setType(Message.TYPE_MESSAGE); message.setCustom(custom); message.setMultiPkg(1); ret = xinge.pushAccountList(0, accountList, message); } catch (Exception e) { LogUtil.error(e); } return (ret); }
3.jar包get
XingeApp.jarit