|
@@ -2,25 +2,34 @@ package com.qs.mp.web.controller.api.channel;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.qs.mp.channel.domain.Channel;
|
|
|
+import com.qs.mp.channel.domain.ChannelCommission;
|
|
|
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.IChannelCommissionService;
|
|
|
import com.qs.mp.channel.service.IChannelService;
|
|
|
import com.qs.mp.common.core.domain.AjaxResult;
|
|
|
import com.qs.mp.common.core.page.TableDataInfo;
|
|
|
import com.qs.mp.common.enums.ChannelCertifyStatusEnum;
|
|
|
import com.qs.mp.common.enums.ChannelVerifyStatusEnum;
|
|
|
import com.qs.mp.common.enums.ErrorCodeEnum;
|
|
|
+import com.qs.mp.common.exception.ServiceException;
|
|
|
+import com.qs.mp.common.utils.DateUtils;
|
|
|
import com.qs.mp.utils.SecurityUtils;
|
|
|
import com.qs.mp.web.controller.common.BaseApiController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import ma.glasnost.orika.MapperFacade;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -45,6 +54,9 @@ public class ChannelController extends BaseApiController {
|
|
|
|
|
|
@Autowired
|
|
|
private IChannelService channelService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IChannelCommissionService channelCommissionService;
|
|
|
|
|
|
@Autowired
|
|
|
private MapperFacade mapperFacade;
|
|
@@ -343,14 +355,14 @@ public class ChannelController extends BaseApiController {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 查看我的渠道信息
|
|
|
+ * 我的(经销商)
|
|
|
*
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(value = "mine/detail")
|
|
|
- @ApiOperation(value = "查看我的渠道信息", notes = "渠道端我的里面点击佣金比例")
|
|
|
- public AjaxResult getMineDetail() {
|
|
|
+ @PostMapping(value = "/site/mine/detail")
|
|
|
+ @ApiOperation(value = "经销商查看我的信息", notes = "经销商端点击我的")
|
|
|
+ public AjaxResult getSiteMineDetail() {
|
|
|
Long channelId = SecurityUtils.getLoginUser().getChannelId();
|
|
|
if (null == channelId) {
|
|
|
return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
@@ -363,4 +375,40 @@ public class ChannelController extends BaseApiController {
|
|
|
channelVO.setParentName(parentChannel.getName());
|
|
|
return AjaxResult.success(channelVO);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我的(渠道)
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/mine/detail")
|
|
|
+ @ApiOperation(value = "渠道端查看我的信息", notes = "渠道端点击我的")
|
|
|
+ public AjaxResult getChannelMineDetail() {
|
|
|
+ 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());
|
|
|
+ // 统计今天的分润金额
|
|
|
+ Date zero = DateUtils.getNowZero(); // 获取当天零点零分时间
|
|
|
+ QueryWrapper<ChannelCommission> queryWrapper = new QueryWrapper<ChannelCommission>();
|
|
|
+ queryWrapper.select("IFNULL(sum(comm_amt) ,0) as commAmt");
|
|
|
+ queryWrapper.lambda().eq(ChannelCommission::getChannelId, channelId);
|
|
|
+ queryWrapper.lambda().gt(ChannelCommission::getCreatedTime, zero);
|
|
|
+ Map<String, Object> map = channelCommissionService.getMap(queryWrapper);
|
|
|
+ if(null != map && map.containsKey("commAmt")) {
|
|
|
+ BigDecimal commAmt = new BigDecimal(map.get("commAmt").toString());
|
|
|
+
|
|
|
+ ChannelOperDataVO channelOperDataVO = new ChannelOperDataVO();
|
|
|
+ channelOperDataVO.setCommAmt(commAmt.longValue());
|
|
|
+ channelVO.setOperData(channelOperDataVO);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(channelVO);
|
|
|
+ }
|
|
|
}
|