Browse Source

fix:渠道、应用、用户列表IOS与安卓同步

zack 1 month ago
parent
commit
14941c9b81
16 changed files with 90 additions and 123 deletions
  1. 1 5
      yt-agent/agent-service/src/main/java/com/ytpm/controller/AgentDitchController.java
  2. 0 22
      yt-agent/agent-service/src/main/java/com/ytpm/controller/YtAppUserController.java
  3. 1 0
      yt-agent/agent-service/src/main/java/com/ytpm/service/AgentAppService.java
  4. 0 7
      yt-agent/agent-service/src/main/java/com/ytpm/service/AgentDitchService.java
  5. 0 16
      yt-agent/agent-service/src/main/java/com/ytpm/service/YtAppUserService.java
  6. 7 0
      yt-agent/agent-service/src/main/java/com/ytpm/service/impl/AgentAppServiceImpl.java
  7. 0 16
      yt-agent/agent-service/src/main/java/com/ytpm/service/impl/AgentDitchServiceImpl.java
  8. 2 48
      yt-agent/agent-service/src/main/java/com/ytpm/service/impl/YtAppUserServiceImpl.java
  9. 8 0
      yt-ios-lemon/lemon-ios-feign/src/main/java/com/ytpm/lemonios/feign/LemonIosFeign.java
  10. 12 0
      yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/controller/DitchController.java
  11. 8 8
      yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/controller/UserController.java
  12. 3 0
      yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/dao/AdRecordMapper.java
  13. 4 0
      yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/dao/AppUserMapper.java
  14. 10 1
      yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/service/DitchService.java
  15. 17 0
      yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/service/impl/DitchServiceImpl.java
  16. 17 0
      yt-ios-lemon/lemon-ios-service/src/main/resources/mapper/AdRecordMapper.xml

+ 1 - 5
yt-agent/agent-service/src/main/java/com/ytpm/controller/AgentDitchController.java

@@ -51,11 +51,7 @@ public class AgentDitchController {
         ytDitch.setAppType(param.getDitchType());
         ytDitch.setCreateTime(new Date());
         ytDitch.setUserId(userInfo.getUserId());
-        if (!param.getDitchType().isEmpty() && param.getDitchType().equals("2")){
-            return agentDitchService.addDefaultConfig(ytDitch, userInfo);
-        } else {
-            return agentDitchService.addOne(ytDitch);
-        }
+        return agentDitchService.addOne(ytDitch);
     }
 
     /**

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

@@ -46,28 +46,6 @@ public class YtAppUserController {
         return appUserService.selectAppUserList(param, userInfo);
     }
 
-    /**
-     * 查询App用户列表
-     * @param param 列表入参
-     * @return 分页列表
-     */
-    @PostMapping("/getUserForIosList")
-    @ApiOperation(value = "查询App用户列表")
-    public ResultTable<YtAppUserListView> selectAppUserForIosList(@RequestBody YtAppUserListParam param, @AuthenticationPrincipal AgentUserInfo userInfo) {
-        return appUserService.selectAppUserForIosList(param, userInfo);
-    }
-
-    /**
-     * 查询渠道列表
-     * @param param 列表入参
-     * @return 分页列表
-     */
-    @PostMapping("/getDitchList")
-    @ApiOperation(value = "查询渠道列表")
-    public ResultTable<AgentDitchView> selectDitchList(@RequestBody DitchListForIosParam param, @AuthenticationPrincipal AgentUserInfo userInfo) {
-        return appUserService.selectDitchList(param, userInfo);
-    }
-
     @PostMapping("/getRevenueByTime")
     @ApiOperation(value = "根据时间获取收益")
     public Result<BigDecimal> getRevenueByTime(@RequestBody YtAppUserListParam param, @AuthenticationPrincipal AgentUserInfo userInfo) {

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

@@ -22,6 +22,7 @@ public interface AgentAppService {
      * 查询应用列表
      */
     ResultTable<AgentAppView> searchAppList(AppListParam appListParam);
+
     List<AgentAppView> searchAppIdList(AppListParam appListParam);
 
     /**

+ 0 - 7
yt-agent/agent-service/src/main/java/com/ytpm/service/AgentDitchService.java

@@ -36,11 +36,4 @@ public interface AgentDitchService {
      * @return
      */
     Result<?> deleteOne(Long ditchId);
-
-    /**
-     * IOS增加渠道时同时新增默认配置
-     * @param param
-     * @return
-     */
-    Result<?> addDefaultConfig(YtDitch param, AgentUserInfo userInfo);
 }

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

@@ -2,8 +2,6 @@ package com.ytpm.service;
 
 import com.ytpm.agent.param.AdRecordListParam;
 import com.ytpm.agent.param.AuditUserParam;
-import com.ytpm.agent.param.DitchListForIosParam;
-import com.ytpm.agent.view.AgentDitchView;
 import com.ytpm.agent.view.AgentUserInfo;
 import com.ytpm.app.param.YtAppUserListParam;
 import com.ytpm.app.view.AppUserStaticsView;
@@ -24,20 +22,6 @@ public interface YtAppUserService {
      */
     ResultTable<YtAppUserListView> selectAppUserList(YtAppUserListParam param, AgentUserInfo userInfo);
 
-    /**
-     * 查询App用户列表
-     * @param param 列表入参
-     * @return 分页列表
-     */
-    ResultTable<YtAppUserListView> selectAppUserForIosList(YtAppUserListParam param, AgentUserInfo userInfo);
-
-    /**
-     * 查询渠道列表
-     * @param param 列表入参
-     * @return 分页列表
-     */
-    ResultTable<AgentDitchView> selectDitchList(DitchListForIosParam param, AgentUserInfo userInfo);
-
     /**
      * 查询用户广告数据统计列表
      */

+ 7 - 0
yt-agent/agent-service/src/main/java/com/ytpm/service/impl/AgentAppServiceImpl.java

@@ -97,6 +97,12 @@ public class AgentAppServiceImpl implements AgentAppService {
         return Result.resultOk(RepMessage.SAVE_SUCCESS);
     }
 
+    private void saveDitch(YtApp app) {
+        YtApp ytApp = appMapper.selectPrimary(app.getAppId());
+        YtPlatformUserApp parent = agentAppMapper.selectByPrimaryKey(ytApp.getSuperiorId());
+        feignInvoker.invoke(parent.getServiceName(), "addDitch",ytApp);
+    }
+
     /**
      * 处理数据库数据变更操作
      */
@@ -117,6 +123,7 @@ public class AgentAppServiceImpl implements AgentAppService {
             appMapper.insertOne(app);
             //新增APP时要生成 app_default_config
             generateDefaultConfig(param,app);
+            saveDitch(app);
         }
     }
 

+ 0 - 16
yt-agent/agent-service/src/main/java/com/ytpm/service/impl/AgentDitchServiceImpl.java

@@ -74,20 +74,4 @@ public class AgentDitchServiceImpl implements AgentDitchService {
         agentDitchMapper.update(ytDitch);
         return Result.resultOk(RepMessage.DELETE_SUCCESS);
     }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public Result<?> addDefaultConfig(YtDitch param, AgentUserInfo userInfo) {
-        param.setIsDelete(0);
-
-        List<YtApp> appList = appMapper.queryAll(userInfo.getUserId());
-        String appId = "";
-        if(appList != null && appList.size() > 0){
-            appId = appList.get(0).getSuperiorId();
-        }
-        param.setAppId(appId);
-        agentDitchMapper.insertOne(param);
-        lemonIosFeign.getLastOne(param);
-        return Result.resultOk(RepMessage.SAVE_SUCCESS);
-    }
 }

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

@@ -11,8 +11,6 @@ import com.ytpm.agent.model.YtPlatformUserApp;
 import com.ytpm.agent.param.AdRecordListParam;
 import com.ytpm.agent.param.AuditCheckParam;
 import com.ytpm.agent.param.AuditUserParam;
-import com.ytpm.agent.param.DitchListForIosParam;
-import com.ytpm.agent.view.AgentDitchView;
 import com.ytpm.agent.view.AgentUserInfo;
 import com.ytpm.app.model.YtDyzAdRecord;
 import com.ytpm.app.model.YtDyzLoginRecord;
@@ -76,9 +74,6 @@ public class YtAppUserServiceImpl implements YtAppUserService {
         //数据量大已改为appId必传
         YtApp ytApp = appMapper.selectPrimary(param.getAppIds());
         YtPlatformUserApp app = agentAppMapper.selectByPrimaryKey(ytApp.getSuperiorId());
-//        if (param.getAppType().equals("2")){
-//            param.setDitchId(ytApp.getDitchId());
-//        }
         Object o = feignInvoker.invoke(app.getServiceName(), "queryAll", param);
         String string = JSON.toJSONString(o);
         JSONObject object = JSON.parseObject(string);
@@ -90,33 +85,6 @@ public class YtAppUserServiceImpl implements YtAppUserService {
         return new ResultTable(StatusCode.OK,RepMessage.QUERY_SUCCESS,views,pageMeta);
     }
 
-    /**
-     * 查询App用户列表
-     * @param param 列表入参
-     * @return 分页列表
-     */
-    @Override
-    public ResultTable<YtAppUserListView> selectAppUserForIosList(YtAppUserListParam param, AgentUserInfo userInfo) {
-        Object o = feignInvoker.invoke("lemonios-service", "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);
-        return new ResultTable(StatusCode.OK,RepMessage.QUERY_SUCCESS,views,pageMeta);
-    }
-
-    @Override
-    public ResultTable<AgentDitchView> selectDitchList(DitchListForIosParam param, AgentUserInfo userInfo) {
-        Object o = feignInvoker.invoke("lemonios-service", "queryDitchList", param);
-        String string = JSON.toJSONString(o);
-        JSONObject object = JSON.parseObject(string);
-        List<AgentDitchView> views = JSONArray.parseArray(object.getString("data"), AgentDitchView.class);
-        System.out.println(views);
-        PageMeta pageMeta = JSON.parseObject(object.getString("pageMeta"), PageMeta.class);
-
-        return new ResultTable(StatusCode.OK,RepMessage.QUERY_SUCCESS,views,pageMeta);
-    }
-
     /**
      * 设置用户扩展信息
      */
@@ -184,22 +152,8 @@ public class YtAppUserServiceImpl implements YtAppUserService {
 
     private ResultTable<YtUserEcpmListView> ecpmListV1(AdRecordListParam param) {
         YtApp ytApp = appMapper.selectPrimary(param.getAppId());
-        Object o;
-        if (Objects.isNull(param.getAdsourceType())) {
-            param.setAdsourceType("888");
-        }
-        if (ytApp == null) {
-            YtPlatformUserApp app = agentAppMapper.selectByPrimaryKey(param.getAppId());
-            if (app != null) {
-                o = feignInvoker.invoke(app.getServiceName(), "adRecords", param.getUserId(), Integer.parseInt(param.getAdsourceType()));
-            } else {
-                o = feignInvoker.invoke("lemonios-service", "adRecords", param.getUserId(), Integer.parseInt(param.getAdsourceType()));
-            }
-        } else {
-            YtPlatformUserApp app = agentAppMapper.selectByPrimaryKey(ytApp.getSuperiorId());
-            o = feignInvoker.invoke(app.getServiceName(), "adRecords", param.getUserId(), Integer.parseInt(param.getAdsourceType()));
-        }
-
+        YtPlatformUserApp app = agentAppMapper.selectByPrimaryKey(ytApp.getSuperiorId());
+        Object o = feignInvoker.invoke(app.getServiceName(), "adRecords", param.getUserId(), Integer.parseInt(param.getAdsourceType()));
         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);

+ 8 - 0
yt-ios-lemon/lemon-ios-feign/src/main/java/com/ytpm/lemonios/feign/LemonIosFeign.java

@@ -1,6 +1,8 @@
 package com.ytpm.lemonios.feign;
 
+import com.ytpm.agent.model.YtApp;
 import com.ytpm.agent.model.YtDitch;
+import com.ytpm.agent.param.AdRecordListParam;
 import com.ytpm.agent.param.AuditCheckParam;
 import com.ytpm.agent.param.DitchListForIosParam;
 import com.ytpm.agent.view.AgentAdGroupStaticsVO;
@@ -54,6 +56,9 @@ public interface LemonIosFeign {
     @GetMapping("/user/adRecords")
     ResultTable<YtDyzAdRecord> adRecords(@RequestParam(name = "userId",required = true) String userId, @RequestParam(name = "adsourceType",required = false)Integer adsourceType);
 
+    @PostMapping("/user/adRecords/page")
+    ResultTable<YtDyzAdRecord> adRecordsPage(@RequestBody AdRecordListParam param);
+
     @PostMapping("/user/queryUserByTime")
     List<YtDyzUser> queryUserByTime(@RequestBody AppUserQueryParam appUserQueryParam);
 
@@ -84,6 +89,9 @@ public interface LemonIosFeign {
     @PostMapping("/ditch/getDitchList")
     Result<List<AgentDitchView>> queryDitchList(@RequestBody DitchListForIosParam param);
 
+    @PostMapping("/ditch/addDitch")
+    Result<?> addDitch(@RequestBody YtApp app);
+
     @PostMapping("/user/queryTodayBanned")
     List<YtDyzUser> queryTodayBanned(@RequestBody AppUserTodayBannedParam appUserTodayBannedParam);
 

+ 12 - 0
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/controller/DitchController.java

@@ -1,6 +1,9 @@
 package com.ytpm.lemonios.controller;
 
 import com.github.pagehelper.PageInfo;
+import com.ytpm.agent.model.YtApp;
+import com.ytpm.agent.model.YtDitch;
+import com.ytpm.agent.param.AppParam;
 import com.ytpm.agent.param.DitchListForIosParam;
 import com.ytpm.agent.param.DitchListParam;
 import com.ytpm.agent.view.AgentDitchView;
@@ -13,6 +16,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 
 @Api(tags = "渠道类型管理模块")
@@ -47,4 +51,12 @@ public class DitchController {
         return ResultTable.resultTableOk(new PageInfo<>(agentDitchService.ditchList(ditchListParam)));
     }
 
+    /**
+     * 新增渠道
+     */
+    @ApiOperation("新增渠道")
+    @PostMapping("/addDitch")
+    public Result<?> add(@RequestBody YtApp app) {
+        return Result.resultOk(RepMessage.SAVE_SUCCESS, agentDitchService.save(app));
+    }
 }

+ 8 - 8
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/controller/UserController.java

@@ -6,6 +6,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.ytpm.advertise.enums.AdSourceTypeEnum;
 import com.ytpm.agent.enums.UserStatusEnum;
+import com.ytpm.agent.param.AdRecordListParam;
 import com.ytpm.agent.param.AuditCheckParam;
 import com.ytpm.agent.param.AuditUserParam;
 import com.ytpm.agent.view.AgentAuditCheckVO;
@@ -68,14 +69,6 @@ public class UserController {
     public ResultTable<YtAppUserListView> queryAll(@RequestBody YtAppUserListParam param) {
         //查询主应用
         PageHelper.startPage(param.getPage(), param.getLimit());
-//        List<YtAppUserListView> result;
-//        if (param.getAppType().equals("2")){
-//            YtAppUserListParam newParam = new YtAppUserListParam();
-//            newParam.setDitchId(param.getDitchId());
-//            result =  appUserMapper.queryAll(newParam);
-//        }else {
-//            result = appUserMapper.queryAll(param);
-//        }
         List<YtAppUserListView> result = appUserMapper.queryAll(param);
         String collect = result.stream().map(YtAppUserListView::getUserId).collect(Collectors.joining(","));
         List<YtDyzAdRecord> adRecords = adRecordMapper.getByUserIds(collect);
@@ -178,6 +171,13 @@ public class UserController {
         return ResultTable.resultTableOk(new PageInfo<YtDyzAdRecord>(result));
     }
 
+    @PostMapping("/adRecords/page")
+    public ResultTable<YtDyzAdRecord> adRecordsPage(@RequestBody AdRecordListParam param) {
+        PageHelper.startPage(param.getPage(), param.getLimit());
+        List<YtDyzAdRecord> adrecords = adRecordMapper.getByUserByParam(param);
+        return ResultTable.resultTableOk(new PageInfo<>(adrecords));
+    }
+
     @PostMapping("/queryUserByTime")
     public List<YtDyzUser> queryUserByTime(@RequestBody AppUserQueryParam appUserQueryParam) {
         List<YtDyzUser> ytDyzUsers = appUserMapper.queryAllByTime(appUserQueryParam.getStartTime(), appUserQueryParam.getEndTime(),appUserQueryParam.getAppIdList());

+ 3 - 0
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/dao/AdRecordMapper.java

@@ -1,5 +1,6 @@
 package com.ytpm.lemonios.dao;
 
+import com.ytpm.agent.param.AdRecordListParam;
 import com.ytpm.app.model.YtDyzAdRecord;
 import com.ytpm.app.param.YtAppUserListParam;
 import com.ytpm.middle.view.AppRevenueHourVO;
@@ -30,6 +31,8 @@ public interface AdRecordMapper {
      */
     List<YtDyzAdRecord> getByIosId(@Param("iosId") String iosId);
 
+    List<YtDyzAdRecord> getByUserByParam(AdRecordListParam param);
+
     /**
      * 查询应用分小时收益数据
      */

+ 4 - 0
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/dao/AppUserMapper.java

@@ -1,8 +1,10 @@
 package com.ytpm.lemonios.dao;
 
+import com.ytpm.agent.param.AdRecordListParam;
 import com.ytpm.agent.param.AuditUserParam;
 import com.ytpm.agent.view.AgentAuditCheckVO;
 import com.ytpm.app.model.YtAppDefaultConfig;
+import com.ytpm.app.model.YtDyzAdRecord;
 import com.ytpm.app.model.YtDyzPowerRecord;
 import com.ytpm.app.model.YtDyzUser;
 import com.ytpm.app.param.AppUserParam;
@@ -100,6 +102,8 @@ public interface AppUserMapper {
      */
     List<YtDyzUser> getUserList(AppUserParam param);
 
+    List<YtDyzAdRecord> getByUserByParam(AdRecordListParam param);
+
     /**
      * 根据应用类型查询应用默认配置
      */

+ 10 - 1
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/service/DitchService.java

@@ -1,8 +1,10 @@
 package com.ytpm.lemonios.service;
 
+import com.ytpm.agent.model.YtApp;
+import com.ytpm.agent.model.YtDitch;
+import com.ytpm.agent.param.AppParam;
 import com.ytpm.agent.param.DitchListParam;
 import com.ytpm.agent.view.AgentDitchView;
-import com.ytpm.general.ResultTable;
 
 import java.util.List;
 
@@ -14,4 +16,11 @@ public interface DitchService {
      * 获取渠道类型列表
      */
     List<AgentDitchView> ditchList(DitchListParam param);
+
+    /**
+     *  新增
+     * @param app
+     * @return
+     */
+    Integer save(YtApp app);
 }

+ 17 - 0
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/service/impl/DitchServiceImpl.java

@@ -1,5 +1,8 @@
 package com.ytpm.lemonios.service.impl;
 
+import com.ytpm.agent.model.YtApp;
+import com.ytpm.agent.model.YtDitch;
+import com.ytpm.agent.param.AppParam;
 import com.ytpm.agent.param.DitchListParam;
 import com.ytpm.agent.view.AgentDitchView;
 import com.ytpm.lemonios.dao.DitchMapper;
@@ -7,6 +10,7 @@ import com.ytpm.lemonios.service.DitchService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 
 @Service
@@ -20,4 +24,17 @@ public class DitchServiceImpl implements DitchService {
     public List<AgentDitchView> ditchList(DitchListParam param) {
         return agentDitchMapper.ditchListForIos(param.getAppId());
     }
+
+    @Override
+    public Integer save(YtApp app) {
+        YtDitch ytDitch = new YtDitch();
+        ytDitch.setDitchName(app.getAppName());
+        ytDitch.setUserId(app.getUserId());
+        ytDitch.setAppId(app.getAppId());
+        ytDitch.setDitchId(app.getDitchId());
+        ytDitch.setAppType(app.getAppType().toString());
+        ytDitch.setIsDelete(0);
+        ytDitch.setCreateTime(new Date());
+        return agentDitchMapper.insertOne(ytDitch);
+    }
 }

+ 17 - 0
yt-ios-lemon/lemon-ios-service/src/main/resources/mapper/AdRecordMapper.xml

@@ -69,6 +69,23 @@
         from yt_dyz_ad_record
         where ios_id = #{iosId}
     </select>
+    <select id="getByUserByParam" resultType="com.ytpm.app.model.YtDyzAdRecord">
+        select
+        record_id, user_id,app_id, nick_name, placement_id, ad_source_id, revenue, network_form_id, network_name,
+        network_placement_id, finish_time, begin_time,result_json,ad_source_type,ad_source_index,ecpm,
+        ifnull(#{loginStatus}, 2) as loginStatus
+        <if test="loginStatus != null and loginStatus == 1">
+            from yt_dyz_ad_record_visitor
+        </if>
+        <if test="loginStatus == null or loginStatus != 1">
+            from yt_dyz_ad_record
+        </if>
+        where user_id = #{userId}
+        <if test="adsourceType != null and adsourceType!=888">
+            and ad_source_type = #{adsourceType}
+        </if>
+        order by finish_time desc
+    </select>
     <select id="getByUserIds" resultType="com.ytpm.app.model.YtDyzAdRecord">
         select
             record_id, user_id,app_id, nick_name, placement_id, ad_source_id, revenue, network_form_id, network_name, network_placement_id, finish_time, begin_time,result_json,ad_source_type,ad_source_index,ecpm