Skip to content

Add support for ot_info_v2 structure in WeChat Work attendance rules API #3658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 24, 2025

The WeChat Work API for getting enterprise attendance rules (getCropCheckinOption) has been updated to return overtime information in a new ot_info_v2 structure instead of the previous ot_info format.

Issue

The existing implementation only supported the old ot_info structure, causing the overtime information to be lost when the API returns the new format:

// New API response format
"ot_info_v2": {
  "workdayconf": {
    "allow_ot": true,
    "type": 1
  },
  "restdayconf": {
    "allow_ot": false,
    "type": 0
  },
  "holidayconf": {
    "allow_ot": true,
    "type": 2
  }
}

Solution

Added support for the new ot_info_v2 structure while maintaining backward compatibility:

  1. New OtInfoV2 class with nested configuration classes:

    • WorkdayConf - workday overtime settings
    • RestdayConf - rest day overtime settings
    • HolidayConf - holiday overtime settings
  2. Enhanced WxCpCropCheckinOption with new field:

    • Added otInfoV2 field with @SerializedName("ot_info_v2") annotation
    • Preserved existing otInfo field for backward compatibility
  3. Comprehensive testing to ensure:

    • New API format deserializes correctly
    • Old API format continues to work
    • Edge cases are handled properly

Usage

The new field will be automatically populated when the API returns the ot_info_v2 structure:

List<WxCpCropCheckinOption> options = wxService.getOaService().getCropCheckinOption();
for (WxCpCropCheckinOption option : options) {
    // Check new format first
    if (option.getOtInfoV2() != null && option.getOtInfoV2().getWorkdayConf() != null) {
        boolean allowWorkdayOt = option.getOtInfoV2().getWorkdayConf().getAllowOt();
        int otType = option.getOtInfoV2().getWorkdayConf().getType();
    }
    // Fallback to old format for backward compatibility
    else if (option.getOtInfo() != null) {
        boolean allowOt = option.getOtInfo().getAllowOtWorkingDay();
    }
}

Fixes #3567.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] 企业微信-获取企业所有打卡规则接口调整 Add support for ot_info_v2 structure in WeChat Work attendance rules API Jul 24, 2025
@Copilot Copilot AI requested a review from binarywang July 24, 2025 08:13
Copilot finished work on behalf of binarywang July 24, 2025 08:13
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.

企业微信-获取企业所有打卡规则接口调整
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy