|
@@ -16,6 +16,7 @@ import com.game.business.util.Md5Utils;
|
|
|
import com.game.business.vo.AppGameBettingDetailsCountVO;
|
|
|
import com.game.business.vo.AppGameCommissionVO;
|
|
|
import com.game.business.vo.AppUserAgentVO;
|
|
|
+import com.game.business.vo.AppUserPAgentVO;
|
|
|
import com.game.common.annotation.Anonymous;
|
|
|
import com.game.common.core.domain.*;
|
|
|
import com.game.common.utils.StringUtils;
|
|
@@ -59,14 +60,14 @@ public class AppUserAgentController extends BaseController
|
|
|
@Anonymous
|
|
|
@PostMapping("/addAgent")
|
|
|
@ApiOperation(value = "添加代理", notes = "添加代理")
|
|
|
- public HttpRet addAgent(@RequestBody AppUserDTO appUserDTO)
|
|
|
+ public HttpRet<AppUserAgentVO> addAgent(@RequestBody AppUserDTO appUserDTO)
|
|
|
{
|
|
|
|
|
|
- if(appUserService.getMobileCount(appUserDTO.getMobile())){
|
|
|
+ if(appUserService.getMobileCount(appUserDTO.getUserName())){
|
|
|
return HttpRet.fail("用户手机号码已存在。");
|
|
|
}
|
|
|
|
|
|
- AppUser appUser = getAppUser(appUserDTO.getMobile(), appUserDTO.getPassWord());
|
|
|
+ AppUser appUser = getAppUser(appUserDTO.getUserName(), appUserDTO.getPassWord());
|
|
|
|
|
|
appUserService.insertAppUser(appUser);
|
|
|
|
|
@@ -81,15 +82,47 @@ public class AppUserAgentController extends BaseController
|
|
|
AppUserAgent dbPuserAgent = pList.get(0);
|
|
|
|
|
|
AppUserAgent appUserAgent = new AppUserAgent();
|
|
|
+ appUserAgent.setId(IdUtil.getSnowflakeNextId());
|
|
|
appUserAgent.setTopId(dbPuserAgent.getTopId() == null ? dbPuserAgent.getUserId() : dbPuserAgent.getTopId());
|
|
|
appUserAgent.setPid(dbPuserAgent.getUserId());
|
|
|
appUserAgent.setUserId(appUser.getUserid());
|
|
|
appUserAgent.setAuditStatus("1");
|
|
|
+ appUserAgent.setLiveRate(0L);
|
|
|
+ appUserAgent.setDividendGuaranteeRate(0L);
|
|
|
appUserAgent.setCreateTime(new Date());
|
|
|
|
|
|
appUserAgentService.insertAppUserAgent(appUserAgent);
|
|
|
|
|
|
- return HttpRet.success("添加成功");
|
|
|
+ AppUserAgentVO appUserAgentVO = new AppUserAgentVO();
|
|
|
+ BeanUtils.copyProperties(appUserAgent, appUserAgentVO);
|
|
|
+ appUserAgentVO.setUserId(appUser.getUserid());
|
|
|
+ appUserAgentVO.setNickName(appUser.getUsername());
|
|
|
+ appUserAgentVO.setAvatar("");
|
|
|
+
|
|
|
+ List<AppGameCommissionVO> gameCommissionVOList = new ArrayList<>();
|
|
|
+ List<AppGame> gameList = appGameService.selectAppGameList(new AppGame());
|
|
|
+ if(gameList != null && !gameList.isEmpty()){
|
|
|
+ for (int i = 0; i < gameList.size(); i++) {
|
|
|
+ AppGame appGame = gameList.get(i);
|
|
|
+
|
|
|
+
|
|
|
+ AppGameCommissionVO appGameCommissionVO = new AppGameCommissionVO();
|
|
|
+ appGameCommissionVO.setPid(dbPuserAgent.getUserId());
|
|
|
+ appGameCommissionVO.setUserId(appUser.getUserid());
|
|
|
+ appGameCommissionVO.setGameRate(0L);
|
|
|
+
|
|
|
+ appGameCommissionVO.setGameId(appGame.getId());
|
|
|
+ appGameCommissionVO.setGameName(appGame.getName());
|
|
|
+ appGameCommissionVO.setLogoUrl(appGame.getLogoUrl());
|
|
|
+ appGameCommissionVO.setGamePath(appGame.getGamePath());
|
|
|
+
|
|
|
+
|
|
|
+ gameCommissionVOList.add(appGameCommissionVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ appUserAgentVO.setCommissions(gameCommissionVOList);
|
|
|
+
|
|
|
+ return HttpRet.success("添加成功", appUserAgentVO);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -125,39 +158,22 @@ public class AppUserAgentController extends BaseController
|
|
|
return HttpRet.success("修改成功");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取代理成员列表
|
|
|
- */
|
|
|
- @Anonymous
|
|
|
- @PostMapping(value = "/getUserAgentList")
|
|
|
- @ApiOperation(value = "获取代理成员列表", notes = "获取代理成员列表")
|
|
|
- public HttpRetArr<AppUserAgentVO> getUserAgentList(@RequestParam(name = "userId") Long userId)
|
|
|
- {
|
|
|
- AppUserAgent userAgent = new AppUserAgent();
|
|
|
- userAgent.setPid(userId);
|
|
|
- List<AppUserAgent> userAgents = appUserAgentService.selectAppUserAgentList(userAgent);
|
|
|
- List<AppUserAgentVO> resultList = new ArrayList<>();
|
|
|
- for (int i = 0; i < userAgents.size(); i++) {
|
|
|
- AppUserAgentVO appUserAgentVO = new AppUserAgentVO();
|
|
|
- BeanUtils.copyProperties(userAgents.get(0), appUserAgentVO);
|
|
|
-
|
|
|
- AppUser appUser = appUserService.selectAppUserByUserid(appUserAgentVO.getUserId());
|
|
|
- if(appUser != null){
|
|
|
- appUserAgentVO.setNickName(appUser.getNickname());
|
|
|
- appUserAgentVO.setAvatar(appUser.getAvatar());
|
|
|
- }
|
|
|
- }
|
|
|
- return HttpRetArr.success("查询成功", resultList);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取代理成员设置
|
|
|
*/
|
|
|
@Anonymous
|
|
|
@PostMapping(value = "/getUserAgent")
|
|
|
@ApiOperation(value = "获取代理成员设置", notes = "获取代理成员设置")
|
|
|
- public HttpRet<AppUserAgentVO> getListByGameId(@RequestParam(name = "pid") Long pid, @RequestParam(name = "userId") Long userId)
|
|
|
+ public HttpRet<AppUserPAgentVO> getListByGameId(@RequestParam(name = "pid") Long pid, @RequestParam(name = "userId") Long userId)
|
|
|
{
|
|
|
+
|
|
|
+ AppUserPAgentVO appUserPAgentVO = new AppUserPAgentVO();
|
|
|
+
|
|
|
+ AppUser appUser = appUserService.selectAppUserByUserid(userId);
|
|
|
+ if(appUser == null ){
|
|
|
+ return HttpRet.fail("用户信息不存在。");
|
|
|
+ }
|
|
|
+
|
|
|
AppUserAgent userAgent = new AppUserAgent();
|
|
|
userAgent.setPid(pid);
|
|
|
userAgent.setUserId(userId);
|
|
@@ -167,8 +183,18 @@ public class AppUserAgentController extends BaseController
|
|
|
return HttpRet.fail("代理信息不存在。");
|
|
|
}
|
|
|
|
|
|
+ AppUserAgent userPAgent = new AppUserAgent();
|
|
|
+ userPAgent.setUserId(pid);
|
|
|
+ List<AppUserAgent> userpAgents = appUserAgentService.selectAppUserAgentList(userPAgent);
|
|
|
+ if(userpAgents == null || userpAgents.isEmpty()){
|
|
|
+ return HttpRet.fail("上级代理信息不存在。");
|
|
|
+ }
|
|
|
+
|
|
|
AppUserAgentVO appUserAgentVO = new AppUserAgentVO();
|
|
|
BeanUtils.copyProperties(userAgents.get(0), appUserAgentVO);
|
|
|
+ appUserAgentVO.setUserId(appUser.getUserid());
|
|
|
+ appUserAgentVO.setNickName(StringUtils.isEmpty(appUser.getNickname()) ? appUser.getUsername() : appUser.getNickname());
|
|
|
+ appUserAgentVO.setAvatar(appUser.getAvatar());
|
|
|
|
|
|
AppGameCommission appGameCommission = new AppGameCommission();
|
|
|
appGameCommission.setPid(pid);
|
|
@@ -181,7 +207,32 @@ public class AppUserAgentController extends BaseController
|
|
|
idGameMap = new HashMap<>();
|
|
|
}
|
|
|
|
|
|
+ AppUserAgentVO appUserpAgentVO = new AppUserAgentVO();
|
|
|
+ BeanUtils.copyProperties(userpAgents.get(0), appUserpAgentVO);
|
|
|
+
|
|
|
+ Map<Long, List<AppGameCommission>> idGamePMap = new HashMap<>();
|
|
|
+
|
|
|
+ if(appUserpAgentVO.getPid() != null){
|
|
|
+ AppGameCommission appGamePCommission = new AppGameCommission();
|
|
|
+ appGamePCommission.setPid(appUserpAgentVO.getPid());
|
|
|
+ appGamePCommission.setUserId(appUserpAgentVO.getUserId());
|
|
|
+ List<AppGameCommission> gamePCommissions = appGameCommissionService.selectAppGameCommissionList(appGamePCommission);
|
|
|
+
|
|
|
+ if(gamePCommissions != null && !gamePCommissions.isEmpty()){
|
|
|
+ idGamePMap = gamePCommissions.stream().collect(Collectors.groupingBy(AppGameCommission::getGameId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(appUserpAgentVO.getLiveRate() == null){
|
|
|
+ appUserpAgentVO.setLiveRate(100L);
|
|
|
+ }
|
|
|
+ if(appUserpAgentVO.getDividendGuaranteeRate() == null){
|
|
|
+ appUserpAgentVO.setDividendGuaranteeRate(100L);
|
|
|
+ }
|
|
|
+
|
|
|
List<AppGameCommissionVO> gameCommissionVOList = new ArrayList<>();
|
|
|
+ List<AppGameCommissionVO> gamePCommissionVOList = new ArrayList<>();
|
|
|
+
|
|
|
List<AppGame> gameList = appGameService.selectAppGameList(new AppGame());
|
|
|
if(gameList != null && !gameList.isEmpty()){
|
|
|
for (int i = 0; i < gameList.size(); i++) {
|
|
@@ -189,10 +240,11 @@ public class AppUserAgentController extends BaseController
|
|
|
|
|
|
|
|
|
AppGameCommissionVO appGameCommissionVO = new AppGameCommissionVO();
|
|
|
-
|
|
|
if(idGameMap.containsKey(appGame.getId())){
|
|
|
AppGameCommission gameCommission = idGameMap.get(appGame.getId()).get(0);
|
|
|
BeanUtils.copyProperties(gameCommission, appGameCommissionVO);
|
|
|
+ }else{
|
|
|
+ appGameCommissionVO.setGameRate(0L);
|
|
|
}
|
|
|
|
|
|
appGameCommissionVO.setGameId(appGame.getId());
|
|
@@ -201,11 +253,27 @@ public class AppUserAgentController extends BaseController
|
|
|
appGameCommissionVO.setGamePath(appGame.getGamePath());
|
|
|
|
|
|
gameCommissionVOList.add(appGameCommissionVO);
|
|
|
+
|
|
|
+ AppGameCommissionVO appGamePCommissionVO = new AppGameCommissionVO();
|
|
|
+ if(idGamePMap.containsKey(appGame.getId())){
|
|
|
+ AppGameCommission gameCommission = idGamePMap.get(appGame.getId()).get(0);
|
|
|
+ BeanUtils.copyProperties(gameCommission, appGamePCommissionVO);
|
|
|
+ }else{
|
|
|
+ appGamePCommissionVO.setGameRate(100L);
|
|
|
+ }
|
|
|
+ appGamePCommissionVO.setGameId(appGame.getId());
|
|
|
+
|
|
|
+ gamePCommissionVOList.add(appGamePCommissionVO);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
appUserAgentVO.setCommissions(gameCommissionVOList);
|
|
|
- return HttpRet.success("查询成功", appUserAgentVO);
|
|
|
+ appUserPAgentVO.setAppUserAgent(appUserAgentVO);
|
|
|
+
|
|
|
+ appUserpAgentVO.setCommissions(gamePCommissionVOList);
|
|
|
+ appUserPAgentVO.setAppUserPAgent(appUserpAgentVO);
|
|
|
+
|
|
|
+ return HttpRet.success("查询成功", appUserPAgentVO);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -214,7 +282,7 @@ public class AppUserAgentController extends BaseController
|
|
|
* @author jiang
|
|
|
* @date 2021/9/25 16:28
|
|
|
*/
|
|
|
- public AppUser getAppUser(String mobile, String password) {
|
|
|
+ public AppUser getAppUser(String userName, String password) {
|
|
|
|
|
|
AppUser appUser = new AppUser();
|
|
|
|
|
@@ -222,15 +290,14 @@ public class AppUserAgentController extends BaseController
|
|
|
if (StringUtils.isNotBlank(password)) {
|
|
|
appUser.setPassword(Md5Utils.md5(Md5Utils.md5(password) + appUser.getSalt()));
|
|
|
}
|
|
|
- appUser.setUsername(mobile);
|
|
|
+ appUser.setUsername(userName);
|
|
|
appUser.setAvatar(null);
|
|
|
appUser.setSex(0L);
|
|
|
appUser.setSignature("这家伙很懒...");
|
|
|
appUser.setSalt(RandomUtil.randomString(8));
|
|
|
|
|
|
// 基础信息
|
|
|
- appUser.setMobile(mobile);
|
|
|
- appUser.setPassword(password);
|
|
|
+// appUser.setMobile(mobile);
|
|
|
appUser.setRegType(0L);
|
|
|
appUser.setOpenid(null);
|
|
|
appUser.setRegisterIp("127.0.0.1");
|