Przeglądaj źródła

渠道应用管理修改为用户新增,后台出包

marxjaw 4 miesięcy temu
rodzic
commit
e553e52fc9

+ 8 - 44
yt-agent/agent-service/src/main/java/com/ytpm/service/impl/AgentAppServiceImpl.java

@@ -2,6 +2,8 @@ package com.ytpm.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.text.CharSequenceUtil;
+import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -76,23 +78,6 @@ public class AgentAppServiceImpl implements AgentAppService {
         if(CollUtil.isEmpty(views)){
             return ResultTable.resultTableOk(new PageInfo<>(new ArrayList<>()));
         }
-        List<String> appIds = views.stream().map(AgentAppView::getAppId).collect(Collectors.toList());
-        ComprehensiveReportParam param = new ComprehensiveReportParam();
-        param.setGroup_by(Collections.singletonList("app"));
-        param.setStartdate(DateUtil.getDateNum(LocalDate.now().minusDays(7)));
-        param.setEnddate(DateUtil.getDateNum(LocalDate.now()));
-        param.setTime_zone("UTC-8");
-        param.setApp_id_list(appIds);
-        List<ComprehensiveAppReport> appReport = advertiseFeign.getAppReport(param);
-        Map<String, ComprehensiveAppReport> reportMap = new HashMap<>();
-        if(CollUtil.isNotEmpty(appReport)){
-            reportMap =  appReport.stream().collect(Collectors.toMap(
-                            s -> s.getApp().getId(), O -> O));
-        }
-        for (AgentAppView view : views) {
-            if(!reportMap.containsKey(view.getAppId()))continue;
-            BeanUtil.copyProperties(reportMap.get(view.getAppId()), view);
-        }
         return ResultTable.resultTableOk(new PageInfo<>(views));
     }
 
@@ -101,42 +86,21 @@ public class AgentAppServiceImpl implements AgentAppService {
      */
     @Override
     public Result<?> saveApp(AppParam param, String userId) {
-        //构造API对象
-        AddAppParam addAppParam = new AddAppParam(param);
-        Result<AddAppResponse> result = null;
-        //调用广告平台API 增加应用
-        try {
-            result=advertiseFeign.saveApp(addAppParam);
-        }catch (Exception e){
-            log.error("参数错误{}",e);
-        }
         //数据库操作,有appId为修改, 没有时为新增
-        changeDataAction(param,result,userId);
+        changeDataAction(param,userId);
         return Result.resultOk(RepMessage.SAVE_SUCCESS);
     }
 
     /**
      * 处理数据库数据变更操作
      */
-    private void changeDataAction(AppParam param, Result<AddAppResponse> result, String userId) {
+    private void changeDataAction(AppParam param, String userId) {
         YtApp app = new YtApp();
         BeanUtil.copyProperties(param, app);
-        if(StrUtil.isNotBlank(param.getAppId())){
-            app.setScreenOrientation(param.getScreen_orientation());
-            app.setPackageName(param.getPackage_name());
-            app.setStoreOnSale(param.getStore_on_sale());
-            app.setStoreUrl(param.getStore_url());
+        if(CharSequenceUtil.isNotBlank(param.getAppId())){
             appMapper.updateOne(app);
         }else{
-            log.debug("result{}",result);
-            AddAppResponse data = result.getData();
-            BeanUtil.copyProperties(param, app);
-            app.setScreenOrientation(param.getScreen_orientation());
-            app.setPackageName(param.getPackage_name());
-            app.setStoreOnSale(param.getStore_on_sale());
-            app.setStoreUrl(param.getStore_url());
-            app.setAppId(data.getUuid());
-            app.setAppKey(data.getApp_key());
+            app.setAppId(IdUtil.fastSimpleUUID());
             app.setUserId(userId);
             app.setEnabled(1);
             appMapper.insertOne(app);
@@ -152,7 +116,7 @@ public class AgentAppServiceImpl implements AgentAppService {
         if(Objects.isNull(ytApp)|| !userId.equals(ytApp.getUserId())){
             Result.resultErr(RepMessage.NOT_PERMIT);
         }
-        advertiseFeign.delApp(appId);
+//        advertiseFeign.delApp(appId);
         appMapper.deleteApp(appId);
         return Result.resultOk(RepMessage.DELETE_SUCCESS);
     }
@@ -167,7 +131,7 @@ public class AgentAppServiceImpl implements AgentAppService {
         if(Objects.isNull(ytApp)){
             Result.resultErr(RepMessage.OBJECT_NOT_EXIST);
         }
-        advertiseFeign.relativePlatform(param);
+//        advertiseFeign.relativePlatform(param);
         YtAppChannelRelative ytAppChannelRelative = new YtAppChannelRelative();
         ytAppChannelRelative.setRelativeId(UUID.randomUUID().toString().replace("-",""));
         ytAppChannelRelative.setAppId(param.getAppId());

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

@@ -58,6 +58,7 @@
             ya.ccpa,
             ya.screen_orientation,
             ya.ditch_name,
+            ya.ditch_id,
             GROUP_CONCAT( acr.channel_id ) channel_id,
             GROUP_CONCAT( acr.channel_name ) channel_name,
             GROUP_CONCAT( acr.network_app_id ) network_app_id,

+ 15 - 4
yt-agent/agent-service/src/main/resources/mapper/AppMapper.xml

@@ -24,7 +24,10 @@
          screen_orientation,
          ccpa,
          store_url,
-         ditch_id
+         ditch_id,
+         ditch_name,
+         superior_id,
+         enabled
         )
         values
         (
@@ -47,7 +50,10 @@
          #{screenOrientation},
          #{ccpa},
          #{storeUrl},
-         #{ditchId}
+         #{ditchId},
+         #{ditchName},
+         #{superiorId},
+         #{enabled}
         )
     </insert>
     <update id="updateOne">
@@ -108,9 +114,14 @@
                 qr_code = #{qrCode},
             </if>
             <if test="ditchId != null">
-               ditch_id=#{ditchId}
+                ditch_id = #{ditchId},
+            </if>
+            <if test="ditchName != null">
+                ditch_name = #{ditchName},
+            </if>
+            <if test="superiorId != null">
+                superior_id = #{superiorId}
             </if>
-
         </set>
         where app_id = #{appId}
     </update>

+ 4 - 0
yt-common/src/main/java/com/ytpm/agent/model/YtApp.java

@@ -105,6 +105,10 @@ public class YtApp {
      * 渠道类型名称
      */
     private String ditchName;
+    /**
+     * 上架应用ID
+     */
+    private String superiorId;
 
 
 }

+ 4 - 0
yt-common/src/main/java/com/ytpm/agent/view/AgentAppView.java

@@ -79,6 +79,10 @@ public class AgentAppView {
      * 渠道类型名称
      */
     private String ditchName;
+    /**
+     * 渠道ID
+     */
+    private String ditchId;
     /**
      * 屏幕方向
      */

+ 1 - 1
yt-common/src/main/java/com/ytpm/util/RedisService.java

@@ -215,7 +215,7 @@ public class RedisService {
             return this.getStr(todayKey);
         }
         this.del(yesterdayKey);
-        this.setStr(todayKey, todayKey+"01");
+        this.setStr(todayKey, todayKey+"0001");
         return this.getStr(todayKey);
     }