[企业微信]fix家校应用single_choice属性字段 #2792

This commit is contained in:
0katekate0 2022-08-25 01:12:32 +08:00
parent 8c461bbaf2
commit d39062353c
2 changed files with 66 additions and 5 deletions

View File

@ -12,8 +12,9 @@ import java.util.List;
/**
* 获取用户填写答案.
* 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 {
@ -63,8 +64,8 @@ public class WxCpGetReportAnswer extends WxCpBaseResp 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;

View File

@ -40,8 +40,68 @@ public class WxCpSchoolHealthTest {
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());