🎨 #3445 【企业微信】第三方应用开发消息处理判断重复的方法进行优化

This commit is contained in:
Zeyes Lee 2024-12-18 21:50:53 +08:00 committed by Binary Wang
parent 24f03e9573
commit 75aa3fce9a
5 changed files with 8 additions and 7 deletions

View File

@ -178,7 +178,7 @@ public class WxChannelMessageRouter {
* @param wxMessage 消息
* @return 是否重复
*/
private boolean isMsgDuplicated(WxChannelMessage wxMessage) {
protected boolean isMsgDuplicated(WxChannelMessage wxMessage) {
String messageId = this.generateMessageId(wxMessage);
return this.messageDuplicateChecker.isDuplicate(messageId);
}
@ -188,7 +188,7 @@ public class WxChannelMessageRouter {
*
* @return 消息id
*/
private String generateMessageId(WxChannelMessage wxMessage) {
protected String generateMessageId(WxChannelMessage wxMessage) {
StringBuilder sb = new StringBuilder();
if (wxMessage.getMsgId() == null) {
sb.append(wxMessage.getCreateTime())

View File

@ -258,7 +258,7 @@ public class WxCpMessageRouter {
return this.route(wxMessage, new HashMap<>(2));
}
private boolean isMsgDuplicated(WxCpXmlMessage wxMessage) {
protected boolean isMsgDuplicated(WxCpXmlMessage wxMessage) {
StringBuilder messageId = new StringBuilder();
if (wxMessage.getMsgId() == null) {
messageId.append(wxMessage.getCreateTime())

View File

@ -278,7 +278,7 @@ public class WxCpTpMessageRouter {
return this.route(wxMessage, new HashMap<>(2));
}
private boolean isMsgDuplicated(final String suiteId, WxCpTpXmlMessage wxMessage) {
protected boolean isMsgDuplicated(final String suiteId, WxCpTpXmlMessage wxMessage) {
StringBuilder messageId = new StringBuilder();
messageId.append(wxMessage.getToUserName());
if (wxMessage.getInfoType() != null) {
@ -306,7 +306,8 @@ public class WxCpTpMessageRouter {
.append("-").append(wxMessage.getCreateTime())
.append("-").append(wxMessage.getFromUserName())
.append("-").append(StringUtils.trimToEmpty(wxMessage.getEvent()))
.append("-").append(StringUtils.trimToEmpty(wxMessage.getEventKey()));
.append("-").append(StringUtils.trimToEmpty(wxMessage.getEventKey()))
.append("-").append(StringUtils.trimToEmpty(wxMessage.getExternalUserID()));
}
}

View File

@ -173,7 +173,7 @@ public class WxMaMessageRouter {
return this.route(wxMessage, new HashMap<>(2));
}
private boolean isMsgDuplicated(WxMaMessage wxMessage) {
protected boolean isMsgDuplicated(WxMaMessage wxMessage) {
StringBuilder messageId = new StringBuilder();
if (wxMessage.getMsgId() == null) {
messageId.append(wxMessage.getCreateTime())

View File

@ -315,7 +315,7 @@ public class WxMpMessageRouter {
return this.route(appid, wxMessage, new HashMap<>(2));
}
private boolean isMsgDuplicated(WxMpXmlMessage wxMessage) {
protected boolean isMsgDuplicated(WxMpXmlMessage wxMessage) {
StringBuilder messageId = new StringBuilder();
if (wxMessage.getMsgId() == null) {
messageId.append(wxMessage.getCreateTime())