Skip to content

企业微信人事助手api响应序列化问题#3977

Merged
binarywang merged 9 commits intobinarywang:developfrom
softboy99:develop
May 9, 2026
Merged

企业微信人事助手api响应序列化问题#3977
binarywang merged 9 commits intobinarywang:developfrom
softboy99:develop

Conversation

@softboy99
Copy link
Copy Markdown
Contributor

image

softboy99 and others added 8 commits March 11, 2026 09:34
merge latest from fork source
…参数不符合系统要求,需要参照具体API接口说明,微信原始报文:{"errcode":40058,"errmsg":"invalid Request Parameter
…rvice.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…pHrServiceImpl.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…rvice.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…序列化问题;UpdateEmployeeFieldInfo暂时未用到,未做测试
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 7, 2026

🤖 Augment PR Summary

Summary: This PR fixes 企业微信「人事助手」相关接口的响应反序列化/字段映射不一致问题,并补充向后兼容的字段/方法。

Changes:

  • 将员工档案数据响应字段映射调整为 API 实际返回的 field_info,并将 WxCpHrEmployeeFieldData 建模为“单个字段”的返回结构(含 fieldid/sub_idx/value_type/value_*)。
  • 将字段定义响应调整为 API 实际返回的 group_list,新增 FieldGroup(分组信息)并提供旧版 getFieldInfoList() 的兼容聚合访问。
  • 更新 WxCpHrEmployeeFieldInfo 的字段定义(fieldid/field_name/is_must/value_type/option_list),并保留旧字段结构为 Deprecated 以兼容历史代码。
  • 在响应类中新增旧方法名的 Deprecated getter/setter,尽量降低升级影响(如 getEmployeeFieldList())。
  • 调整并增强 HR 相关集成测试输出逻辑,按分组打印字段信息与员工档案字段值,便于定位返回结构。
  • 将 HR 测试类加入 TestNG suite,并在 Surefire 中加入若干 --add-opens 以规避新 JDK 下的反射访问限制。

Technical Notes: 新增了 mobile 值的对象结构(国家码/手机号)以及 option 列表的新版/旧版兼容结构;整体意图是与官方返回字段名保持一致并为旧 API 入口提供平滑过渡。

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 5 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread weixin-java-cp/pom.xml
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weixin-java-cp/pom.xml:128: These --add-opens JVM args are only supported on Java 9+, so if this module’s tests are ever executed on JDK8 the forked test JVM will fail to start. Consider guarding this configuration so it only applies on JDK9+ runs.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 旨在修复企业微信「人事助手」相关接口在响应反序列化时字段结构与实际 API 返回不一致导致的解析问题,通过调整 HR 相关 Bean 的 @SerializedName 映射与数据结构,并补充对应的接口测试覆盖。

Changes:

  • 调整 HR 字段定义/员工档案数据响应的字段映射,使其与实际返回的 group_listfield_info 等结构对齐,并提供部分旧方法名的兼容入口。
  • 扩展 WxCpHrEmployeeFieldInfo / WxCpHrEmployeeFieldData 的字段模型以承载更多返回信息(字段ID、值类型、选项等)。
  • 新增 WxCpHrServiceImplTest 到 TestNG suite,并在 weixin-java-cp 模块 surefire 配置中加入 JVM --add-opens 参数。

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
weixin-java-cp/src/test/resources/testng.xml 将 HR API 测试类加入 TestNG suite 以执行验证
weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpHrServiceImplTest.java 更新/增强 HR 接口集成测试用例
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/hr/WxCpHrEmployeeFieldInfoResp.java 将字段定义响应调整为按分组返回(group_list)并提供旧 getter 兼容
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/hr/WxCpHrEmployeeFieldInfo.java 扩展字段定义模型(fieldId/optionList/valueType 等)并尝试兼容旧字段
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/hr/WxCpHrEmployeeFieldDataResp.java 将员工档案数据响应映射改为 field_info 并保留旧方法名
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/hr/WxCpHrEmployeeFieldData.java 将单条档案数据建模为“单个字段数据”,补齐 value_* 等返回字段,并调整更新请求字段
weixin-java-cp/pom.xml surefire 增加 --add-opens 相关 JVM 参数以支持反射访问

Comment thread weixin-java-cp/pom.xml
@binarywang
Copy link
Copy Markdown
Owner

请逐条阅读comments,做出相应处理,要么修改代码,要么如果确实不需要修改,给出合理的回应,然后点resolve

项目的log设置调试时,控制台不显示

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@binarywang binarywang merged commit 7a4204a into binarywang:develop May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants