From 20d1626cfd4294cd31934514b2a38468c540e8b6 Mon Sep 17 00:00:00 2001 From: 0katekate0 <1960779692@qq.com> Date: Thu, 9 Jun 2022 16:51:56 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E3=80=91=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=A1=AB=E5=86=99=E7=AD=94=E6=A1=88=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cp/api/WxCpSchoolHealthService.java | 17 ++++ .../api/impl/WxCpSchoolHealthServiceImpl.java | 17 ++++ .../school/health/WxCpGetReportAnswer.java | 96 +++++++++++++++++++ .../weixin/cp/constant/WxCpApiPathConsts.java | 1 + .../weixin/cp/api/WxCpSchoolHealthTest.java | 13 +++ 5 files changed, 144 insertions(+) create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/school/health/WxCpGetReportAnswer.java diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpSchoolHealthService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpSchoolHealthService.java index 0d852e74b1..76233046d3 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpSchoolHealthService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpSchoolHealthService.java @@ -3,6 +3,7 @@ import lombok.NonNull; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.cp.bean.school.health.WxCpGetHealthReportStat; +import me.chanjar.weixin.cp.bean.school.health.WxCpGetReportAnswer; import me.chanjar.weixin.cp.bean.school.health.WxCpGetReportJobIds; import me.chanjar.weixin.cp.bean.school.health.WxCpGetReportJobInfo; @@ -54,4 +55,20 @@ public interface WxCpSchoolHealthService { */ WxCpGetReportJobInfo getReportJobInfo(@NonNull String jobId, @NonNull String date) throws WxErrorException; + /** + * 获取用户填写答案 + * 通过此接口可以获取指定的健康上报任务详情。 + *
+ * 请求方式:POST(HTTPS)
+ * 请求地址:https://qyapi.weixin.qq.com/cgi-bin/health/get_report_answer?access_token=ACCESS_TOKEN
+ *
+ * @param jobId
+ * @param date
+ * @param offset
+ * @param limit
+ * @return
+ * @throws WxErrorException
+ */
+ WxCpGetReportAnswer getReportAnswer(@NonNull String jobId, @NonNull String date, Integer offset, Integer limit) throws WxErrorException;
+
}
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpSchoolHealthServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpSchoolHealthServiceImpl.java
index bee4bf0306..ff1119cc1a 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpSchoolHealthServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpSchoolHealthServiceImpl.java
@@ -8,6 +8,7 @@
import me.chanjar.weixin.cp.api.WxCpSchoolHealthService;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.school.health.WxCpGetHealthReportStat;
+import me.chanjar.weixin.cp.bean.school.health.WxCpGetReportAnswer;
import me.chanjar.weixin.cp.bean.school.health.WxCpGetReportJobIds;
import me.chanjar.weixin.cp.bean.school.health.WxCpGetReportJobInfo;
@@ -56,4 +57,20 @@ public WxCpGetReportJobInfo getReportJobInfo(@NonNull String jobId, @NonNull Str
return WxCpGetReportJobInfo.fromJson(responseContent);
}
+ @Override
+ public WxCpGetReportAnswer getReportAnswer(@NonNull String jobId, @NonNull String date, Integer offset, Integer limit) throws WxErrorException {
+ String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(GET_REPORT_ANSWER);
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.addProperty("jobid", jobId);
+ jsonObject.addProperty("date", date);
+ if (offset != null) {
+ jsonObject.addProperty("offset", offset);
+ }
+ if (limit != null) {
+ jsonObject.addProperty("limit", limit);
+ }
+ String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
+ return WxCpGetReportAnswer.fromJson(responseContent);
+ }
+
}
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/school/health/WxCpGetReportAnswer.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/school/health/WxCpGetReportAnswer.java
new file mode 100644
index 0000000000..a016ad1ef4
--- /dev/null
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/school/health/WxCpGetReportAnswer.java
@@ -0,0 +1,96 @@
+package me.chanjar.weixin.cp.bean.school.health;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import me.chanjar.weixin.cp.bean.WxCpBaseResp;
+import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 获取用户填写答案.
+ *
+ * @author Wang_Wong
+ */
+@Data
+public class WxCpGetReportAnswer extends WxCpBaseResp implements Serializable {
+ private static final long serialVersionUID = -5028321625142879581L;
+
+ @SerializedName("answers")
+ private List