diff --git a/inside-notices/src/main/java/cn/axzo/msg/center/message/controller/PrivateMessageController.java b/inside-notices/src/main/java/cn/axzo/msg/center/message/controller/PrivateMessageController.java index 687e6687..8dcc7ad5 100644 --- a/inside-notices/src/main/java/cn/axzo/msg/center/message/controller/PrivateMessageController.java +++ b/inside-notices/src/main/java/cn/axzo/msg/center/message/controller/PrivateMessageController.java @@ -10,10 +10,13 @@ import cn.axzo.msg.center.inside.notices.service.impl.v3.MessageRecordServiceV3; import cn.axzo.msg.center.message.domain.param.PendingMessagePushParam; import cn.axzo.msg.center.message.service.group.GroupTemplateService; import cn.axzo.msg.center.message.service.todo.manage.TodoManager; +import com.alibaba.cloud.nacos.NacosConfigManager; +import com.alibaba.cloud.nacos.parser.NacosDataParserHandler; import com.google.common.base.Splitter; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.springframework.core.env.PropertySource; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -39,6 +42,7 @@ public class PrivateMessageController { private final TodoSearchService todoSearchService; private final TodoManager todoManager; private final GroupTemplateService groupTemplateService; + private final NacosConfigManager nacosConfigManager; @PostMapping("/sendPendingMessage") public Object sendPendingMessage(@RequestBody @Valid PendingMessagePushParam request) { @@ -87,4 +91,20 @@ public class PrivateMessageController { } return phone2PersonId; } + + /** + * 因为没有权限了, 用于查看nacos是否配置了正确的值 + */ + @PostMapping("/readNacosConfig") + public Object readNacosConfig() throws Exception { + String value = nacosConfigManager.getConfigService() + .getConfig("msg-center.yaml", "DEFAULT_GROUP", 5000); + List> sources = NacosDataParserHandler.getInstance() + .parseNacosData("msg-center.yaml", value, "yaml"); + if (sources == null) return null; + return sources.stream() + .map(PropertySource::getSource) + .findFirst() + .orElse(null); + } } \ No newline at end of file