فهرست منبع

添加ChannelController API测试类

guanglong 3 سال پیش
والد
کامیت
77d9389fc9
1فایلهای تغییر یافته به همراه310 افزوده شده و 11 حذف شده
  1. 310 11
      mp-admin/src/test/java/com/qs/mp/api/ChannelControllerTest.java

+ 310 - 11
mp-admin/src/test/java/com/qs/mp/api/ChannelControllerTest.java

@@ -1,7 +1,12 @@
 package com.qs.mp.api;
 
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.junit.jupiter.api.Test;
 
+import com.alibaba.fastjson.JSON;
 import com.qs.mp.common.BaseControllerTest;
 
 /**
@@ -11,17 +16,311 @@ import com.qs.mp.common.BaseControllerTest;
  */
 public class ChannelControllerTest extends BaseControllerTest {
 
-  @Test
-  public void testGetChannelDetail(){
-//    String mobile  = "15658078136";
-//    int identity = 1;
-//    String custId ="2099122220001234";
-//    String id = "88230664881373184134";
-//    String params = "{\"identity\":\""+identity+"\",\"custId\":\""+custId+"\",\"id\":\""+id+"\"}";
-//    String url = "http://localhost:8080/api/v1/qs/user/getLoginUserinfo?";
-//    System.out.println(request(url, params));
-  }
+	/**
+	 * 获取我的下级渠道列表信息,支持翻页
+	 * 调用场景:渠道端查询子渠道列表
+	 */
+	@Test
+	public void testGetSubChannelList() {
+		Map<String, Object> map = new HashMap<String, Object>();
+		int pageNum = 1;
+		int pageSize = 10;
+		map.put("pageNum", pageNum);
+		map.put("pageSize", pageSize);
+		String params = JSON.toJSONString(map);
+		System.out.println("params = " + params);
+		String url = "http://localhost:8080/api/v1/mp/channel/subchannel/list?";
+		System.out.println(request(url, params));
+	}
+
+	/**
+	 * 获取我的下级渠道详情信息
+	 * 调用场景:渠道端查询子渠道详情
+	 */
+	@Test
+	public void testGetChannelDetail() {
+		String channelId = "1";
+		String params = "{\"channelId\":\"" + channelId + "\"}";
+		String url = "http://localhost:8080/api/v1/mp/channel/subchannel/detail?";
+		System.out.println(request(url, params));
+	}
+
+	/**
+	 * 渠道端新增子渠道
+	 * 调用场景:渠道端新增子渠道
+	 */
+	@Test
+	public void testSubChannelAdd() {
+		String mobile = "15112682435";
+		String name = "西湖渠道";
+		Long provinceId = 330000000000L;
+		String province = "浙江省";
+		Long cityId = 330100000000L;
+		String city = "杭州市";
+		Long areaId = 330106000000L;
+		String area = "西湖区";
+		BigDecimal commRate = new BigDecimal(10);
+		Map<String, Object> map = new HashMap<String, Object>();
+		map.put("mobile", mobile);
+		map.put("name", name);
+		map.put("provinceId", provinceId);
+		map.put("province", province);
+		map.put("cityId", cityId);
+		map.put("city", city);
+		map.put("areaId", areaId);
+		map.put("area", area);
+		map.put("commRate", commRate);
+		String params = JSON.toJSONString(map);
+		System.out.println("params = " + params);
+		String url = "http://localhost:8080/api/v1/mp/channel/subchannel/create?";
+		System.out.println(request(url, params));
+	}
+
+	/**
+	 * 渠道端编辑子渠道信息
+	 * 调用场景:渠道端编辑子渠道信息
+	 */
+	@Test
+	public void testSubChannelEdit() {
+		Long channelId = 2L;
+		String mobile = "15112682435";
+		String name = "西湖渠道";
+		Long provinceId = 330000000000L;
+		String province = "浙江省";
+		Long cityId = 330100000000L;
+		String city = "杭州市";
+		Long areaId = 330106000000L;
+		String area = "西湖区";
+		BigDecimal commRate = new BigDecimal(10);
+		Map<String, Object> map = new HashMap<String, Object>();
+		map.put("channelId", channelId);
+		map.put("mobile", mobile);
+		map.put("name", name);
+		map.put("provinceId", provinceId);
+		map.put("province", province);
+		map.put("cityId", cityId);
+		map.put("city", city);
+		map.put("areaId", areaId);
+		map.put("area", area);
+		map.put("commRate", commRate);
+		String params = JSON.toJSONString(map);
+		System.out.println("params = " + params);
+		String url = "http://localhost:8080/api/v1/mp/channel/subchannel/update?";
+		System.out.println(request(url, params));
+	}
+	
+	
+	/**
+	 * 获取当前用户渠道或者某个子渠道的经营数据
+	 * 调用场景:渠道端首页查询当前渠道经营数据、子渠道详情页面查询经营数据
+	 */
+	@Test
+	public void testGetSubChannelOperData() {
+		Long channelId = 1L;
+		int days =1;
+		Map<String, Object> map = new HashMap<String, Object>();
+		map.put("channelId", channelId);
+		map.put("days", days);
+		String params = JSON.toJSONString(map);
+		System.out.println("params = " + params);
+		String url = "http://localhost:8080/api/v1/mp/channel/subchannel/operdata/query?";
+		System.out.println(request(url, params));
+	}
+	
+	/**
+	 * 获取子渠道的经营数据列表
+	 * 调用场景:渠道端首页子渠道经营数据列表
+	 */
+	@Test
+	public void testGetSubChannelOperDataList() {
+		int days =1;
+		int pageNum = 1;
+		int pageSize = 10;
+		Map<String, Object> map = new HashMap<String, Object>();
+		map.put("days", days);
+		map.put("pageNum", pageNum);
+		map.put("pageSize", pageSize);
+		String params = JSON.toJSONString(map);
+		System.out.println("params = " + params);
+		String url = "http://localhost:8080/api/v1/mp/channel/subchannel/operdata/list?";
+		System.out.println(request(url, params));
+	}
+	
+	
+	/**
+	 * 获取我的经销商列表信息,支持翻页
+	 * 调用场景:渠道端查询经销商列表
+	 */
+	@Test
+	public void testGetSiteList() {
+		Map<String, Object> map = new HashMap<String, Object>();
+		int pageNum = 1;
+		int pageSize = 10;
+		String certifyStatus = "y";
+		String verifyStatus = "wait";
+		map.put("pageNum", pageNum);
+		map.put("pageSize", pageSize);
+		map.put("certifyStatus", certifyStatus);
+		map.put("verifyStatus", verifyStatus);
+		String params = JSON.toJSONString(map);
+		System.out.println("params = " + params);
+		String url = "http://localhost:8080/api/v1/mp/channel/site/list?";
+		System.out.println(request(url, params));
+	}
+
+	/**
+	 * 获取我的经销商详情信息
+	 * 调用场景:渠道端查询经销商详情
+	 */
+	@Test
+	public void testGetSiteDetail() {
+		String channelId = "1";
+		String params = "{\"channelId\":\"" + channelId + "\"}";
+		String url = "http://localhost:8080/api/v1/mp/channel/site/detail?";
+		System.out.println(request(url, params));
+	}
+
+	/**
+	 * 新增经销商信息
+	 * 调用场景:渠道端新增经销商
+	 */
+	@Test
+	public void testSiteAdd() {
+		String mobile = "15112682436";
+		String name = "西湖第一经销商";
+		String contact = "张三";
+		Long provinceId = 330000000000L;
+		String province = "浙江省";
+		Long cityId = 330100000000L;
+		String city = "杭州市";
+		Long areaId = 330106000000L;
+		String area = "西湖区";
+		String address = "趵突泉往前100米";
+		BigDecimal commRate = new BigDecimal(10);
+		Map<String, Object> map = new HashMap<String, Object>();
+		map.put("mobile", mobile);
+		map.put("name", name);
+		map.put("contact", contact);
+		map.put("provinceId", provinceId);
+		map.put("province", province);
+		map.put("cityId", cityId);
+		map.put("city", city);
+		map.put("areaId", areaId);
+		map.put("area", area);
+		map.put("address", address);
+		map.put("commRate", commRate);
+		String params = JSON.toJSONString(map);
+		System.out.println("params = " + params);
+		String url = "http://localhost:8080/api/v1/mp/channel/site/create?";
+		System.out.println(request(url, params));
+	}
 
+	/**
+	 * 渠编辑经销商信息
+	 * 调用场景:渠道端编辑经销商信息
+	 */
+	@Test
+	public void testSiteEdit() {
+		Long channelId = 2L;
+		String mobile = "15112682436";
+		String name = "西湖第一经销商";
+		String contact = "张三";
+		Long provinceId = 330000000000L;
+		String province = "浙江省";
+		Long cityId = 330100000000L;
+		String city = "杭州市";
+		Long areaId = 330106000000L;
+		String area = "西湖区";
+		String address = "趵突泉往前100米";
+		BigDecimal commRate = new BigDecimal(10);
+		Map<String, Object> map = new HashMap<String, Object>();
+		map.put("channelId", channelId);
+		map.put("mobile", mobile);
+		map.put("contact", contact);
+		map.put("provinceId", provinceId);
+		map.put("province", province);
+		map.put("cityId", cityId);
+		map.put("city", city);
+		map.put("areaId", areaId);
+		map.put("area", area);
+		map.put("address", address);
+		map.put("commRate", commRate);
+		String params = JSON.toJSONString(map);
+		System.out.println("params = " + params);
+		String url = "http://localhost:8080/api/v1/mp/channel/site/update?";
+		System.out.println(request(url, params));
+	}
+	
+	
+	/**
+	 * 经销商认证审核
+	 * 调用场景:渠道端审核经销商认证
+	 */
+	@Test
+	public void testSiteVerify() {
+		Long channelId = 2L;
+		String verifyStatus = "accept";
+		String memo = "备注,拒绝时必填";
+		BigDecimal commRate = new BigDecimal(10);  // 分润比例,通过时必填
+		Map<String, Object> map = new HashMap<String, Object>();
+		map.put("channelId", channelId);
+		map.put("verifyStatus", verifyStatus);
+		map.put("memo", memo);
+		map.put("commRate", commRate);
+		String params = JSON.toJSONString(map);
+		System.out.println("params = " + params);
+		String url = "http://localhost:8080/api/v1/mp/channel/site/verify?";
+		System.out.println(request(url, params));
+	}
+	
+	
+	/**
+	 * 提交认证
+	 * 调用场景:经销商认证页面点提交
+	 */
+	@Test
+	public void testSiteVerifySubmit() {
+		Long channelId = 2L;
+		String contact = "张三";
+		String siteType = "1";
+		Long provinceId = 330000000000L;
+		String province = "浙江省";
+		Long cityId = 330100000000L;
+		String city = "杭州市";
+		Long areaId = 330106000000L;
+		String area = "西湖区";
+		String address = "趵突泉往前100米";
+		String bizLicensePic = "111.png";  // 营业执照,多张图用逗号隔开
+		String doorPic = "222.png";// 门店照片,多张图用逗号隔开
+		Map<String, Object> map = new HashMap<String, Object>();
+		map.put("channelId", channelId);
+		map.put("contact", contact);
+		map.put("siteType", siteType);
+		map.put("provinceId", provinceId);
+		map.put("province", province);
+		map.put("cityId", cityId);
+		map.put("city", city);
+		map.put("areaId", areaId);
+		map.put("area", area);
+		map.put("address", address);
+		map.put("bizLicensePic", bizLicensePic);
+		map.put("doorPic", doorPic);
+		String params = JSON.toJSONString(map);
+		System.out.println("params = " + params);
+		String url = "http://localhost:8080/api/v1/mp/channel/site/verify/submit?";
+		System.out.println(request(url, params));
+	}
+	
+	
+	/**
+	 * 查看我的渠道信息
+	 * 调用场景:渠道端我的里面点击佣金比例
+	 */
+	@Test
+	public void testGetMineDetail() {
+		String params = "{}";
+		String url = "http://localhost:8080/api/v1/mp/channel/mine/detail?";
+		System.out.println(request(url, params));
+	}
 
-  
 }