91 lines
2.9 KiB
C++
91 lines
2.9 KiB
C++
|
|
#ifndef IMS_INTEGRATION_SERVICE_HPP
|
|||
|
|
#define IMS_INTEGRATION_SERVICE_HPP
|
|||
|
|
|
|||
|
|
#include "ims_types.hpp"
|
|||
|
|
#include <memory>
|
|||
|
|
#include <vector>
|
|||
|
|
#include <functional>
|
|||
|
|
|
|||
|
|
namespace ims {
|
|||
|
|
|
|||
|
|
/// @brief 第三方系统集成服务类。
|
|||
|
|
///
|
|||
|
|
/// 提供标准化的接口注册与预留、第三方数据对接、定时/实时数据同步能力。
|
|||
|
|
class IntegrationService {
|
|||
|
|
public:
|
|||
|
|
IntegrationService();
|
|||
|
|
~IntegrationService();
|
|||
|
|
|
|||
|
|
// ==================== 标准化接口预留 (SRS-IMS_F-027) ====================
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 注册一个标准化外部接口。
|
|||
|
|
*
|
|||
|
|
* @requirement(name="标准化接口预留", id="SRS-IMS_F-027")
|
|||
|
|
* 允许系统注册外部可调用的 API 端点定义,供第三方系统对接使用。
|
|||
|
|
*/
|
|||
|
|
bool registerInterface(const std::string& api_name,
|
|||
|
|
const std::string& endpoint,
|
|||
|
|
const std::string& method,
|
|||
|
|
const std::string& description);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 获取所有已注册的标准化接口列表。
|
|||
|
|
*
|
|||
|
|
* @requirement(name="标准化接口预留", id="SRS-IMS_F-027")
|
|||
|
|
*/
|
|||
|
|
std::vector<std::string> listRegisteredInterfaces();
|
|||
|
|
|
|||
|
|
// ==================== 第三方数据对接 (SRS-IMS_F-028) ====================
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 从第三方系统导入数据。
|
|||
|
|
*
|
|||
|
|
* @requirement(name="第三方数据对接", id="SRS-IMS_F-028")
|
|||
|
|
* 从指定的外部系统拉取数据并解析为内部 ExchangeMessage。
|
|||
|
|
*/
|
|||
|
|
std::vector<ExchangeMessage> importFromThirdParty(
|
|||
|
|
const std::string& source_system,
|
|||
|
|
const std::string& data_type);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 向第三方系统推送数据。
|
|||
|
|
*
|
|||
|
|
* @requirement(name="第三方数据对接", id="SRS-IMS_F-028")
|
|||
|
|
* 将内部业务数据封装后推送到目标第三方系统。
|
|||
|
|
*/
|
|||
|
|
bool pushToThirdParty(const std::string& target_system,
|
|||
|
|
const ExchangeMessage& message);
|
|||
|
|
|
|||
|
|
// ==================== 数据同步 (SRS-IMS_F-029) ====================
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 执行一次全量/增量数据同步。
|
|||
|
|
*
|
|||
|
|
* @requirement(name="数据同步", id="SRS-IMS_F-029")
|
|||
|
|
* 按照指定的同步方向(导入/导出)和类型执行数据同步操作。
|
|||
|
|
*/
|
|||
|
|
bool syncData(const std::string& partner_system,
|
|||
|
|
const std::string& data_type,
|
|||
|
|
bool full_sync);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 注册定时同步任务。
|
|||
|
|
*
|
|||
|
|
* @requirement(name="数据同步", id="SRS-IMS_F-029")
|
|||
|
|
* 允许注册一个按指定间隔(秒)循环执行的数据同步回调。
|
|||
|
|
*/
|
|||
|
|
int32_t registerSyncTask(const std::string& partner_system,
|
|||
|
|
const std::string& data_type,
|
|||
|
|
int32_t interval_seconds,
|
|||
|
|
std::function<bool()> sync_callback);
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
struct Impl;
|
|||
|
|
std::unique_ptr<Impl> pImpl_;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
} // namespace ims
|
|||
|
|
|
|||
|
|
#endif // IMS_INTEGRATION_SERVICE_HPP
|