ChannelControllerTest.java 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. package com.qs.mp.api;
  2. import java.math.BigDecimal;
  3. import java.util.HashMap;
  4. import java.util.Map;
  5. import org.junit.jupiter.api.Test;
  6. import com.alibaba.fastjson.JSON;
  7. import com.qs.mp.common.BaseControllerTest;
  8. /**
  9. * @auther duota
  10. * @create 2021 2021/9/7 6:36 下午
  11. * @describe
  12. */
  13. public class ChannelControllerTest extends BaseControllerTest {
  14. /**
  15. * 获取我的下级渠道列表信息,支持翻页
  16. * 调用场景:渠道端查询子渠道列表
  17. */
  18. @Test
  19. public void testGetSubChannelList() {
  20. Map<String, Object> map = new HashMap<String, Object>();
  21. int pageNum = 1;
  22. int pageSize = 10;
  23. map.put("pageNum", pageNum);
  24. map.put("pageSize", pageSize);
  25. String params = JSON.toJSONString(map);
  26. System.out.println("params = " + params);
  27. String url = "http://localhost:8080/api/v1/mp/channel/subchannel/list?";
  28. System.out.println(request(url, params));
  29. }
  30. /**
  31. * 获取我的下级渠道详情信息
  32. * 调用场景:渠道端查询子渠道详情
  33. */
  34. @Test
  35. public void testGetChannelDetail() {
  36. String channelId = "4";
  37. String params = "{\"channelId\":\"" + channelId + "\"}";
  38. String url = "http://localhost:8080/api/v1/mp/channel/subchannel/detail?";
  39. System.out.println(request(url, params));
  40. }
  41. /**
  42. * 渠道端新增子渠道
  43. * 调用场景:渠道端新增子渠道
  44. */
  45. @Test
  46. public void testSubChannelAdd() {
  47. String mobile = "15112682431";
  48. String name = "西湖渠道";
  49. Long provinceId = 330000000000L;
  50. String province = "浙江省";
  51. Long cityId = 330100000000L;
  52. String city = "杭州市";
  53. Long areaId = 330106000000L;
  54. String area = "西湖区";
  55. BigDecimal commRate = new BigDecimal(10);
  56. Map<String, Object> map = new HashMap<String, Object>();
  57. map.put("mobile", mobile);
  58. map.put("name", name);
  59. map.put("provinceId", provinceId);
  60. map.put("province", province);
  61. map.put("cityId", cityId);
  62. map.put("city", city);
  63. map.put("areaId", areaId);
  64. map.put("area", area);
  65. map.put("commRate", commRate);
  66. String params = JSON.toJSONString(map);
  67. System.out.println("params = " + params);
  68. String url = "http://localhost:8080/api/v1/mp/channel/subchannel/create?";
  69. System.out.println(request(url, params));
  70. }
  71. /**
  72. * 渠道端编辑子渠道信息
  73. * 调用场景:渠道端编辑子渠道信息
  74. */
  75. @Test
  76. public void testSubChannelEdit() {
  77. Long channelId = 2L;
  78. String mobile = "15112682435";
  79. String name = "西湖渠道";
  80. Long provinceId = 330000000000L;
  81. String province = "浙江省";
  82. Long cityId = 330100000000L;
  83. String city = "杭州市";
  84. Long areaId = 330106000000L;
  85. String area = "西湖区";
  86. BigDecimal commRate = new BigDecimal(10);
  87. Map<String, Object> map = new HashMap<String, Object>();
  88. map.put("channelId", channelId);
  89. map.put("mobile", mobile);
  90. map.put("name", name);
  91. map.put("provinceId", provinceId);
  92. map.put("province", province);
  93. map.put("cityId", cityId);
  94. map.put("city", city);
  95. map.put("areaId", areaId);
  96. map.put("area", area);
  97. map.put("commRate", commRate);
  98. String params = JSON.toJSONString(map);
  99. System.out.println("params = " + params);
  100. String url = "http://localhost:8080/api/v1/mp/channel/subchannel/update?";
  101. System.out.println(request(url, params));
  102. }
  103. /**
  104. * 获取当前用户渠道或者某个子渠道的经营数据
  105. * 调用场景:渠道端首页查询当前渠道经营数据、子渠道详情页面查询经营数据
  106. */
  107. @Test
  108. public void testGetSubChannelOperData() {
  109. Long channelId = 1L;
  110. int days =1;
  111. Map<String, Object> map = new HashMap<String, Object>();
  112. map.put("channelId", channelId);
  113. map.put("days", days);
  114. String params = JSON.toJSONString(map);
  115. System.out.println("params = " + params);
  116. String url = "http://localhost:8080/api/v1/mp/channel/subchannel/operdata/query?";
  117. System.out.println(request(url, params));
  118. }
  119. /**
  120. * 获取子渠道的经营数据列表
  121. * 调用场景:渠道端首页子渠道经营数据列表
  122. */
  123. @Test
  124. public void testGetSubChannelOperDataList() {
  125. int days =1;
  126. int pageNum = 1;
  127. int pageSize = 10;
  128. Map<String, Object> map = new HashMap<String, Object>();
  129. map.put("days", days);
  130. map.put("pageNum", pageNum);
  131. map.put("pageSize", pageSize);
  132. String params = JSON.toJSONString(map);
  133. System.out.println("params = " + params);
  134. String url = "http://localhost:8080/api/v1/mp/channel/subchannel/operdata/list?";
  135. System.out.println(request(url, params));
  136. }
  137. /**
  138. * 获取我的经销商列表信息,支持翻页
  139. * 调用场景:渠道端查询经销商列表
  140. */
  141. @Test
  142. public void testGetSiteList() {
  143. Map<String, Object> map = new HashMap<String, Object>();
  144. int pageNum = 1;
  145. int pageSize = 10;
  146. String certifyStatus = "y";
  147. String verifyStatus = "wait";
  148. map.put("pageNum", pageNum);
  149. map.put("pageSize", pageSize);
  150. map.put("certifyStatus", certifyStatus);
  151. map.put("verifyStatus", verifyStatus);
  152. String params = JSON.toJSONString(map);
  153. System.out.println("params = " + params);
  154. String url = "http://localhost:8080/api/v1/mp/channel/site/list?";
  155. System.out.println(request(url, params));
  156. }
  157. /**
  158. * 获取我的经销商详情信息
  159. * 调用场景:渠道端查询经销商详情
  160. */
  161. @Test
  162. public void testGetSiteDetail() {
  163. String channelId = "1";
  164. String params = "{\"channelId\":\"" + channelId + "\"}";
  165. String url = "http://localhost:8080/api/v1/mp/channel/site/detail?";
  166. System.out.println(request(url, params));
  167. }
  168. /**
  169. * 新增经销商信息
  170. * 调用场景:渠道端新增经销商
  171. */
  172. @Test
  173. public void testSiteAdd() {
  174. String mobile = "15112682436";
  175. String name = "西湖第一经销商";
  176. String contact = "张三";
  177. Long provinceId = 330000000000L;
  178. String province = "浙江省";
  179. Long cityId = 330100000000L;
  180. String city = "杭州市";
  181. Long areaId = 330106000000L;
  182. String area = "西湖区";
  183. String address = "趵突泉往前100米";
  184. BigDecimal commRate = new BigDecimal(10);
  185. Map<String, Object> map = new HashMap<String, Object>();
  186. map.put("mobile", mobile);
  187. map.put("name", name);
  188. map.put("contact", contact);
  189. map.put("provinceId", provinceId);
  190. map.put("province", province);
  191. map.put("cityId", cityId);
  192. map.put("city", city);
  193. map.put("areaId", areaId);
  194. map.put("area", area);
  195. map.put("address", address);
  196. map.put("commRate", commRate);
  197. String params = JSON.toJSONString(map);
  198. System.out.println("params = " + params);
  199. String url = "http://localhost:8080/api/v1/mp/channel/site/create?";
  200. System.out.println(request(url, params));
  201. }
  202. /**
  203. * 渠编辑经销商信息
  204. * 调用场景:渠道端编辑经销商信息
  205. */
  206. @Test
  207. public void testSiteEdit() {
  208. Long channelId = 2L;
  209. String mobile = "15112682436";
  210. String name = "西湖第一经销商";
  211. String contact = "张三";
  212. Long provinceId = 330000000000L;
  213. String province = "浙江省";
  214. Long cityId = 330100000000L;
  215. String city = "杭州市";
  216. Long areaId = 330106000000L;
  217. String area = "西湖区";
  218. String address = "趵突泉往前100米";
  219. BigDecimal commRate = new BigDecimal(10);
  220. Map<String, Object> map = new HashMap<String, Object>();
  221. map.put("channelId", channelId);
  222. map.put("mobile", mobile);
  223. map.put("contact", contact);
  224. map.put("provinceId", provinceId);
  225. map.put("province", province);
  226. map.put("cityId", cityId);
  227. map.put("city", city);
  228. map.put("areaId", areaId);
  229. map.put("area", area);
  230. map.put("address", address);
  231. map.put("commRate", commRate);
  232. String params = JSON.toJSONString(map);
  233. System.out.println("params = " + params);
  234. String url = "http://localhost:8080/api/v1/mp/channel/site/update?";
  235. System.out.println(request(url, params));
  236. }
  237. /**
  238. * 经销商认证审核
  239. * 调用场景:渠道端审核经销商认证
  240. */
  241. @Test
  242. public void testSiteVerify() {
  243. Long channelId = 2L;
  244. String verifyStatus = "accept";
  245. String memo = "备注,拒绝时必填";
  246. BigDecimal commRate = new BigDecimal(10); // 分润比例,通过时必填
  247. Map<String, Object> map = new HashMap<String, Object>();
  248. map.put("channelId", channelId);
  249. map.put("verifyStatus", verifyStatus);
  250. map.put("memo", memo);
  251. map.put("commRate", commRate);
  252. String params = JSON.toJSONString(map);
  253. System.out.println("params = " + params);
  254. String url = "http://localhost:8080/api/v1/mp/channel/site/verify?";
  255. System.out.println(request(url, params));
  256. }
  257. /**
  258. * 提交认证
  259. * 调用场景:经销商认证页面点提交
  260. */
  261. @Test
  262. public void testSiteVerifySubmit() {
  263. Long channelId = 2L;
  264. String contact = "张三";
  265. String siteType = "1";
  266. Long provinceId = 330000000000L;
  267. String province = "浙江省";
  268. Long cityId = 330100000000L;
  269. String city = "杭州市";
  270. Long areaId = 330106000000L;
  271. String area = "西湖区";
  272. String address = "趵突泉往前100米";
  273. String bizLicensePic = "111.png"; // 营业执照,多张图用逗号隔开
  274. String doorPic = "222.png";// 门店照片,多张图用逗号隔开
  275. Map<String, Object> map = new HashMap<String, Object>();
  276. map.put("channelId", channelId);
  277. map.put("contact", contact);
  278. map.put("siteType", siteType);
  279. map.put("provinceId", provinceId);
  280. map.put("province", province);
  281. map.put("cityId", cityId);
  282. map.put("city", city);
  283. map.put("areaId", areaId);
  284. map.put("area", area);
  285. map.put("address", address);
  286. map.put("bizLicensePic", bizLicensePic);
  287. map.put("doorPic", doorPic);
  288. String params = JSON.toJSONString(map);
  289. System.out.println("params = " + params);
  290. String url = "http://localhost:8080/api/v1/mp/channel/site/verify/submit?";
  291. System.out.println(request(url, params));
  292. }
  293. /**
  294. * 查看我的渠道信息
  295. * 调用场景:渠道端我的里面点击佣金比例
  296. */
  297. @Test
  298. public void testGetMineDetail() {
  299. String params = "{}";
  300. String url = "http://localhost:8080/api/v1/mp/channel/mine/detail?";
  301. System.out.println(request(url, params));
  302. }
  303. }