|
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.qs.mp.channel.domain.Channel;
|
|
|
import com.qs.mp.channel.domain.ChannelAddr;
|
|
|
import com.qs.mp.channel.domain.param.ChannelParam;
|
|
|
+import com.qs.mp.channel.domain.param.VerifyParam;
|
|
|
+import com.qs.mp.channel.domain.vo.ChannelOperDataVO;
|
|
|
import com.qs.mp.channel.domain.vo.ChannelVO;
|
|
|
import com.qs.mp.channel.service.IChannelService;
|
|
|
import com.qs.mp.common.core.domain.AjaxResult;
|
|
@@ -54,12 +56,12 @@ public class ChannelController extends BaseApiController {
|
|
|
private MapperFacade mapperFacade;
|
|
|
|
|
|
/**
|
|
|
- * 子渠道列表查询
|
|
|
+ * 获取我的下级渠道列表信息,支持翻页
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("subchannel/list")
|
|
|
- public TableDataInfo list(@RequestBody Channel channel) {
|
|
|
+ public TableDataInfo listChannel(@RequestBody Channel channel) {
|
|
|
Long channelId = SecurityUtils.getLoginUser().getChannelId();
|
|
|
List<ChannelVO> list = new ArrayList<ChannelVO>();
|
|
|
if(null != channelId) {
|
|
@@ -78,7 +80,7 @@ public class ChannelController extends BaseApiController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping(value = "subchannel/detail")
|
|
|
- public AjaxResult getInfo(@RequestBody Channel channel) {
|
|
|
+ public AjaxResult getChannelDetail(@RequestBody Channel channel) {
|
|
|
if (null == channel || null == channel.getChannelId()) {
|
|
|
return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
}
|
|
@@ -86,6 +88,9 @@ public class ChannelController extends BaseApiController {
|
|
|
ChannelVO channelVO = new ChannelVO();
|
|
|
Channel queryChannel = channelService.getById(channelId);
|
|
|
BeanUtils.copyProperties(queryChannel, channelVO);
|
|
|
+ // 查询今日的销售额、佣金收入、新增用户数
|
|
|
+ ChannelOperDataVO channelOperDataVO = channelService.getChannelOperData(channelVO.getChannelNo(), 1);
|
|
|
+ channelVO.setOperData(channelOperDataVO);
|
|
|
return AjaxResult.success(channelVO);
|
|
|
}
|
|
|
|
|
@@ -96,7 +101,7 @@ public class ChannelController extends BaseApiController {
|
|
|
*/
|
|
|
@ApiOperation(value = "新增子渠道信息", notes = "渠道端新增子渠道")
|
|
|
@PostMapping("subchannel/create")
|
|
|
- public AjaxResult addChannel(@Validated @RequestBody ChannelParam channelParam) {
|
|
|
+ public AjaxResult channelCreate(@Validated @RequestBody ChannelParam channelParam) {
|
|
|
if (channelParam.getChannelId() != null && channelParam.getChannelId() != 0) {
|
|
|
return AjaxResult.error("该渠道已存在");
|
|
|
}
|
|
@@ -119,7 +124,7 @@ public class ChannelController extends BaseApiController {
|
|
|
*/
|
|
|
@ApiOperation(value = "编辑子渠道信息", notes = "渠道端编辑子渠道")
|
|
|
@PostMapping("subchannel/update")
|
|
|
- public AjaxResult editChannel(@Validated @RequestBody ChannelParam channelParam) {
|
|
|
+ public AjaxResult channelUpdate(@Validated @RequestBody ChannelParam channelParam) {
|
|
|
|
|
|
if (null == channelParam || null == channelParam.getChannelId()) {
|
|
|
return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
@@ -132,5 +137,213 @@ public class ChannelController extends BaseApiController {
|
|
|
}
|
|
|
return AjaxResult.success("编辑子渠道信息'" + channel.getName() + "'成功");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *获取当前用户渠道或者某个子渠道的经营数据
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "subchannel/operdata/query")
|
|
|
+ public AjaxResult getOperData(@RequestBody JSONObject jsonObject) {
|
|
|
+ if (null == jsonObject) {
|
|
|
+ return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
+ }
|
|
|
+ Long channelId = SecurityUtils.getLoginUser().getChannelId();
|
|
|
+ int days = jsonObject.getIntValue("days");;
|
|
|
+ if(StringUtils.isNotBlank(jsonObject.getString("channelId"))) {
|
|
|
+ channelId = jsonObject.getLong("channelId");
|
|
|
+ }
|
|
|
+ days = days > 0?days:1;
|
|
|
+ days = days > 0?days:1;
|
|
|
+ Channel channel = channelService.getById(channelId);
|
|
|
+ // 查询今日的销售额、佣金收入、新增用户数
|
|
|
+ ChannelOperDataVO channelOperDataVO = channelService.getChannelOperData(channel.getChannelNo(), 1);
|
|
|
+ return AjaxResult.success(channelOperDataVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取子渠道的经营数据列表
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "subchannel/operdata/list")
|
|
|
+ public TableDataInfo getOperDataList(@RequestBody JSONObject jsonObject) {
|
|
|
+ Long channelId = SecurityUtils.getLoginUser().getChannelId();
|
|
|
+ int days = jsonObject.getIntValue("days");;
|
|
|
+ if(StringUtils.isNotBlank(jsonObject.getString("channelId"))) {
|
|
|
+ channelId = jsonObject.getLong("channelId");
|
|
|
+ }
|
|
|
+ days = days > 0?days:1;
|
|
|
+ List<Channel> list = channelService.list(
|
|
|
+ new LambdaQueryWrapper<Channel>().eq(Channel::getParentId, channelId)
|
|
|
+ .orderByDesc(Channel::getChannelId));
|
|
|
+
|
|
|
+ List<ChannelOperDataVO> dataList = new ArrayList<ChannelOperDataVO>();
|
|
|
+ if(null != list && list.size() > 0) {
|
|
|
+ for(Channel channel : list) {
|
|
|
+ if(null != channel && null != channel.getChannelNo()) {
|
|
|
+ // 查询今日的销售额、佣金收入、新增用户数
|
|
|
+ ChannelOperDataVO channelOperDataVO = channelService.getChannelOperData(channel.getChannelNo(), days);
|
|
|
+ if(null != channelOperDataVO) {
|
|
|
+ channelOperDataVO.setName(channel.getName());
|
|
|
+ dataList.add(channelOperDataVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return getDataTable(dataList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取我的经销商列表信息,支持翻页
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("site/list")
|
|
|
+ public TableDataInfo listSite(@RequestBody Channel channel) {
|
|
|
+ Long channelId = SecurityUtils.getLoginUser().getChannelId();
|
|
|
+ List<ChannelVO> list = new ArrayList<ChannelVO>();
|
|
|
+ if(null != channelId) {
|
|
|
+ channel.setParentId(channelId);
|
|
|
+ startPage();
|
|
|
+ // List<Channel> list = channelService.list(new LambdaQueryWrapper<Channel>());
|
|
|
+ list = channelService.selectSiteVoList(channel);
|
|
|
+ }
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取我的下级渠道详情信息
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "site/detail")
|
|
|
+ public AjaxResult getSiteDetail(@RequestBody Channel channel) {
|
|
|
+ if (null == channel || null == channel.getChannelId()) {
|
|
|
+ return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
+ }
|
|
|
+ Long channelId = channel.getChannelId();
|
|
|
+ ChannelVO channelVO = new ChannelVO();
|
|
|
+ Channel queryChannel = channelService.getById(channelId);
|
|
|
+ BeanUtils.copyProperties(queryChannel, channelVO);
|
|
|
+ // 查询今日的销售额、佣金收入、新增用户数
|
|
|
+ ChannelOperDataVO channelOperDataVO = channelService.getChannelOperData(channelVO.getChannelNo(), 1);
|
|
|
+ channelVO.setOperData(channelOperDataVO);
|
|
|
+ return AjaxResult.success(channelVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增经销商信息
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "渠道端新增经销商", notes = "渠道端新增经销商")
|
|
|
+ @PostMapping("site/create")
|
|
|
+ public AjaxResult siteCreate(@Validated @RequestBody ChannelParam channelParam) {
|
|
|
+ if (channelParam.getChannelId() != null && channelParam.getChannelId() != 0) {
|
|
|
+ return AjaxResult.error("该经销商已存在");
|
|
|
+ }
|
|
|
+ Long channelId = SecurityUtils.getLoginUser().getChannelId();
|
|
|
|
|
|
+ Channel channel = mapperFacade.map(channelParam, Channel.class);
|
|
|
+ channel.setParentId(channelId);
|
|
|
+ try {
|
|
|
+ channelService.saveSite(channel);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("新增经销商信息'" + channel.getName() + "'失败");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("新增经销商信息'" + channel.getName() + "'成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑经销商信息
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "编辑经销商信息", notes = "渠道端编辑经销商")
|
|
|
+ @PostMapping("site/update")
|
|
|
+ public AjaxResult siteUpdate(@Validated @RequestBody ChannelParam channelParam) {
|
|
|
+
|
|
|
+ if (null == channelParam || null == channelParam.getChannelId()) {
|
|
|
+ return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
+ }
|
|
|
+ Channel channel = mapperFacade.map(channelParam, Channel.class);
|
|
|
+ try {
|
|
|
+ channelService.updateSite(channel);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("编辑经销商信息'" + channel.getName() + "'失败");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("编辑经销商信息'" + channel.getName() + "'成功");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 经销商认证审核
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "经销商认证审核", notes = "经销商认证审核")
|
|
|
+ @PostMapping("site/verify")
|
|
|
+ public AjaxResult siteVerify(@RequestBody Channel channel) {
|
|
|
+
|
|
|
+ if (null == channel || null == channel.getChannelId() || null == channel.getVerifyStatus()) {
|
|
|
+ return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ channelService.updateById(channel);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("经销商'" + channel.getName() + "'认证审核失败");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("经销商'" + channel.getName() + "'认证审核成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 经销商认证页面点提交
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "经销商认证信息提交", notes = "经销商认证页面点提交")
|
|
|
+ @PostMapping("site/verify/submit")
|
|
|
+ public AjaxResult siteVerifySubmit(@Validated @RequestBody VerifyParam verifyParam) {
|
|
|
+
|
|
|
+ if (null == verifyParam || null == verifyParam.getChannelId()) {
|
|
|
+ return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
+ }
|
|
|
+ Channel channel = mapperFacade.map(verifyParam, Channel.class);
|
|
|
+ try {
|
|
|
+ channelService.updateById(channel);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("经销商'" + channel.getName() + "'提交认证信息失败");
|
|
|
+ }
|
|
|
+ return AjaxResult.success("经销商'" + channel.getName() + "'提交认证信息成功");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查看我的渠道信息
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "min/detail")
|
|
|
+ @ApiOperation(value = "查看我的渠道信息", notes = "渠道端我的里面点击佣金比例")
|
|
|
+ public AjaxResult getMinInfo() {
|
|
|
+
|
|
|
+ Long channelId = SecurityUtils.getLoginUser().getChannelId();
|
|
|
+ if (null == channelId) {
|
|
|
+ return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
+ }
|
|
|
+ ChannelVO channelVO = new ChannelVO();
|
|
|
+ Channel queryChannel = channelService.getById(channelId);
|
|
|
+ BeanUtils.copyProperties(queryChannel, channelVO);
|
|
|
+ // 查询今日的销售额、佣金收入、新增用户数
|
|
|
+ Channel parentChannel = channelService.getById(queryChannel.getParentId());
|
|
|
+ channelVO.setParentName(parentChannel.getName());
|
|
|
+ return AjaxResult.success(channelVO);
|
|
|
+ }
|
|
|
}
|