|
@@ -200,7 +200,7 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
|
|
|
|
|
|
// 发送推送消息
|
|
|
if (EImSendType.IMMEDIATELY == info.getSendType()) {
|
|
|
- sendMessage(info.getId());
|
|
|
+ asyncBatchSendingMessage(sending);
|
|
|
}
|
|
|
|
|
|
return true;
|
|
@@ -338,6 +338,16 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
|
|
|
throw new BizException("无效的群发消息ID");
|
|
|
}
|
|
|
|
|
|
+ // 发送消息
|
|
|
+ asyncBatchSendingMessage(info);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 异步发送消息
|
|
|
+ * @param info CustomerServiceBatchSending
|
|
|
+ */
|
|
|
+ private void asyncBatchSendingMessage(CustomerServiceBatchSending info) {
|
|
|
String lockName = MessageFormat.format("batchSending:{0}", String.valueOf(info.getId()));
|
|
|
// 消息状态判定,且不能重复发送
|
|
|
DistributedLock.of(redissonClient).runIfLockCanGet(lockName, () -> {
|
|
@@ -428,13 +438,12 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
|
|
|
.update();
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
- log.error("sendMessage id={}", id, e);
|
|
|
+ log.error("sendMessage id={}", info.getId(), e);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|