//找到需要发的微信号,参考https://www.wuliaokankan.cn/url301/138.html
List<AccountInfo> accList = accountDao.getAllAccountInfoByTypeCidDid(info.getCid(), info.getDid());
if(null != accList && accList.size()>0){
List<String> whoinvisibleIdList = whoinvisibleIdList(info) ;//不给谁看
for(int i=0;i<accList.size();i++){
AccountInfo account = accList.get(i);
List<WeChatAccountInfo> weChatIdList = weChatAccountDao.findWeChatAccountInfo(account.getCid(), account.getId());
if(null != weChatIdList && weChatIdList.size()>0){
for(int j=0;j<weChatIdList.size();j++){
WeChatAccountInfo waInfo = weChatIdList.get(j);//哪些微信号需要定时操作
//微信号中需要屏蔽的微信号的好友
List<String> friendWechatList = whoinvisibleWechatIdList(whoinvisibleIdList, info, waInfo, weChatContactDao);
//子任务分别处理 存储子任务详情
if(info.getTasktype()==1){//添加群发任务
//找到需要群发的好友微信号,屏蔽不需要群发的人
List<String> newfriendWechatList = weChatContactDao.findFriendWeChatIds(waInfo.getWechatid(), friendWechatList);
if(null != newfriendWechatList && newfriendWechatList.size()>0){
if(newfriendWechatList.size()<=200){
saveGroupSendTimeTaskDetail(info, newfriendWechatList, waInfo.getWechatid(), timeTaskDetailsDao);
}else{
int subCount = newfriendWechatList.size();
int subSize = 200;
int subPageTotal = (subCount / subSize) + ((subCount % subSize > 0) ? 1 : 0);
// 根据页码取数据
for (int x = 0, len = subPageTotal - 1; x <= len; x++) {
// 分页计算
int fromIndex = x * subSize;
int toIndex = ((x == len) ? subCount : ((x + 1) * subSize));
List<String> strings = newfriendWechatList.subList(fromIndex, toIndex);
String dat = info.getExecute_time();
Date dte = DateUtil.convertString2Date(dat, DateUtil.DATE_FORMAT_4);
long times = dte.getTime() + (x * 1000 * 60 *10);
dat = DateUtil.convertDate2String(new Date(times), DateUtil.DATE_FORMAT_4);
info.setExecute_time(dat);
saveGroupSendTimeTaskDetail(info, strings, waInfo.getWechatid(), timeTaskDetailsDao);
}
}
}
}else if(info.getTasktype()==2){//发朋友圈
saveCircleSendTimeTaskDetail(info, friendWechatList, waInfo.getWechatid(), timeTaskDetailsDao);
}
}
}
}
微信群发接口调用代码
最新推荐文章于 2024-05-27 15:18:28 发布