提交 7e4cf8cc 作者: gh

定时客服开启

上级 cbe699f6
......@@ -86,7 +86,7 @@ public class SchedulingTask {
/**
* 每10min扫描一次正常客服
*/
//@Scheduled(cron = "0 0/10 * * * *")
@Scheduled(cron = "0 0/10 * * * *")
public void publishCustomerMessage(){
Calendar calendar = Calendar.getInstance();
......
......@@ -221,39 +221,41 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
List<CustomerGraphics> customerGraphicsList = list(new QueryWrapper<CustomerGraphics>().eq(CustomerGraphics.COL_POST_TIME, requestDate).eq(CustomerGraphics.COL_SEND_STATUS,9));
for (CustomerGraphics customerGraphics : customerGraphicsList) {
//人群包id
Long packId = customerGraphics.getPackId();
//根据人群包找人,并按appId分组
List<CrowdPackageUserVO> userList = registerUserEntityService.getCurrentInPackUserList(packId, false);
//去重
Map<String, List<CrowdPackageUserVO>> appidUserMap = userList.stream().collect(Collectors.groupingBy(CrowdPackageUserVO::getAppId,
Collectors.collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(CrowdPackageUserVO::getOpenId))), ArrayList::new)));
//根据客服id找不同公众号的链接,并按appId分组
List<ReferralEntityVo> referralList = referralEntityService.findReferralByCustomerGraphicsId(customerGraphics.getId());
Map<String, List<ReferralEntityVo>> referralMap = referralList.stream().collect(Collectors.groupingBy(ReferralEntityVo::getAppid));
//循环该客服下的所有素材
for (Map.Entry<String, List<ReferralEntityVo>> referralEntry : referralMap.entrySet()) {
String appid = referralEntry.getKey();
//获取token
AuthorizerToken authorizerToken = authorizerTokenService.findTokenByAppid(appid);
if (authorizerToken!=null&&authorizerToken.getAuthorizerAccessToken()!=null){
//获取该号的链接实体
List<ReferralEntityVo> referralEntityVo = referralMap.get(appid);
//获取该号的openid
List<CrowdPackageUserVO> packageUserVo = appidUserMap.get(appid);
if (referralEntityVo!=null&&!referralEntityVo.isEmpty()){
weChatService.sendCustomerMessage(appid,authorizerToken,customerGraphics,packageUserVo,referralEntityVo);
if(!customerGraphicsList.isEmpty()){
for (CustomerGraphics customerGraphics : customerGraphicsList) {
//人群包id
Long packId = customerGraphics.getPackId();
//根据人群包找人,并按appId分组
List<CrowdPackageUserVO> userList = registerUserEntityService.getCurrentInPackUserList(packId, false);
//去重
Map<String, List<CrowdPackageUserVO>> appidUserMap = userList.stream().collect(Collectors.groupingBy(CrowdPackageUserVO::getAppId,
Collectors.collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(CrowdPackageUserVO::getOpenId))), ArrayList::new)));
//根据客服id找不同公众号的链接,并按appId分组
List<ReferralEntityVo> referralList = referralEntityService.findReferralByCustomerGraphicsId(customerGraphics.getId());
Map<String, List<ReferralEntityVo>> referralMap = referralList.stream().collect(Collectors.groupingBy(ReferralEntityVo::getAppid));
//循环该客服下的所有素材
for (Map.Entry<String, List<ReferralEntityVo>> referralEntry : referralMap.entrySet()) {
String appid = referralEntry.getKey();
//获取token
AuthorizerToken authorizerToken = authorizerTokenService.findTokenByAppid(appid);
if (authorizerToken!=null&&authorizerToken.getAuthorizerAccessToken()!=null){
//获取该号的链接实体
List<ReferralEntityVo> referralEntityVo = referralMap.get(appid);
//获取该号的openid
List<CrowdPackageUserVO> packageUserVo = appidUserMap.get(appid);
if (referralEntityVo!=null&&!referralEntityVo.isEmpty()){
weChatService.sendCustomerMessage(appid,authorizerToken,customerGraphics,packageUserVo,referralEntityVo);
}
}
}
}
updateBatchById(customerGraphicsList);
}
updateBatchById(customerGraphicsList);
}
private BaseResult checkExtendBook(String storeType, CrowdPackageConditionMatch storeConditionMatch) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论