Skip to content

Commit

Permalink
[企业微信]fix家校应用single_choice属性字段 binarywang#2792
Browse files Browse the repository at this point in the history
  • Loading branch information
0katekate0 committed Aug 24, 2022
1 parent 8c461bb commit d390623
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

/**
* 获取用户填写答案.
* https://developer.work.weixin.qq.com/document/path/93679
*
* @author Wang_Wong
* @author <a href="https://github.com/0katekate0">Wang_Wong</a>
*/
@Data
public class WxCpGetReportAnswer extends WxCpBaseResp implements Serializable {
Expand Down Expand Up @@ -63,8 +64,8 @@ public static class ReportValue implements Serializable {
@SerializedName("question_id")
private Integer questionId;

@SerializedName("single_chose")
private Integer singleChose;
@SerializedName("single_choice")
private Integer singleChoice;

@SerializedName("multi_choice")
private List<Integer> multiChoice;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,68 @@ public void test() throws WxErrorException {
String currDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());


// Test
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\"]}]}]}";
// Test Json
String reportAnswerStr = "{\n" +
" \"errcode\": 0,\n" +
" \"errmsg\": \"ok\",\n" +
" \"answers\":[\n" +
"\t\t{\n" +
"\t\t\t\"id_type\": 1,\n" +
"\t\t\t\"userid\": \"userid2\",\n" +
"\t\t\t\"report_time\": 123456789,\n" +
"\t\t\t\"report_values\": [\n" +
"\t\t\t\t{\n" +
"\t\t\t\t\t\"question_id\": 1,\n" +
"\t\t\t\t\t\"single_choice\": 2\n" +
"\t\t\t\t},\n" +
"\t\t\t\t{\n" +
"\t\t\t\t\t\"question_id\": 2,\n" +
"\t\t\t\t\t\"text\": \"广东省广州市\"\n" +
"\t\t\t\t},\n" +
"\t\t\t\t{\n" +
"\t\t\t\t\t\"question_id\": 3,\n" +
"\t\t\t\t\t\"multi_choice\": [\n" +
"\t\t\t\t\t\t1, 3\n" +
"\t\t\t\t\t]\n" +
"\t\t\t\t},\n" +
"\t\t\t\t{\n" +
"\t\t\t\t\t\"question_id\": 4,\n" +
"\t\t\t\t\t\"fileid\": [\n" +
" \"XXXXXXX\"\n" +
" ]\n" +
"\t\t\t\t}\n" +
"\t\t\t]\n" +
"\t\t},\n" +
"\t\t{\n" +
"\t\t\t\"id_type\": 2,\n" +
"\t\t\t\"student_userid\": \"student_userid1\",\n" +
"\t\t\t\"parent_userid\": \"parent_userid1\",\n" +
"\t\t\t\"report_time\": 123456789,\n" +
"\t\t\t\"report_values\":[\n" +
"\t\t\t\t{\n" +
"\t\t\t\t\t\"question_id\": 1,\n" +
"\t\t\t\t\t\"single_choice\": 1\n" +
"\t\t\t\t},\n" +
"\t\t\t\t{\n" +
"\t\t\t\t\t\"question_id\": 2,\n" +
"\t\t\t\t\t\"text\": \"广东省深圳市\"\n" +
"\t\t\t\t},\n" +
"\t\t\t\t{\n" +
"\t\t\t\t\t\"question_id\": 3,\n" +
"\t\t\t\t\t\"multi_choice\":[\n" +
"\t\t\t\t\t\t1,2,3\n" +
"\t\t\t\t\t]\n" +
"\t\t\t\t},\n" +
"\t\t\t\t{\n" +
"\t\t\t\t\t\"question_id\": 4,\n" +
"\t\t\t\t\t\"fileid\": [\n" +
" \"XXXXXXX\"\n" +
" ]\n" +
"\t\t\t\t}\n" +
"\t\t\t]\n" +
"\t\t}\n" +
"\t]\n" +
"}";
WxCpGetReportAnswer getReportAnswer = WxCpGetReportAnswer.fromJson(reportAnswerStr);
log.info("获取对应的getReportAnswer:{}", getReportAnswer.toJson());

Expand Down

0 comments on commit d390623

Please sign in to comment.