mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-11-11 19:07:09 +08:00
转移统计分析相关接口为单独类,为以后完善补充统计分析接口做准备
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package me.chanjar.weixin.mp.api.impl;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUserCumulate;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUserSummary;
|
||||
|
||||
/**
|
||||
* 测试统计分析相关的接口
|
||||
* Created by Binary Wang on 2016/8/23.
|
||||
* @author binarywang (https://github.com/binarywang)
|
||||
*/
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxMpDataCubeServiceImplTest {
|
||||
private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
@Inject
|
||||
protected WxMpServiceImpl wxService;
|
||||
|
||||
@Test
|
||||
public void testGetUserSummary() throws WxErrorException, ParseException {
|
||||
Date beginDate = simpleDateFormat.parse("2016-08-20");
|
||||
Date endDate = simpleDateFormat.parse("2016-08-22");
|
||||
List<WxMpUserSummary> summaries = this.wxService.getDataCubeService()
|
||||
.getUserSummary(beginDate, endDate);
|
||||
Assert.assertNotNull(summaries);
|
||||
System.out.println(summaries);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUserCumulate() throws WxErrorException, ParseException {
|
||||
Date beginDate = simpleDateFormat.parse("2016-08-21");
|
||||
Date endDate = simpleDateFormat.parse("2016-08-22");
|
||||
List<WxMpUserCumulate> cumulates = this.wxService.getDataCubeService()
|
||||
.getUserCumulate(beginDate, endDate);
|
||||
Assert.assertNotNull(cumulates);
|
||||
System.out.println(cumulates);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +1,15 @@
|
||||
package me.chanjar.weixin.mp.api.impl;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUserCumulate;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUserList;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUserSummary;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUserList;
|
||||
|
||||
/**
|
||||
* 测试用户相关的接口
|
||||
@@ -61,24 +56,4 @@ public class WxMpUserServiceImplTest {
|
||||
this.wxService.getGroupService().userUpdateGroup(configStorage.getOpenId(), this.wxService.getGroupService().groupGet().get(3).getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUserSummary() throws WxErrorException, ParseException {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date beginDate = simpleDateFormat.parse("2015-01-01");
|
||||
Date endDate = simpleDateFormat.parse("2015-01-02");
|
||||
List<WxMpUserSummary> summaries = this.wxService.getUserService().dataCubeUserSummary(beginDate, endDate);
|
||||
Assert.assertNotNull(summaries);
|
||||
System.out.println(summaries);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUserCumulate() throws WxErrorException, ParseException {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date beginDate = simpleDateFormat.parse("2015-01-01");
|
||||
Date endDate = simpleDateFormat.parse("2015-01-02");
|
||||
List<WxMpUserCumulate> cumulates = this.wxService.getUserService().dataCubeUserCumulate(beginDate, endDate);
|
||||
Assert.assertNotNull(cumulates);
|
||||
System.out.println(cumulates);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user