Skip to content

Fix DateRange control config mapping in weixin-java-cp approval template#3897

Merged
binarywang merged 2 commits intodevelopfrom
copilot/fix-date-range-control-issue
Mar 3, 2026
Merged

Fix DateRange control config mapping in weixin-java-cp approval template#3897
binarywang merged 2 commits intodevelopfrom
copilot/fix-date-range-control-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

The DateRange control's config.date_range was not mapped in TemplateConfig — it existed only inside TemplateAttendance, causing the fields to be silently dropped during deserialization. Additionally, TemplateDateRange was missing official_holiday and perday_duration fields present in the actual API response.

Changes

  • TemplateDateRange — add officialHoliday (official_holiday) and perdayDuration (perday_duration) fields
  • TemplateConfig (templatedata package) — add dateRange (date_range) field; update Javadoc to mention DateRange
  • WxCpOaApprovalTemplateResult.TemplateConfig (inner class) — add same dateRange field + import

API response shape now correctly mapped

"config": {
  "date_range": {
    "type": "halfday",
    "official_holiday": 0,
    "perday_duration": 86400
  }
}
Original prompt

This section details on the original issue you should resolve

<issue_title>weixin-java-cp企业微信工作流模板时长控件属性不一致</issue_title>
<issue_description>### 简要描述
工作流模板中date_range与sdk的类属性转换有问题,不在TemplateAttendance里,而是直接在TemplateConfig下

模块版本情况

  • WxJava 模块名: weixin-java-cp,4.8.0

详细描述

模板json

{
                "property": {
                    "control": "DateRange",
                    "id": "DateRange-1771648875218",
                    "title": [
                        {
                            "text": "上线时间",
                            "lang": "zh_CN"
                        }
                    ],
                    "placeholder": [
                        {
                            "text": "",
                            "lang": "zh_CN"
                        }
                    ],
                    "require": 0,
                    "un_print": 0,
                    "inner_id": "",
                    "un_replace": 0,
                    "display": 1
                },
                "config": {
                    "date_range": {
                        "type": "halfday",
                        "official_holiday": 0,
                        "perday_duration": 86400
                    }
                }
            }

Image</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix inconsistent properties for DateRange control in workflow template Fix DateRange control config mapping in weixin-java-cp approval template Mar 3, 2026
@binarywang binarywang marked this pull request as ready for review March 3, 2026 08:29
Copilot AI review requested due to automatic review settings March 3, 2026 08:29
Copy link

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 修复了企业微信 OA 审批模板中 DateRange(时长)控件的 config.date_range 反序列化映射缺失问题,并补齐了 date_range 配置里与实际 API 返回一致的字段,避免反序列化时字段被静默丢弃。

Changes:

  • TemplateConfig 增加 dateRangedate_range)字段以正确承载 DateRange 控件配置
  • TemplateDateRange 补充 officialHolidayofficial_holiday)与 perdayDurationperday_duration)字段
  • 同步更新 WxCpOaApprovalTemplateResult.TemplateConfig 内部类的 dateRange 字段与相关 import

Reviewed changes

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

File Description
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/templatedata/TemplateDateRange.java 补齐 date_range 配置缺失字段并添加 Gson 映射注解
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/templatedata/TemplateConfig.java date_range 映射提升到 TemplateConfig,并更新 Javadoc 列表
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/oa/WxCpOaApprovalTemplateResult.java 同步内部 TemplateConfigdate_range 字段映射,避免结果对象丢字段

@binarywang binarywang merged commit b42d6be into develop Mar 3, 2026
5 checks passed
@binarywang binarywang deleted the copilot/fix-date-range-control-issue branch March 3, 2026 08:43
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.

weixin-java-cp企业微信工作流模板时长控件属性不一致

3 participants