mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #2620 【企业微信】微信客服统计管理模块增加获取「客户数据统计」企业汇总数据的接口
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package me.chanjar.weixin.cp.util.json;
|
||||
|
||||
import com.google.gson.*;
|
||||
import me.chanjar.weixin.common.util.json.GsonHelper;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfGetCorpStatisticResp;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* @author zhongjun
|
||||
* @date 2022/4/25
|
||||
**/
|
||||
public class StatisticListAdapter implements JsonDeserializer<WxCpKfGetCorpStatisticResp.StatisticList> {
|
||||
|
||||
@Override
|
||||
public WxCpKfGetCorpStatisticResp.StatisticList deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||
WxCpKfGetCorpStatisticResp.StatisticList statisticList = new WxCpKfGetCorpStatisticResp.StatisticList();
|
||||
JsonObject asJsonObject = jsonElement.getAsJsonObject();
|
||||
statisticList.setStatTime(asJsonObject.get("stat_time").getAsLong());
|
||||
JsonElement statistic = asJsonObject.get("statistic");
|
||||
if (GsonHelper.isNotNull(statistic)) {
|
||||
WxCpKfGetCorpStatisticResp.Statistic statisticObj = new WxCpKfGetCorpStatisticResp.Statistic();
|
||||
statisticObj.setSessionCnt(statistic.getAsJsonObject().get("session_cnt").getAsInt());
|
||||
statisticObj.setCustomerCnt(statistic.getAsJsonObject().get("customer_cnt").getAsInt());
|
||||
statisticObj.setCustomerMsgCnt(statistic.getAsJsonObject().get("customer_msg_cnt").getAsInt());
|
||||
statisticObj.setUpgradeServiceCustomerCnt(statistic.getAsJsonObject().get("upgrade_service_customer_cnt").getAsInt());
|
||||
statisticObj.setAiTransferRate(statistic.getAsJsonObject().get("ai_transfer_rate").getAsInt());
|
||||
statisticObj.setAiKnowledgeHitRate(statistic.getAsJsonObject().get("ai_knowledge_hit_rate").getAsInt());
|
||||
}
|
||||
return statisticList;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import me.chanjar.weixin.cp.bean.WxCpChat;
|
||||
import me.chanjar.weixin.cp.bean.WxCpDepart;
|
||||
import me.chanjar.weixin.cp.bean.WxCpTag;
|
||||
import me.chanjar.weixin.cp.bean.WxCpUser;
|
||||
import me.chanjar.weixin.cp.bean.kf.WxCpKfGetCorpStatisticResp;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -27,6 +29,7 @@ public class WxCpGsonBuilder {
|
||||
INSTANCE.registerTypeAdapter(WxError.class, new WxErrorAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMenu.class, new WxCpMenuGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxCpTag.class, new WxCpTagGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxCpKfGetCorpStatisticResp.StatisticList.class, new StatisticListAdapter());
|
||||
}
|
||||
|
||||
public static Gson create() {
|
||||
|
||||
Reference in New Issue
Block a user