Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
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
hooloo
ms
soss
Commits
1843deb2
Commit
1843deb2
authored
Mar 28, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加推送日志
parent
7e6d8cc0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
soss-system/src/main/java/com/soss/system/jiguang/impl/JiGuangPushServiceImpl.java
+22
-6
No files found.
soss-system/src/main/java/com/soss/system/jiguang/impl/JiGuangPushServiceImpl.java
View file @
1843deb2
package
com
.
soss
.
system
.
jiguang
.
impl
;
package
com
.
soss
.
system
.
jiguang
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.system.domain.vo.PushBean
;
import
com.soss.system.domain.vo.PushBean
;
import
com.soss.system.jiguang.JiGuangPushService
;
import
com.soss.system.jiguang.JiGuangPushService
;
import
com.soss.system.jiguang.MyJiGuangPushService
;
import
com.soss.system.jiguang.MyJiGuangPushService
;
import
com.soss.system.mapper.MachineMapper
;
import
com.soss.system.mapper.MachineMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -17,6 +19,7 @@ import java.util.List;
...
@@ -17,6 +19,7 @@ import java.util.List;
* 封装业务功能相关
* 封装业务功能相关
*/
*/
@Service
@Service
@Slf4j
public
class
JiGuangPushServiceImpl
implements
JiGuangPushService
{
public
class
JiGuangPushServiceImpl
implements
JiGuangPushService
{
/** 一次推送最大数量 (极光限制1000) */
/** 一次推送最大数量 (极光限制1000) */
private
static
final
int
max_size
=
800
;
private
static
final
int
max_size
=
800
;
...
@@ -24,28 +27,34 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
...
@@ -24,28 +27,34 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
private
MyJiGuangPushService
jPushService
;
private
MyJiGuangPushService
jPushService
;
@Autowired
@Autowired
private
MachineMapper
machineMapper
;
private
MachineMapper
machineMapper
;
/**
/**
* 推送全部, 不支持附加信息
* 推送全部, 不支持附加信息
*
* @return
* @return
*/
*/
@Override
@Override
public
boolean
pushAll
(
PushBean
pushBean
){
public
boolean
pushAll
(
PushBean
pushBean
)
{
return
jPushService
.
pushAll
(
pushBean
);
return
jPushService
.
pushAll
(
pushBean
);
}
}
/**
/**
* 推送全部ios
* 推送全部ios
*
* @return
* @return
*/
*/
@Override
@Override
public
boolean
pushIos
(
PushBean
pushBean
){
public
boolean
pushIos
(
PushBean
pushBean
)
{
return
jPushService
.
pushIos
(
pushBean
);
return
jPushService
.
pushIos
(
pushBean
);
}
}
/**
/**
* 推送ios 指定id
* 推送ios 指定id
*
* @return
* @return
*/
*/
@Override
@Override
public
boolean
pushIos
(
PushBean
pushBean
,
String
...
registids
){
public
boolean
pushIos
(
PushBean
pushBean
,
String
...
registids
)
{
registids
=
checkRegistids
(
registids
);
// 剔除无效registed
registids
=
checkRegistids
(
registids
);
// 剔除无效registed
while
(
registids
.
length
>
max_size
)
{
// 每次推送max_size个
while
(
registids
.
length
>
max_size
)
{
// 每次推送max_size个
jPushService
.
pushIos
(
pushBean
,
Arrays
.
copyOfRange
(
registids
,
0
,
max_size
));
jPushService
.
pushIos
(
pushBean
,
Arrays
.
copyOfRange
(
registids
,
0
,
max_size
));
...
@@ -53,29 +62,35 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
...
@@ -53,29 +62,35 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
}
}
return
jPushService
.
pushIos
(
pushBean
,
registids
);
return
jPushService
.
pushIos
(
pushBean
,
registids
);
}
}
/**
/**
* 推送全部android
* 推送全部android
*
* @return
* @return
*/
*/
@Override
@Override
public
boolean
pushAndroid
(
PushBean
pushBean
){
public
boolean
pushAndroid
(
PushBean
pushBean
)
{
return
jPushService
.
pushAndroid
(
pushBean
);
return
jPushService
.
pushAndroid
(
pushBean
);
}
}
/**
/**
* 推送android 指定id
* 推送android 指定id
*
* @return
* @return
*/
*/
@Override
@Override
public
boolean
pushAndroid
(
PushBean
pushBean
,
String
...
registids
){
public
boolean
pushAndroid
(
PushBean
pushBean
,
String
...
registids
)
{
registids
=
checkRegistids
(
registids
);
// 剔除无效registed
registids
=
checkRegistids
(
registids
);
// 剔除无效registed
push to
while
(
registids
.
length
>
max_size
)
{
// 每次推送max_size个
while
(
registids
.
length
>
max_size
)
{
// 每次推送max_size个
jPushService
.
pushAndroid
(
pushBean
,
Arrays
.
copyOfRange
(
registids
,
0
,
max_size
));
jPushService
.
pushAndroid
(
pushBean
,
Arrays
.
copyOfRange
(
registids
,
0
,
max_size
));
registids
=
Arrays
.
copyOfRange
(
registids
,
max_size
,
registids
.
length
);
registids
=
Arrays
.
copyOfRange
(
registids
,
max_size
,
registids
.
length
);
}
}
return
jPushService
.
pushAndroid
(
pushBean
,
registids
);
return
jPushService
.
pushAndroid
(
pushBean
,
registids
);
}
}
/**
/**
* 剔除无效registed
* 剔除无效registed
*
* @param registids
* @param registids
* @return
* @return
*/
*/
...
@@ -97,6 +112,7 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
...
@@ -97,6 +112,7 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
PushBean
pushBean
=
new
PushBean
();
PushBean
pushBean
=
new
PushBean
();
pushBean
.
setMessageCount
(
jsonObject
);
pushBean
.
setMessageCount
(
jsonObject
);
pushAndroid
(
pushBean
,
registerIds
);
pushAndroid
(
pushBean
,
registerIds
);
log
.
info
(
"push to "
+
JSON
.
toJSONString
(
registerIds
)
+
", "
+
JSON
.
toJSONString
(
jsonObject
));
}
}
}
}
...
...
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