Procházet zdrojové kódy

Merge branch 'dev' into 'mp-server-test'

Dev

See merge request quanshu/mp-server!24
zhong chunping před 3 roky
rodič
revize
422ed823a6

+ 3 - 11
mp-admin/src/main/java/com/qs/mp/web/controller/api/channel/ChannelController.java

@@ -107,11 +107,7 @@ public class ChannelController extends BaseApiController {
 		Long channelId = SecurityUtils.getLoginUser().getChannelId();
 		Channel channel = mapperFacade.map(channelParam, Channel.class);
 		channel.setParentId(channelId);
-		try {
-			channelService.saveChannel(channel, "channel");
-		} catch (Exception e) {
-			return AjaxResult.error("子渠道'" + channel.getName() + "'新增失败");
-		}
+		channelService.saveChannel(channel, "channel");
 		return AjaxResult.success("子渠道'" + channel.getName() + "'新增成功");
 	}
 
@@ -128,11 +124,7 @@ public class ChannelController extends BaseApiController {
 			return error(ErrorCodeEnum.ERROR_CODE_1001);
 		}
 		Channel channel = mapperFacade.map(channelParam, Channel.class);
-		try {
-			channelService.updateChannel(channel, "channel");
-		} catch (Exception e) {
-			return AjaxResult.error("子渠道'" + channel.getName() + "'编辑失败");
-		}
+		channelService.updateChannel(channel, "channel");
 		return AjaxResult.success("子渠道'" + channel.getName() + "'编辑成功");
 	}
 	
@@ -184,7 +176,7 @@ public class ChannelController extends BaseApiController {
 		}
 		days = days > 0?days:1;
 		List<Channel> list = channelService.list(
-		        new LambdaQueryWrapper<Channel>().eq(Channel::getParentId, channelId)
+		        new LambdaQueryWrapper<Channel>().eq(Channel::getParentId, channelId).gt(Channel::getLevel, 0)
 		            .orderByDesc(Channel::getChannelId));
 		
 		List<ChannelOperDataVO> dataList = new ArrayList<ChannelOperDataVO>();

+ 2 - 2
mp-admin/src/main/resources/application-8100.yml

@@ -116,9 +116,9 @@ client:
 # cloud
 cloud:
   # 存储对象公开可访问
-  public-bucket-name: ygp-public-1307117429
+  public-bucket-name: mp-public-1307117429
   # 存储对象公开不可访问,需要通过应用下载
-  private-bucket-name: ygp-auth-1307117429
+  private-bucket-name: mp-auth-1307117429
 
 # 小程序
 miniprogram:

+ 2 - 2
mp-admin/src/main/resources/application-8200.yml

@@ -116,9 +116,9 @@ client:
 # cloud
 cloud:
   # 存储对象公开可访问
-  public-bucket-name: ygp-public-1307117429
+  public-bucket-name: mp-public-1307117429
   # 存储对象公开不可访问,需要通过应用下载
-  private-bucket-name: ygp-auth-1307117429
+  private-bucket-name: mp-auth-1307117429
 
 # 小程序
 miniprogram:

+ 2 - 2
mp-admin/src/main/resources/application-dev.yml

@@ -109,9 +109,9 @@ client:
 # cloud
 cloud:
     # 存储对象公开可访问
-    public-bucket-name: ygp-public-test-1307117429
+    public-bucket-name: mp-public-test-1307117429
     # 存储对象公开不可访问,需要通过应用下载
-    private-bucket-name: ygp-auth-test-1307117429
+    private-bucket-name: mp-auth-test-1307117429
 
 # 小程序
 miniprogram:

+ 2 - 2
mp-admin/src/main/resources/application-test.yml

@@ -114,9 +114,9 @@ client:
 # cloud
 cloud:
   # 存储对象公开可访问
-  public-bucket-name: ygp-public-test-1307117429
+  public-bucket-name: mp-public-test-1307117429
   # 存储对象公开不可访问,需要通过应用下载
-  private-bucket-name: ygp-auth-test-1307117429
+  private-bucket-name: mp-auth-test-1307117429
 
 # 小程序
 miniprogram:

+ 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 = "4";
+		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 = "15112682431";
+		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));
+	}
 
-  
 }

+ 24 - 0
mp-admin/src/test/java/com/qs/mp/api/UserControllerTest.java

@@ -0,0 +1,24 @@
+package com.qs.mp.api;
+
+import org.junit.jupiter.api.Test;
+
+import com.qs.mp.common.BaseControllerTest;
+
+/**
+ * @auther duota
+ * @create 2021 2021/9/7 6:36 下午
+ * @describe
+ */
+public class UserControllerTest extends BaseControllerTest {
+
+  /**
+   * 发送短信验证码接口
+   */
+  @Test
+  public void testSendSmsCode(){
+    String mobile  = "15112682435";
+    String params = "{\"mobile\":\""+mobile+"\"}";
+    String url = "http://localhost:8080/api/v1/mp/sms/sendSmsCode?";
+    System.out.println(request(url, params));
+  }
+}

+ 1 - 1
mp-admin/src/test/java/com/qs/mp/common/BaseControllerTest.java

@@ -31,7 +31,7 @@ public class BaseControllerTest {
     headers.put("content-type", "application/json; charset=UTF-8");
     headers.put("x-zz-timestamp", timestamp);
     // 本地登录状态
-    String token = "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjZmZDZjYmU1LTIzYjItNDY3ZS1hYWRlLWExMjAwOWUwZDAyZSJ9.7AQ5wEBV9qr0YMXy9L0e1UvwEriU4u4WZeufCfvrXsj3nuEkHnxjEpy_6LOcDBAB88e_SZY3P2vLhL4seWkcHA";
+    String token = "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjNiODY5YWVjLWQ2NTYtNDc2OC05NmIyLWRmMDljMDk1ZWE4YyJ9.5ejb8VGTmqc8MyPHxnjyQLg2EMSFty3C-A0D9ZgVnghn_uxPNvtXvS3ApzKVhwsC8JL5RcoEvKZ2eR3rFEzqRA";
 
     if (!StringUtils.isBlank(token)) {
       headers.put("Authorization", "Bearer "+token);

+ 1 - 1
mp-service/src/main/java/com/qs/mp/admin/domain/TicketAwards.java

@@ -22,7 +22,7 @@ public class TicketAwards implements Serializable {
   /**
    * 主键
    */
-  @TableId(value = "awards_id" , type = IdType.INPUT)
+  @TableId(value = "awards_id" , type = IdType.AUTO)
   private String awardsId;
 
   /**

+ 8 - 8
mp-service/src/main/java/com/qs/mp/admin/domain/TicketAwardsPrize.java

@@ -22,8 +22,8 @@ public class TicketAwardsPrize implements Serializable {
   /**
    * 主键
    */
-  @TableId(value = "id" , type = IdType.AUTO)
-  private Long id;
+  @TableId(value = "prize_id" , type = IdType.INPUT)
+  private String prizeId;
 
   /**
    * 奖项ID
@@ -32,16 +32,16 @@ public class TicketAwardsPrize implements Serializable {
   private String awardsId;
 
   /**
-   * 奖品ID(GOODS_ID或TEMPL_ID)
+   * 奖品ID(GOODS_ID或COUPON_ID)
    */
-  @TableField("prize_id")
-  private String prizeId;
+  @TableField("ref_id")
+  private String refId;
 
   /**
-   * 奖品类型(GOODS或VOUCHER或COIN)
+   * 奖品类型(GOODS或COUPON或COIN)
    */
-  @TableField("prize_type")
-  private String prizeType;
+  @TableField("ref_type")
+  private String refType;
 
   /**
    * 奖品数

+ 3 - 3
mp-service/src/main/java/com/qs/mp/admin/domain/param/TicketBoxListVO.java

@@ -42,12 +42,12 @@ public class TicketBoxListVO {
   /**
    * 盲票包原价
    */
-  private Integer boxPrice;
+  private Integer pkgPrice;
 
   /**
    * 盲票包售价
    */
-  private Integer boxSalePrice;
+  private Integer pkgSalePrice;
 
   /**
    * 每包盲票张数
@@ -87,5 +87,5 @@ public class TicketBoxListVO {
   /**
    * 上架时间
    */
-  private Date putonTime;
+  private Date onTime;
 }

+ 2 - 2
mp-service/src/main/java/com/qs/mp/channel/service/IChannelService.java

@@ -25,7 +25,7 @@ public interface IChannelService extends IService<Channel> {
 	 * @param channelType channel:子渠道  site: 经销商
 	 * @return
 	 */
-    public void saveChannel(Channel channel, String channelType) throws Exception;
+    public void saveChannel(Channel channel, String channelType);
      
     /**
 	 * 编辑子渠道、经销商信息
@@ -34,7 +34,7 @@ public interface IChannelService extends IService<Channel> {
 	 * @param channelType channel:子渠道  site: 经销商
 	 * @return
 	 */
-    public void updateChannel(Channel channel, String channelType) throws Exception;
+    public void updateChannel(Channel channel, String channelType);
     
     
 	/**

+ 9 - 3
mp-service/src/main/java/com/qs/mp/channel/service/impl/ChannelServiceImpl.java

@@ -52,7 +52,7 @@ public class ChannelServiceImpl extends ServiceImpl<ChannelMapper, Channel> impl
 
 	@Override
 	@Transactional
-	public void saveChannel(Channel channel, String channelType) throws Exception {
+	public void saveChannel(Channel channel, String channelType){
 		
 		String title = channelType.equals("channel")?"渠道":"经销商";
 		// 1、校验名称是否重复、手机号是否存在(渠道表)
@@ -85,6 +85,7 @@ public class ChannelServiceImpl extends ServiceImpl<ChannelMapper, Channel> impl
 			channel.setLevel(0);
 		}
 		// 3.插入数据
+		channel.setChannelNo(channel.getChannelId()+"");
 		boolean res = channelService.save(channel);
 		if(res && null != channel.getChannelId()) {
 			channel.setChannelNo(parentChannel.getChannelNo()+"."+channel.getChannelId());
@@ -100,15 +101,20 @@ public class ChannelServiceImpl extends ServiceImpl<ChannelMapper, Channel> impl
 		        throw new ServiceException("新增'" + title + channel.getName() + "'失败,请联系管理员");
 		    }
 		    channel.setUserId(sysUser.getUserId());
-		    channelService.updateById(channel);
+		    boolean ures = channelService.updateById(channel);
+		    if(!ures) {
+		    	throw new ServiceException("新增'" + title + channel.getName() + "'失败,请联系管理员");
+		    }
 		    // 4.发送账号创建成功短信
+		}else {
+			throw new ServiceException("新增'" + title + channel.getName() + "'失败,请联系管理员");
 		}
 	}
 	
 
 	@Override
 	@Transactional
-	public void updateChannel(Channel channel, String channelType) throws Exception {
+	public void updateChannel(Channel channel, String channelType) {
 		String title = channelType.equals("channel")?"渠道":"经销商";
 		// 1、校验修改子渠道是否为当前用户的子渠道
 		Channel oldChannel = channelService.getById(channel.getChannelId());

+ 4 - 4
mp-service/src/main/resources/mapper/admin/TicketAwardsPrizeMapper.xml

@@ -4,10 +4,10 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.qs.mp.admin.domain.TicketAwardsPrize">
-        <id column="id" property="id" />
+        <id column="prize_id" property="prizeId" />
         <result column="awards_id" property="awardsId" />
-        <result column="prize_id" property="prizeId" />
-        <result column="prize_type" property="prizeType" />
+        <result column="ref_id" property="refId" />
+        <result column="prize_type" property="refType" />
         <result column="quantity" property="quantity" />
         <result column="cashed_qty" property="cashedQty" />
         <result column="created_time" property="createdTime" />
@@ -16,7 +16,7 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, awards_id, prize_id, prize_type, quantity, cashed_qty, created_time, updated_time
+        prize_id, awards_id, ref_id, ref_type, quantity, cashed_qty, created_time, updated_time
     </sql>
 
 </mapper>