|
@@ -2,17 +2,24 @@ package com.game.business.controller;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.game.business.domain.AppUserCount;
|
|
|
+import com.game.business.dto.AppAgentEditDto;
|
|
|
+import com.game.business.dto.AppAgentTeamDto;
|
|
|
+import com.game.business.service.IAppUserAgentService;
|
|
|
import com.game.business.dto.AgentIndexDTO;
|
|
|
import com.game.business.service.IAppUserCountService;
|
|
|
import com.game.business.service.IAppUserService;
|
|
|
+import com.game.business.vo.AppAgentTeamVo;
|
|
|
import com.game.business.vo.AppUserAgentJournalIndexVO;
|
|
|
+import com.game.common.core.controller.BaseController;
|
|
|
import com.game.common.core.domain.HttpRet;
|
|
|
+import com.game.common.core.domain.HttpRetPageArr;
|
|
|
import com.game.common.utils.MessageUtils;
|
|
|
import com.game.common.utils.SecurityUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
@@ -22,7 +29,7 @@ import java.util.stream.Collectors;
|
|
|
@RestController
|
|
|
@RequestMapping("/business/agent")
|
|
|
@Api(value = "AppGameBettingController", description = "代理接口", tags = {"代理接口"})
|
|
|
-public class AppAgentController {
|
|
|
+public class AppAgentController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private IAppUserCountService appUserCountService;
|
|
@@ -30,14 +37,20 @@ public class AppAgentController {
|
|
|
@Autowired
|
|
|
private IAppUserService appUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IAppUserAgentService appUserAgentService;
|
|
|
+
|
|
|
/**
|
|
|
* 首页
|
|
|
*/
|
|
|
@PostMapping(value = "/index")
|
|
|
- @ApiOperation(value = "首页", notes = "首页")
|
|
|
- public HttpRet<AppUserAgentJournalIndexVO> index(AgentIndexDTO agentIndexDto)
|
|
|
+ @ApiOperation(value = "用户代理统计", notes = "用户代理统计")
|
|
|
+ public HttpRet<AppUserAgentJournalIndexVO> index(@RequestBody AgentIndexDTO agentIndexDto)
|
|
|
{
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
+ if(null != agentIndexDto.getUserId()){
|
|
|
+ userId = agentIndexDto.getUserId();
|
|
|
+ }
|
|
|
AppUserAgentJournalIndexVO vo = new AppUserAgentJournalIndexVO();
|
|
|
Date nowDate = DateUtil.date();
|
|
|
if(agentIndexDto.getType() == 1){
|
|
@@ -52,10 +65,12 @@ public class AppAgentController {
|
|
|
//佣金
|
|
|
vo.setMyCommission(appUserCountList.stream().mapToDouble(e->e.getLiveCommission() + e.getGameCommission()).sum());
|
|
|
//团队人数
|
|
|
- vo.setTeamUser(appUserService.getCount(userId,null,null));
|
|
|
+ vo.setTeamUser(appUserAgentService.countAgent(userId,null,null));
|
|
|
//团队充值
|
|
|
vo.setTeamRecharge(appUserCountList.stream().mapToDouble(e->e.getRechargeAmount()).sum());
|
|
|
//团队投注
|
|
|
+ vo.setTeamBetting(appUserAgentService.sumBetting(DateUtil.format(beginDate,"yyyy-MM-dd").concat(" 00:00:00")
|
|
|
+ ,DateUtil.format(endDate,"yyyy-MM-dd").concat(" 23:59:59"),userId));
|
|
|
//团队直播消费
|
|
|
vo.setTeamLive(appUserCountList.stream().mapToDouble(e->e.getLiveUseAmount()).sum());
|
|
|
//团队投注赢
|
|
@@ -66,12 +81,34 @@ public class AppAgentController {
|
|
|
vo.setActiveUser(appUserCountList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(()-> new TreeSet<>(Comparator.comparing(f->f.getUserId()))), ArrayList::new)).size());
|
|
|
//昨日新增
|
|
|
Date yesterDay = DateUtil.offsetDay(DateUtil.date(),-1);
|
|
|
- vo.setYesterdayUser(appUserService.getCount(userId,DateUtil.format(yesterDay,"yyyy-MM-dd").concat(" 00:00:00")
|
|
|
+ vo.setYesterdayUser(appUserAgentService.countAgent(userId,DateUtil.format(yesterDay,"yyyy-MM-dd").concat(" 00:00:00")
|
|
|
,DateUtil.format(yesterDay,"yyyy-MM-dd").concat(" 23:59:59")));
|
|
|
- vo.setMonthUser(appUserService.getCount(userId,DateUtil.format(beginDate,"yyyy-MM-dd").concat(" 00:00:00")
|
|
|
+ vo.setMonthUser(appUserAgentService.countAgent(userId,DateUtil.format(beginDate,"yyyy-MM-dd").concat(" 00:00:00")
|
|
|
,DateUtil.format(endDate,"yyyy-MM-dd").concat(" 23:59:59")));
|
|
|
}
|
|
|
return HttpRet.success(MessageUtils.message("11022"),vo);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改直播分成、分红保底
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/updateSetting")
|
|
|
+ @ApiOperation(value = "修改直播分成、分红保底", notes = "修改直播分成、分红保底")
|
|
|
+ public HttpRet<Boolean> updateSetting(@RequestBody AppAgentEditDto editDto)
|
|
|
+ {
|
|
|
+ return appUserAgentService.updateSetting(editDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 团队列表
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/teamList")
|
|
|
+ @ApiOperation(value = "团队列表", notes = "团队列表")
|
|
|
+ public HttpRetPageArr<AppAgentTeamVo> teamList(@RequestBody AppAgentTeamDto teamDto)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ List<AppAgentTeamVo> list = appUserAgentService.teamList(teamDto);
|
|
|
+ return HttpRetPageArr.success(MessageUtils.message("11022"),getDataTable(list));
|
|
|
+ }
|
|
|
+
|
|
|
}
|