提交 527108fb 作者: gh

registerUser发送前去重

上级 62eac792
......@@ -122,6 +122,8 @@ public class CustomerGraphics implements Serializable {
public static final String COL_POST_TIME = "post_time";
public static final String COL_SEND_STATUS = "send_status";
public static final String COL_CREATE_USER = "create_user";
public static final String COL_GMT_CREATE = "gmt_create";
......
......@@ -48,7 +48,7 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
if (!allPostUser.isEmpty()){
//号-用户
Map<String, List<CustomerDelayPublish>> userMap = allPostUser.stream().filter(a->a.getCustomerSort()!=null).collect(Collectors.groupingBy(CustomerDelayPublish::getAppId));
Map<String, Map<String,CustomerDelayPublish>> userMap = allPostUser.stream().filter(a->a.getCustomerSort()!=null).collect(Collectors.groupingBy(CustomerDelayPublish::getAppId,Collectors.toMap(CustomerDelayPublish::getOpenId,a->a,(v1,v2)->v1)));
//获取所有延时客服
List<CustomerDelayItemVO> allDelayCustomerMessage = customerGraphicsDelayService.findAllDelayCustomerSort(appidSet,null);
......@@ -62,7 +62,7 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
Set<CustomerDelayItemVO> needUpdateCustomerDelay = new HashSet<>();
for (Map.Entry<String, List<CustomerDelayPublish>> userEntry : userMap.entrySet()) {
for (Map.Entry<String, Map<String,CustomerDelayPublish>> userEntry : userMap.entrySet()) {
String appid = userEntry.getKey();
//获取该号token
......@@ -74,8 +74,10 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
//该号下延时客服
Map<Integer,List<CustomerDelayItemVO>> delaySortMap = customerMap.get(appid);
//所有的用户
List<CustomerDelayPublish> userList = userEntry.getValue();
Map<String,CustomerDelayPublish> userPublishMap = userEntry.getValue();
//去重
List<CustomerDelayPublish> userList = (List<CustomerDelayPublish>) userPublishMap.values();
if (delaySortMap!=null&&!delaySortMap.isEmpty()){
//将所有待用延时客服收集
for (CustomerDelayPublish userPublish : userList) {
......
......@@ -47,6 +47,9 @@ import com.yaoyaozw.customer.service.CustomerGraphicsService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toCollection;
/**
* 客户图形服务impl
*
......@@ -215,16 +218,17 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
public void sendCustomerMessage(IntegrationRequestDTO integrationRequestDTO) {
Date requestDate = integrationRequestDTO.getRequestDate();
//todo:当前时刻发送的客服(需要加启用禁用)
List<CustomerGraphics> customerGraphicsList = list(new QueryWrapper<CustomerGraphics>().eq(CustomerGraphics.COL_POST_TIME, requestDate));
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));
//去重
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());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论