소스 검색

经销商管理

guanglong 3 년 전
부모
커밋
48ba92f3eb
1개의 변경된 파일14개의 추가작업 그리고 25개의 파일을 삭제
  1. 14 25
      mp-admin/src/main/java/com/qs/mp/web/controller/api/admin/SaleSiteController.java

+ 14 - 25
mp-admin/src/main/java/com/qs/mp/web/controller/api/admin/SaleSiteController.java

@@ -58,7 +58,7 @@ public class SaleSiteController extends BaseApiController {
 
 
 	/**
-	 * 获取我的下级渠道列表信息,支持翻页
+	 * 获取经销商列表信息,支持翻页
 	 *
 	 * @return
 	 */
@@ -68,7 +68,7 @@ public class SaleSiteController extends BaseApiController {
 		startPage();
 		QueryWrapper<Channel> queryWrapper = new QueryWrapper<>();
 		queryWrapper.eq("t1.parent_id", null!=channel && null != channel.getChannelId()?channel.getChannelId():0);
-		queryWrapper.gt("t1.level", 0);
+		queryWrapper.eq("t1.level", 0);
 		queryWrapper.likeRight(null != channel && StringUtils.isNotBlank(channel.getMobile()), "t1.mobile", channel.getMobile());
 		queryWrapper.likeRight(null != channel && StringUtils.isNotBlank(channel.getName()), "t1.name", channel.getName());
 		queryWrapper.eq(null != channel && null != channel.getProvinceId(), "t1.province_id", channel.getProvinceId());
@@ -95,15 +95,15 @@ public class SaleSiteController extends BaseApiController {
 	
 	
 	/**
-	 * 新增子渠道信息
+	 * 新增经销商信息
 	 * @param
 	 * @return
 	 */
-	@ApiOperation(value = "新增子渠道信息", notes = "渠道端新增子渠道")
+	@ApiOperation(value = "新增经销商信息", notes = "渠道端新增经销商")
 	@PostMapping("/create")
 	public AjaxResult channelCreate(@Validated @RequestBody ChannelParam channelParam) {
 		if (channelParam.getChannelId() != null && channelParam.getChannelId() != 0) {
-			return AjaxResult.error("该渠道已存在");
+			return AjaxResult.error("该经销商已存在");
 		}
 		Channel channel = mapperFacade.map(channelParam, Channel.class);
 		// 1、校验名称是否重复、手机号是否存在(渠道表)
@@ -141,18 +141,18 @@ public class SaleSiteController extends BaseApiController {
 		try {
 			channelService.saveChannel(channel,"channel");
 		} catch (Exception e) {
-			return AjaxResult.error("渠道'" + channel.getName() + "'新增失败" + e.getMessage());
+			return AjaxResult.error("经销商'" + channel.getName() + "'新增失败" + e.getMessage());
 		}
 		
-		return AjaxResult.success("渠道'" + channel.getName() + "'新增成功");
+		return AjaxResult.success("经销商'" + channel.getName() + "'新增成功");
 	}
 
 	/**
-	 * 编辑子渠道信息
+	 * 编辑经销商信息
 	 * @param
 	 * @return
 	 */
-	@ApiOperation(value = "编辑子渠道信息", notes = "渠道端编辑子渠道")
+	@ApiOperation(value = "编辑经销商信息", notes = "经销商端编辑经销商")
 	@PostMapping("/update")
 	public AjaxResult channelUpdate(@Validated @RequestBody ChannelParam channelParam) {
 		if (null == channelParam || null == channelParam.getChannelId()) {
@@ -162,7 +162,7 @@ public class SaleSiteController extends BaseApiController {
 		// 1、校验修改子渠道是否为当前用户的子渠道
 		Channel oldChannel = channelService.getById(channel.getChannelId());
 		if(null == oldChannel || null == oldChannel.getChannelId()) {
-			return AjaxResult.error("渠道'" + oldChannel.getName() + "'编辑失败,渠道ID异常");
+			return AjaxResult.error("经销商'" + oldChannel.getName() + "'编辑失败,ID异常");
 		}
 		// 2.校验名称是否重复、手机号是否存在(渠道表);
 		if(!channel.getName().equals(oldChannel.getName())) {
@@ -171,7 +171,7 @@ public class SaleSiteController extends BaseApiController {
 			queryWrapper.gt(Channel::getLevel, 1);
 			int nameCount = channelService.count(queryWrapper);
 			if(nameCount > 0) {
-				return AjaxResult.error("渠道名称" + channel.getName() + "已存在!");
+				return AjaxResult.error("经销商名称" + channel.getName() + "已存在!");
 			}
 		}
 		boolean mobileChange = false;  // 手机号码是否有变更
@@ -198,32 +198,21 @@ public class SaleSiteController extends BaseApiController {
 		}else {
 			return AjaxResult.error("父渠道不存在");
 		}
-		// 查询子渠道的最大佣金比例
-		QueryWrapper<Channel> queryWrapper = new QueryWrapper<Channel>();
-		queryWrapper.select("IFNULL(max(comm_rate),0) as commRate");
-		queryWrapper.lambda().eq(Channel::getParentId, channel.getChannelId());
-		Map<String, Object> map = channelService.getMap(queryWrapper);
-		if(null != map && map.containsKey("commRate")) {
-			BigDecimal commRate = new BigDecimal(map.get("commRate").toString());
-			if(!commRate.equals(BigDecimal.ZERO) && channel.getCommRate().compareTo(commRate) < 0) {
-				return AjaxResult.error("不能低于其子渠道的最大佣金比例");
-			}
-		}
 		try {
 			channelService.updateChannel(channel, mobileChange);
 		} catch (Exception e) {
 			return AjaxResult.error(e.getMessage());
 		}
-		return AjaxResult.success("渠道'" + channel.getName() + "'编辑成功");
+		return AjaxResult.success("经销商'" + channel.getName() + "'编辑成功");
 	}
 	
 	
 	/**
-	 * 停用、启用渠道
+	 * 停用、启用经销商
 	 * @param
 	 * @return
 	 */
-	@ApiOperation(value = "停用、启用渠道信息", notes = "渠道管理编辑子渠道")
+	@ApiOperation(value = "停用、启用经销商信息", notes = "经销商管理编辑经销商")
 	@PostMapping("/status")
 	public AjaxResult channelStatus(@RequestBody JSONObject jsonObject) {
 		String channelId = jsonObject.containsKey("channelId")?jsonObject.get("channelId").toString():"";