记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
8c5d749b
Commit
8c5d749b
authored
Mar 29, 2024
by
zhoujianping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.增加华为离线推送
parent
a5dde0a7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
35 deletions
+53
-35
AndroidNotification.java
...iquidnet/commons/lang/util/upush/AndroidNotification.java
+9
-0
UmengNotification.java
.../liquidnet/commons/lang/util/upush/UmengNotification.java
+5
-1
AndroidBroadcast.java
...net/commons/lang/util/upush/android/AndroidBroadcast.java
+2
-2
IOSBroadcast.java
...m/liquidnet/commons/lang/util/upush/ios/IOSBroadcast.java
+3
-3
PerformanceVoTask.java
...m/liquidnet/service/platform/utils/PerformanceVoTask.java
+34
-29
No files found.
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/upush/AndroidNotification.java
View file @
8c5d749b
...
...
@@ -72,6 +72,15 @@ public abstract class AndroidNotification extends UmengNotification {
rootJson
.
put
(
"policy"
,
policyJson
);
}
policyJson
.
put
(
key
,
value
);
}
else
if
(
CHANNEL_PROPERTIES
.
contains
(
key
)){
JSONObject
channelJson
=
null
;
if
(
rootJson
.
has
(
"channel_properties"
))
{
channelJson
=
rootJson
.
getJSONObject
(
"channel_properties"
);
}
else
{
channelJson
=
new
JSONObject
();
rootJson
.
put
(
"channel_properties"
,
channelJson
);
}
channelJson
.
put
(
key
,
value
);
}
else
{
if
(
key
==
"payload"
||
key
==
"body"
||
key
==
"policy"
||
key
==
"extra"
)
{
throw
new
Exception
(
"You don't need to set value for "
+
key
+
" , just set values for the sub keys in it."
);
...
...
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/upush/UmengNotification.java
View file @
8c5d749b
...
...
@@ -22,7 +22,11 @@ public abstract class UmengNotification {
protected
static
final
HashSet
<
String
>
POLICY_KEYS
=
new
HashSet
<
String
>(
Arrays
.
asList
(
new
String
[]{
"start_time"
,
"expire_time"
,
"max_send_num"
}));
protected
static
final
HashSet
<
String
>
CHANNEL_PROPERTIES
=
new
HashSet
<
String
>(
Arrays
.
asList
(
new
String
[]{
"channel_activity"
}));
// Set predefined keys in the rootJson, for extra keys(Android) or customized keys(IOS) please
// refer to corresponding methods in the subclass.
public
abstract
boolean
setPredefinedKeyValue
(
String
key
,
Object
value
)
throws
Exception
;
...
...
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/upush/android/AndroidBroadcast.java
View file @
8c5d749b
...
...
@@ -4,9 +4,9 @@ package com.liquidnet.commons.lang.util.upush.android;
import
com.liquidnet.commons.lang.util.upush.AndroidNotification
;
public
class
AndroidBroadcast
extends
AndroidNotification
{
public
AndroidBroadcast
(
String
appkey
,
String
appMasterSecret
,
String
type
)
throws
Exception
{
public
AndroidBroadcast
(
String
appkey
,
String
appMasterSecret
)
throws
Exception
{
setAppMasterSecret
(
appMasterSecret
);
setPredefinedKeyValue
(
"appkey"
,
appkey
);
this
.
setPredefinedKeyValue
(
"type"
,
type
);
this
.
setPredefinedKeyValue
(
"type"
,
"broadcast"
);
}
}
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/upush/ios/IOSBroadcast.java
View file @
8c5d749b
...
...
@@ -4,10 +4,10 @@ package com.liquidnet.commons.lang.util.upush.ios;
import
com.liquidnet.commons.lang.util.upush.IOSNotification
;
public
class
IOSBroadcast
extends
IOSNotification
{
public
IOSBroadcast
(
String
appkey
,
String
appMasterSecret
,
String
type
)
throws
Exception
{
public
IOSBroadcast
(
String
appkey
,
String
appMasterSecret
)
throws
Exception
{
setAppMasterSecret
(
appMasterSecret
);
setPredefinedKeyValue
(
"appkey"
,
appkey
);
this
.
setPredefinedKeyValue
(
"type"
,
type
);
this
.
setPredefinedKeyValue
(
"type"
,
"broadcast"
);
}
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/utils/PerformanceVoTask.java
View file @
8c5d749b
...
...
@@ -8,7 +8,9 @@ import com.liquidnet.commons.lang.util.*;
import
com.liquidnet.commons.lang.util.upush.AndroidNotification
;
import
com.liquidnet.commons.lang.util.upush.PushClient
;
import
com.liquidnet.commons.lang.util.upush.android.AndroidBroadcast
;
import
com.liquidnet.commons.lang.util.upush.android.AndroidUnicast
;
import
com.liquidnet.commons.lang.util.upush.ios.IOSBroadcast
;
import
com.liquidnet.commons.lang.util.upush.ios.IOSUnicast
;
import
com.liquidnet.service.kylin.constant.KylinRedisConst
;
import
com.liquidnet.service.kylin.dao.KylinPerformancesSubscribeDao
;
import
com.liquidnet.service.kylin.dto.param.PerformancePartnerVo
;
...
...
@@ -523,7 +525,7 @@ public class PerformanceVoTask {
log
.
info
(
"友盟Android开票提醒推送开始startTime===={}"
,
startTime
);
for
(
KylinPerformancesSubscribeDao
kylinPerformancesSubscribeDao
:
kylinPerformancesSubscribeDaoAndroidList
)
{
//友盟推送
sendAndroid
Broad
cast
(
kylinPerformancesSubscribeDao
.
getDeviceTokens
(),
kylinPerformancesSubscribeDao
.
getPushTitle
(),
6
,
kylinPerformancesSubscribeDao
.
getJumpValue
());
sendAndroid
Uni
cast
(
kylinPerformancesSubscribeDao
.
getDeviceTokens
(),
kylinPerformancesSubscribeDao
.
getPushTitle
(),
6
,
kylinPerformancesSubscribeDao
.
getJumpValue
());
}
long
endTime
=
System
.
currentTimeMillis
();
// 获取结束时间
log
.
info
(
"友盟Android开票提醒推送结束方法执行时间秒===={}"
,(
startTime
-
endTime
)/
1000
);
...
...
@@ -539,7 +541,7 @@ public class PerformanceVoTask {
log
.
info
(
"友盟IOS开票提醒推送开始startTime===={}"
,
startTime
);
for
(
KylinPerformancesSubscribeDao
kylinPerformancesSubscribeDao
:
kylinPerformancesSubscribeDaoIOSList
)
{
//友盟推送
sendIOS
Broadcas
t
(
kylinPerformancesSubscribeDao
.
getDeviceTokens
(),
kylinPerformancesSubscribeDao
.
getPushTitle
(),
6
,
kylinPerformancesSubscribeDao
.
getJumpValue
());
sendIOS
Unicast
t
(
kylinPerformancesSubscribeDao
.
getDeviceTokens
(),
kylinPerformancesSubscribeDao
.
getPushTitle
(),
6
,
kylinPerformancesSubscribeDao
.
getJumpValue
());
}
long
endTime
=
System
.
currentTimeMillis
();
// 获取结束时间
log
.
info
(
"友盟IOS开票提醒推送结束方法执行时间秒===={}"
,(
startTime
-
endTime
)/
1000
);
...
...
@@ -548,57 +550,60 @@ public class PerformanceVoTask {
performancesMapper
.
updatePerformanceSubscribePushById
(
IOSIds
);
}
}
public
void
sendAndroid
Broad
cast
(
String
deviceTokens
,
String
pushTitle
,
Integer
jumpType
,
String
jumpValue
)
{
public
void
sendAndroid
Uni
cast
(
String
deviceTokens
,
String
pushTitle
,
Integer
jumpType
,
String
jumpValue
)
{
try
{
Android
Broadcast
broadcast
=
new
AndroidBroadcast
(
androidAppkey
,
androidAppMasterSecret
,
"unicast"
);
broad
cast
.
setBadge
(
1
);
broad
cast
.
setTicker
(
"【正在现场】开票提醒"
);
broad
cast
.
setTitle
(
"【正在现场】开票提醒"
);
broad
cast
.
setText
(
pushTitle
+
",10分钟后即将开售,请点击进入详情页购买。"
);
Android
Unicast
unicast
=
new
AndroidUnicast
(
androidAppkey
,
androidAppMasterSecret
);
uni
cast
.
setBadge
(
1
);
uni
cast
.
setTicker
(
"【正在现场】开票提醒"
);
uni
cast
.
setTitle
(
"【正在现场】开票提醒"
);
uni
cast
.
setText
(
pushTitle
+
",10分钟后即将开售,请点击进入详情页购买。"
);
String
custom
=
UpushTargetType
.
getTypeAction
(
jumpType
);
broad
cast
.
goCustomAfterOpen
(
custom
);
broad
cast
.
setDisplayType
(
AndroidNotification
.
DisplayType
.
NOTIFICATION
);
uni
cast
.
goCustomAfterOpen
(
custom
);
uni
cast
.
setDisplayType
(
AndroidNotification
.
DisplayType
.
NOTIFICATION
);
if
(!
LnsEnum
.
ENV
.
prod
.
name
().
equals
(
environment
.
getProperty
(
CurrentUtil
.
CK_ENV_ACTIVE
)))
{
broad
cast
.
setTestMode
();
uni
cast
.
setTestMode
();
}
else
{
broad
cast
.
setProductionMode
();
uni
cast
.
setProductionMode
();
}
// Set customized fields
broad
cast
.
setExtraField
(
"type"
,
jumpType
.
toString
());
broad
cast
.
setExtraField
(
"id"
,
jumpValue
);
broad
cast
.
setExtraField
(
"url"
,
jumpValue
);
uni
cast
.
setExtraField
(
"type"
,
jumpType
.
toString
());
uni
cast
.
setExtraField
(
"id"
,
jumpValue
);
uni
cast
.
setExtraField
(
"url"
,
jumpValue
);
//表示指定的单个设备
broadcast
.
setPredefinedKeyValue
(
"device_tokens"
,
deviceTokens
);
unicast
.
setDeviceToken
(
deviceTokens
);
//配置华为离线通知
unicast
.
setPredefinedKeyValue
(
"channel_activity"
,
"com.modernsky.istv.ui.activity.MfrMessageActivity"
);
log
.
info
(
"友盟消息推送开始Android============deviceTokens========={},pushTitle========={}"
,
deviceTokens
,
pushTitle
);
String
sendRes
=
client
.
send
(
broad
cast
);
String
sendRes
=
client
.
send
(
uni
cast
);
log
.
info
(
"友盟消息推送成功AndroidReturn============sendRes===={}"
,
sendRes
);
}
catch
(
Exception
e
)
{
log
.
info
(
"友盟消息推送失败Android============deviceTokens={},pushTitle={},e={}"
,
deviceTokens
,
pushTitle
,
e
);
}
}
public
void
sendIOS
Broadcas
t
(
String
deviceTokens
,
String
pushTitle
,
Integer
jumpType
,
String
jumpValue
)
{
public
void
sendIOS
Unicast
t
(
String
deviceTokens
,
String
pushTitle
,
Integer
jumpType
,
String
jumpValue
)
{
AdminUpush
updatePush
=
new
AdminUpush
();
try
{
IOS
Broadcast
broadcast
=
new
IOSBroadcast
(
iosAppkey
,
iosAppMasterSecret
,
"unicast"
);
IOS
Unicast
unicast
=
new
IOSUnicast
(
iosAppkey
,
iosAppMasterSecret
);
//alert的值设置为字典
broad
cast
.
setAlert
(
"【正在现场】开票提醒"
,
""
,
pushTitle
+
",10分钟后即将开售,请点击进入详情页购买。"
);
broad
cast
.
setBadge
(
1
);
broad
cast
.
setSound
(
"default"
);
uni
cast
.
setAlert
(
"【正在现场】开票提醒"
,
""
,
pushTitle
+
",10分钟后即将开售,请点击进入详情页购买。"
);
uni
cast
.
setBadge
(
1
);
uni
cast
.
setSound
(
"default"
);
if
(!
LnsEnum
.
ENV
.
prod
.
name
().
equals
(
environment
.
getProperty
(
CurrentUtil
.
CK_ENV_ACTIVE
)))
{
broad
cast
.
setTestMode
();
uni
cast
.
setTestMode
();
}
else
{
broad
cast
.
setProductionMode
();
uni
cast
.
setProductionMode
();
}
// Set customized fields
broad
cast
.
setCustomizedField
(
"type"
,
jumpType
.
toString
());
broad
cast
.
setCustomizedField
(
"id"
,
jumpValue
);
broad
cast
.
setCustomizedField
(
"url"
,
jumpValue
);
uni
cast
.
setCustomizedField
(
"type"
,
jumpType
.
toString
());
uni
cast
.
setCustomizedField
(
"id"
,
jumpValue
);
uni
cast
.
setCustomizedField
(
"url"
,
jumpValue
);
//表示指定的单个设备
broadcast
.
setPredefinedKeyValue
(
"device_tokens"
,
deviceTokens
);
unicast
.
setDeviceToken
(
deviceTokens
);
log
.
info
(
"友盟消息推送开始IOS============deviceTokens========={},pushTitle========={}"
,
deviceTokens
,
pushTitle
);
String
sendRes
=
client
.
send
(
broad
cast
);
String
sendRes
=
client
.
send
(
uni
cast
);
log
.
info
(
"友盟消息推送成功IOS============sendRes===={}"
,
sendRes
);
}
catch
(
Exception
e
)
{
log
.
info
(
"友盟消息推送失败IOS============deviceTokens={},pushTitle={},e={}"
,
deviceTokens
,
pushTitle
,
e
);;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment