refactor(search):重构搜索服务模块结构
- 将 han-note-search 模块拆分为 han-note-search-api 和 han-note-search-biz - 调整包路径,统一添加 biz 子包以区分业务实现 - 更新相关类的导入路径以适配新的包结构 - 修改 Maven 模块配置,设置父模块打包方式为 pom- 添加新的 API 模块用于 RPC 接口定义 - 更新依赖配置,确保模块间正确引用 - 调整 IDEA 编译器配置以识别新模块 - 更新 HTTP 客户端测试数据和请求示例 - 添加 Feign 客户端支持以实现服务间通信 - 实现笔记文档重建功能并提供对外接口 - 增加数据对齐服务中远程调用搜索服务的能力 - 更新全局异常处理器和枚举类的包路径 - 调整应用启动类的 Mapper 扫描路径 - 更新 Elasticsearch 配置类和索引相关类路径 - 修改控制器和服务接口以支持新架构 - 更新测试类路径以匹配新的项目结构
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package com.hanserwei.hannote.search.api;
|
||||
|
||||
import com.hanserwei.framework.common.response.Response;
|
||||
import com.hanserwei.hannote.search.constant.ApiConstants;
|
||||
import com.hanserwei.hannote.search.dto.RebuildNoteDocumentReqDTO;
|
||||
import com.hanserwei.hannote.search.dto.RebuildUserDocumentReqDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient(name = ApiConstants.SERVICE_NAME)
|
||||
public interface SearchFeignApi {
|
||||
|
||||
String PREFIX = "/search";
|
||||
|
||||
/**
|
||||
* 重建笔记文档
|
||||
*
|
||||
* @param rebuildNoteDocumentReqDTO 重建笔记文档请求参数对象,包含重建所需的相关信息
|
||||
* @return 返回重建操作的结果响应对象
|
||||
*/
|
||||
@PostMapping(value = PREFIX + "/note/document/rebuild")
|
||||
Response<?> rebuildNoteDocument(@RequestBody RebuildNoteDocumentReqDTO rebuildNoteDocumentReqDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 重建用户文档
|
||||
*
|
||||
* @param rebuildUserDocumentReqDTO 重建用户文档请求参数对象,包含重建所需的相关信息
|
||||
* @return 返回重建操作的结果响应对象
|
||||
*/
|
||||
@PostMapping(value = PREFIX + "/user/document/rebuild")
|
||||
Response<?> rebuildUserDocument(@RequestBody RebuildUserDocumentReqDTO rebuildUserDocumentReqDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.hanserwei.hannote.search.constant;
|
||||
|
||||
public interface ApiConstants {
|
||||
|
||||
/**
|
||||
* 服务名称
|
||||
*/
|
||||
String SERVICE_NAME = "han-note-search";
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.hanserwei.hannote.search.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class RebuildNoteDocumentReqDTO {
|
||||
|
||||
@NotNull(message = "笔记 ID 不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.hanserwei.hannote.search.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class RebuildUserDocumentReqDTO {
|
||||
|
||||
@NotNull(message = "用户 ID 不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user