feat/multi-channel-framework [AC-INIT]合并功能代码 #12
|
|
@ -1,8 +1,11 @@
|
|||
package com.wecom.robot.controller;
|
||||
|
||||
import com.wecom.robot.adapter.ChannelAdapter;
|
||||
import com.wecom.robot.adapter.MessageSyncCapable;
|
||||
import com.wecom.robot.config.WecomConfig;
|
||||
import com.wecom.robot.dto.WxCallbackMessage;
|
||||
import com.wecom.robot.dto.*;
|
||||
import com.wecom.robot.service.MessageProcessService;
|
||||
import com.wecom.robot.service.MessageRouterService;
|
||||
import com.wecom.robot.util.WXBizMsgCrypt;
|
||||
import com.wecom.robot.util.XmlUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -11,14 +14,24 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 企业微信回调控制器
|
||||
* <p>
|
||||
* 负责验签/解密/解析,构建 InboundMessage 传递给 MessageRouterService。
|
||||
* [AC-MCA-08] 入口层控制器
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wecom")
|
||||
@RequiredArgsConstructor
|
||||
public class WecomCallbackController {
|
||||
|
||||
private static final String CHANNEL_TYPE = "wechat";
|
||||
|
||||
private final WecomConfig wecomConfig;
|
||||
private final MessageProcessService messageProcessService;
|
||||
private final MessageRouterService messageRouterService;
|
||||
private final Map<String, ChannelAdapter> channelAdapters;
|
||||
|
||||
@GetMapping("/callback")
|
||||
public String verifyUrl(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.wecom.robot.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.wecom.robot.adapter.ChannelAdapter;
|
||||
import com.wecom.robot.adapter.MessageSyncCapable;
|
||||
import com.wecom.robot.dto.InboundMessage;
|
||||
import com.wecom.robot.dto.ServiceStateResponse;
|
||||
import com.wecom.robot.dto.SyncMsgResponse;
|
||||
|
|
@ -12,28 +14,29 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 消息处理服务 - 微信渠道消息处理入口
|
||||
*
|
||||
* <p>职责:
|
||||
* <ul>
|
||||
* <li>处理微信回调事件(消息同步、会话事件等)</li>
|
||||
* <li>构建 InboundMessage 并委托给 MessageRouterService</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>关联 AC: [AC-MCA-08] 统一消息路由
|
||||
*
|
||||
* @see MessageRouterService
|
||||
* @see InboundMessage
|
||||
* 消息处理服务
|
||||
* <p>
|
||||
* 负责从微信拉取消息并转换为 InboundMessage 传递给 MessageRouterService。
|
||||
* [AC-MCA-08] 消息处理服务
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MessageProcessService {
|
||||
|
||||
private static final String CHANNEL_TYPE = "wechat";
|
||||
|
||||
private final SessionManagerService sessionManagerService;
|
||||
private final AiService aiService;
|
||||
private final TransferService transferService;
|
||||
private final WecomApiService wecomApiService;
|
||||
private final WebSocketService webSocketService;
|
||||
private final MessageRouterService messageRouterService;
|
||||
private final Map<String, ChannelAdapter> channelAdapters;
|
||||
|
||||
@Async
|
||||
public void processKfMessageEvent(WxCallbackMessage event) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue