|
@@ -11,9 +11,11 @@ import com.qs.mp.channel.domain.vo.ChannelVO;
|
|
|
import com.qs.mp.channel.service.IChannelOrderService;
|
|
|
import com.qs.mp.channel.service.IChannelService;
|
|
|
import com.qs.mp.channel.service.IChannelUserRelService;
|
|
|
+import com.qs.mp.common.annotation.Log;
|
|
|
import com.qs.mp.common.constant.UserConstants;
|
|
|
import com.qs.mp.common.core.domain.AjaxResult;
|
|
|
import com.qs.mp.common.core.page.TableDataInfo;
|
|
|
+import com.qs.mp.common.enums.BusinessType;
|
|
|
import com.qs.mp.common.enums.ChannelRoleEnum;
|
|
|
import com.qs.mp.common.enums.ErrorCodeEnum;
|
|
|
import com.qs.mp.system.domain.SysUser;
|
|
@@ -31,6 +33,7 @@ import java.util.Map;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -51,16 +54,16 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
|
|
|
@Autowired
|
|
|
private IChannelService channelService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private IChannelUserRelService channelUserRelService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private IChannelOrderService channelOrderService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private ISysUserService userService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private MapperFacade mapperFacade;
|
|
|
|
|
@@ -70,6 +73,7 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/tree")
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:channel:list')")
|
|
|
public AjaxResult treeChannel(@RequestBody Channel channel) {
|
|
|
List<ChannelVO> list = new ArrayList<ChannelVO>();
|
|
|
QueryWrapper<Channel> queryWrapper = new QueryWrapper<>();
|
|
@@ -97,14 +101,15 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
}
|
|
|
return AjaxResult.success(list);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 查询所有渠道列表
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/listAll")
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:channel:list')")
|
|
|
public AjaxResult listAllChannel() {
|
|
|
List<Channel> list = new ArrayList<Channel>();
|
|
|
LambdaQueryWrapper<Channel> queryWrapper = new LambdaQueryWrapper<Channel>();
|
|
@@ -113,14 +118,15 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
list = channelService.list(queryWrapper);
|
|
|
return AjaxResult.success(list);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取我的下级渠道列表信息,支持翻页
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/list")
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:channel:list')")
|
|
|
public TableDataInfo listChannel(@RequestBody Channel channel) {
|
|
|
List<ChannelVO> list = new ArrayList<ChannelVO>();
|
|
|
startPage();
|
|
@@ -151,15 +157,17 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
}
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 渠道管理新增一级渠道信息
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Log(title = "新增渠道", businessType = BusinessType.INSERT)
|
|
|
@ApiOperation(value = "新增子渠道信息", notes = "渠道端新增子渠道")
|
|
|
@PostMapping("/create")
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:channel:add')")
|
|
|
public AjaxResult channelCreate(@Validated @RequestBody ChannelParam channelParam) {
|
|
|
if (channelParam.getChannelId() != null && channelParam.getChannelId() != 0) {
|
|
|
return AjaxResult.error("该渠道已存在");
|
|
@@ -182,7 +190,7 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
// if(null != channel.getParentId() && channel.getParentId() != 0) {
|
|
|
// Channel parentChannel = channelService.getById(channel.getParentId());
|
|
|
// if(null != parentChannel) {
|
|
|
-// if(null != parentChannel.getCommRate()
|
|
|
+// if(null != parentChannel.getCommRate()
|
|
|
// && channel.getCommRate().compareTo(parentChannel.getCommRate()) > 0) {
|
|
|
// return AjaxResult.error("佣金比例不能高于父渠道的佣金比例");
|
|
|
// }
|
|
@@ -204,7 +212,7 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
} catch (Exception e) {
|
|
|
return AjaxResult.error("渠道'" + channel.getName() + "'新增失败" + e.getMessage());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return AjaxResult.success("渠道'" + channel.getName() + "'新增成功");
|
|
|
}
|
|
|
|
|
@@ -213,8 +221,10 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Log(title = "修改渠道", businessType = BusinessType.UPDATE)
|
|
|
@ApiOperation(value = "编辑子渠道信息", notes = "渠道端编辑子渠道")
|
|
|
@PostMapping("/update")
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:channel:edit')")
|
|
|
public AjaxResult channelUpdate(@Validated @RequestBody ChannelParam channelParam) {
|
|
|
if (null == channelParam || null == channelParam.getChannelId()) {
|
|
|
return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
@@ -250,7 +260,7 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
// 3.校验佣金比例,不能高于其父渠道的佣金比例,不能低于其子渠道的最大佣金比例
|
|
|
// Channel parentChannel = channelService.getById(oldChannel.getParentId());
|
|
|
// if(null != parentChannel) {
|
|
|
-// if(null != parentChannel.getCommRate()
|
|
|
+// if(null != parentChannel.getCommRate()
|
|
|
// && channel.getCommRate().compareTo(parentChannel.getCommRate()) > 0) {
|
|
|
// return AjaxResult.error("佣金比例不能高于父渠道的佣金比例");
|
|
|
// }
|
|
@@ -277,15 +287,17 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
}
|
|
|
return AjaxResult.success("渠道'" + channel.getName() + "'编辑成功");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 停用、启用渠道
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Log(title = "启停渠道", businessType = BusinessType.UPDATE)
|
|
|
@ApiOperation(value = "停用、启用渠道信息", notes = "渠道管理编辑子渠道")
|
|
|
@PostMapping("/status")
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:channel:edit')")
|
|
|
public AjaxResult channelStatus(@RequestBody JSONObject jsonObject) {
|
|
|
String channelId = jsonObject.containsKey("channelId")?jsonObject.get("channelId").toString():"";
|
|
|
String status = jsonObject.containsKey("status")?jsonObject.get("status").toString():"";
|
|
@@ -300,8 +312,8 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
}
|
|
|
return AjaxResult.success("操作成功");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 查询渠道详情
|
|
|
* @param
|
|
@@ -309,6 +321,7 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
*/
|
|
|
@ApiOperation(value = "查询渠道详情信息", notes = "渠道管理编辑子渠道查询渠道详情")
|
|
|
@PostMapping("/detail")
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:channel:query')")
|
|
|
public AjaxResult getChannelDetail(@RequestBody JSONObject jsonObject) {
|
|
|
String channelId = (null != jsonObject && jsonObject.containsKey("channelId"))?jsonObject.getString("channelId"):"";
|
|
|
if (StringUtils.isBlank(channelId)) {
|
|
@@ -333,5 +346,5 @@ public class ChannelMgrController extends BaseApiController {
|
|
|
channelVO.setOperData(channelOperDataVO);
|
|
|
return AjaxResult.success(channelVO);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|