| @@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api; | |||||
| import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleResult; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleResult; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleTotal; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleTotal; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeMsgResult; | |||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary; | ||||
| @@ -110,4 +111,82 @@ public interface WxMpDataCubeService { | |||||
| */ | */ | ||||
| List<WxDataCubeArticleResult> getUserShareHour(Date beginDate, Date endDate) throws WxErrorException; | List<WxDataCubeArticleResult> getUserShareHour(Date beginDate, Date endDate) throws WxErrorException; | ||||
| //*******************消息分析数据接口***********************// | |||||
| /** | |||||
| * <pre> | |||||
| * 获取消息发送概况数据(getupstreammsg) | |||||
| * 详情请见文档:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141085&token=&lang=zh_CN">消息分析数据接口</a> | |||||
| * 接口url格式:https://api.weixin.qq.com/datacube/getupstreammsg?access_token=ACCESS_TOKEN | |||||
| * | |||||
| * @param beginDate 开始时间 | |||||
| * @param endDate 最大时间跨度7天,endDate不能早于begingDate | |||||
| */ | |||||
| List<WxDataCubeMsgResult> getUpstreamMsg(Date beginDate, Date endDate) throws WxErrorException; | |||||
| /** | |||||
| * <pre> | |||||
| * 获取消息分送分时数据(getupstreammsghour) | |||||
| * 详情请见文档:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141085&token=&lang=zh_CN">消息分析数据接口</a> | |||||
| * 接口url格式:https://api.weixin.qq.com/datacube/getupstreammsghour?access_token=ACCESS_TOKEN | |||||
| * | |||||
| * @param beginDate 开始时间 | |||||
| * @param endDate 最大时间跨度1天,endDate不能早于begingDate | |||||
| */ | |||||
| List<WxDataCubeMsgResult> getUpstreamMsgHour(Date beginDate, Date endDate) throws WxErrorException; | |||||
| /** | |||||
| * <pre> | |||||
| * 获取消息发送周数据(getupstreammsgweek) | |||||
| * 详情请见文档:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141085&token=&lang=zh_CN">消息分析数据接口</a> | |||||
| * 接口url格式:https://api.weixin.qq.com/datacube/getupstreammsgweek?access_token=ACCESS_TOKEN | |||||
| * | |||||
| * @param beginDate 开始时间 | |||||
| * @param endDate 最大时间跨度30天,endDate不能早于begingDate | |||||
| */ | |||||
| List<WxDataCubeMsgResult> getUpstreamMsgWeek(Date beginDate, Date endDate) throws WxErrorException; | |||||
| /** | |||||
| * <pre> | |||||
| * 获取消息发送月数据(getupstreammsgmonth) | |||||
| * 详情请见文档:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141085&token=&lang=zh_CN">消息分析数据接口</a> | |||||
| * 接口url格式:https://api.weixin.qq.com/datacube/getupstreammsgmonth?access_token=ACCESS_TOKEN | |||||
| * | |||||
| * @param beginDate 开始时间 | |||||
| * @param endDate 最大时间跨度30天,endDate不能早于begingDate | |||||
| */ | |||||
| List<WxDataCubeMsgResult> getUpstreamMsgMonth(Date beginDate, Date endDate) throws WxErrorException; | |||||
| /** | |||||
| * <pre> | |||||
| * 获取消息发送分布数据(getupstreammsgdist) | |||||
| * 详情请见文档:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141085&token=&lang=zh_CN">消息分析数据接口</a> | |||||
| * 接口url格式:https://api.weixin.qq.com/datacube/getupstreammsgdist?access_token=ACCESS_TOKEN | |||||
| * | |||||
| * @param beginDate 开始时间 | |||||
| * @param endDate 最大时间跨度15天,endDate不能早于begingDate | |||||
| */ | |||||
| List<WxDataCubeMsgResult> getUpstreamMsgDist(Date beginDate, Date endDate) throws WxErrorException; | |||||
| /** | |||||
| * <pre> | |||||
| * 获取消息发送分布周数据(getupstreammsgdistweek) | |||||
| * 详情请见文档:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141085&token=&lang=zh_CN">消息分析数据接口</a> | |||||
| * 接口url格式:https://api.weixin.qq.com/datacube/getupstreammsgdistweek?access_token=ACCESS_TOKEN | |||||
| * | |||||
| * @param beginDate 开始时间 | |||||
| * @param endDate 最大时间跨度30天,endDate不能早于begingDate | |||||
| */ | |||||
| List<WxDataCubeMsgResult> getUpstreamMsgDistWeek(Date beginDate, Date endDate) throws WxErrorException; | |||||
| /** | |||||
| * <pre> | |||||
| * 获取消息发送分布月数据(getupstreammsgdistmonth) | |||||
| * 详情请见文档:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141085&token=&lang=zh_CN">消息分析数据接口</a> | |||||
| * 接口url格式:https://api.weixin.qq.com/datacube/getupstreammsgdistmonth?access_token=ACCESS_TOKEN | |||||
| * | |||||
| * @param beginDate 开始时间 | |||||
| * @param endDate 最大时间跨度30天,endDate不能早于begingDate | |||||
| */ | |||||
| List<WxDataCubeMsgResult> getUpstreamMsgDistMonth(Date beginDate, Date endDate) throws WxErrorException; | |||||
| } | } | ||||
| @@ -8,6 +8,7 @@ import me.chanjar.weixin.mp.api.WxMpDataCubeService; | |||||
| import me.chanjar.weixin.mp.api.WxMpService; | import me.chanjar.weixin.mp.api.WxMpService; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleResult; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleResult; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleTotal; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleTotal; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeMsgResult; | |||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary; | ||||
| import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | ||||
| @@ -22,7 +23,7 @@ import java.util.List; | |||||
| * @author binarywang (https://github.com/binarywang) | * @author binarywang (https://github.com/binarywang) | ||||
| */ | */ | ||||
| public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | ||||
| protected final Logger log = LoggerFactory.getLogger(WxMpServiceImpl.class); | |||||
| protected final Logger log = LoggerFactory.getLogger(WxMpDataCubeServiceImpl.class); | |||||
| private static final String API_URL_PREFIX = "https://api.weixin.qq.com/datacube"; | private static final String API_URL_PREFIX = "https://api.weixin.qq.com/datacube"; | ||||
| private WxMpService wxMpService; | private WxMpService wxMpService; | ||||
| @@ -134,4 +135,102 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
| new TypeToken<List<WxDataCubeArticleResult>>() { | new TypeToken<List<WxDataCubeArticleResult>>() { | ||||
| }.getType()); | }.getType()); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxDataCubeMsgResult> getUpstreamMsg(Date beginDate, Date endDate) | |||||
| throws WxErrorException { | |||||
| String url = API_URL_PREFIX + "/getupstreammsg"; | |||||
| JsonObject param = new JsonObject(); | |||||
| param.addProperty("begin_date", WxMpService.SIMPLE_DATE_FORMAT.format(beginDate)); | |||||
| param.addProperty("end_date", WxMpService.SIMPLE_DATE_FORMAT.format(endDate)); | |||||
| String responseContent = this.wxMpService.post(url, param.toString()); | |||||
| this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
| return WxMpGsonBuilder.INSTANCE.create().fromJson(new JsonParser().parse(responseContent).getAsJsonObject().get("list"), | |||||
| new TypeToken<List<WxDataCubeMsgResult>>() { | |||||
| }.getType()); | |||||
| } | |||||
| @Override | |||||
| public List<WxDataCubeMsgResult> getUpstreamMsgHour(Date beginDate, | |||||
| Date endDate) throws WxErrorException { | |||||
| String url = API_URL_PREFIX + "/getupstreammsghour"; | |||||
| JsonObject param = new JsonObject(); | |||||
| param.addProperty("begin_date", WxMpService.SIMPLE_DATE_FORMAT.format(beginDate)); | |||||
| param.addProperty("end_date", WxMpService.SIMPLE_DATE_FORMAT.format(endDate)); | |||||
| String responseContent = this.wxMpService.post(url, param.toString()); | |||||
| this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
| return WxMpGsonBuilder.INSTANCE.create().fromJson(new JsonParser().parse(responseContent).getAsJsonObject().get("list"), | |||||
| new TypeToken<List<WxDataCubeMsgResult>>() { | |||||
| }.getType()); | |||||
| } | |||||
| @Override | |||||
| public List<WxDataCubeMsgResult> getUpstreamMsgWeek(Date beginDate, | |||||
| Date endDate) throws WxErrorException { | |||||
| String url = API_URL_PREFIX + "/getupstreammsgweek"; | |||||
| JsonObject param = new JsonObject(); | |||||
| param.addProperty("begin_date", WxMpService.SIMPLE_DATE_FORMAT.format(beginDate)); | |||||
| param.addProperty("end_date", WxMpService.SIMPLE_DATE_FORMAT.format(endDate)); | |||||
| String responseContent = this.wxMpService.post(url, param.toString()); | |||||
| this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
| return WxMpGsonBuilder.INSTANCE.create().fromJson(new JsonParser().parse(responseContent).getAsJsonObject().get("list"), | |||||
| new TypeToken<List<WxDataCubeMsgResult>>() { | |||||
| }.getType()); | |||||
| } | |||||
| @Override | |||||
| public List<WxDataCubeMsgResult> getUpstreamMsgMonth(Date beginDate, | |||||
| Date endDate) throws WxErrorException { | |||||
| String url = API_URL_PREFIX + "/getupstreammsgmonth"; | |||||
| JsonObject param = new JsonObject(); | |||||
| param.addProperty("begin_date", WxMpService.SIMPLE_DATE_FORMAT.format(beginDate)); | |||||
| param.addProperty("end_date", WxMpService.SIMPLE_DATE_FORMAT.format(endDate)); | |||||
| String responseContent = this.wxMpService.post(url, param.toString()); | |||||
| this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
| return WxMpGsonBuilder.INSTANCE.create().fromJson(new JsonParser().parse(responseContent).getAsJsonObject().get("list"), | |||||
| new TypeToken<List<WxDataCubeMsgResult>>() { | |||||
| }.getType()); | |||||
| } | |||||
| @Override | |||||
| public List<WxDataCubeMsgResult> getUpstreamMsgDist(Date beginDate, | |||||
| Date endDate) throws WxErrorException { | |||||
| String url = API_URL_PREFIX + "/getupstreammsgdist"; | |||||
| JsonObject param = new JsonObject(); | |||||
| param.addProperty("begin_date", WxMpService.SIMPLE_DATE_FORMAT.format(beginDate)); | |||||
| param.addProperty("end_date", WxMpService.SIMPLE_DATE_FORMAT.format(endDate)); | |||||
| String responseContent = this.wxMpService.post(url, param.toString()); | |||||
| this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
| return WxMpGsonBuilder.INSTANCE.create().fromJson(new JsonParser().parse(responseContent).getAsJsonObject().get("list"), | |||||
| new TypeToken<List<WxDataCubeMsgResult>>() { | |||||
| }.getType()); | |||||
| } | |||||
| @Override | |||||
| public List<WxDataCubeMsgResult> getUpstreamMsgDistWeek(Date beginDate, | |||||
| Date endDate) throws WxErrorException { | |||||
| String url = API_URL_PREFIX + "/getupstreammsgdistweek"; | |||||
| JsonObject param = new JsonObject(); | |||||
| param.addProperty("begin_date", WxMpService.SIMPLE_DATE_FORMAT.format(beginDate)); | |||||
| param.addProperty("end_date", WxMpService.SIMPLE_DATE_FORMAT.format(endDate)); | |||||
| String responseContent = this.wxMpService.post(url, param.toString()); | |||||
| this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
| return WxMpGsonBuilder.INSTANCE.create().fromJson(new JsonParser().parse(responseContent).getAsJsonObject().get("list"), | |||||
| new TypeToken<List<WxDataCubeMsgResult>>() { | |||||
| }.getType()); | |||||
| } | |||||
| @Override | |||||
| public List<WxDataCubeMsgResult> getUpstreamMsgDistMonth(Date beginDate, | |||||
| Date endDate) throws WxErrorException { | |||||
| String url = API_URL_PREFIX + "/getupstreammsgdistmonth"; | |||||
| JsonObject param = new JsonObject(); | |||||
| param.addProperty("begin_date", WxMpService.SIMPLE_DATE_FORMAT.format(beginDate)); | |||||
| param.addProperty("end_date", WxMpService.SIMPLE_DATE_FORMAT.format(endDate)); | |||||
| String responseContent = this.wxMpService.post(url, param.toString()); | |||||
| this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
| return WxMpGsonBuilder.INSTANCE.create().fromJson(new JsonParser().parse(responseContent).getAsJsonObject().get("list"), | |||||
| new TypeToken<List<WxDataCubeMsgResult>>() { | |||||
| }.getType()); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,117 @@ | |||||
| package me.chanjar.weixin.mp.bean.datacube; | |||||
| import com.google.gson.annotations.SerializedName; | |||||
| /** | |||||
| * 消息分析数据接口返回结果对象 | |||||
| * @author binarywang(https://github.com/binarywang) | |||||
| * Created by Binary Wang on 2016/8/29. | |||||
| */ | |||||
| public class WxDataCubeMsgResult extends WxDataCubeBaseResult { | |||||
| /** | |||||
| * ref_hour | |||||
| * 数据的小时,包括从000到2300,分别代表的是[000,100)到[2300,2400),即每日的第1小时和最后1小时 | |||||
| */ | |||||
| @SerializedName("ref_hour") | |||||
| private Integer refHour; | |||||
| /** | |||||
| * msg_type | |||||
| * 消息类型,代表含义如下:1代表文字 2代表图片 3代表语音 4代表视频 6代表第三方应用消息(链接消息) | |||||
| */ | |||||
| @SerializedName("msg_type") | |||||
| private Integer msgType; | |||||
| /** | |||||
| * msg_user | |||||
| * 上行发送了(向公众号发送了)消息的用户数 | |||||
| */ | |||||
| @SerializedName("msg_user") | |||||
| private Integer msgUser; | |||||
| /** | |||||
| * msg_count | |||||
| * 上行发送了消息的消息总数 | |||||
| */ | |||||
| @SerializedName("msg_count") | |||||
| private Integer msgCount; | |||||
| /** | |||||
| * count_interval | |||||
| * 当日发送消息量分布的区间,0代表 “0”,1代表“1-5”,2代表“6-10”,3代表“10次以上” | |||||
| */ | |||||
| @SerializedName("count_interval") | |||||
| private Integer countInterval; | |||||
| /** | |||||
| * int_page_read_count | |||||
| * 图文页的阅读次数 | |||||
| */ | |||||
| @SerializedName("int_page_read_count") | |||||
| private Integer intPageReadCount; | |||||
| /** | |||||
| * ori_page_read_user | |||||
| * 原文页(点击图文页“阅读原文”进入的页面)的阅读人数,无原文页时此处数据为0 | |||||
| */ | |||||
| @SerializedName("ori_page_read_user") | |||||
| private Integer oriPageReadUser; | |||||
| public Integer getRefHour() { | |||||
| return this.refHour; | |||||
| } | |||||
| public void setRefHour(Integer refHour) { | |||||
| this.refHour = refHour; | |||||
| } | |||||
| public Integer getMsgType() { | |||||
| return this.msgType; | |||||
| } | |||||
| public void setMsgType(Integer msgType) { | |||||
| this.msgType = msgType; | |||||
| } | |||||
| public Integer getMsgUser() { | |||||
| return this.msgUser; | |||||
| } | |||||
| public void setMsgUser(Integer msgUser) { | |||||
| this.msgUser = msgUser; | |||||
| } | |||||
| public Integer getMsgCount() { | |||||
| return this.msgCount; | |||||
| } | |||||
| public void setMsgCount(Integer msgCount) { | |||||
| this.msgCount = msgCount; | |||||
| } | |||||
| public Integer getCountInterval() { | |||||
| return this.countInterval; | |||||
| } | |||||
| public void setCountInterval(Integer countInterval) { | |||||
| this.countInterval = countInterval; | |||||
| } | |||||
| public Integer getIntPageReadCount() { | |||||
| return this.intPageReadCount; | |||||
| } | |||||
| public void setIntPageReadCount(Integer intPageReadCount) { | |||||
| this.intPageReadCount = intPageReadCount; | |||||
| } | |||||
| public Integer getOriPageReadUser() { | |||||
| return this.oriPageReadUser; | |||||
| } | |||||
| public void setOriPageReadUser(Integer oriPageReadUser) { | |||||
| this.oriPageReadUser = oriPageReadUser; | |||||
| } | |||||
| } | |||||
| @@ -5,6 +5,7 @@ import me.chanjar.weixin.common.exception.WxErrorException; | |||||
| import me.chanjar.weixin.mp.api.ApiTestModule; | import me.chanjar.weixin.mp.api.ApiTestModule; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleResult; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleResult; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleTotal; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleTotal; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeMsgResult; | |||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate; | ||||
| import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary; | ||||
| import org.testng.Assert; | import org.testng.Assert; | ||||
| @@ -12,6 +13,8 @@ import org.testng.annotations.DataProvider; | |||||
| import org.testng.annotations.Guice; | import org.testng.annotations.Guice; | ||||
| import org.testng.annotations.Test; | import org.testng.annotations.Test; | ||||
| import static org.junit.Assert.fail; | |||||
| import java.text.ParseException; | import java.text.ParseException; | ||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| @@ -24,26 +27,39 @@ import java.util.List; | |||||
| */ | */ | ||||
| @Guice(modules = ApiTestModule.class) | @Guice(modules = ApiTestModule.class) | ||||
| public class WxMpDataCubeServiceImplTest { | public class WxMpDataCubeServiceImplTest { | ||||
| private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat( | |||||
| "yyyy-MM-dd"); | |||||
| @Inject | @Inject | ||||
| protected WxMpServiceImpl wxService; | protected WxMpServiceImpl wxService; | ||||
| @DataProvider | @DataProvider | ||||
| public Object[][] oneDay() throws ParseException { | public Object[][] oneDay() throws ParseException { | ||||
| return new Object[][]{{simpleDateFormat.parse("2016-08-22")}}; | |||||
| return new Object[][] { { simpleDateFormat.parse("2016-08-22") } }; | |||||
| } | } | ||||
| @DataProvider | @DataProvider | ||||
| public Object[][] threeDays() throws ParseException { | public Object[][] threeDays() throws ParseException { | ||||
| return new Object[][]{{simpleDateFormat.parse("2016-08-20"), | |||||
| simpleDateFormat.parse("2016-08-22")}}; | |||||
| return new Object[][] { { simpleDateFormat.parse("2016-08-20"), | |||||
| simpleDateFormat.parse("2016-08-22") } }; | |||||
| } | } | ||||
| @DataProvider | @DataProvider | ||||
| public Object[][] sevenDays() throws ParseException { | public Object[][] sevenDays() throws ParseException { | ||||
| return new Object[][]{{simpleDateFormat.parse("2016-08-16"), | |||||
| simpleDateFormat.parse("2016-08-22")}}; | |||||
| return new Object[][] { { simpleDateFormat.parse("2016-08-16"), | |||||
| simpleDateFormat.parse("2016-08-22") } }; | |||||
| } | |||||
| @DataProvider | |||||
| public Object[][] fifteenDays() throws ParseException { | |||||
| return new Object[][] { { simpleDateFormat.parse("2016-08-14"), | |||||
| simpleDateFormat.parse("2016-08-27") } }; | |||||
| } | |||||
| @DataProvider | |||||
| public Object[][] thirtyDays() throws ParseException { | |||||
| return new Object[][] { { simpleDateFormat.parse("2016-07-30"), | |||||
| simpleDateFormat.parse("2016-08-27") } }; | |||||
| } | } | ||||
| @Test(dataProvider = "sevenDays") | @Test(dataProvider = "sevenDays") | ||||
| @@ -67,7 +83,7 @@ public class WxMpDataCubeServiceImplTest { | |||||
| @Test(dataProvider = "oneDay") | @Test(dataProvider = "oneDay") | ||||
| public void testGetArticleSummary(Date date) throws WxErrorException { | public void testGetArticleSummary(Date date) throws WxErrorException { | ||||
| List<WxDataCubeArticleResult> results = this.wxService.getDataCubeService() | List<WxDataCubeArticleResult> results = this.wxService.getDataCubeService() | ||||
| .getArticleSummary(date, date); | |||||
| .getArticleSummary(date, date); | |||||
| Assert.assertNotNull(results); | Assert.assertNotNull(results); | ||||
| System.out.println(results); | System.out.println(results); | ||||
| } | } | ||||
| @@ -78,7 +94,7 @@ public class WxMpDataCubeServiceImplTest { | |||||
| @Test(dataProvider = "oneDay") | @Test(dataProvider = "oneDay") | ||||
| public void testGetArticleTotal(Date date) throws WxErrorException { | public void testGetArticleTotal(Date date) throws WxErrorException { | ||||
| List<WxDataCubeArticleTotal> results = this.wxService.getDataCubeService() | List<WxDataCubeArticleTotal> results = this.wxService.getDataCubeService() | ||||
| .getArticleTotal(date, date); | |||||
| .getArticleTotal(date, date); | |||||
| Assert.assertNotNull(results); | Assert.assertNotNull(results); | ||||
| System.out.println(results); | System.out.println(results); | ||||
| } | } | ||||
| @@ -87,7 +103,7 @@ public class WxMpDataCubeServiceImplTest { | |||||
| public void testGetUserRead(Date beginDate, Date endDate) | public void testGetUserRead(Date beginDate, Date endDate) | ||||
| throws WxErrorException { | throws WxErrorException { | ||||
| List<WxDataCubeArticleResult> results = this.wxService.getDataCubeService() | List<WxDataCubeArticleResult> results = this.wxService.getDataCubeService() | ||||
| .getUserRead(beginDate, endDate); | |||||
| .getUserRead(beginDate, endDate); | |||||
| Assert.assertNotNull(results); | Assert.assertNotNull(results); | ||||
| System.out.println(results); | System.out.println(results); | ||||
| } | } | ||||
| @@ -95,7 +111,7 @@ public class WxMpDataCubeServiceImplTest { | |||||
| @Test(dataProvider = "oneDay") | @Test(dataProvider = "oneDay") | ||||
| public void testGetUserReadHour(Date date) throws WxErrorException { | public void testGetUserReadHour(Date date) throws WxErrorException { | ||||
| List<WxDataCubeArticleResult> results = this.wxService.getDataCubeService() | List<WxDataCubeArticleResult> results = this.wxService.getDataCubeService() | ||||
| .getUserReadHour(date, date); | |||||
| .getUserReadHour(date, date); | |||||
| Assert.assertNotNull(results); | Assert.assertNotNull(results); | ||||
| System.out.println(results); | System.out.println(results); | ||||
| } | } | ||||
| @@ -104,7 +120,7 @@ public class WxMpDataCubeServiceImplTest { | |||||
| public void testGetUserShare(Date beginDate, Date endDate) | public void testGetUserShare(Date beginDate, Date endDate) | ||||
| throws WxErrorException { | throws WxErrorException { | ||||
| List<WxDataCubeArticleResult> results = this.wxService.getDataCubeService() | List<WxDataCubeArticleResult> results = this.wxService.getDataCubeService() | ||||
| .getUserShare(beginDate, endDate); | |||||
| .getUserShare(beginDate, endDate); | |||||
| Assert.assertNotNull(results); | Assert.assertNotNull(results); | ||||
| System.out.println(results); | System.out.println(results); | ||||
| } | } | ||||
| @@ -112,7 +128,69 @@ public class WxMpDataCubeServiceImplTest { | |||||
| @Test(dataProvider = "oneDay") | @Test(dataProvider = "oneDay") | ||||
| public void testGetUserShareHour(Date date) throws WxErrorException { | public void testGetUserShareHour(Date date) throws WxErrorException { | ||||
| List<WxDataCubeArticleResult> results = this.wxService.getDataCubeService() | List<WxDataCubeArticleResult> results = this.wxService.getDataCubeService() | ||||
| .getUserShareHour(date, date); | |||||
| .getUserShareHour(date, date); | |||||
| Assert.assertNotNull(results); | |||||
| System.out.println(results); | |||||
| } | |||||
| @Test(dataProvider = "sevenDays") | |||||
| public void testGetUpstreamMsg(Date beginDate, Date endDate) throws WxErrorException { | |||||
| List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() | |||||
| .getUpstreamMsg(beginDate, endDate); | |||||
| Assert.assertNotNull(results); | |||||
| System.out.println(results); | |||||
| } | |||||
| @Test(dataProvider = "oneDay") | |||||
| public void testGetUpstreamMsgHour(Date date) throws WxErrorException { | |||||
| List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() | |||||
| .getUpstreamMsgHour(date, date); | |||||
| Assert.assertNotNull(results); | |||||
| System.out.println(results); | |||||
| } | |||||
| @Test(dataProvider = "thirtyDays") | |||||
| public void testGetUpstreamMsgWeek(Date beginDate, Date endDate) throws WxErrorException { | |||||
| List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() | |||||
| .getUpstreamMsgWeek(beginDate, endDate); | |||||
| Assert.assertNotNull(results); | |||||
| System.out.println(results); | |||||
| } | |||||
| /** | |||||
| * TODO 该接口,暂时没找到有数据的日期,无法测试验证 | |||||
| */ | |||||
| @Test(dataProvider = "thirtyDays") | |||||
| public void testGetUpstreamMsgMonth(Date beginDate, Date endDate) throws WxErrorException { | |||||
| List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() | |||||
| .getUpstreamMsgMonth(beginDate, endDate); | |||||
| Assert.assertNotNull(results); | |||||
| System.out.println(results); | |||||
| } | |||||
| @Test(dataProvider = "fifteenDays") | |||||
| public void testGetUpstreamMsgDist(Date beginDate, Date endDate) throws WxErrorException { | |||||
| List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() | |||||
| .getUpstreamMsgDist(beginDate, endDate); | |||||
| Assert.assertNotNull(results); | |||||
| System.out.println(results); | |||||
| } | |||||
| @Test(dataProvider = "thirtyDays") | |||||
| public void testGetUpstreamMsgDistWeek(Date beginDate, Date endDate) throws WxErrorException { | |||||
| List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() | |||||
| .getUpstreamMsgDistWeek(beginDate, endDate); | |||||
| Assert.assertNotNull(results); | |||||
| System.out.println(results); | |||||
| } | |||||
| /** | |||||
| * TODO 该接口,暂时没找到有数据的日期,无法测试验证 | |||||
| */ | |||||
| @Test(dataProvider = "thirtyDays") | |||||
| public void testGetUpstreamMsgDistMonth(Date beginDate, Date endDate) throws WxErrorException { | |||||
| List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() | |||||
| .getUpstreamMsgDistMonth(beginDate, endDate); | |||||
| Assert.assertNotNull(results); | Assert.assertNotNull(results); | ||||
| System.out.println(results); | System.out.println(results); | ||||
| } | } | ||||