|
@@ -122,6 +122,7 @@ public class AppUserAgentController extends BaseController
|
|
|
gameCommissionVOList.add(appGameCommissionVO);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
appUserAgentVO.setCommissions(gameCommissionVOList);
|
|
|
|
|
|
return HttpRet.success("添加成功", appUserAgentVO);
|
|
@@ -361,6 +362,57 @@ public class AppUserAgentController extends BaseController
|
|
|
return HttpRet.success("查询成功", appUserPAgentVO);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * 获取最小限制
|
|
|
+ */
|
|
|
+ @Anonymous
|
|
|
+ @PostMapping(value = "/getUserAgentMin")
|
|
|
+ @ApiOperation(value = "获取最小限制", notes = "获取最小限制")
|
|
|
+ public HttpRet<AppUserAgentVO> getUserAgentMin(@RequestParam(name = "pid") Long pid, @RequestParam(name = "userId") Long userId)
|
|
|
+ {
|
|
|
+
|
|
|
+ AppUserAgent userAgent = new AppUserAgent();
|
|
|
+ userAgent.setPid(pid);
|
|
|
+ userAgent.setUserId(userId);
|
|
|
+ List<AppUserAgent> userAgents = appUserAgentService.selectAppUserAgentList(userAgent);
|
|
|
+
|
|
|
+ if(userAgents == null || userAgents.isEmpty()){
|
|
|
+ return HttpRet.fail("代理信息不存在。");
|
|
|
+ }
|
|
|
+
|
|
|
+ AppUserAgent appUserAgent = userAgents.get(0);
|
|
|
+
|
|
|
+
|
|
|
+ AppUserAgentVO appUserAgentVO = new AppUserAgentVO();
|
|
|
+ appUserAgentVO.setDividendGuaranteeRate(0.00);
|
|
|
+ appUserAgentVO.setLiveRate(0.00);
|
|
|
+
|
|
|
+
|
|
|
+ setUserAgentMinRate(appUserAgentVO, userId);
|
|
|
+
|
|
|
+ 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.setGameRate(0L);
|
|
|
+ appGameCommissionVO.setGameId(appGame.getId());
|
|
|
+
|
|
|
+ setGameCommissionMinRate(appGameCommissionVO, userId);
|
|
|
+
|
|
|
+ gameCommissionVOList.add(appGameCommissionVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ appUserAgentVO.setCommissions(gameCommissionVOList);
|
|
|
+
|
|
|
+ return HttpRet.success("查询成功", appUserAgentVO);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
* 新增用户
|
|
|
* @return 用户id
|
|
@@ -448,4 +500,39 @@ public class AppUserAgentController extends BaseController
|
|
|
return appUser;
|
|
|
}
|
|
|
|
|
|
+ public void setUserAgentMinRate(AppUserAgentVO appUserAgentVO, Long userId){
|
|
|
+
|
|
|
+ AppUserAgent userAgent = new AppUserAgent();
|
|
|
+ userAgent.setPid(userId);
|
|
|
+ List<AppUserAgent> userAgents = appUserAgentService.selectAppUserAgentList(userAgent);
|
|
|
+
|
|
|
+ if(userAgents == null || userAgents.isEmpty()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<AppUserAgent> sortLives = userAgents.stream().sorted(Comparator.comparing(AppUserAgent::getLiveRate)).collect(Collectors.toList());
|
|
|
+ appUserAgentVO.setLiveRate(sortLives.get(0).getLiveRate());
|
|
|
+ List<AppUserAgent> sortDividendGuarantee = userAgents.stream().sorted(Comparator.comparing(AppUserAgent::getDividendGuaranteeRate)).collect(Collectors.toList());
|
|
|
+ appUserAgentVO.setLiveRate(sortDividendGuarantee.get(0).getDividendGuaranteeRate());
|
|
|
+ setUserAgentMinRate(appUserAgentVO, userId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void setGameCommissionMinRate(AppGameCommissionVO appGameCommissionVO, Long userId){
|
|
|
+
|
|
|
+ AppGameCommission appGameCommission = new AppGameCommission();
|
|
|
+ appGameCommission.setGameId(appGameCommissionVO.getGameId());
|
|
|
+ appGameCommission.setPid(userId);
|
|
|
+ List<AppGameCommission> gameCommissions = appGameCommissionService.selectAppGameCommissionList(appGameCommission);
|
|
|
+
|
|
|
+ if(gameCommissions == null || gameCommissions.isEmpty()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<AppGameCommission> sortGameCommissions = gameCommissions.stream().sorted(Comparator.comparing(AppGameCommission::getGameRate)).collect(Collectors.toList());
|
|
|
+ appGameCommissionVO.setGameRate(sortGameCommissions.get(0).getGameRate());
|
|
|
+ setGameCommissionMinRate(appGameCommissionVO, userId);
|
|
|
+ }
|
|
|
}
|