Skip to content

Commit 152e6a0

Browse files
authored
🐛 #2792【企业微信】修复家校应用接口single_choice属性错误问题
2 parents 8c461bb + d390623 commit 152e6a0

File tree

2 files changed

+66
-5
lines changed

2 files changed

+66
-5
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/school/health/WxCpGetReportAnswer.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212

1313
/**
1414
* 获取用户填写答案.
15+
* https://developer.work.weixin.qq.com/document/path/93679
1516
*
16-
* @author Wang_Wong
17+
* @author <a href="/0katekate0">Wang_Wong</a>
1718
*/
1819
@Data
1920
public class WxCpGetReportAnswer extends WxCpBaseResp implements Serializable {
@@ -63,8 +64,8 @@ public static class ReportValue implements Serializable {
6364
@SerializedName("question_id")
6465
private Integer questionId;
6566

66-
@SerializedName("single_chose")
67-
private Integer singleChose;
67+
@SerializedName("single_choice")
68+
private Integer singleChoice;
6869

6970
@SerializedName("multi_choice")
7071
private List<Integer> multiChoice;

weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpSchoolHealthTest.java

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,68 @@ public void test() throws WxErrorException {
4040
String currDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
4141

4242

43-
// Test
44-
String reportAnswerStr = "{\"errcode\":0,\"errmsg\":\"ok\",\"answers\":[{\"id_type\":1,\"userid\":\"userid2\",\"report_time\":123456789,\"report_values\":[{\"question_id\":1,\"single_choice\":2},{\"question_id\":2,\"text\":\"广东省广州市\"},{\"question_id\":3,\"multi_choice\":[1,3]},{\"question_id\":4,\"fileid\":[\"XXXXXXX\"]}]},{\"id_type\":2,\"student_userid\":\"student_userid1\",\"parent_userid\":\"parent_userid1\",\"report_time\":123456789,\"report_values\":[{\"question_id\":1,\"single_choice\":1},{\"question_id\":2,\"text\":\"广东省深圳市\"},{\"question_id\":3,\"multi_choice\":[1,2,3]},{\"question_id\":4,\"fileid\":[\"XXXXXXX\"]}]}]}";
43+
// Test Json
44+
String reportAnswerStr = "{\n" +
45+
" \"errcode\": 0,\n" +
46+
" \"errmsg\": \"ok\",\n" +
47+
" \"answers\":[\n" +
48+
"\t\t{\n" +
49+
"\t\t\t\"id_type\": 1,\n" +
50+
"\t\t\t\"userid\": \"userid2\",\n" +
51+
"\t\t\t\"report_time\": 123456789,\n" +
52+
"\t\t\t\"report_values\": [\n" +
53+
"\t\t\t\t{\n" +
54+
"\t\t\t\t\t\"question_id\": 1,\n" +
55+
"\t\t\t\t\t\"single_choice\": 2\n" +
56+
"\t\t\t\t},\n" +
57+
"\t\t\t\t{\n" +
58+
"\t\t\t\t\t\"question_id\": 2,\n" +
59+
"\t\t\t\t\t\"text\": \"广东省广州市\"\n" +
60+
"\t\t\t\t},\n" +
61+
"\t\t\t\t{\n" +
62+
"\t\t\t\t\t\"question_id\": 3,\n" +
63+
"\t\t\t\t\t\"multi_choice\": [\n" +
64+
"\t\t\t\t\t\t1, 3\n" +
65+
"\t\t\t\t\t]\n" +
66+
"\t\t\t\t},\n" +
67+
"\t\t\t\t{\n" +
68+
"\t\t\t\t\t\"question_id\": 4,\n" +
69+
"\t\t\t\t\t\"fileid\": [\n" +
70+
" \"XXXXXXX\"\n" +
71+
" ]\n" +
72+
"\t\t\t\t}\n" +
73+
"\t\t\t]\n" +
74+
"\t\t},\n" +
75+
"\t\t{\n" +
76+
"\t\t\t\"id_type\": 2,\n" +
77+
"\t\t\t\"student_userid\": \"student_userid1\",\n" +
78+
"\t\t\t\"parent_userid\": \"parent_userid1\",\n" +
79+
"\t\t\t\"report_time\": 123456789,\n" +
80+
"\t\t\t\"report_values\":[\n" +
81+
"\t\t\t\t{\n" +
82+
"\t\t\t\t\t\"question_id\": 1,\n" +
83+
"\t\t\t\t\t\"single_choice\": 1\n" +
84+
"\t\t\t\t},\n" +
85+
"\t\t\t\t{\n" +
86+
"\t\t\t\t\t\"question_id\": 2,\n" +
87+
"\t\t\t\t\t\"text\": \"广东省深圳市\"\n" +
88+
"\t\t\t\t},\n" +
89+
"\t\t\t\t{\n" +
90+
"\t\t\t\t\t\"question_id\": 3,\n" +
91+
"\t\t\t\t\t\"multi_choice\":[\n" +
92+
"\t\t\t\t\t\t1,2,3\n" +
93+
"\t\t\t\t\t]\n" +
94+
"\t\t\t\t},\n" +
95+
"\t\t\t\t{\n" +
96+
"\t\t\t\t\t\"question_id\": 4,\n" +
97+
"\t\t\t\t\t\"fileid\": [\n" +
98+
" \"XXXXXXX\"\n" +
99+
" ]\n" +
100+
"\t\t\t\t}\n" +
101+
"\t\t\t]\n" +
102+
"\t\t}\n" +
103+
"\t]\n" +
104+
"}";
45105
WxCpGetReportAnswer getReportAnswer = WxCpGetReportAnswer.fromJson(reportAnswerStr);
46106
log.info("获取对应的getReportAnswer:{}", getReportAnswer.toJson());
47107

0 commit comments

Comments
 (0)