package com.upcode.weighing.util;
import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.Message;
import cn.jpush.api.push.model.Options;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.AndroidNotification;
import cn.jpush.api.push.model.notification.IosNotification;
import cn.jpush.api.push.model.notification.Notification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
/**
* @author liuxinghong
* @Description: 极光推送 工具类
* @date 2018/5/21/0219:48
*/
public class JpushClientUtil {
private static Logger log = LoggerFactory.getLogger(JpushClientUtil.class);
//private final static String appKey = "73be2b3c81006530d63e009a";
//private final static String masterSecret = "17832f1b426a3cdb47bfaf8f";
private final static String appKey = "ff7b21bbdca528095ae16c44";
private final static String masterSecret = "105141b384832ad2e88b5cde";
private static JPushClient jPushClient = new JPushClient(masterSecret.trim(), appKey.trim());
/**
* 推送给别名参数的用户
*
* @param alias 别名参数(单个)
* @param notification_title 通知内容标题
* @param msg_title 消息内容标题
* @param msg_content 消息内容
* @param extrasparam 扩展字段
* @return 0推送失败,1推送成功
*/
public static int sendToAlias(String alias, String notification_title, String msg_title, String msg_content, String extrasparam) {
int result = 0;
try {
PushPayload pushPayload = JpushClientUtil.buildPushObject_all_alias_alertWithTitle(alias, notification_title, msg_title, msg_content, extrasparam);
System.out.println(pushPayload);
PushResult pushResult = jPushClient.sendPush(pushPayload);
System.out.println("极光推送返回结果:" + pushResult + ",返回状态码:" + pushResult.getResponseCode());
if (pushResult.getResponseCode() == 200) {
result = 1;
}
} catch (APIConnectionException e) {
e.printStackTrace();
log.debug("极光推送服务调用失败!请检查相关连接数据!");
} catch (APIRequestException e) {
e.printStackTrace();
log.debug("极光推送服务调用失败!请检查相关数据!");
}
return result;
}
/**
* 推送给别名参数的用户
*
* @param alias 别名参数(多个)
* @param notification_title 通知内容标题
* @param msg_title 消息内容标题
* @param msg_content 消息内容
* @param extrasparam 扩展字段
* @return 0推送失败,1推送成功
*/
public static int sendToAliasList(List<String> alias, String notification_title, String msg_title, String msg_content, String extrasparam) {
int result = 0;
try {
PushPayload pushPayload = JpushClientUtil.buildPushObject_all_aliasList_alertWithTitle(alias, notification_title, msg_title, msg_content, extrasparam);
System.out.println(pushPayload);
PushResult pushResult = jPushClient.sendPush(pushPayload);
System.out.println(pushResult);
if (pushResult.getResponseCode() == 200) {
result = 1;
}
} catch (APIConnectionException e) {
e.printStackTrace();
} catch (APIRequestException e) {
e.printStackTrace();
}
return result;
}
/**
* 推送给别名参数的用户
*
* @param alias 别名参数(多个)
* @param notification_title 通知内容标题
* @param msg_title 消息内容标题
* @param msg_content 消息内容
* @param key 扩展字段key
* @param extrasparam 扩展字段
* @return 0推送失败,1推送成功
*/
public static int sendToAliasListTopic(List<String> alias, String notification_title, String msg_title, String msg_content, String key, String extrasparam) {
int result = 0;
try {
PushPayload pushPayload = JpushClientUtil.buildPushObject_all_aliasList_Topic_alertWithTitle(alias, notification_title, msg_title, msg_content, key, extrasparam);
System.out.println(pushPayload);
PushResult pushResult = jPushClient.sendPush(pushPayload);
System.out.println(pushResult);
if (pushResult.getResponseCode() == 200) {
result = 1;
}
} catch (APIConnectionException e) {
e.printStackTrace();
} catch (APIRequestException e) {
e.printStackTrace();
}
return result;
}
/**
* 推送给设备标识参数的用户
*
* @param registrationId 设备标识(单一设备)
* @param notification_title 通知内容标题
* @param msg_title 消息内容标题
* @param msg_content 消息内容
* @param extrasparam 扩展字段
* @return 0推送失败,1推送成功
*/
public static int sendToRegistrationId(String registrationId, String notification_title, String msg_title, String msg_content, String extrasparam) {
int result = 0;
try {
PushPayload pushPayload = JpushClientUtil.buildPushObject_all_registrationId_alertWithTitle(registrationId, notification_title, msg_title, msg_content, extrasparam);
System.out.println(pushPayload);
PushResult pushResult = jPushClient.sendPush(pushPayload);
System.out.println(pushResult);
if (pushResult.getResponseCode() == 200) {
result = 1;
}
} catch (APIConnectionException e) {
e.printStackTrace();
} catch (APIRequestException e) {
e.printStackTrace();
}
return result;
}
/**
* 推送给设备标识参数的用户
*
* @param registrationIdList 设备标识(同时发送给多个设备)
* @param notification_title 通知内容标题
* @param msg_title 消息内容标题
* @param msg_content 消息内容
* @param extrasparam 扩展字段
* @return 0推送失败,1推送成功
*/
public static int sendToRegistrationIdList(List<String> registrationIdList, String notification_title, String msg_title, String msg_content, String extrasparam) {
int result = 0;
try {
PushPayload pushPayload = JpushClientUtil.buildPushObject_all_registrationIdList_alertWithTitle(registrationIdList, notification_title, msg_title, msg_content, extrasparam);
System.out.println(pushPayload);
PushResult pushResult = jPushClient.sendPush(pushPayload);
System.out.println(pushResult);
if (pushResult.getResponseCode() == 200) {
result = 1;
}
} catch (APIConnectionException e) {
e.printStackTrace();
} catch (APIRequestException e) {
e.printStackTrace();
}
return result;
}
/**
* 发送给所有安卓用户
*
* @param notification_title 通知内容标题
* @param msg_title 消息内容标题
* @param msg_content 消息内容
* @param extrasparam 扩展字段
* @return 0推送失败,1推送成功
*/
public static int sendToAllAndroid(String notification_title, String msg_title, String msg_content, String extrasparam) {
int result = 0;
try {
PushPaylo
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
该流动治超管理平台后端接口设计源码采用Java语言编写,共包含764个文件,涵盖658个Java源文件、28个Markdown文档、26个XML配置文件、20个YAML配置文件、10个Gradle构建脚本文件、9个JAR包文件、4个文本文件、2个Excel文件以及少量其他类型文件。该项目专注于流动治超管理平台的后端接口开发,适用于相关领域的治超管理需求。
资源推荐
资源详情
资源评论
收起资源包目录
基于Java语言的流动治超管理平台后端接口设计源码 (764个子文件)
Dockerfile 670B
Dockerfile 341B
Dockerfile 272B
Dockerfile 255B
Dockerfile 255B
build.gradle 4KB
build.gradle 3KB
build.gradle 2KB
build.gradle 2KB
build.gradle 1KB
build.gradle 902B
build.gradle 763B
build.gradle 499B
settings.gradle 306B
build.gradle 236B
unoil-3.2.1.jar 1.35MB
hutool-core-5.6.3.jar 939KB
ridl-3.2.1.jar 251KB
jurt-3.2.1.jar 106KB
juh-3.2.1.jar 54KB
jodconverter-core-4.2.0.jar 46KB
jodconverter-2.2.2.jar 31KB
myencrypt.jar 2KB
myencrypt.jar 2KB
JpushClientUtil.java 45KB
SysFileController.java 30KB
Money.java 30KB
SysUserServiceImpl.java 29KB
JpushUtil.java 24KB
DateTools.java 22KB
DetectRecordRespVo.java 19KB
DetectRecord.java 19KB
DetectRecordAddVo.java 18KB
DetectRecordEditVo.java 17KB
TimeUtil.java 17KB
MyRedisTokenStore.java 16KB
BaseToolBox.java 16KB
DomainUserDetailsServiceImpl.java 15KB
Constants.java 13KB
EasyExcelUtils.java 12KB
SysOrganizationServiceImpl.java 12KB
RestTemplateUtil.java 11KB
FtpUtil.java 11KB
DetectStatsServiceImpl.java 11KB
SysResServiceImpl.java 9KB
BillConstants.java 9KB
SysUserController.java 9KB
MapUtil.java 9KB
CaptchaZuulFilter.java 9KB
MoneyUtils.java 9KB
SysOrganizationController.java 8KB
BaseController.java 8KB
AppUser.java 8KB
FastModifyRespVo.java 8KB
ClientRequestInfoUtil.java 8KB
ClientRequestInfoUtil.java 8KB
ClientRequestInfoUtil.java 8KB
AuthorizationServerConfig.java 8KB
DetectPointRespVo.java 7KB
VehicleRespVo.java 7KB
DetectRecordController.java 7KB
DetectPointController.java 7KB
ObuIssueReqVo.java 7KB
HttpClientUtil.java 7KB
PicIdInfoVo.java 7KB
PassWordUtils.java 7KB
QRCodeUtil.java 7KB
ResourceServerConfig.java 7KB
SysResController.java 7KB
User.java 7KB
ToolBox.java 7KB
CaptchaController.java 7KB
DetectStatsController.java 7KB
AppBaseController.java 7KB
DetectPoint.java 6KB
PassCardRespVo.java 6KB
RedissonAutoConfiguration.java 6KB
CodeGenerator.java 6KB
SCPUtil.java 6KB
StringUtils.java 6KB
UserHelper.java 6KB
NumberUtil.java 6KB
SmsApi.java 6KB
ResourceServerConfig.java 6KB
OverBlacklistController.java 5KB
AbstractCaptchaService.java 5KB
CodeGenerator.java 5KB
SysAreaController.java 5KB
PayBillsVo.java 5KB
ETCTwoBillBillVo.java 5KB
AppInfoController.java 5KB
DateParamUtils.java 5KB
MsgTemplateParamEntity.java 5KB
DateUtils.java 5KB
SysFileServiceImpl.java 5KB
EtcMarketingReportReqVo.java 5KB
SysClientDetails.java 5KB
SysClientDetails.java 5KB
ETCThreeBillBillVo.java 5KB
ChineseCaptchaStrategy.java 5KB
共 764 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
lsx202406
- 粉丝: 2271
- 资源: 5549
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 计算机毕业设计:python+爬虫+cnki网站爬
- nyakumi-lewd-snack-3-4k_720p.7z.002
- 现在微信小程序能用的mqtt.min.js
- 基于MPC的非线性摆锤系统轨迹跟踪控制matlab仿真,包括程序中文注释,仿真操作步骤
- shell脚本入门-变量、字符串, Shell脚本中变量与字符串的基础操作教程
- 基于MATLAB的ITS信道模型数值模拟仿真,包括程序中文注释,仿真操作步骤
- 基于Java、JavaScript、CSS的电子产品商城设计与实现源码
- 基于Vue 2的zjc项目设计源码,适用于赶项目需求
- 基于跨语言统一的C++头文件设计源码开发方案
- 基于MindSpore 1.3的T-GCNTemporal Graph Convolutional Network设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功