Bladeren bron

appFeign 改为动态调用
代理商系统操作需带 appId 数据量太大

marxjaw 2 maanden geleden
bovenliggende
commit
a8e226c914

+ 50 - 32
yt-agent/agent-service/src/main/java/com/ytpm/controller/AgentIndexController.java

@@ -15,8 +15,6 @@ import com.ytpm.app.model.YtDyzUser;
 import com.ytpm.constant.StrConstant;
 import com.ytpm.dao.AppMapper;
 import com.ytpm.dao.RiskMapper;
-import com.ytpm.feign.AppFeign;
-import com.ytpm.feign.RiskFeign;
 import com.ytpm.general.RepMessage;
 import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
@@ -39,6 +37,7 @@ import org.springframework.web.bind.annotation.RestController;
 import springfox.documentation.annotations.ApiIgnore;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
@@ -47,6 +46,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 @Api(tags = "首页数据统计模块")
@@ -54,13 +54,8 @@ import java.util.stream.Collectors;
 @Slf4j
 @RequestMapping("/index")
 public class AgentIndexController {
-
-    @Resource
-    private AppFeign appFeign;
-
     @Resource
     private AgentAppService agentAppService;
-
     @Resource
     private AppMapper appMapper;
     @Resource
@@ -79,45 +74,67 @@ public class AgentIndexController {
     @ApiOperation("查询顶部数据展示")
     @GetMapping("/getTopCount")
     public Result<AgentTopCountView> getTopCount(@ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo){
-        String key = "topCount_"+userInfo.getUserId();
+        String key = StrConstant.TOP_COUNT+userInfo.getUserId();
         if(Boolean.TRUE.equals(redisService.hasKey(key))){
             String str = redisService.getStr(key);
             AgentTopCountView view = JSONObject.parseObject(str, AgentTopCountView.class);
             return Result.resultObjOk(view);
         }
         //查询用户所有应用
-        List<YtApp> ytApps = appMapper.queryAll(userInfo.getUserId());
-        if(CollUtil.isEmpty(ytApps)){
-            return Result.resultObjOk(new AgentTopCountView());
+        ResultTable<YtPlatformUserApp> issuedAppList = agentAppService.getIssuedAppList(userInfo.getUserId());
+        if(CollUtil.isEmpty(issuedAppList.getData())){
+            return Result.resultErr(RepMessage.APP_EMPTY);
         }
-        String appIds = ytApps.stream().map(YtApp::getAppId).collect(Collectors.joining(","));
         //查询广告数 查询用户数 查询预估收益 查询风控数
-        AgentTopCountView view = appFeign.getAppTopCount(appIds);
-        redisService.setTimeOutHoursStr(key,JSON.toJSONString(view),2);
-        return Result.resultObjOk(view);
+        int adCount = 0;
+        int userCount = 0;
+        int riskCount = 0;
+        BigDecimal revenue = new BigDecimal(0);
+        List<YtPlatformUserApp> appList = issuedAppList.getData();
+        List<String> appIdList = agentAppService.getApkIdList(userInfo.getUserId());
+        List<String> serveList = appList.stream().map(YtPlatformUserApp::getServiceName).distinct().collect(Collectors.toList());
+        for (String serve : serveList) {
+            Object o = feignInvoker.invoke(serve,"getAppTopCount", String.join(",", appIdList));
+            String string = JSON.toJSONString(o);
+            AgentTopCountView view = JSONObject.parseObject(string, AgentTopCountView.class);
+            adCount += view.getAdCount();
+            userCount += view.getUserCount();
+            riskCount += view.getRiskCount();
+            revenue = revenue.add(view.getRevenue());
+        }
+        AgentTopCountView result = new AgentTopCountView(adCount,userCount,riskCount,revenue);
+        redisService.setTimeOutMinutesStr(key,JSON.toJSONString(result),45);
+        return Result.resultObjOk(result);
     }
 
     /**
      * 查询广告平台收益
      */
     @ApiOperation("查询广告平台收益")
-    @PostMapping("/profit")
-    public Result<List<AgentAdGroupStaticsVO>> profit(@ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo) {
-        String redisKey = StrConstant.PLATFORM_AGENT_SUFFIX+StrConstant.PROFIT+userInfo.getUserId();
-        //判断无缓存或者缓存小于3分钟时查询最新数据, 保存一小时
+    @GetMapping("/profit")
+    public Result<List<AgentAdGroupStaticsVO>> profit(@RequestParam(name = "appId")String appId,@ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo) {
+        //校验应用状态
+        YtPlatformUserApp app = agentAppService.selectByPrimaryKey(appId);
+        if(Objects.isNull(app)){
+            return Result.resultErr(RepMessage.OBJECT_NOT_EXIST);
+        }
+        List<YtApp> appList = appMapper.getBySuperiorId(appId);
+        if(CollUtil.isEmpty(appList)){
+            return Result.resultErr(RepMessage.APP_EMPTY);
+        }
+        //设定缓存键值 小于三分钟时更新续存
+        String redisKey = StrConstant.PLATFORM_AGENT_SUFFIX + appId +StrConstant.PROFIT+userInfo.getUserId();
+        String appIds = appList.stream().map(YtApp::getAppId).distinct().collect(Collectors.joining(","));
+        //分广告平台,分别统计用户当天、昨日、本月的数据封装并返回
         if(Boolean.FALSE.equals(redisService.hasKey(redisKey)) || redisService.getExpire(redisKey) < 3){
-            //查询代理商拥有的app
-            List<YtApp> ytApps = appMapper.queryAll(userInfo.getUserId());
-            if(CollUtil.isEmpty(ytApps)){
-                return Result.resultErr("未找到您的应用,请在应用管理新增");
+            Object o = feignInvoker.invoke(app.getServiceName(),"getAgentProfit", appIds);
+            List<AgentAdGroupStaticsVO> agentProfit = JSONArray.parseArray(JSON.toJSONString(o), AgentAdGroupStaticsVO.class);
+            if(CollUtil.isNotEmpty(agentProfit)){
+                redisService.setTimeOutMinutesStr(redisKey, JSON.toJSONString(agentProfit),60);
             }
-            String appIds = ytApps.stream().map(YtApp::getAppId).collect(Collectors.joining(","));
-            //分广告平台,分别统计用户当天、昨日、本月的数据封装并返回
-            List<AgentAdGroupStaticsVO> agentProfit = appFeign.getAgentProfit(appIds);
-            redisService.setTimeOutMinutesStr(redisKey, JSON.toJSONString(agentProfit),60);
             return Result.resultObjOk(agentProfit);
         }
-        //缓存则从缓存中获
+        //缓存取值
         String str = redisService.getStr(redisKey);
         List<AgentAdGroupStaticsVO> vos = JSONArray.parseArray(str, AgentAdGroupStaticsVO.class);
         return Result.resultObjOk(vos);
@@ -126,7 +143,7 @@ public class AgentIndexController {
     @ApiOperation("查询用户行为数据统计")
     @PostMapping("/userStatistic")
     public Result<Map<String, Object>> getDashboardData(@ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo) {
-        String key = "userStatistic_"+userInfo.getUserId();
+        String key = StrConstant.USER_STATISTIC+userInfo.getUserId();
         if(redisService.hasKey(key)){
             String str = redisService.getStr(key);
             Map<String, Object> map = JSON.parseObject(str, Map.class);
@@ -144,12 +161,13 @@ public class AgentIndexController {
         //查询 各APP 当月注册的所有用户
         List<YtDyzUser> allUserList = new ArrayList<>();
         List<YtDyzUser> allLoginList = new ArrayList<>();
-        for (YtPlatformUserApp datum : data) {
-            Object o = feignInvoker.invoke(datum.getServiceName(),"getMonthRegistryUser", String.join(",", appIdList),1);
+        List<String> services = data.stream().map(YtPlatformUserApp::getServiceName).distinct().collect(Collectors.toList());
+        for (String serve : services) {
+            Object o = feignInvoker.invoke(serve,"getMonthRegistryUser", String.join(",", appIdList),1);
             List<YtDyzUser> dyzUsers = JSONArray.parseArray(JSON.toJSONString(o) , YtDyzUser.class);
             if(CollUtil.isNotEmpty(dyzUsers)){allUserList.addAll(dyzUsers);}
 
-            o = feignInvoker.invoke(datum.getServiceName(),"getMonthRegistryUser", String.join(",", appIdList),2);
+            o = feignInvoker.invoke(serve,"getMonthRegistryUser", String.join(",", appIdList),2);
             dyzUsers = JSONArray.parseArray(JSON.toJSONString(o) , YtDyzUser.class);
             if(CollUtil.isNotEmpty(dyzUsers)){allLoginList.addAll(dyzUsers);}
         }

+ 2 - 2
yt-agent/agent-service/src/main/java/com/ytpm/controller/YtAppUserController.java

@@ -61,8 +61,8 @@ public class YtAppUserController {
      */
     @GetMapping("/ecpm")
     @ApiOperation(value = "查询用户ecpm数据")
-    public ResultTable<YtUserEcpmListView> ecpmList(@RequestParam(name = "userId", required = true) String userId, @RequestParam(name = "adsourceType",required = false)Integer adsourceType){
-        return appUserService.ecpmList(userId,adsourceType);
+    public ResultTable<YtUserEcpmListView> ecpmList(@RequestParam("appId")String appId,@RequestParam(name = "userId", required = true) String userId, @RequestParam(name = "adsourceType",required = false)Integer adsourceType){
+        return appUserService.ecpmList(appId,userId,adsourceType);
     }
 
     /**

+ 5 - 0
yt-agent/agent-service/src/main/java/com/ytpm/dao/AgentAppMapper.java

@@ -36,4 +36,9 @@ public interface AgentAppMapper {
      * 查询代理商子包ID
      */
     List<String> getApkIdList(@Param("userId") String userId);
+
+    /**
+     * 主键查询母包
+     */
+    YtPlatformUserApp selectByPrimaryKey(@Param("appId") String appId);
 }

+ 2 - 0
yt-agent/agent-service/src/main/java/com/ytpm/dao/AppMapper.java

@@ -45,4 +45,6 @@ public interface AppMapper {
      * 根据母包和渠道查询应用
      */
     YtApp getByDitchIdAndSuperiorId(@Param("ditchId") Long ditchId, @Param("superiorId") String superiorId);
+
+    List<YtApp> getBySuperiorId(@Param("superiorId") String superiorId);
 }

+ 3 - 0
yt-agent/agent-service/src/main/java/com/ytpm/service/AgentAppService.java

@@ -8,6 +8,7 @@ import com.ytpm.agent.view.AgentAppView;
 import com.ytpm.agent.view.AgentEnableAppView;
 import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -56,4 +57,6 @@ public interface AgentAppService {
      * 查询代理商子包ID
      */
     List<String> getApkIdList(String userId);
+
+    YtPlatformUserApp selectByPrimaryKey(@Param("appId") String appId);
 }

+ 1 - 1
yt-agent/agent-service/src/main/java/com/ytpm/service/YtAppUserService.java

@@ -30,7 +30,7 @@ public interface YtAppUserService {
     /**
      * 查询用户的ecpm列表
      */
-    ResultTable<YtUserEcpmListView> ecpmList(String userId,Integer adsourceType);
+    ResultTable<YtUserEcpmListView> ecpmList(String appId,String userId,Integer adsourceType);
 
     /**
      * 根据时间统计收益

+ 18 - 17
yt-agent/agent-service/src/main/java/com/ytpm/service/impl/AgentAppServiceImpl.java

@@ -24,26 +24,21 @@ import com.ytpm.app.model.YtAppDefaultConfig;
 import com.ytpm.dao.AgentAppMapper;
 import com.ytpm.dao.AppChannelRelativeMapper;
 import com.ytpm.dao.AppMapper;
-import com.ytpm.feign.AdvertiseFeign;
-import com.ytpm.feign.AppFeign;
 import com.ytpm.general.RepMessage;
 import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
 import com.ytpm.handle.CustomerException;
 import com.ytpm.middle.view.AppListVO;
 import com.ytpm.service.AgentAppService;
-import com.ytpm.util.DateUtil;
+import com.ytpm.utils.FeignClientInvoker;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
-import java.time.LocalDate;
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.Objects;
 import java.util.UUID;
 import java.util.stream.Collectors;
@@ -53,13 +48,12 @@ import java.util.stream.Collectors;
 @Slf4j
 public class AgentAppServiceImpl implements AgentAppService {
 
+    @Autowired
+    private FeignClientInvoker feignInvoker;
     @Resource
     private AgentAppMapper agentAppMapper;
     @Resource
     private AppMapper appMapper;
-    @Resource
-    private AppFeign appFeign;
-
     @Resource
     private AppChannelRelativeMapper appChannelRelativeMapper;
 
@@ -150,11 +144,10 @@ public class AgentAppServiceImpl implements AgentAppService {
         String ditchId = param.getDitchId().toString();
         String substr = ditchId.substring(ditchId.length() - 5);
         int appType = Integer.parseInt(index + substr);
-        //将所有app按照上架时间排序
-        Result<String> result = appFeign.saveAppConfig(new YtAppDefaultConfig(null,param.getAppName(),vo.getWxAppId(),vo.getWxSecret(),app.getAppId(),app.getAppId(),appType));
-        if(200!=result.getCode()){
-            throw new CustomerException(result.getMessage());
-        }
+        //远程调用指定应用保存 应用的出包配置
+        YtPlatformUserApp superior = agentAppMapper.selectByPrimaryKey(param.getSuperiorId());
+        YtAppDefaultConfig config = new YtAppDefaultConfig(null, param.getAppName(), vo.getWxAppId(), vo.getWxSecret(), app.getAppId(), app.getAppId(), appType);
+        feignInvoker.invoke(superior.getServiceName(), "saveAppConfig",config);
     }
 
     /**
@@ -166,9 +159,9 @@ public class AgentAppServiceImpl implements AgentAppService {
         if(Objects.isNull(ytApp)|| !userId.equals(ytApp.getUserId())){
             Result.resultErr(RepMessage.NOT_PERMIT);
         }
-//        advertiseFeign.delApp(appId);
+        YtPlatformUserApp superior = agentAppMapper.selectByPrimaryKey(ytApp.getSuperiorId());
         appMapper.deleteApp(appId);
-        appFeign.delAppConfig(appId);
+        feignInvoker.invoke(superior.getServiceName(), "delAppConfig",appId);
         return Result.resultOk(RepMessage.DELETE_SUCCESS);
     }
 
@@ -221,4 +214,12 @@ public class AgentAppServiceImpl implements AgentAppService {
         return agentAppMapper.getApkIdList(userId);
     }
 
+    /**
+     * 主键查询母包
+     */
+    @Override
+    public YtPlatformUserApp selectByPrimaryKey(String appId) {
+        return agentAppMapper.selectByPrimaryKey(appId);
+    }
+
 }

+ 51 - 51
yt-agent/agent-service/src/main/java/com/ytpm/service/impl/YtAppUserServiceImpl.java

@@ -1,9 +1,12 @@
 package com.ytpm.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
 import com.ytpm.agent.model.YtApp;
+import com.ytpm.agent.model.YtPlatformUserApp;
 import com.ytpm.agent.param.AuditCheckParam;
 import com.ytpm.agent.param.AuditUserParam;
 import com.ytpm.agent.view.AgentUserInfo;
@@ -13,30 +16,32 @@ import com.ytpm.app.param.YtAppUserListParam;
 import com.ytpm.app.view.AppUserStaticsView;
 import com.ytpm.app.view.YtAppUserListView;
 import com.ytpm.app.view.YtUserEcpmListView;
+import com.ytpm.dao.AgentAppMapper;
 import com.ytpm.dao.AgentStaticsMapper;
 import com.ytpm.dao.AppMapper;
 import com.ytpm.dao.MessageMapper;
 import com.ytpm.dao.RiskMapper;
 import com.ytpm.feign.AppFeign;
+import com.ytpm.general.PageMeta;
 import com.ytpm.general.RepMessage;
 import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
+import com.ytpm.general.StatusCode;
 import com.ytpm.middle.model.YtPlatformMessage;
 import com.ytpm.middle.view.MessageRecordVO;
 import com.ytpm.middle.view.MessageVO;
 import com.ytpm.risk.view.RiskTemplateView;
 import com.ytpm.service.YtAppUserService;
+import com.ytpm.utils.FeignClientInvoker;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 import java.util.Objects;
-import java.util.stream.Collectors;
 
 /**
  * App用户业务逻辑
@@ -44,6 +49,8 @@ import java.util.stream.Collectors;
 @Service
 public class YtAppUserServiceImpl implements YtAppUserService {
 
+    @Autowired
+    private FeignClientInvoker feignInvoker;
     @Resource
     private AppMapper appMapper;
     @Resource
@@ -51,9 +58,9 @@ public class YtAppUserServiceImpl implements YtAppUserService {
     @Resource
     private AgentStaticsMapper staticsMapper;
     @Resource
-    private AppFeign appFeign;
-    @Resource
     private MessageMapper messageMapper;
+    @Resource
+    private AgentAppMapper agentAppMapper;
 
 
     /**
@@ -63,45 +70,35 @@ public class YtAppUserServiceImpl implements YtAppUserService {
      */
     @Override
     public ResultTable<YtAppUserListView> selectAppUserList(YtAppUserListParam param, AgentUserInfo userInfo) {
-        //查询当前用户的所有应用
-        List<YtApp> ytApps = appMapper.queryAll(userInfo.getUserId());
-        if(StrUtil.isBlank(param.getAppIds())){
-            if(CollUtil.isEmpty(ytApps)) {
-                return ResultTable.resultTableOk(new PageInfo<>(Collections.emptyList()));
-            }
-            String appIds = ytApps.stream().map(YtApp::getAppId).collect(Collectors.joining(","));
-            param.setAppIds(appIds);
-        }
-        Map<String, YtApp> appMap = ytApps.stream().collect(Collectors.toMap(YtApp::getAppId, o->o));
-        ResultTable<YtAppUserListView> resultTable = appFeign.queryAll(param);
-        setUserExtInfo(resultTable,appMap);
-        return resultTable;
+        //数据量大已改为appId必传
+        YtApp ytApp = appMapper.selectPrimary(param.getAppIds());
+        YtPlatformUserApp app = agentAppMapper.selectByPrimaryKey(ytApp.getSuperiorId());
+        Object o = feignInvoker.invoke(app.getServiceName(), "queryAll", param);
+        String string = JSON.toJSONString(o);
+        JSONObject object = JSON.parseObject(string);
+        List<YtAppUserListView> views = JSONArray.parseArray(object.getString("data"), YtAppUserListView.class);
+        PageMeta pageMeta = JSON.parseObject(object.getString("pageMeta"), PageMeta.class);
+        setUserExtInfo(views,ytApp);
+        return new ResultTable(StatusCode.OK,RepMessage.QUERY_SUCCESS,views,pageMeta);
     }
 
     /**
      * 设置用户扩展信息
      */
-    private void setUserExtInfo(ResultTable<YtAppUserListView> resultTable, Map<String, YtApp> appMap) {
-        List<YtAppUserListView> data = resultTable.getData();
+    private void setUserExtInfo(List<YtAppUserListView> data, YtApp ytApp) {
         for (YtAppUserListView datum : data) {
             List<YtDyzLoginRecord> recordList = datum.getLoginRecordList();
-            YtApp ytApp = appMap.get(datum.getAppId());
-            if(Objects.nonNull(ytApp)) {
-                datum.setAppId(ytApp.getAppId());
-                datum.setAppName(ytApp.getAppName());
-                datum.setAppType(ytApp.getAppType());
-                datum.setChannelId(ytApp.getChannelId());
-                datum.setVersionCode(ytApp.getVersionCode());
-                datum.setDitchId(ytApp.getDitchId());
-                datum.setDitchName(ytApp.getDitchName());
-            }
-            if(CollUtil.isNotEmpty(recordList)){
-                datum.setDeviceRepeatCount((int) recordList.stream().map(YtDyzLoginRecord::getDeviceModel).distinct().count());
-                datum.setIpRepeatCount((int)recordList.stream().map(YtDyzLoginRecord::getIpAddr).distinct().count());
-                datum.setCommunicationOperator(recordList.get(0).getOperator());
-            }
+            datum.setAppId(ytApp.getAppId());
+            datum.setAppName(ytApp.getAppName());
+            datum.setAppType(ytApp.getAppType());
+            datum.setChannelId(ytApp.getChannelId());
+            datum.setVersionCode(ytApp.getVersionCode());
+            datum.setDitchId(ytApp.getDitchId());
+            datum.setDitchName(ytApp.getDitchName());
+            datum.setDeviceRepeatCount((int) recordList.stream().map(YtDyzLoginRecord::getDeviceModel).distinct().count());
+            datum.setIpRepeatCount((int)recordList.stream().map(YtDyzLoginRecord::getIpAddr).distinct().count());
+            datum.setCommunicationOperator(recordList.get(0).getOperator());
         }
-        resultTable.setData(data);
     }
 
     /**
@@ -136,10 +133,14 @@ public class YtAppUserServiceImpl implements YtAppUserService {
      * 查询用户的ecpm
      */
     @Override
-    public ResultTable<YtUserEcpmListView> ecpmList(String userId,Integer adsourceType) {
-        ResultTable<YtDyzAdRecord> table = appFeign.adRecords(userId,adsourceType);
-        List<YtDyzAdRecord> data = table.getData();
-        return ResultTable.resultTableOk(new PageInfo<>(data));
+    public ResultTable<YtUserEcpmListView> ecpmList(String appId,String userId,Integer adsourceType) {
+        YtApp ytApp = appMapper.selectPrimary(appId);
+        YtPlatformUserApp app = agentAppMapper.selectByPrimaryKey(ytApp.getSuperiorId());
+        Object o = feignInvoker.invoke(app.getServiceName(), "adRecords", userId,adsourceType);
+        JSONObject object = JSONObject.parseObject(JSON.toJSONString(o));
+        List<YtDyzAdRecord> records = JSONArray.parseArray(object.getString("data"), YtDyzAdRecord.class);
+        PageMeta pageMeta = JSON.parseObject(object.getString("pageMeta"), PageMeta.class);
+        return new ResultTable(StatusCode.OK,RepMessage.QUERY_SUCCESS,records,pageMeta);
     }
 
     /**
@@ -147,15 +148,11 @@ public class YtAppUserServiceImpl implements YtAppUserService {
      */
     @Override
     public Result<BigDecimal> getRevenueByTime(YtAppUserListParam param, String userId) {
-        if(StrUtil.isBlank(param.getAppIds())){
-            List<YtApp> ytApps = appMapper.queryAll(userId);
-            if(CollUtil.isEmpty(ytApps)) {
-                return Result.resultObjOk(BigDecimal.ZERO);
-            }
-            String appIds = ytApps.stream().map(YtApp::getAppId).collect(Collectors.joining(","));
-            param.setAppIds(appIds);
-        }
-        return Result.resultObjOk(appFeign.getRevenueByTime(param));
+        //数据量大改为必定选择一个app
+        YtApp ytApp = appMapper.selectPrimary(param.getAppIds());
+        YtPlatformUserApp app = agentAppMapper.selectByPrimaryKey(ytApp.getSuperiorId());
+        Object o = feignInvoker.invoke(app.getServiceName(), "getRevenueByTime",param);
+        return Result.resultObjOk(new BigDecimal(JSON.toJSONString(o)));
     }
 
     /**
@@ -192,6 +189,7 @@ public class YtAppUserServiceImpl implements YtAppUserService {
 
     /**
      * 批量审核
+     *  数据量大必须选择一个app
      */
     @Override
     public Result<String> batchAudit(AuditUserParam auditParam) {
@@ -202,7 +200,9 @@ public class YtAppUserServiceImpl implements YtAppUserService {
         if(Objects.isNull(ecpmLimit) || Objects.isNull(revenueLimit)){
             return Result.resultErr(RepMessage.OBJECT_NOT_EXIST);
         }
-        appFeign.batchAudit(new AuditCheckParam(ecpmLimit,revenueLimit,auditParam));
+        YtApp ytApp = appMapper.selectPrimary(auditParam.getAppId());
+        YtPlatformUserApp app = agentAppMapper.selectByPrimaryKey(ytApp.getSuperiorId());
+        feignInvoker.invoke(app.getServiceName(), "batchAudit", new AuditCheckParam(ecpmLimit,revenueLimit,auditParam));
         return Result.resultOk(RepMessage.CONFIRM_SUCCESS);
     }
 

+ 6 - 0
yt-agent/agent-service/src/main/resources/mapper/AgentAppMapper.xml

@@ -96,4 +96,10 @@
         from yt_app
         where user_id = #{userId}
     </select>
+    <select id="selectByPrimaryKey" resultType="com.ytpm.agent.model.YtPlatformUserApp">
+        select
+            app_id, app_name, user_id, app_type, detail_url, package_name, domain, issued_time, wx_app_id, wx_secret, sale_price, grant_type, charge_status, feign_class_path, service_name, create_time, create_user_id, update_time, update_user_id, available
+        from yt_platform_user_app
+        where available = 1 and app_id = #{appId}
+    </select>
 </mapper>

+ 7 - 1
yt-agent/agent-service/src/main/resources/mapper/AppMapper.xml

@@ -130,7 +130,7 @@
     </update>
     <select id="selectPrimary" resultType="com.ytpm.agent.model.YtApp">
         select
-            app_id,ditch_id, ditch_name,  app_key, app_name,user_id, app_type, apk_url, qr_code, version_code, update_tips, enabled
+            app_id,ditch_id, ditch_name,  app_key, app_name,user_id, app_type, apk_url, qr_code, version_code, update_tips, enabled,superior_id
         from yt_app
         where app_id = #{appId}
     </select>
@@ -183,4 +183,10 @@
         from yt_app
         where superior_id = #{superiorId} and ditch_id = #{ditchId}
     </select>
+    <select id="getBySuperiorId" resultType="com.ytpm.agent.model.YtApp">
+        select
+            app_id, app_key, app_name, user_id, app_type, apk_url, qr_code, version_code, update_tips, enabled, store_on_sale, store_type, store_url, package_name, domain, category, sub_category, coppa, screen_orientation, ccpa, feign_path, ditch_id, ditch_name, superior_id
+        from yt_app
+        where superior_id = #{superiorId}
+    </select>
 </mapper>

+ 8 - 0
yt-common/src/main/java/com/ytpm/constant/StrConstant.java

@@ -20,6 +20,14 @@ public class StrConstant {
      * 首页广告统计数据
      */
     public static final String PROFIT="PROFIT_";
+    /**
+     * 首页顶部统计数据
+     */
+    public static final String TOP_COUNT="topCount_";
+    /**
+     * 首页用户统计数据
+     */
+    public static final String USER_STATISTIC="userStatistic_";
 
 
 }