浏览代码

代码修改

kk 3 月之前
父节点
当前提交
62a0091945

+ 65 - 0
game-business/src/main/java/com/game/business/controller/AppUserAgentController.java

@@ -161,6 +161,71 @@ public class AppUserAgentController extends BaseController
         return  HttpRet.success("修改成功", appUserAgent);
     }
 
+    /**
+     * 获取代理成员设置
+     */
+    @Anonymous
+    @PostMapping(value = "/getUserAgentByUserId")
+    @ApiOperation(value = "获取代理配置", notes = "获取代理配置")
+    public HttpRet<AppUserAgentVO> getUserAgentByUserId()
+    {
+
+        Long userId = SecurityUtils.getUserId();
+
+        AppUserAgent userAgent = new AppUserAgent();
+        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();
+        BeanUtils.copyProperties(appUserAgent, appUserAgentVO);
+
+        AppGameCommission appGameCommission = new AppGameCommission();
+        appGameCommission.setPid(appUserAgent.getPid());
+        appGameCommission.setUserId(appUserAgent.getUserId());
+        List<AppGameCommission> gameCommissions = appGameCommissionService.selectAppGameCommissionList(appGameCommission);
+        Map<Long, List<AppGameCommission>> idGameMap;
+        if(gameCommissions != null && !gameCommissions.isEmpty()){
+            idGameMap = gameCommissions.stream().collect(Collectors.groupingBy(AppGameCommission::getGameId));
+        }else{
+            idGameMap = new HashMap<>();
+        }
+
+        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();
+                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());
+                appGameCommissionVO.setGameName(appGame.getName());
+                appGameCommissionVO.setLogoUrl(appGame.getLogoUrl());
+                appGameCommissionVO.setGamePath(appGame.getGamePath());
+
+                gameCommissionVOList.add(appGameCommissionVO);
+            }
+        }
+
+        appUserAgentVO.setCommissions(gameCommissionVOList);
+
+        return HttpRet.success("查询成功", appUserAgentVO);
+    }
+
     /**
      * 获取代理成员设置
      */

+ 3 - 2
game-business/src/main/java/com/game/business/controller/AppUserCountDividendController.java

@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
 import com.game.business.dto.AppUserDividendListDto;
 import com.game.business.dto.AppUserDividendSendDto;
 import com.game.common.core.domain.HttpRet;
+import com.game.common.core.domain.HttpRetPageArr;
 import com.game.common.core.domain.R;
 import com.game.common.utils.SecurityUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -48,11 +49,11 @@ public class AppUserCountDividendController extends BaseController
      */
     @GetMapping("/list")
     @ApiOperation(value = "查询周分红列表", notes = "获取周分红列表")
-    public TableDataInfo<AppUserCountDividend> list(AppUserDividendListDto dto)
+    public HttpRetPageArr<AppUserCountDividend> list(AppUserDividendListDto dto)
     {
         startPage();
         List<AppUserCountDividend> list = appUserCountDividendService.selectUserDividendList(SecurityUtils.getUserId());
-        return getDataTable(list);
+        return HttpRetPageArr.success("查询成功", getDataTable(list));
     }
 
     /**

+ 1 - 1
game-business/src/main/resources/mapper/business/AppUserCountDividendMapper.xml

@@ -98,7 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
-    <select id="selectUserDividendList" parameterType="String" resultMap="AppUserCountDividendResult">
+    <select id="selectUserDividendList" resultMap="AppUserCountDividendResult">
         select a.* from app_user_count_dividend as a inner join app_user_agent as b on a.user_id = b.user_id
         where b.pid = #{pid}
     </select>