1
0
mirror of synced 2025-12-24 02:57:55 +08:00

🎨 #3567 【企业微信】获取企业所有打卡规则接口调整

This commit is contained in:
Copilot
2025-07-30 23:10:30 +08:00
committed by GitHub
parent 14f8c8ebc2
commit a881de59a5
2 changed files with 137 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import me.chanjar.weixin.cp.api.ApiTestModule;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
import me.chanjar.weixin.cp.bean.oa.*;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
@@ -168,6 +169,46 @@ public class WxCpOaServiceImplTest {
System.out.println(gson.toJson(results));
}
/**
* Test new ot_info_v2 structure deserialization.
*/
@Test
public void testOtInfoV2Deserialization() {
// Test JSON with ot_info_v2 structure based on the new API response format
String jsonWithOtInfoV2 = "{\n" +
" \"groupid\": 1,\n" +
" \"groupname\": \"test group\",\n" +
" \"grouptype\": 0,\n" +
" \"ot_info_v2\": {\n" +
" \"workdayconf\": {\n" +
" \"allow_ot\": true,\n" +
" \"type\": 1\n" +
" },\n" +
" \"restdayconf\": {\n" +
" \"allow_ot\": false,\n" +
" \"type\": 0\n" +
" },\n" +
" \"holidayconf\": {\n" +
" \"allow_ot\": true,\n" +
" \"type\": 2\n" +
" }\n" +
" }\n" +
"}";
WxCpCropCheckinOption option = WxCpGsonBuilder.create().fromJson(jsonWithOtInfoV2, WxCpCropCheckinOption.class);
assertThat(option).isNotNull();
assertThat(option.getOtInfoV2()).isNotNull();
assertThat(option.getOtInfoV2().getWorkdayConf()).isNotNull();
assertThat(option.getOtInfoV2().getWorkdayConf().getAllowOt()).isTrue();
assertThat(option.getOtInfoV2().getWorkdayConf().getType()).isEqualTo(1);
assertThat(option.getOtInfoV2().getRestdayConf()).isNotNull();
assertThat(option.getOtInfoV2().getRestdayConf().getAllowOt()).isFalse();
assertThat(option.getOtInfoV2().getHolidayConf().getAllowOt()).isTrue();
System.out.println("Parsed ot_info_v2 structure:");
System.out.println(gson.toJson(option.getOtInfoV2()));
}
/**
* Test get approval info.
*