|
@@ -1,6 +1,7 @@
|
|
|
package com.rongwei.safecommon.utils;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.rongwei.commonservice.serial.service.SysSerialNumberService;
|
|
|
import com.rongwei.commonservice.service.RedisService;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
@@ -9,6 +10,8 @@ import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
import com.rongwei.rwcommonentity.commonservers.vo.SysNotifyAnnounceVo;
|
|
|
import com.rongwei.rwcommonentity.commonservers.vo.SysSerialVo;
|
|
|
import com.rongwei.safecommon.fegin.CXCommonFeginClient;
|
|
|
+import jodd.util.ArraysUtil;
|
|
|
+import org.apache.commons.collections.ListUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -106,20 +109,9 @@ public class CXCommonUtils {
|
|
|
commonFeginClient.sendNotify(sysNotifyAnnounceVo);
|
|
|
|
|
|
//防止推送用户过多,导致调用接口报错,实行分流
|
|
|
- List<String> userList = new LinkedList<>();
|
|
|
- for (String recipientId : recipientIds) {
|
|
|
- userList.add(recipientId);
|
|
|
- if(userList.size() == 10){
|
|
|
- pushApp(title, content, userList);
|
|
|
- userList = new LinkedList<>();
|
|
|
- }
|
|
|
- }
|
|
|
- if (userList.size()>0){
|
|
|
- pushApp(title, content, userList);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ Lists.partition(recipientIds, 10).forEach(userIds->{
|
|
|
+ pushApp(title, content, userIds);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
public static void pushApp(String title, String content, List<String> recipientIds){
|