添加用户个人技能标签提取

This commit is contained in:
zk
2026-03-20 11:34:12 +08:00
parent dc2e241151
commit 971694d648
7 changed files with 466 additions and 6 deletions
+27 -1
View File
@@ -125,4 +125,30 @@ inclusion: manual
- 通过 MyBatis-Plus 的 `@TableField(typeHandler = JacksonTypeHandler.class)` 注解实现自动序列化/反序列化
- 含有 TypeHandler 字段的 PO`@TableName` 必须加 `autoResultMap = true`,如 `@TableName(value = "bg_xxx", autoResultMap = true)`
- JSON 数组存简单值用 `List<String>` 或 `List<Long>`,存复杂结构则抽象为独立的 VO 类(如 `DescriptionParagraph`),放在 `manager/pojo/vo/` 下
- Param 和 Dto 中对应字段直接使用相同的 Java 类型,Controller 层通过 `BeanUtils.copyProperties` 直接拷贝,不做手动 JSON 转换
- Param 和 Dto 中对应字段直接使用相同的 Java 类型,Controller 层通过 `BeanUtils.copyProperties` 直接拷贝,不做手动 JSON 转换
## 代码格式规范
### 紧凑风格
- 避免过度换行,保持代码紧凑易读
- Lambda 表达式和 Stream 操作尽量写在一行,除非超过 120 字符
- 方法参数列表较多时,可适当换行但保持紧凑,每行放多个参数
- 字符串拼接优先写在一行,除非过长影响可读性
### 示例
**推荐(紧凑风格):**
```java
// 查询语句一行
List<JobCategory> categories = jobCategoryMapper.selectList(new LambdaQueryWrapper<JobCategory>().eq(JobCategory::getLevel, 2));
// Stream 操作一行
List<Long> ids = categories.stream().map(JobCategory::getId).collect(Collectors.toList());
// 方法参数紧凑排列
private List<Long> identifyCategories(UserProfile profile, List<UserProfileEducation> educationList,
List<UserProfileWork> workList, List<UserProfileInternship> internshipList,
List<UserProfileProject> projectList, List<UserProfileCompetition> competitionList) {
// 字符串拼接一行
String userMessage = "【用户个人资料】\n" + profileJson + "\n\n【二级岗位分类列表】\n" + categoryText;
+33 -5
View File
@@ -44,7 +44,7 @@ offerpie/back-end
│ ├─ pom.xml
│ └─ src/main/java
│ └─ org.jiayunet
│ ├─ config/ # OSS、Redis、Security、WxPay、Sms 等统一配置
│ ├─ config/ # OSS、Redis、Security、WxPay、Sms、Async 等统一配置
│ ├─ tool/ # Http、IP、Redis、认证、验证码等工具类
│ ├─ interceptor/ # 全局拦截器(日志、TraceId、黑名单、SQL 统计等)
│ ├─ aop/ # AOP 日志切面
@@ -88,6 +88,7 @@ offerpie/back-end
│ ├─ UserProfileInternshipMapper.java # 用户实习经历Mapper
│ ├─ UserProfileProjectMapper.java # 用户项目经历Mapper
│ ├─ UserProfileCompetitionMapper.java # 用户竞赛经历Mapper
│ ├─ UserProfileSkillTagRelationMapper.java # 用户技能标签关联Mapper
│ └─ AppJobDataMapper.java # 爬虫岗位原始数据Mapper
├─ pojo/
│ ├─ po/ # 持久化实体
@@ -117,9 +118,10 @@ offerpie/back-end
│ │ ├─ UserProfileInternship.java # 用户实习经历表(bg_user_profile_internship
│ │ ├─ UserProfileProject.java # 用户项目经历表(bg_user_profile_project
│ │ ├─ UserProfileCompetition.java # 用户竞赛经历表(bg_user_profile_competition
│ │ ├─ UserProfileSkillTagRelation.java # 用户技能标签关联表(bg_user_profile_skill_tag_relation
│ │ └─ AppJobData.java # 爬虫岗位原始数据表(app_job_data
│ └─ vo/ # ViewObjectOssUrlVo、DescriptionParagraph 等)
└─ service/ # 业务 ServiceOssService、SmsService、DictCacheService、JobCleanService、JobCleanTransactionService、CompanyCleanService、CompanyCleanTransactionService 等)
└─ service/ # 业务 ServiceOssService、SmsService、DictCacheService、JobCleanService、JobCleanTransactionService、CompanyCleanService、CompanyCleanTransactionService、UserSkillTagMatchService 等)
```
> **设计理念** – 业务实体和 Mapper 位于 `manager`B 端和 C 端共享;C 端特有的注解、切面、权限服务、路由菜单服务位于 `client-api`,避免 B 端误用;`common` 提供统一的技术支撑。
@@ -127,7 +129,7 @@ offerpie/back-end
| 层级 | 主要职责 | 关键类/包 |
|------|----------|-----------|
| **client-api** | - 面向终端用户的 REST API <br> - 启动 Spring Boot 应用 <br> - 短信验证码登录(含自动注册、邀请码绑定) <br> - **功能权限校验**:注解 + 切面 + 权限服务(校验、扣减、回退) <br> - **路由菜单**:获取用户有效菜单树 | `ClientApplication``LoginController``RouteMenuController``FuncPermission``FuncPermissionAspect``FuncPermissionService``RouteMenuService``UserRegisterService``RouteMenuVo` |
| **common** | - **统一配置**OSS、Redis、Security、WxPay、Sms 等 <br> - **跨层工具**:HTTP、IP、认证、验证码、Redis Server 等 <br> - **全局拦截/切面**:日志、TraceId、黑名单、SQL 打印 <br> - **统一异常/响应**`GlobalExceptionAdvice``UnifiedResponse` <br> - **业务抽象**:邮件发送、微信支付(Native/JS/Transfer <br> - **公共 POJO**:登录令牌、防重放信息等 | `config/`, `tool/`, `interceptor/`, `aop/`, `exception/`, `email/`, `wxPay/`, `pojo/` |
| **common** | - **统一配置**OSS、Redis、Security、WxPay、Sms、Async 等 <br> - **跨层工具**:HTTP、IP、认证、验证码、Redis Server 等 <br> - **全局拦截/切面**:日志、TraceId、黑名单、SQL 打印 <br> - **统一异常/响应**`GlobalExceptionAdvice``UnifiedResponse` <br> - **业务抽象**:邮件发送、微信支付(Native/JS/Transfer、异步任务 <br> - **公共 POJO**:登录令牌、防重放信息等 | `config/`, `tool/`, `interceptor/`, `aop/`, `exception/`, `email/`, `wxPay/`, `pojo/` |
| **manager** | - **业务实体**`User``OssFile``UserInvite``RouteMenu``FuncPermission``UserRouteMenuStock``UserFuncPermissionStock``UserFuncUsageLog``ChinaRegionsCode``JobCategory``Company``Job``JobRegionRelation``Industry``SkillTag``UserJobFavorite``UserJobApplication``UserJobDislike``AppJobData` <br> - **MyBatis Mapper**`UserMapper``OssFileMapper``UserInviteMapper``RouteMenuMapper``FuncPermissionMapper``UserRouteMenuStockMapper``UserFuncPermissionStockMapper``UserFuncUsageLogMapper``ChinaRegionsCodeMapper``JobCategoryMapper``CompanyMapper``JobMapper``JobRegionRelationMapper``IndustryMapper``SkillTagMapper``UserJobFavoriteMapper``UserJobApplicationMapper``UserJobDislikeMapper``AppJobDataMapper` <br> - **业务 API**:文件上传/下载、健康检查等 <br> - **业务逻辑**:服务层、工具类等 <br> - **既供 B 端 UI(待实现)使用,也供 C 端业务直接调用** | `controller/`, `mapper/`, `pojo/po/`, `pojo/vo/`, `service/`, `constant/` |
## 3️⃣ 关键业务实体
@@ -162,6 +164,7 @@ offerpie/back-end
| `UserProfileProject` | manager | 用户项目经历表(bg_user_profile_projectprofile子表),公司、项目名、角色、起止时间、描述段落(JSON对象数组)。 |
| `UserProfileCompetition` | manager | 用户竞赛经历表(bg_user_profile_competitionprofile子表),竞赛名、奖项、获奖时间、描述段落(JSON对象数组)。 |
| `JobSkillTagRelation` | manager | 岗位-技能标签关联表(bg_job_skill_tag_relation),预定义技能标签与岗位的关联,用于匹配度计算。 |
| `UserProfileSkillTagRelation` | manager | 用户技能标签关联表(bg_user_profile_skill_tag_relation),记录用户匹配的技能标签,由AI自动识别生成。 |
| `AppJobData` | manager | 爬虫岗位原始数据表(app_job_data),存储爬虫抓取的原始岗位数据,供清洗服务读取并写入业务表。 |
## 4️⃣ 权限体系设计
@@ -199,7 +202,7 @@ offerpie/back-end
## 5️⃣ 共享技术栈(位于 `common`)
| 类别 | 关键实现 | 位置 |
|------|----------|------|
| **配置** | `OssConfig`, `RedissonConf`, `SecurityConfig`, `WxPayConfig`, `SmsConfig` | `common/config` |
| **配置** | `OssConfig`, `RedissonConf`, `SecurityConfig`, `WxPayConfig`, `SmsConfig`, `AsyncConfig` | `common/config` |
| **安全** | JWT 过滤器、登录令牌 (`RedisLoginTokenInfo`)、防重放 (`RedisPreventReplayInfo`) | `common/interceptor``common/pojo/interceptor` |
| **邮件** | `EmailAbility`(封装邮件发送) | `common/email` |
| **AI** | `AiChatAbility`OpenAI 兼容多供应商对话)、`AiChatConfig`(供应商配置) | `common/ai` |
@@ -223,7 +226,32 @@ offerpie/back-end
- 权限体系分两层:前端路由控制菜单可见性,后端切面控制功能点权限与库存扣减。
- 权限和菜单作为商品维度,框架只负责校验和库存管理,不关心权限来源。
## 4.5️⃣ 邀请模块设计
## 4.5️⃣ 用户技能标签匹配设计
### 整体架构
- **触发时机**:用户保存个人资料(主表或任意子表)后异步触发
- **匹配流程**:两次 AI 调用 → 第一次识别用户所属的二级岗位分类(1-10个),第二次从候选技能标签中匹配用户技能
- **数据存储**:全量替换 `bg_user_profile_skill_tag_relation`
### 数据库表(1张)
| 表名 | 说明 |
|------|------|
| `bg_user_profile_skill_tag_relation` | 用户技能标签关联(user_id + skill_tag_id 唯一约束) |
### 核心流程
1. 查询用户完整个人资料(主表 + 5张子表)
2. 数据有效性检查(主表或所有子表为空 → 清空关联表)
3. 第一次 AI 调用:识别用户所属的二级岗位分类(1-10个),信息不足返回空数组
4. 查询三级分类:根据二级分类 ID 查询所有三级分类(技能标签挂在三级分类下)
5. 查询候选技能标签(WHERE category_id IN 三级分类列表)
6. 第二次 AI 调用:从候选标签中匹配用户技能标签
7. 全量替换关联表(先 DELETE,结果非空则 BATCH INSERT
### 异步执行
- 使用 Spring `@Async` 注解,配置独立线程池(核心5线程,最大10线程,队列200)
- 异常统一记录日志,不影响主流程
- AI 调用失败不修改关联表(保持原状)
## 4.6️⃣ 邀请模块设计
### 数据库表(1张)
| 表名 | 说明 |
|------|------|