From 6f3487a09aa94b0272d31d9cf8c0bee667abf048 Mon Sep 17 00:00:00 2001 From: JiaoTianBo Date: Wed, 25 Mar 2026 10:48:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor(mapper):=20=E4=BC=98=E5=8C=96=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E9=80=92=E5=BD=92=E8=BD=AC=E6=8D=A2=E4=B8=BAJSON?= =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8C=96=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 支持基本类型(str, int, float, bool)直接返回 - 支持SDK返回的模型对象通过__dict__递归转换 - 跳过私有属性和方法避免序列化异常 - 其他对象转换为字符串保证兼容性 feat(service): 新增候选人入库标识 - IngestionResult添加is_new字段区分新增或更新 - success_result方法新增is_new参数支持自定义设置 - duplicate_result默认is_new为False明确重复非新增 refactor(frontend): 重构侧边栏菜单布局和样式 - 简化侧边栏logo结构,调整图标大小和颜色 - 替换t-menu为div循环渲染自定义菜单项 - 菜单项支持点击事件,应用激活状态样式 - 添加蓝色指示器显示当前激活菜单项 - 优化侧边栏宽度固定,主布局采用flex布局 - 美化升级卡片视觉,调整间距和阴影统一风格 --- .../ylhp_hr_2_0/mapper/resume_mapper.py | 15 +- .../ingestion/unified_ingestion_service.py | 9 +- .../src/components/Layout.vue | 146 +++++++++--------- 3 files changed, 91 insertions(+), 79 deletions(-) diff --git a/src/main/python/cn/yinlihupo/ylhp_hr_2_0/mapper/resume_mapper.py b/src/main/python/cn/yinlihupo/ylhp_hr_2_0/mapper/resume_mapper.py index 8e13da0..4b25e27 100644 --- a/src/main/python/cn/yinlihupo/ylhp_hr_2_0/mapper/resume_mapper.py +++ b/src/main/python/cn/yinlihupo/ylhp_hr_2_0/mapper/resume_mapper.py @@ -41,6 +41,9 @@ class ResumeMapper: """递归转换对象为可JSON序列化的格式""" if obj is None: return None + # 处理基本类型 + if isinstance(obj, (str, int, float, bool)): + return obj # 处理枚举类型 if hasattr(obj, 'value'): return obj.value @@ -65,7 +68,17 @@ class ResumeMapper: value = getattr(obj, field_name) result[field_name] = self._convert_to_serializable(value) return result - return obj + # 处理一般对象(如SDK返回的Model对象) + if hasattr(obj, '__dict__'): + result = {} + for key, value in obj.__dict__.items(): + # 跳过私有属性和方法 + if key.startswith('_'): + continue + result[key] = self._convert_to_serializable(value) + return result + # 最后尝试转换为字符串 + return str(obj) def _entity_to_model(self, entity: Resume) -> ResumeModel: """将实体转换为模型""" diff --git a/src/main/python/cn/yinlihupo/ylhp_hr_2_0/service/ingestion/unified_ingestion_service.py b/src/main/python/cn/yinlihupo/ylhp_hr_2_0/service/ingestion/unified_ingestion_service.py index cd0e18f..59a1abb 100644 --- a/src/main/python/cn/yinlihupo/ylhp_hr_2_0/service/ingestion/unified_ingestion_service.py +++ b/src/main/python/cn/yinlihupo/ylhp_hr_2_0/service/ingestion/unified_ingestion_service.py @@ -20,14 +20,16 @@ class IngestionResult: errors: list = None is_duplicate: bool = False existing_candidate_id: Optional[str] = None + is_new: bool = True # 是否为新增候选人(False表示更新) @classmethod - def success_result(cls, candidate_id: str, message: str = "") -> "IngestionResult": + def success_result(cls, candidate_id: str, message: str = "", is_new: bool = True) -> "IngestionResult": """创建成功结果""" return cls( success=True, candidate_id=candidate_id, - message=message or "入库成功" + message=message or "入库成功", + is_new=is_new ) @classmethod @@ -50,7 +52,8 @@ class IngestionResult: success=True, # 重复不算失败 is_duplicate=True, existing_candidate_id=existing_id, - message=message or "候选人已存在" + message=message or "候选人已存在", + is_new=False # 重复候选人不算新增 ) diff --git a/src/main/web/cn.yinlihupo/ylhp_hr_2_0_fronted/src/components/Layout.vue b/src/main/web/cn.yinlihupo/ylhp_hr_2_0_fronted/src/components/Layout.vue index 30b8d84..e237f20 100644 --- a/src/main/web/cn.yinlihupo/ylhp_hr_2_0_fronted/src/components/Layout.vue +++ b/src/main/web/cn.yinlihupo/ylhp_hr_2_0_fronted/src/components/Layout.vue @@ -3,35 +3,22 @@ - - - +