feat(0): [wcf-bmc]-修复配置文件open-msg-groups参数取值问题

This commit is contained in:
chandler 2025-05-03 20:14:44 +08:00
parent cd922bc737
commit 5bf8d371c5
2 changed files with 9 additions and 6 deletions

View File

@ -2,7 +2,7 @@ package com.wechat.ferry.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -45,7 +45,7 @@ public class WeChatMsgServiceImpl implements WeChatMsgService {
WxPpMsgDTO dto = JSON.parseObject(jsonString, WxPpMsgDTO.class);
// 有开启的群聊配置
if (weChatFerryProperties.getOpenMsgGroupSwitch() && !weChatFerryProperties.getOpenMsgGroups().isEmpty()) {
Map<String, List<String>> openMsgGroupMap = new HashMap<>();
Map<String, List<String>> openMsgGroupMap = new LinkedHashMap<>();
String allFnNoStr = "";
List<String> allFnNoList = new ArrayList<>();
if (weChatFerryProperties.getOpenMsgGroups().containsKey("ALL")) {
@ -79,6 +79,7 @@ public class WeChatMsgServiceImpl implements WeChatMsgService {
// 指定处理的群聊
if (!openMsgGroupMap.isEmpty()) {
log.debug("[收到消息后处理]-[汇总后的所有功能]-openMsgGroupMap{}", openMsgGroupMap);
List<String> fnNoList = new ArrayList<>();
// 先执行所有群都需要执行的
if (openMsgGroupMap.containsKey("ALL")) {
@ -90,6 +91,7 @@ public class WeChatMsgServiceImpl implements WeChatMsgService {
}
// 需要执行的策略
if (!CollectionUtils.isEmpty(fnNoList)) {
log.debug("[收到消息后处理]-[汇总后的单群功能]-fnNoList{},群号:{}", fnNoList, dto.getRoomId());
for (String no : fnNoList) {
// 根据功能号获取对应的策略
ReceiveMsgStrategy receiveMsgStrategy = ReceiveMsgFactory.getStrategy(no);

View File

@ -35,12 +35,13 @@ wechat:
contacts-type-official:
- weixinguanhaozhushou|微信公众平台
# 接收消息回调开关
open-msg-group-switch: false
open-msg-group-switch: true
# 需要开启消息处理的群
open-msg-groups:
# key:群编号 val:开启的功能号,对应ReceiveMsgChannelEnum枚举中的code
ALL: '1'
53257911730@chatroom: '1,2'
# key:"[群编号]" val:开启的功能号,对应ReceiveMsgChannelEnum枚举中的code
"[ALL]": '0,1'
"[53257911730@chatroom]": '0,2,3'
"[50501762866@chatroom]": '0,3'
# 接收消息回调开关
receive-msg-callback-switch: false
# 接收消息回调地址